1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00
sdrangel/plugins/feature/map/Cesium/Cesium.js
2022-02-04 20:41:22 +00:00

91 lines
3.9 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Cesium={})}(this,(function(exports){"use strict";function appendForwardSlash(e){return 0!==e.length&&"/"===e[e.length-1]||(e+="/"),e}function defined(e){return null!=e}function DeveloperError(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let e=this.name+": "+this.message;return defined(this.stack)&&(e+="\n"+this.stack.toString()),e},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};const Check={};function getUndefinedErrorMessage(e){return e+" is required, actual value was undefined"}function getFailedTypeErrorMessage(e,t,n){return"Expected "+n+" to be typeof "+t+", actual typeof was "+e}function defaultValue(e,t){return null!=e?e:t}Check.typeOf={},Check.defined=function(e,t){if(!defined(t))throw new DeveloperError(getUndefinedErrorMessage(e))},Check.typeOf.func=function(e,t){if("function"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"function",e))},Check.typeOf.string=function(e,t){if("string"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"string",e))},Check.typeOf.number=function(e,t){if("number"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"number",e))},Check.typeOf.number.lessThan=function(e,t,n){if(Check.typeOf.number(e,t),t>=n)throw new DeveloperError("Expected "+e+" to be less than "+n+", actual value was "+t)},Check.typeOf.number.lessThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t>n)throw new DeveloperError("Expected "+e+" to be less than or equal to "+n+", actual value was "+t)},Check.typeOf.number.greaterThan=function(e,t,n){if(Check.typeOf.number(e,t),t<=n)throw new DeveloperError("Expected "+e+" to be greater than "+n+", actual value was "+t)},Check.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t<n)throw new DeveloperError("Expected "+e+" to be greater than or equal to "+n+", actual value was "+t)},Check.typeOf.object=function(e,t){if("object"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"object",e))},Check.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"boolean",e))},Check.typeOf.bigint=function(e,t){if("bigint"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"bigint",e))},Check.typeOf.number.equals=function(e,t,n,i){if(Check.typeOf.number(e,n),Check.typeOf.number(t,i),n!==i)throw new DeveloperError(e+" must be equal to "+t+", the actual values are "+n+" and "+i)},defaultValue.EMPTY_OBJECT=Object.freeze({});var MersenneTwister=function(e){null==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};MersenneTwister.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(e,t){var n,i,r;for(this.init_seed(19650218),n=1,i=0,r=this.N>t?this.N:t;r;r--){var o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+e[i]+i,this.mt[n]>>>=0,i++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(r=this.N-1;r;r--){o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},MersenneTwister.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,(e^=e>>>18)>>>0},MersenneTwister.prototype.random_int31=function(){return this.random_int()>>>1},MersenneTwister.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.random_int()*(1/4294967296)},MersenneTwister.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},MersenneTwister.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var mersenneTwister=MersenneTwister;const CesiumMath={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,EPSILON21:1e-21,GRAVITATIONALPARAMETER:3986004418e5,SOLAR_RADIUS:6955e5,LUNAR_RADIUS:1737400,SIXTY_FOUR_KILOBYTES:65536,FOUR_GIGABYTES:4294967296};CesiumMath.sign=defaultValue(Math.sign,(function(e){return 0===(e=+e)||e!=e?e:e>0?1:-1})),CesiumMath.signNotZero=function(e){return e<0?-1:1},CesiumMath.toSNorm=function(e,t){return t=defaultValue(t,255),Math.round((.5*CesiumMath.clamp(e,-1,1)+.5)*t)},CesiumMath.fromSNorm=function(e,t){return t=defaultValue(t,255),CesiumMath.clamp(e,0,t)/t*2-1},CesiumMath.normalize=function(e,t,n){return 0===(n=Math.max(n-t,0))?0:CesiumMath.clamp((e-t)/n,0,1)},CesiumMath.sinh=defaultValue(Math.sinh,(function(e){return(Math.exp(e)-Math.exp(-e))/2})),CesiumMath.cosh=defaultValue(Math.cosh,(function(e){return(Math.exp(e)+Math.exp(-e))/2})),CesiumMath.lerp=function(e,t,n){return(1-n)*e+n*t},CesiumMath.PI=Math.PI,CesiumMath.ONE_OVER_PI=1/Math.PI,CesiumMath.PI_OVER_TWO=Math.PI/2,CesiumMath.PI_OVER_THREE=Math.PI/3,CesiumMath.PI_OVER_FOUR=Math.PI/4,CesiumMath.PI_OVER_SIX=Math.PI/6,CesiumMath.THREE_PI_OVER_TWO=3*Math.PI/2,CesiumMath.TWO_PI=2*Math.PI,CesiumMath.ONE_OVER_TWO_PI=1/(2*Math.PI),CesiumMath.RADIANS_PER_DEGREE=Math.PI/180,CesiumMath.DEGREES_PER_RADIAN=180/Math.PI,CesiumMath.RADIANS_PER_ARCSECOND=CesiumMath.RADIANS_PER_DEGREE/3600,CesiumMath.toRadians=function(e){return e*CesiumMath.RADIANS_PER_DEGREE},CesiumMath.toDegrees=function(e){return e*CesiumMath.DEGREES_PER_RADIAN},CesiumMath.convertLongitudeRange=function(e){const t=CesiumMath.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},CesiumMath.clampToLatitudeRange=function(e){return CesiumMath.clamp(e,-1*CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO)},CesiumMath.negativePiToPi=function(e){return e>=-CesiumMath.PI&&e<=CesiumMath.PI?e:CesiumMath.zeroToTwoPi(e+CesiumMath.PI)-CesiumMath.PI},CesiumMath.zeroToTwoPi=function(e){if(e>=0&&e<=CesiumMath.TWO_PI)return e;const t=CesiumMath.mod(e,CesiumMath.TWO_PI);return Math.abs(t)<CesiumMath.EPSILON14&&Math.abs(e)>CesiumMath.EPSILON14?CesiumMath.TWO_PI:t},CesiumMath.mod=function(e,t){return CesiumMath.sign(e)===CesiumMath.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t},CesiumMath.equalsEpsilon=function(e,t,n,i){n=defaultValue(n,0),i=defaultValue(i,n);const r=Math.abs(e-t);return r<=i||r<=n*Math.max(Math.abs(e),Math.abs(t))},CesiumMath.lessThan=function(e,t,n){return e-t<-n},CesiumMath.lessThanOrEquals=function(e,t,n){return e-t<n},CesiumMath.greaterThan=function(e,t,n){return e-t>n},CesiumMath.greaterThanOrEquals=function(e,t,n){return e-t>-n};const factorials=[1];CesiumMath.factorial=function(e){const t=factorials.length;if(e>=t){let n=factorials[t-1];for(let i=t;i<=e;i++){const e=n*i;factorials.push(e),n=e}}return factorials[e]},CesiumMath.incrementWrap=function(e,t,n){return n=defaultValue(n,0),++e>t&&(e=n),e},CesiumMath.isPowerOfTwo=function(e){return 0!==e&&0==(e&e-1)},CesiumMath.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},CesiumMath.previousPowerOfTwo=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e=((e|=e>>32)>>>0)-(e>>>1)},CesiumMath.clamp=function(e,t,n){return e<t?t:e>n?n:e};let randomNumberGenerator$2=new mersenneTwister;function Cartesian3(e,t,n){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0)}CesiumMath.setRandomNumberSeed=function(e){randomNumberGenerator$2=new mersenneTwister(e)},CesiumMath.nextRandomNumber=function(){return randomNumberGenerator$2.random()},CesiumMath.randomBetween=function(e,t){return CesiumMath.nextRandomNumber()*(t-e)+e},CesiumMath.acosClamped=function(e){return Math.acos(CesiumMath.clamp(e,-1,1))},CesiumMath.asinClamped=function(e){return Math.asin(CesiumMath.clamp(e,-1,1))},CesiumMath.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},CesiumMath.logBase=function(e,t){return Math.log(e)/Math.log(t)},CesiumMath.cbrt=defaultValue(Math.cbrt,(function(e){const t=Math.pow(Math.abs(e),1/3);return e<0?-t:t})),CesiumMath.log2=defaultValue(Math.log2,(function(e){return Math.log(e)*Math.LOG2E})),CesiumMath.fog=function(e,t){const n=e*t;return 1-Math.exp(-n*n)},CesiumMath.fastApproximateAtan=function(e){return e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},CesiumMath.fastApproximateAtan2=function(e,t){let n,i=Math.abs(e);n=Math.abs(t);const r=Math.max(i,n);n=Math.min(i,n);const o=n/r;return i=CesiumMath.fastApproximateAtan(o),i=Math.abs(t)>Math.abs(e)?CesiumMath.PI_OVER_TWO-i:i,i=e<0?CesiumMath.PI-i:i,i=t<0?-i:i,i},Cartesian3.fromSpherical=function(e,t){defined(t)||(t=new Cartesian3);const n=e.clock,i=e.cone,r=defaultValue(e.magnitude,1),o=r*Math.sin(i);return t.x=o*Math.cos(n),t.y=o*Math.sin(n),t.z=r*Math.cos(i),t},Cartesian3.fromElements=function(e,t,n,i){return defined(i)?(i.x=e,i.y=t,i.z=n,i):new Cartesian3(e,t,n)},Cartesian3.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new Cartesian3(e.x,e.y,e.z)},Cartesian3.fromCartesian4=Cartesian3.clone,Cartesian3.packedLength=3,Cartesian3.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},Cartesian3.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian3),n.x=e[t++],n.y=e[t++],n.z=e[t],n},Cartesian3.packArray=function(e,t){const n=e.length,i=3*n;if(defined(t)){if(!Array.isArray(t)&&t.length!==i)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let i=0;i<n;++i)Cartesian3.pack(e[i],t,3*i);return t},Cartesian3.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const n=i/3;t[n]=Cartesian3.unpack(e,i,t[n])}return t},Cartesian3.fromArray=Cartesian3.unpack,Cartesian3.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},Cartesian3.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},Cartesian3.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},Cartesian3.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},Cartesian3.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},Cartesian3.magnitude=function(e){return Math.sqrt(Cartesian3.magnitudeSquared(e))};const distanceScratch$3=new Cartesian3;Cartesian3.distance=function(e,t){return Cartesian3.subtract(e,t,distanceScratch$3),Cartesian3.magnitude(distanceScratch$3)},Cartesian3.distanceSquared=function(e,t){return Cartesian3.subtract(e,t,distanceScratch$3),Cartesian3.magnitudeSquared(distanceScratch$3)},Cartesian3.normalize=function(e,t){const n=Cartesian3.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},Cartesian3.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Cartesian3.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},Cartesian3.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n},Cartesian3.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},Cartesian3.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},Cartesian3.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},Cartesian3.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},Cartesian3.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},Cartesian3.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const lerpScratch$3=new Cartesian3;Cartesian3.lerp=function(e,t,n,i){return Cartesian3.multiplyByScalar(t,n,lerpScratch$3),i=Cartesian3.multiplyByScalar(e,1-n,i),Cartesian3.add(lerpScratch$3,i,i)};const angleBetweenScratch$1=new Cartesian3,angleBetweenScratch2$1=new Cartesian3;Cartesian3.angleBetween=function(e,t){Cartesian3.normalize(e,angleBetweenScratch$1),Cartesian3.normalize(t,angleBetweenScratch2$1);const n=Cartesian3.dot(angleBetweenScratch$1,angleBetweenScratch2$1),i=Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch$1,angleBetweenScratch2$1,angleBetweenScratch$1));return Math.atan2(i,n)};const mostOrthogonalAxisScratch$2=new Cartesian3;Cartesian3.mostOrthogonalAxis=function(e,t){const n=Cartesian3.normalize(e,mostOrthogonalAxisScratch$2);return Cartesian3.abs(n,n),t=n.x<=n.y?n.x<=n.z?Cartesian3.clone(Cartesian3.UNIT_X,t):Cartesian3.clone(Cartesian3.UNIT_Z,t):n.y<=n.z?Cartesian3.clone(Cartesian3.UNIT_Y,t):Cartesian3.clone(Cartesian3.UNIT_Z,t)},Cartesian3.projectVector=function(e,t,n){const i=Cartesian3.dot(e,t)/Cartesian3.dot(t,t);return Cartesian3.multiplyByScalar(t,i,n)},Cartesian3.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},Cartesian3.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},Cartesian3.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,n,i)&&CesiumMath.equalsEpsilon(e.y,t.y,n,i)&&CesiumMath.equalsEpsilon(e.z,t.z,n,i)},Cartesian3.cross=function(e,t,n){const i=e.x,r=e.y,o=e.z,a=t.x,s=t.y,c=t.z,l=r*c-o*s,u=o*a-i*c,d=i*s-r*a;return n.x=l,n.y=u,n.z=d,n},Cartesian3.midpoint=function(e,t,n){return n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y),n.z=.5*(e.z+t.z),n},Cartesian3.fromDegrees=function(e,t,n,i,r){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartesian3.fromRadians(e,t,n,i,r)};let scratchN=new Cartesian3,scratchK=new Cartesian3;const wgs84RadiiSquared=new Cartesian3(40680631590769,40680631590769,40408299984661.445);Cartesian3.fromRadians=function(e,t,n,i,r){n=defaultValue(n,0);const o=defined(i)?i.radiiSquared:wgs84RadiiSquared,a=Math.cos(t);scratchN.x=a*Math.cos(e),scratchN.y=a*Math.sin(e),scratchN.z=Math.sin(t),scratchN=Cartesian3.normalize(scratchN,scratchN),Cartesian3.multiplyComponents(o,scratchN,scratchK);const s=Math.sqrt(Cartesian3.dot(scratchN,scratchK));return scratchK=Cartesian3.divideByScalar(scratchK,s,scratchK),scratchN=Cartesian3.multiplyByScalar(scratchN,n,scratchN),defined(r)||(r=new Cartesian3),Cartesian3.add(scratchK,scratchN,r)},Cartesian3.fromDegreesArray=function(e,t,n){const i=e.length;defined(n)?n.length=i/2:n=new Array(i/2);for(let r=0;r<i;r+=2){const i=e[r],o=e[r+1],a=r/2;n[a]=Cartesian3.fromDegrees(i,o,0,t,n[a])}return n},Cartesian3.fromRadiansArray=function(e,t,n){const i=e.length;defined(n)?n.length=i/2:n=new Array(i/2);for(let r=0;r<i;r+=2){const i=e[r],o=e[r+1],a=r/2;n[a]=Cartesian3.fromRadians(i,o,0,t,n[a])}return n},Cartesian3.fromDegreesArrayHeights=function(e,t,n){const i=e.length;defined(n)?n.length=i/3:n=new Array(i/3);for(let r=0;r<i;r+=3){const i=e[r],o=e[r+1],a=e[r+2],s=r/3;n[s]=Cartesian3.fromDegrees(i,o,a,t,n[s])}return n},Cartesian3.fromRadiansArrayHeights=function(e,t,n){const i=e.length;defined(n)?n.length=i/3:n=new Array(i/3);for(let r=0;r<i;r+=3){const i=e[r],o=e[r+1],a=e[r+2],s=r/3;n[s]=Cartesian3.fromRadians(i,o,a,t,n[s])}return n},Cartesian3.ZERO=Object.freeze(new Cartesian3(0,0,0)),Cartesian3.ONE=Object.freeze(new Cartesian3(1,1,1)),Cartesian3.UNIT_X=Object.freeze(new Cartesian3(1,0,0)),Cartesian3.UNIT_Y=Object.freeze(new Cartesian3(0,1,0)),Cartesian3.UNIT_Z=Object.freeze(new Cartesian3(0,0,1)),Cartesian3.prototype.clone=function(e){return Cartesian3.clone(this,e)},Cartesian3.prototype.equals=function(e){return Cartesian3.equals(this,e)},Cartesian3.prototype.equalsEpsilon=function(e,t,n){return Cartesian3.equalsEpsilon(this,e,t,n)},Cartesian3.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};const scaleToGeodeticSurfaceIntersection=new Cartesian3,scaleToGeodeticSurfaceGradient=new Cartesian3;function scaleToGeodeticSurface(e,t,n,i,r){const o=e.x,a=e.y,s=e.z,c=t.x,l=t.y,u=t.z,d=o*o*c*c,h=a*a*l*l,p=s*s*u*u,f=d+h+p,m=Math.sqrt(1/f),g=Cartesian3.multiplyByScalar(e,m,scaleToGeodeticSurfaceIntersection);if(f<i)return isFinite(m)?Cartesian3.clone(g,r):void 0;const _=n.x,y=n.y,C=n.z,T=scaleToGeodeticSurfaceGradient;T.x=g.x*_*2,T.y=g.y*y*2,T.z=g.z*C*2;let S,A,v,E,b,x,P,D,w,M,I,R=(1-m)*Cartesian3.magnitude(e)/(.5*Cartesian3.magnitude(T)),O=0;do{R-=O,v=1/(1+R*_),E=1/(1+R*y),b=1/(1+R*C),x=v*v,P=E*E,D=b*b,w=x*v,M=P*E,I=D*b,S=d*x+h*P+p*D-1,A=d*w*_+h*M*y+p*I*C;O=S/(-2*A)}while(Math.abs(S)>CesiumMath.EPSILON12);return defined(r)?(r.x=o*v,r.y=a*E,r.z=s*b,r):new Cartesian3(o*v,a*E,s*b)}function Cartographic(e,t,n){this.longitude=defaultValue(e,0),this.latitude=defaultValue(t,0),this.height=defaultValue(n,0)}Cartographic.fromRadians=function(e,t,n,i){return n=defaultValue(n,0),defined(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Cartographic(e,t,n)},Cartographic.fromDegrees=function(e,t,n,i){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartographic.fromRadians(e,t,n,i)};const cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/6378137,1/6378137,1/6356752.314245179),wgs84OneOverRadiiSquared=new Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;function initialize$f(e,t,n,i){t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,0),e._radii=new Cartesian3(t,n,i),e._radiiSquared=new Cartesian3(t*t,n*n,i*i),e._radiiToTheFourth=new Cartesian3(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new Cartesian3(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),e._oneOverRadiiSquared=new Cartesian3(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Ellipsoid(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,initialize$f(this,e,t,n)}Cartographic.fromCartesian=function(e,t,n){const i=defined(t)?t.oneOverRadii:wgs84OneOverRadii,r=defined(t)?t.oneOverRadiiSquared:wgs84OneOverRadiiSquared,o=scaleToGeodeticSurface(e,i,r,defined(t)?t._centerToleranceSquared:wgs84CenterToleranceSquared,cartesianToCartographicP$1);if(!defined(o))return;let a=Cartesian3.multiplyComponents(o,r,cartesianToCartographicN$1);a=Cartesian3.normalize(a,a);const s=Cartesian3.subtract(e,o,cartesianToCartographicH$1),c=Math.atan2(a.y,a.x),l=Math.asin(a.z),u=CesiumMath.sign(Cartesian3.dot(s,e))*Cartesian3.magnitude(s);return defined(n)?(n.longitude=c,n.latitude=l,n.height=u,n):new Cartographic(c,l,u)},Cartographic.toCartesian=function(e,t,n){return Cartesian3.fromRadians(e.longitude,e.latitude,e.height,t,n)},Cartographic.clone=function(e,t){if(defined(e))return defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Cartographic(e.longitude,e.latitude,e.height)},Cartographic.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Cartographic.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},Cartographic.ZERO=Object.freeze(new Cartographic(0,0,0)),Cartographic.prototype.clone=function(e){return Cartographic.clone(this,e)},Cartographic.prototype.equals=function(e){return Cartographic.equals(this,e)},Cartographic.prototype.equalsEpsilon=function(e,t){return Cartographic.equalsEpsilon(this,e,t)},Cartographic.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},Object.defineProperties(Ellipsoid.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),Ellipsoid.clone=function(e,t){if(!defined(e))return;const n=e._radii;return defined(t)?(Cartesian3.clone(n,t._radii),Cartesian3.clone(e._radiiSquared,t._radiiSquared),Cartesian3.clone(e._radiiToTheFourth,t._radiiToTheFourth),Cartesian3.clone(e._oneOverRadii,t._oneOverRadii),Cartesian3.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new Ellipsoid(n.x,n.y,n.z)},Ellipsoid.fromCartesian3=function(e,t){return defined(t)||(t=new Ellipsoid),defined(e)?(initialize$f(t,e.x,e.y,e.z),t):t},Ellipsoid.WGS84=Object.freeze(new Ellipsoid(6378137,6378137,6356752.314245179)),Ellipsoid.UNIT_SPHERE=Object.freeze(new Ellipsoid(1,1,1)),Ellipsoid.MOON=Object.freeze(new Ellipsoid(CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS)),Ellipsoid.prototype.clone=function(e){return Ellipsoid.clone(this,e)},Ellipsoid.packedLength=Cartesian3.packedLength,Ellipsoid.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._radii,t,n),t},Ellipsoid.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t);return Ellipsoid.fromCartesian3(i,n)},Ellipsoid.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid.prototype.geodeticSurfaceNormalCartographic=function(e,t){const n=e.longitude,i=e.latitude,r=Math.cos(i),o=r*Math.cos(n),a=r*Math.sin(n),s=Math.sin(i);return defined(t)||(t=new Cartesian3),t.x=o,t.y=a,t.z=s,Cartesian3.normalize(t,t)},Ellipsoid.prototype.geodeticSurfaceNormal=function(e,t){if(!Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON14))return defined(t)||(t=new Cartesian3),t=Cartesian3.multiplyComponents(e,this._oneOverRadiiSquared,t),Cartesian3.normalize(t,t)};const cartographicToCartesianNormal=new Cartesian3,cartographicToCartesianK=new Cartesian3;Ellipsoid.prototype.cartographicToCartesian=function(e,t){const n=cartographicToCartesianNormal,i=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(e,n),Cartesian3.multiplyComponents(this._radiiSquared,n,i);const r=Math.sqrt(Cartesian3.dot(n,i));return Cartesian3.divideByScalar(i,r,i),Cartesian3.multiplyByScalar(n,e.height,n),defined(t)||(t=new Cartesian3),Cartesian3.add(i,n,t)},Ellipsoid.prototype.cartographicArrayToCartesianArray=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const cartesianToCartographicN=new Cartesian3,cartesianToCartographicP=new Cartesian3,cartesianToCartographicH=new Cartesian3;Ellipsoid.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,cartesianToCartographicP);if(!defined(n))return;const i=this.geodeticSurfaceNormal(n,cartesianToCartographicN),r=Cartesian3.subtract(e,n,cartesianToCartographicH),o=Math.atan2(i.y,i.x),a=Math.asin(i.z),s=CesiumMath.sign(Cartesian3.dot(r,e))*Cartesian3.magnitude(r);return defined(t)?(t.longitude=o,t.latitude=a,t.height=s,t):new Cartographic(o,a,s)},Ellipsoid.prototype.cartesianArrayToCartographicArray=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},Ellipsoid.prototype.scaleToGeodeticSurface=function(e,t){return scaleToGeodeticSurface(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},Ellipsoid.prototype.scaleToGeocentricSurface=function(e,t){defined(t)||(t=new Cartesian3);const n=e.x,i=e.y,r=e.z,o=this._oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+i*i*o.y+r*r*o.z);return Cartesian3.multiplyByScalar(e,a,t)},Ellipsoid.prototype.transformPositionToScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._oneOverRadii,t)},Ellipsoid.prototype.transformPositionFromScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._radii,t)},Ellipsoid.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this._radii,e._radii)},Ellipsoid.prototype.toString=function(){return this._radii.toString()},Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){t=defaultValue(t,0);const i=this._squaredXOverSquaredZ;if(defined(n)||(n=new Cartesian3),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const abscissas=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],weights=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function gaussLegendreQuadrature(e,t,n){const i=.5*(t+e),r=.5*(t-e);let o=0;for(let e=0;e<5;e++){const t=r*abscissas[e];o+=weights[e]*(n(i+t)+n(i-t))}return o*=r,o}function GeographicProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Ellipsoid.prototype.surfaceArea=function(e){const t=e.west;let n=e.east;const i=e.south,r=e.north;for(;n<t;)n+=CesiumMath.TWO_PI;const o=this._radiiSquared,a=o.x,s=o.y,c=o.z,l=a*s;return gaussLegendreQuadrature(i,r,(function(e){const i=Math.cos(e),r=Math.sin(e);return Math.cos(e)*gaussLegendreQuadrature(t,n,(function(e){const t=Math.cos(e),n=Math.sin(e);return Math.sqrt(l*r*r+c*(s*t*t+a*n*n)*i*i)}))}))},Object.defineProperties(GeographicProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),GeographicProjection.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,r=e.latitude*n,o=e.height;return defined(t)?(t.x=i,t.y=r,t.z=o,t):new Cartesian3(i,r,o)},GeographicProjection.prototype.unproject=function(e,t){const n=this._oneOverSemimajorAxis,i=e.x*n,r=e.y*n,o=e.z;return defined(t)?(t.longitude=i,t.latitude=r,t.height=o,t):new Cartographic(i,r,o)};const Intersect={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Intersect$1=Object.freeze(Intersect);function Interval(e,t){this.start=defaultValue(e,0),this.stop=defaultValue(t,0)}function Matrix3(e,t,n,i,r,o,a,s,c){this[0]=defaultValue(e,0),this[1]=defaultValue(i,0),this[2]=defaultValue(a,0),this[3]=defaultValue(t,0),this[4]=defaultValue(r,0),this[5]=defaultValue(s,0),this[6]=defaultValue(n,0),this[7]=defaultValue(o,0),this[8]=defaultValue(c,0)}Matrix3.packedLength=9,Matrix3.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t},Matrix3.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix3),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n},Matrix3.clone=function(e,t){if(defined(e))return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},Matrix3.fromArray=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix3),n[0]=e[t],n[1]=e[t+1],n[2]=e[t+2],n[3]=e[t+3],n[4]=e[t+4],n[5]=e[t+5],n[6]=e[t+6],n[7]=e[t+7],n[8]=e[t+8],n},Matrix3.fromColumnMajorArray=function(e,t){return Matrix3.clone(e,t)},Matrix3.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new Matrix3(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Matrix3.fromQuaternion=function(e,t){const n=e.x*e.x,i=e.x*e.y,r=e.x*e.z,o=e.x*e.w,a=e.y*e.y,s=e.y*e.z,c=e.y*e.w,l=e.z*e.z,u=e.z*e.w,d=e.w*e.w,h=n-a-l+d,p=2*(i-u),f=2*(r+c),m=2*(i+u),g=-n+a-l+d,_=2*(s-o),y=2*(r-c),C=2*(s+o),T=-n-a+l+d;return defined(t)?(t[0]=h,t[1]=m,t[2]=y,t[3]=p,t[4]=g,t[5]=C,t[6]=f,t[7]=_,t[8]=T,t):new Matrix3(h,p,f,m,g,_,y,C,T)},Matrix3.fromHeadingPitchRoll=function(e,t){const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),r=Math.cos(e.roll),o=Math.sin(-e.pitch),a=Math.sin(-e.heading),s=Math.sin(e.roll),c=n*i,l=-r*a+s*o*i,u=s*a+r*o*i,d=n*a,h=r*i+s*o*a,p=-s*i+r*o*a,f=-o,m=s*n,g=r*n;return defined(t)?(t[0]=c,t[1]=d,t[2]=f,t[3]=l,t[4]=h,t[5]=m,t[6]=u,t[7]=p,t[8]=g,t):new Matrix3(c,l,u,d,h,p,f,m,g)},Matrix3.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new Matrix3(e.x,0,0,0,e.y,0,0,0,e.z)},Matrix3.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new Matrix3(e,0,0,0,e,0,0,0,e)},Matrix3.fromCrossProduct=function(e,t){return defined(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new Matrix3(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},Matrix3.fromRotationX=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new Matrix3(1,0,0,0,n,-i,0,i,n)},Matrix3.fromRotationY=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new Matrix3(n,0,i,0,1,0,-i,0,n)},Matrix3.fromRotationZ=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(n,-i,0,i,n,0,0,0,1)},Matrix3.toArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},Matrix3.getElementIndex=function(e,t){return 3*e+t},Matrix3.getColumn=function(e,t,n){const i=3*t,r=e[i],o=e[i+1],a=e[i+2];return n.x=r,n.y=o,n.z=a,n},Matrix3.setColumn=function(e,t,n,i){const r=3*t;return(i=Matrix3.clone(e,i))[r]=n.x,i[r+1]=n.y,i[r+2]=n.z,i},Matrix3.getRow=function(e,t,n){const i=e[t],r=e[t+3],o=e[t+6];return n.x=i,n.y=r,n.z=o,n},Matrix3.setRow=function(e,t,n,i){return(i=Matrix3.clone(e,i))[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const scratchColumn$2=new Cartesian3;Matrix3.getScale=function(e,t){return t.x=Cartesian3.magnitude(Cartesian3.fromElements(e[0],e[1],e[2],scratchColumn$2)),t.y=Cartesian3.magnitude(Cartesian3.fromElements(e[3],e[4],e[5],scratchColumn$2)),t.z=Cartesian3.magnitude(Cartesian3.fromElements(e[6],e[7],e[8],scratchColumn$2)),t};const scratchScale$8=new Cartesian3;Matrix3.getMaximumScale=function(e){return Matrix3.getScale(e,scratchScale$8),Cartesian3.maximumComponent(scratchScale$8)},Matrix3.multiply=function(e,t,n){const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],r=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],o=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],l=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],u=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=r,n[2]=o,n[3]=a,n[4]=s,n[5]=c,n[6]=l,n[7]=u,n[8]=d,n},Matrix3.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},Matrix3.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},Matrix3.multiplyByVector=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=e[0]*i+e[3]*r+e[6]*o,s=e[1]*i+e[4]*r+e[7]*o,c=e[2]*i+e[5]*r+e[8]*o;return n.x=a,n.y=s,n.z=c,n},Matrix3.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},Matrix3.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},Matrix3.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},Matrix3.transpose=function(e,t){const n=e[0],i=e[3],r=e[6],o=e[1],a=e[4],s=e[7],c=e[2],l=e[5],u=e[8];return t[0]=n,t[1]=i,t[2]=r,t[3]=o,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t};const UNIT=new Cartesian3(1,1,1);function computeFrobeniusNorm(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}Matrix3.getRotation=function(e,t){const n=Cartesian3.divideComponents(UNIT,Matrix3.getScale(e,scratchScale$8),scratchScale$8);return t=Matrix3.multiplyByScale(e,n,t)};const rowVal=[1,0,0],colVal=[2,2,1];function offDiagonalFrobeniusNorm(e){let t=0;for(let n=0;n<3;++n){const i=e[Matrix3.getElementIndex(colVal[n],rowVal[n])];t+=2*i*i}return Math.sqrt(t)}function shurDecomposition(e,t){const n=CesiumMath.EPSILON15;let i=0,r=1;for(let t=0;t<3;++t){const n=Math.abs(e[Matrix3.getElementIndex(colVal[t],rowVal[t])]);n>i&&(r=t,i=n)}let o=1,a=0;const s=rowVal[r],c=colVal[r];if(Math.abs(e[Matrix3.getElementIndex(c,s)])>n){const t=(e[Matrix3.getElementIndex(c,c)]-e[Matrix3.getElementIndex(s,s)])/2/e[Matrix3.getElementIndex(c,s)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),a=n*o}return(t=Matrix3.clone(Matrix3.IDENTITY,t))[Matrix3.getElementIndex(s,s)]=t[Matrix3.getElementIndex(c,c)]=o,t[Matrix3.getElementIndex(c,s)]=a,t[Matrix3.getElementIndex(s,c)]=-a,t}const jMatrix=new Matrix3,jMatrixTranspose=new Matrix3;Matrix3.computeEigenDecomposition=function(e,t){const n=CesiumMath.EPSILON20;let i=0,r=0;defined(t)||(t={});const o=t.unitary=Matrix3.clone(Matrix3.IDENTITY,t.unitary),a=t.diagonal=Matrix3.clone(e,t.diagonal),s=n*computeFrobeniusNorm(a);for(;r<10&&offDiagonalFrobeniusNorm(a)>s;)shurDecomposition(a,jMatrix),Matrix3.transpose(jMatrix,jMatrixTranspose),Matrix3.multiply(a,jMatrix,a),Matrix3.multiply(jMatrixTranspose,a,a),Matrix3.multiply(o,jMatrix,o),++i>2&&(++r,i=0);return t},Matrix3.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},Matrix3.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],o=e[4],a=e[7],s=e[2],c=e[5],l=e[8];return t*(o*l-c*a)+r*(c*i-n*l)+s*(n*a-o*i)},Matrix3.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=Matrix3.determinant(e);t[0]=a*u-l*s,t[1]=l*r-i*u,t[2]=i*s-a*r,t[3]=c*s-o*u,t[4]=n*u-c*r,t[5]=o*r-n*s,t[6]=o*l-c*a,t[7]=c*i-n*l,t[8]=n*a-o*i;const h=1/d;return Matrix3.multiplyByScalar(t,h,t)};const scratchTransposeMatrix$1=new Matrix3;function Cartesian4(e,t,n,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0),this.w=defaultValue(i,0)}Matrix3.inverseTranspose=function(e,t){return Matrix3.inverse(Matrix3.transpose(e,scratchTransposeMatrix$1),t)},Matrix3.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},Matrix3.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},Matrix3.IDENTITY=Object.freeze(new Matrix3(1,0,0,0,1,0,0,0,1)),Matrix3.ZERO=Object.freeze(new Matrix3(0,0,0,0,0,0,0,0,0)),Matrix3.COLUMN0ROW0=0,Matrix3.COLUMN0ROW1=1,Matrix3.COLUMN0ROW2=2,Matrix3.COLUMN1ROW0=3,Matrix3.COLUMN1ROW1=4,Matrix3.COLUMN1ROW2=5,Matrix3.COLUMN2ROW0=6,Matrix3.COLUMN2ROW1=7,Matrix3.COLUMN2ROW2=8,Object.defineProperties(Matrix3.prototype,{length:{get:function(){return Matrix3.packedLength}}}),Matrix3.prototype.clone=function(e){return Matrix3.clone(this,e)},Matrix3.prototype.equals=function(e){return Matrix3.equals(this,e)},Matrix3.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},Matrix3.prototype.equalsEpsilon=function(e,t){return Matrix3.equalsEpsilon(this,e,t)},Matrix3.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},Cartesian4.fromElements=function(e,t,n,i,r){return defined(r)?(r.x=e,r.y=t,r.z=n,r.w=i,r):new Cartesian4(e,t,n,i)},Cartesian4.fromColor=function(e,t){return defined(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new Cartesian4(e.red,e.green,e.blue,e.alpha)},Cartesian4.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Cartesian4(e.x,e.y,e.z,e.w)},Cartesian4.packedLength=4,Cartesian4.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},Cartesian4.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian4),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n},Cartesian4.packArray=function(e,t){const n=e.length,i=4*n;if(defined(t)){if(!Array.isArray(t)&&t.length!==i)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let i=0;i<n;++i)Cartesian4.pack(e[i],t,4*i);return t},Cartesian4.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const n=i/4;t[n]=Cartesian4.unpack(e,i,t[n])}return t},Cartesian4.fromArray=Cartesian4.unpack,Cartesian4.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},Cartesian4.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},Cartesian4.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},Cartesian4.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},Cartesian4.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Cartesian4.magnitude=function(e){return Math.sqrt(Cartesian4.magnitudeSquared(e))};const distanceScratch$2=new Cartesian4;Cartesian4.distance=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$2),Cartesian4.magnitude(distanceScratch$2)},Cartesian4.distanceSquared=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$2),Cartesian4.magnitudeSquared(distanceScratch$2)},Cartesian4.normalize=function(e,t){const n=Cartesian4.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t},Cartesian4.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Cartesian4.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},Cartesian4.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n},Cartesian4.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},Cartesian4.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},Cartesian4.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},Cartesian4.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},Cartesian4.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Cartesian4.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const lerpScratch$2=new Cartesian4;Cartesian4.lerp=function(e,t,n,i){return Cartesian4.multiplyByScalar(t,n,lerpScratch$2),i=Cartesian4.multiplyByScalar(e,1-n,i),Cartesian4.add(lerpScratch$2,i,i)};const mostOrthogonalAxisScratch$1=new Cartesian4;Cartesian4.mostOrthogonalAxis=function(e,t){const n=Cartesian4.normalize(e,mostOrthogonalAxisScratch$1);return Cartesian4.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?Cartesian4.clone(Cartesian4.UNIT_X,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.z<=n.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.y<=n.z?n.y<=n.w?Cartesian4.clone(Cartesian4.UNIT_Y,t):Cartesian4.clone(Cartesian4.UNIT_W,t):n.z<=n.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t)},Cartesian4.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Cartesian4.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},Cartesian4.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,n,i)&&CesiumMath.equalsEpsilon(e.y,t.y,n,i)&&CesiumMath.equalsEpsilon(e.z,t.z,n,i)&&CesiumMath.equalsEpsilon(e.w,t.w,n,i)},Cartesian4.ZERO=Object.freeze(new Cartesian4(0,0,0,0)),Cartesian4.ONE=Object.freeze(new Cartesian4(1,1,1,1)),Cartesian4.UNIT_X=Object.freeze(new Cartesian4(1,0,0,0)),Cartesian4.UNIT_Y=Object.freeze(new Cartesian4(0,1,0,0)),Cartesian4.UNIT_Z=Object.freeze(new Cartesian4(0,0,1,0)),Cartesian4.UNIT_W=Object.freeze(new Cartesian4(0,0,0,1)),Cartesian4.prototype.clone=function(e){return Cartesian4.clone(this,e)},Cartesian4.prototype.equals=function(e){return Cartesian4.equals(this,e)},Cartesian4.prototype.equalsEpsilon=function(e,t,n){return Cartesian4.equalsEpsilon(this,e,t,n)},Cartesian4.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"};const scratchF32Array=new Float32Array(1),scratchU8Array=new Uint8Array(scratchF32Array.buffer),testU32=new Uint32Array([287454020]),testU8=new Uint8Array(testU32.buffer),littleEndian=68===testU8[0];function RuntimeError(e){let t;this.name="RuntimeError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}function Matrix4(e,t,n,i,r,o,a,s,c,l,u,d,h,p,f,m){this[0]=defaultValue(e,0),this[1]=defaultValue(r,0),this[2]=defaultValue(c,0),this[3]=defaultValue(h,0),this[4]=defaultValue(t,0),this[5]=defaultValue(o,0),this[6]=defaultValue(l,0),this[7]=defaultValue(p,0),this[8]=defaultValue(n,0),this[9]=defaultValue(a,0),this[10]=defaultValue(u,0),this[11]=defaultValue(f,0),this[12]=defaultValue(i,0),this[13]=defaultValue(s,0),this[14]=defaultValue(d,0),this[15]=defaultValue(m,0)}Cartesian4.packFloat=function(e,t){return defined(t)||(t=new Cartesian4),scratchF32Array[0]=e,littleEndian?(t.x=scratchU8Array[0],t.y=scratchU8Array[1],t.z=scratchU8Array[2],t.w=scratchU8Array[3]):(t.x=scratchU8Array[3],t.y=scratchU8Array[2],t.z=scratchU8Array[1],t.w=scratchU8Array[0]),t},Cartesian4.unpackFloat=function(e){return littleEndian?(scratchU8Array[0]=e.x,scratchU8Array[1]=e.y,scratchU8Array[2]=e.z,scratchU8Array[3]=e.w):(scratchU8Array[0]=e.w,scratchU8Array[1]=e.z,scratchU8Array[2]=e.y,scratchU8Array[3]=e.x),scratchF32Array[0]},defined(Object.create)&&(RuntimeError.prototype=Object.create(Error.prototype),RuntimeError.prototype.constructor=RuntimeError),RuntimeError.prototype.toString=function(){let e=this.name+": "+this.message;return defined(this.stack)&&(e+="\n"+this.stack.toString()),e},Matrix4.packedLength=16,Matrix4.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t},Matrix4.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix4),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n},Matrix4.clone=function(e,t){if(defined(e))return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])},Matrix4.fromArray=Matrix4.unpack,Matrix4.fromColumnMajorArray=function(e,t){return Matrix4.clone(e,t)},Matrix4.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new Matrix4(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},Matrix4.fromRotationTranslation=function(e,t,n){return t=defaultValue(t,Cartesian3.ZERO),defined(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new Matrix4(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)},Matrix4.fromTranslationQuaternionRotationScale=function(e,t,n,i){defined(i)||(i=new Matrix4);const r=n.x,o=n.y,a=n.z,s=t.x*t.x,c=t.x*t.y,l=t.x*t.z,u=t.x*t.w,d=t.y*t.y,h=t.y*t.z,p=t.y*t.w,f=t.z*t.z,m=t.z*t.w,g=t.w*t.w,_=s-d-f+g,y=2*(c-m),C=2*(l+p),T=2*(c+m),S=-s+d-f+g,A=2*(h-u),v=2*(l-p),E=2*(h+u),b=-s-d+f+g;return i[0]=_*r,i[1]=T*r,i[2]=v*r,i[3]=0,i[4]=y*o,i[5]=S*o,i[6]=E*o,i[7]=0,i[8]=C*a,i[9]=A*a,i[10]=b*a,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},Matrix4.fromTranslationRotationScale=function(e,t){return Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)},Matrix4.fromTranslation=function(e,t){return Matrix4.fromRotationTranslation(Matrix3.IDENTITY,e,t)},Matrix4.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Matrix4(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},Matrix4.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Matrix4(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};const fromCameraF=new Cartesian3,fromCameraR=new Cartesian3,fromCameraU=new Cartesian3;Matrix4.fromCamera=function(e,t){const n=e.position,i=e.direction,r=e.up;Cartesian3.normalize(i,fromCameraF),Cartesian3.normalize(Cartesian3.cross(fromCameraF,r,fromCameraR),fromCameraR),Cartesian3.normalize(Cartesian3.cross(fromCameraR,fromCameraF,fromCameraU),fromCameraU);const o=fromCameraR.x,a=fromCameraR.y,s=fromCameraR.z,c=fromCameraF.x,l=fromCameraF.y,u=fromCameraF.z,d=fromCameraU.x,h=fromCameraU.y,p=fromCameraU.z,f=n.x,m=n.y,g=n.z,_=o*-f+a*-m+s*-g,y=d*-f+h*-m+p*-g,C=c*f+l*m+u*g;return defined(t)?(t[0]=o,t[1]=d,t[2]=-c,t[3]=0,t[4]=a,t[5]=h,t[6]=-l,t[7]=0,t[8]=s,t[9]=p,t[10]=-u,t[11]=0,t[12]=_,t[13]=y,t[14]=C,t[15]=1,t):new Matrix4(o,a,s,_,d,h,p,y,-c,-l,-u,C,0,0,0,1)},Matrix4.computePerspectiveFieldOfView=function(e,t,n,i,r){const o=1/Math.tan(.5*e),a=o/t,s=(i+n)/(n-i),c=2*i*n/(n-i);return r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=s,r[11]=-1,r[12]=0,r[13]=0,r[14]=c,r[15]=0,r},Matrix4.computeOrthographicOffCenter=function(e,t,n,i,r,o,a){let s=1/(t-e),c=1/(i-n),l=1/(o-r);const u=-(t+e)*s,d=-(i+n)*c,h=-(o+r)*l;return s*=2,c*=2,l*=-2,a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=c,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=l,a[11]=0,a[12]=u,a[13]=d,a[14]=h,a[15]=1,a},Matrix4.computePerspectiveOffCenter=function(e,t,n,i,r,o,a){const s=2*r/(t-e),c=2*r/(i-n),l=(t+e)/(t-e),u=(i+n)/(i-n),d=-(o+r)/(o-r),h=-2*o*r/(o-r);return a[0]=s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=c,a[6]=0,a[7]=0,a[8]=l,a[9]=u,a[10]=d,a[11]=-1,a[12]=0,a[13]=0,a[14]=h,a[15]=0,a},Matrix4.computeInfinitePerspectiveOffCenter=function(e,t,n,i,r,o){const a=2*r/(t-e),s=2*r/(i-n),c=(t+e)/(t-e),l=(i+n)/(i-n),u=-2*r;return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=-1,o[11]=-1,o[12]=0,o[13]=0,o[14]=u,o[15]=0,o},Matrix4.computeViewportTransformation=function(e,t,n,i){defined(i)||(i=new Matrix4),e=defaultValue(e,defaultValue.EMPTY_OBJECT);const r=defaultValue(e.x,0),o=defaultValue(e.y,0),a=defaultValue(e.width,0),s=defaultValue(e.height,0);t=defaultValue(t,0);const c=.5*a,l=.5*s,u=.5*((n=defaultValue(n,1))-t),d=c,h=l,p=u,f=r+c,m=o+l,g=t+u;return i[0]=d,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=p,i[11]=0,i[12]=f,i[13]=m,i[14]=g,i[15]=1,i},Matrix4.computeView=function(e,t,n,i,r){return r[0]=i.x,r[1]=n.x,r[2]=-t.x,r[3]=0,r[4]=i.y,r[5]=n.y,r[6]=-t.y,r[7]=0,r[8]=i.z,r[9]=n.z,r[10]=-t.z,r[11]=0,r[12]=-Cartesian3.dot(i,e),r[13]=-Cartesian3.dot(n,e),r[14]=Cartesian3.dot(t,e),r[15]=1,r},Matrix4.toArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},Matrix4.getElementIndex=function(e,t){return 4*e+t},Matrix4.getColumn=function(e,t,n){const i=4*t,r=e[i],o=e[i+1],a=e[i+2],s=e[i+3];return n.x=r,n.y=o,n.z=a,n.w=s,n},Matrix4.setColumn=function(e,t,n,i){const r=4*t;return(i=Matrix4.clone(e,i))[r]=n.x,i[r+1]=n.y,i[r+2]=n.z,i[r+3]=n.w,i},Matrix4.setTranslation=function(e,t,n){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};const scaleScratch$1=new Cartesian3;Matrix4.setScale=function(e,t,n){const i=Matrix4.getScale(e,scaleScratch$1),r=Cartesian3.divideComponents(t,i,scaleScratch$1);return Matrix4.multiplyByScale(e,r,n)},Matrix4.getRow=function(e,t,n){const i=e[t],r=e[t+4],o=e[t+8],a=e[t+12];return n.x=i,n.y=r,n.z=o,n.w=a,n},Matrix4.setRow=function(e,t,n,i){return(i=Matrix4.clone(e,i))[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};const scratchColumn$1=new Cartesian3;Matrix4.getScale=function(e,t){return t.x=Cartesian3.magnitude(Cartesian3.fromElements(e[0],e[1],e[2],scratchColumn$1)),t.y=Cartesian3.magnitude(Cartesian3.fromElements(e[4],e[5],e[6],scratchColumn$1)),t.z=Cartesian3.magnitude(Cartesian3.fromElements(e[8],e[9],e[10],scratchColumn$1)),t};const scratchScale$7=new Cartesian3;Matrix4.getMaximumScale=function(e){return Matrix4.getScale(e,scratchScale$7),Cartesian3.maximumComponent(scratchScale$7)},Matrix4.multiply=function(e,t,n){const i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],u=e[7],d=e[8],h=e[9],p=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],C=t[0],T=t[1],S=t[2],A=t[3],v=t[4],E=t[5],b=t[6],x=t[7],P=t[8],D=t[9],w=t[10],M=t[11],I=t[12],R=t[13],O=t[14],B=t[15],L=i*C+s*T+d*S+m*A,F=r*C+c*T+h*S+g*A,N=o*C+l*T+p*S+_*A,V=a*C+u*T+f*S+y*A,k=i*v+s*E+d*b+m*x,U=r*v+c*E+h*b+g*x,G=o*v+l*E+p*b+_*x,$=a*v+u*E+f*b+y*x,z=i*P+s*D+d*w+m*M,H=r*P+c*D+h*w+g*M,W=o*P+l*D+p*w+_*M,q=a*P+u*D+f*w+y*M,j=i*I+s*R+d*O+m*B,X=r*I+c*R+h*O+g*B,Y=o*I+l*R+p*O+_*B,K=a*I+u*R+f*O+y*B;return n[0]=L,n[1]=F,n[2]=N,n[3]=V,n[4]=k,n[5]=U,n[6]=G,n[7]=$,n[8]=z,n[9]=H,n[10]=W,n[11]=q,n[12]=j,n[13]=X,n[14]=Y,n[15]=K,n},Matrix4.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},Matrix4.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},Matrix4.multiplyTransformation=function(e,t,n){const i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],c=e[6],l=e[8],u=e[9],d=e[10],h=e[12],p=e[13],f=e[14],m=t[0],g=t[1],_=t[2],y=t[4],C=t[5],T=t[6],S=t[8],A=t[9],v=t[10],E=t[12],b=t[13],x=t[14],P=i*m+a*g+l*_,D=r*m+s*g+u*_,w=o*m+c*g+d*_,M=i*y+a*C+l*T,I=r*y+s*C+u*T,R=o*y+c*C+d*T,O=i*S+a*A+l*v,B=r*S+s*A+u*v,L=o*S+c*A+d*v,F=i*E+a*b+l*x+h,N=r*E+s*b+u*x+p,V=o*E+c*b+d*x+f;return n[0]=P,n[1]=D,n[2]=w,n[3]=0,n[4]=M,n[5]=I,n[6]=R,n[7]=0,n[8]=O,n[9]=B,n[10]=L,n[11]=0,n[12]=F,n[13]=N,n[14]=V,n[15]=1,n},Matrix4.multiplyByMatrix3=function(e,t,n){const i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],c=e[6],l=e[8],u=e[9],d=e[10],h=t[0],p=t[1],f=t[2],m=t[3],g=t[4],_=t[5],y=t[6],C=t[7],T=t[8],S=i*h+a*p+l*f,A=r*h+s*p+u*f,v=o*h+c*p+d*f,E=i*m+a*g+l*_,b=r*m+s*g+u*_,x=o*m+c*g+d*_,P=i*y+a*C+l*T,D=r*y+s*C+u*T,w=o*y+c*C+d*T;return n[0]=S,n[1]=A,n[2]=v,n[3]=0,n[4]=E,n[5]=b,n[6]=x,n[7]=0,n[8]=P,n[9]=D,n[10]=w,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},Matrix4.multiplyByTranslation=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=i*e[0]+r*e[4]+o*e[8]+e[12],s=i*e[1]+r*e[5]+o*e[9]+e[13],c=i*e[2]+r*e[6]+o*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=a,n[13]=s,n[14]=c,n[15]=e[15],n};const uniformScaleScratch=new Cartesian3;Matrix4.multiplyByUniformScale=function(e,t,n){return uniformScaleScratch.x=t,uniformScaleScratch.y=t,uniformScaleScratch.z=t,Matrix4.multiplyByScale(e,uniformScaleScratch,n)},Matrix4.multiplyByScale=function(e,t,n){const i=t.x,r=t.y,o=t.z;return 1===i&&1===r&&1===o?Matrix4.clone(e,n):(n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=0,n[4]=r*e[4],n[5]=r*e[5],n[6]=r*e[6],n[7]=0,n[8]=o*e[8],n[9]=o*e[9],n[10]=o*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},Matrix4.multiplyByVector=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=t.w,s=e[0]*i+e[4]*r+e[8]*o+e[12]*a,c=e[1]*i+e[5]*r+e[9]*o+e[13]*a,l=e[2]*i+e[6]*r+e[10]*o+e[14]*a,u=e[3]*i+e[7]*r+e[11]*o+e[15]*a;return n.x=s,n.y=c,n.z=l,n.w=u,n},Matrix4.multiplyByPointAsVector=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=e[0]*i+e[4]*r+e[8]*o,s=e[1]*i+e[5]*r+e[9]*o,c=e[2]*i+e[6]*r+e[10]*o;return n.x=a,n.y=s,n.z=c,n},Matrix4.multiplyByPoint=function(e,t,n){const i=t.x,r=t.y,o=t.z,a=e[0]*i+e[4]*r+e[8]*o+e[12],s=e[1]*i+e[5]*r+e[9]*o+e[13],c=e[2]*i+e[6]*r+e[10]*o+e[14];return n.x=a,n.y=s,n.z=c,n},Matrix4.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},Matrix4.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},Matrix4.transpose=function(e,t){const n=e[1],i=e[2],r=e[3],o=e[6],a=e[7],s=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[10]=e[10],t[11]=e[14],t[12]=r,t[13]=a,t[14]=s,t[15]=e[15],t},Matrix4.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},Matrix4.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},Matrix4.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},Matrix4.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},Matrix4.getMatrix3=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};const scratchInverseRotation=new Matrix3,scratchMatrix3Zero=new Matrix3,scratchBottomRow=new Cartesian4,scratchExpectedBottomRow=new Cartesian4(0,0,0,1);Matrix4.inverse=function(e,t){const n=e[0],i=e[4],r=e[8],o=e[12],a=e[1],s=e[5],c=e[9],l=e[13],u=e[2],d=e[6],h=e[10],p=e[14],f=e[3],m=e[7],g=e[11],_=e[15];let y=h*_,C=p*g,T=d*_,S=p*m,A=d*g,v=h*m,E=u*_,b=p*f,x=u*g,P=h*f,D=u*m,w=d*f;const M=y*s+S*c+A*l-(C*s+T*c+v*l),I=C*a+E*c+P*l-(y*a+b*c+x*l),R=T*a+b*s+D*l-(S*a+E*s+w*l),O=v*a+x*s+w*c-(A*a+P*s+D*c),B=C*i+T*r+v*o-(y*i+S*r+A*o),L=y*n+b*r+x*o-(C*n+E*r+P*o),F=S*n+E*i+w*o-(T*n+b*i+D*o),N=A*n+P*i+D*r-(v*n+x*i+w*r);y=r*l,C=o*c,T=i*l,S=o*s,A=i*c,v=r*s,E=n*l,b=o*a,x=n*c,P=r*a,D=n*s,w=i*a;const V=y*m+S*g+A*_-(C*m+T*g+v*_),k=C*f+E*g+P*_-(y*f+b*g+x*_),U=T*f+b*m+D*_-(S*f+E*m+w*_),G=v*f+x*m+w*g-(A*f+P*m+D*g),$=T*h+v*p+C*d-(A*p+y*d+S*h),z=x*p+y*u+b*h-(E*h+P*p+C*u),H=E*d+w*p+S*u-(D*p+T*u+b*d),W=D*h+A*u+P*d-(x*d+w*h+v*u);let q=n*M+i*I+r*R+o*O;if(Math.abs(q)<CesiumMath.EPSILON21){if(Matrix3.equalsEpsilon(Matrix4.getMatrix3(e,scratchInverseRotation),scratchMatrix3Zero,CesiumMath.EPSILON7)&&Cartesian4.equals(Matrix4.getRow(e,3,scratchBottomRow),scratchExpectedBottomRow))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;throw new RuntimeError("matrix is not invertible because its determinate is zero.")}return q=1/q,t[0]=M*q,t[1]=I*q,t[2]=R*q,t[3]=O*q,t[4]=B*q,t[5]=L*q,t[6]=F*q,t[7]=N*q,t[8]=V*q,t[9]=k*q,t[10]=U*q,t[11]=G*q,t[12]=$*q,t[13]=z*q,t[14]=H*q,t[15]=W*q,t},Matrix4.inverseTransformation=function(e,t){const n=e[0],i=e[1],r=e[2],o=e[4],a=e[5],s=e[6],c=e[8],l=e[9],u=e[10],d=e[12],h=e[13],p=e[14],f=-n*d-i*h-r*p,m=-o*d-a*h-s*p,g=-c*d-l*h-u*p;return t[0]=n,t[1]=o,t[2]=c,t[3]=0,t[4]=i,t[5]=a,t[6]=l,t[7]=0,t[8]=r,t[9]=s,t[10]=u,t[11]=0,t[12]=f,t[13]=m,t[14]=g,t[15]=1,t};const scratchTransposeMatrix=new Matrix4;function Rectangle(e,t,n,i){this.west=defaultValue(e,0),this.south=defaultValue(t,0),this.east=defaultValue(n,0),this.north=defaultValue(i,0)}Matrix4.inverseTranspose=function(e,t){return Matrix4.inverse(Matrix4.transpose(e,scratchTransposeMatrix),t)},Matrix4.IDENTITY=Object.freeze(new Matrix4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),Matrix4.ZERO=Object.freeze(new Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),Matrix4.COLUMN0ROW0=0,Matrix4.COLUMN0ROW1=1,Matrix4.COLUMN0ROW2=2,Matrix4.COLUMN0ROW3=3,Matrix4.COLUMN1ROW0=4,Matrix4.COLUMN1ROW1=5,Matrix4.COLUMN1ROW2=6,Matrix4.COLUMN1ROW3=7,Matrix4.COLUMN2ROW0=8,Matrix4.COLUMN2ROW1=9,Matrix4.COLUMN2ROW2=10,Matrix4.COLUMN2ROW3=11,Matrix4.COLUMN3ROW0=12,Matrix4.COLUMN3ROW1=13,Matrix4.COLUMN3ROW2=14,Matrix4.COLUMN3ROW3=15,Object.defineProperties(Matrix4.prototype,{length:{get:function(){return Matrix4.packedLength}}}),Matrix4.prototype.clone=function(e){return Matrix4.clone(this,e)},Matrix4.prototype.equals=function(e){return Matrix4.equals(this,e)},Matrix4.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},Matrix4.prototype.equalsEpsilon=function(e,t){return Matrix4.equalsEpsilon(this,e,t)},Matrix4.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},Object.defineProperties(Rectangle.prototype,{width:{get:function(){return Rectangle.computeWidth(this)}},height:{get:function(){return Rectangle.computeHeight(this)}}}),Rectangle.packedLength=4,Rectangle.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t},Rectangle.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Rectangle),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n},Rectangle.computeWidth=function(e){let t=e.east;const n=e.west;return t<n&&(t+=CesiumMath.TWO_PI),t-n},Rectangle.computeHeight=function(e){return e.north-e.south},Rectangle.fromDegrees=function(e,t,n,i,r){return e=CesiumMath.toRadians(defaultValue(e,0)),t=CesiumMath.toRadians(defaultValue(t,0)),n=CesiumMath.toRadians(defaultValue(n,0)),i=CesiumMath.toRadians(defaultValue(i,0)),defined(r)?(r.west=e,r.south=t,r.east=n,r.north=i,r):new Rectangle(e,t,n,i)},Rectangle.fromRadians=function(e,t,n,i,r){return defined(r)?(r.west=defaultValue(e,0),r.south=defaultValue(t,0),r.east=defaultValue(n,0),r.north=defaultValue(i,0),r):new Rectangle(e,t,n,i)},Rectangle.fromCartographicArray=function(e,t){let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(let t=0,c=e.length;t<c;t++){const c=e[t];n=Math.min(n,c.longitude),i=Math.max(i,c.longitude),a=Math.min(a,c.latitude),s=Math.max(s,c.latitude);const l=c.longitude>=0?c.longitude:c.longitude+CesiumMath.TWO_PI;r=Math.min(r,l),o=Math.max(o,l)}return i-n>o-r&&(n=r,i=o,i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI),n>CesiumMath.PI&&(n-=CesiumMath.TWO_PI)),defined(t)?(t.west=n,t.south=a,t.east=i,t.north=s,t):new Rectangle(n,a,i,s)},Rectangle.fromCartesianArray=function(e,t,n){t=defaultValue(t,Ellipsoid.WGS84);let i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let n=0,l=e.length;n<l;n++){const l=t.cartesianToCartographic(e[n]);i=Math.min(i,l.longitude),r=Math.max(r,l.longitude),s=Math.min(s,l.latitude),c=Math.max(c,l.latitude);const u=l.longitude>=0?l.longitude:l.longitude+CesiumMath.TWO_PI;o=Math.min(o,u),a=Math.max(a,u)}return r-i>a-o&&(i=o,r=a,r>CesiumMath.PI&&(r-=CesiumMath.TWO_PI),i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI)),defined(n)?(n.west=i,n.south=s,n.east=r,n.north=c,n):new Rectangle(i,s,r,c)},Rectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Rectangle(e.west,e.south,e.east,e.north)},Rectangle.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n},Rectangle.prototype.clone=function(e){return Rectangle.clone(this,e)},Rectangle.prototype.equals=function(e){return Rectangle.equals(this,e)},Rectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},Rectangle.prototype.equalsEpsilon=function(e,t){return Rectangle.equalsEpsilon(this,e,t)},Rectangle.validate=function(e){},Rectangle.southwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Cartographic(e.west,e.south)},Rectangle.northwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Cartographic(e.west,e.north)},Rectangle.northeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Cartographic(e.east,e.north)},Rectangle.southeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Cartographic(e.east,e.south)},Rectangle.center=function(e,t){let n=e.east;const i=e.west;n<i&&(n+=CesiumMath.TWO_PI);const r=CesiumMath.negativePiToPi(.5*(i+n)),o=.5*(e.south+e.north);return defined(t)?(t.longitude=r,t.latitude=o,t.height=0,t):new Cartographic(r,o)},Rectangle.intersection=function(e,t,n){let i=e.east,r=e.west,o=t.east,a=t.west;i<r&&o>0?i+=CesiumMath.TWO_PI:o<a&&i>0&&(o+=CesiumMath.TWO_PI),i<r&&a<0?a+=CesiumMath.TWO_PI:o<a&&r<0&&(r+=CesiumMath.TWO_PI);const s=CesiumMath.negativePiToPi(Math.max(r,a)),c=CesiumMath.negativePiToPi(Math.min(i,o));if((e.west<e.east||t.west<t.east)&&c<=s)return;const l=Math.max(e.south,t.south),u=Math.min(e.north,t.north);return l>=u?void 0:defined(n)?(n.west=s,n.south=l,n.east=c,n.north=u,n):new Rectangle(s,l,c,u)},Rectangle.simpleIntersection=function(e,t,n){const i=Math.max(e.west,t.west),r=Math.max(e.south,t.south),o=Math.min(e.east,t.east),a=Math.min(e.north,t.north);if(!(r>=a||i>=o))return defined(n)?(n.west=i,n.south=r,n.east=o,n.north=a,n):new Rectangle(i,r,o,a)},Rectangle.union=function(e,t,n){defined(n)||(n=new Rectangle);let i=e.east,r=e.west,o=t.east,a=t.west;i<r&&o>0?i+=CesiumMath.TWO_PI:o<a&&i>0&&(o+=CesiumMath.TWO_PI),i<r&&a<0?a+=CesiumMath.TWO_PI:o<a&&r<0&&(r+=CesiumMath.TWO_PI);const s=CesiumMath.negativePiToPi(Math.min(r,a)),c=CesiumMath.negativePiToPi(Math.max(i,o));return n.west=s,n.south=Math.min(e.south,t.south),n.east=c,n.north=Math.max(e.north,t.north),n},Rectangle.expand=function(e,t,n){return defined(n)||(n=new Rectangle),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n},Rectangle.contains=function(e,t){let n=t.longitude;const i=t.latitude,r=e.west;let o=e.east;return o<r&&(o+=CesiumMath.TWO_PI,n<0&&(n+=CesiumMath.TWO_PI)),(n>r||CesiumMath.equalsEpsilon(n,r,CesiumMath.EPSILON14))&&(n<o||CesiumMath.equalsEpsilon(n,o,CesiumMath.EPSILON14))&&i>=e.south&&i<=e.north};const subsampleLlaScratch=new Cartographic;function BoundingSphere(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.radius=defaultValue(t,0)}Rectangle.subsample=function(e,t,n,i){t=defaultValue(t,Ellipsoid.WGS84),n=defaultValue(n,0),defined(i)||(i=[]);let r=0;const o=e.north,a=e.south,s=e.east,c=e.west,l=subsampleLlaScratch;l.height=n,l.longitude=c,l.latitude=o,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=s,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.latitude=a,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=c,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.latitude=o<0?o:a>0?a:0;for(let n=1;n<8;++n)l.longitude=-Math.PI+n*CesiumMath.PI_OVER_TWO,Rectangle.contains(e,l)&&(i[r]=t.cartographicToCartesian(l,i[r]),r++);return 0===l.latitude&&(l.longitude=c,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=s,i[r]=t.cartographicToCartesian(l,i[r]),r++),i.length=r,i},Rectangle.MAX_VALUE=Object.freeze(new Rectangle(-Math.PI,-CesiumMath.PI_OVER_TWO,Math.PI,CesiumMath.PI_OVER_TWO));const fromPointsXMin=new Cartesian3,fromPointsYMin=new Cartesian3,fromPointsZMin=new Cartesian3,fromPointsXMax=new Cartesian3,fromPointsYMax=new Cartesian3,fromPointsZMax=new Cartesian3,fromPointsCurrentPos=new Cartesian3,fromPointsScratch=new Cartesian3,fromPointsRitterCenter=new Cartesian3,fromPointsMinBoxPt=new Cartesian3,fromPointsMaxBoxPt=new Cartesian3,fromPointsNaiveCenterScratch=new Cartesian3,volumeConstant=4/3*CesiumMath.PI;BoundingSphere.fromPoints=function(e,t){if(defined(t)||(t=new BoundingSphere),!defined(e)||0===e.length)return t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=0,t;const n=Cartesian3.clone(e[0],fromPointsCurrentPos),i=Cartesian3.clone(n,fromPointsXMin),r=Cartesian3.clone(n,fromPointsYMin),o=Cartesian3.clone(n,fromPointsZMin),a=Cartesian3.clone(n,fromPointsXMax),s=Cartesian3.clone(n,fromPointsYMax),c=Cartesian3.clone(n,fromPointsZMax),l=e.length;let u;for(u=1;u<l;u++){Cartesian3.clone(e[u],n);const t=n.x,l=n.y,d=n.z;t<i.x&&Cartesian3.clone(n,i),t>a.x&&Cartesian3.clone(n,a),l<r.y&&Cartesian3.clone(n,r),l>s.y&&Cartesian3.clone(n,s),d<o.z&&Cartesian3.clone(n,o),d>c.z&&Cartesian3.clone(n,c)}const d=Cartesian3.magnitudeSquared(Cartesian3.subtract(a,i,fromPointsScratch)),h=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,r,fromPointsScratch)),p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch));let f=i,m=a,g=d;h>g&&(g=h,f=r,m=s),p>g&&(g=p,f=o,m=c);const _=fromPointsRitterCenter;_.x=.5*(f.x+m.x),_.y=.5*(f.y+m.y),_.z=.5*(f.z+m.z);let y=Cartesian3.magnitudeSquared(Cartesian3.subtract(m,_,fromPointsScratch)),C=Math.sqrt(y);const T=fromPointsMinBoxPt;T.x=i.x,T.y=r.y,T.z=o.z;const S=fromPointsMaxBoxPt;S.x=a.x,S.y=s.y,S.z=c.z;const A=Cartesian3.midpoint(T,S,fromPointsNaiveCenterScratch);let v=0;for(u=0;u<l;u++){Cartesian3.clone(e[u],n);const t=Cartesian3.magnitude(Cartesian3.subtract(n,A,fromPointsScratch));t>v&&(v=t);const i=Cartesian3.magnitudeSquared(Cartesian3.subtract(n,_,fromPointsScratch));if(i>y){const e=Math.sqrt(i);C=.5*(C+e),y=C*C;const t=e-C;_.x=(C*_.x+t*n.x)/e,_.y=(C*_.y+t*n.y)/e,_.z=(C*_.z+t*n.z)/e}}return C<v?(Cartesian3.clone(_,t.center),t.radius=C):(Cartesian3.clone(A,t.center),t.radius=v),t};const defaultProjection$1=new GeographicProjection,fromRectangle2DLowerLeft=new Cartesian3,fromRectangle2DUpperRight=new Cartesian3,fromRectangle2DSouthwest=new Cartographic,fromRectangle2DNortheast=new Cartographic;BoundingSphere.fromRectangle2D=function(e,t,n){return BoundingSphere.fromRectangleWithHeights2D(e,t,0,0,n)},BoundingSphere.fromRectangleWithHeights2D=function(e,t,n,i,r){if(defined(r)||(r=new BoundingSphere),!defined(e))return r.center=Cartesian3.clone(Cartesian3.ZERO,r.center),r.radius=0,r;t=defaultValue(t,defaultProjection$1),Rectangle.southwest(e,fromRectangle2DSouthwest),fromRectangle2DSouthwest.height=n,Rectangle.northeast(e,fromRectangle2DNortheast),fromRectangle2DNortheast.height=i;const o=t.project(fromRectangle2DSouthwest,fromRectangle2DLowerLeft),a=t.project(fromRectangle2DNortheast,fromRectangle2DUpperRight),s=a.x-o.x,c=a.y-o.y,l=a.z-o.z;r.radius=.5*Math.sqrt(s*s+c*c+l*l);const u=r.center;return u.x=o.x+.5*s,u.y=o.y+.5*c,u.z=o.z+.5*l,r};const fromRectangle3DScratch=[];BoundingSphere.fromRectangle3D=function(e,t,n,i){if(t=defaultValue(t,Ellipsoid.WGS84),n=defaultValue(n,0),defined(i)||(i=new BoundingSphere),!defined(e))return i.center=Cartesian3.clone(Cartesian3.ZERO,i.center),i.radius=0,i;const r=Rectangle.subsample(e,t,n,fromRectangle3DScratch);return BoundingSphere.fromPoints(r,i)},BoundingSphere.fromVertices=function(e,t,n,i){if(defined(i)||(i=new BoundingSphere),!defined(e)||0===e.length)return i.center=Cartesian3.clone(Cartesian3.ZERO,i.center),i.radius=0,i;t=defaultValue(t,Cartesian3.ZERO),n=defaultValue(n,3);const r=fromPointsCurrentPos;r.x=e[0]+t.x,r.y=e[1]+t.y,r.z=e[2]+t.z;const o=Cartesian3.clone(r,fromPointsXMin),a=Cartesian3.clone(r,fromPointsYMin),s=Cartesian3.clone(r,fromPointsZMin),c=Cartesian3.clone(r,fromPointsXMax),l=Cartesian3.clone(r,fromPointsYMax),u=Cartesian3.clone(r,fromPointsZMax),d=e.length;let h;for(h=0;h<d;h+=n){const n=e[h]+t.x,i=e[h+1]+t.y,d=e[h+2]+t.z;r.x=n,r.y=i,r.z=d,n<o.x&&Cartesian3.clone(r,o),n>c.x&&Cartesian3.clone(r,c),i<a.y&&Cartesian3.clone(r,a),i>l.y&&Cartesian3.clone(r,l),d<s.z&&Cartesian3.clone(r,s),d>u.z&&Cartesian3.clone(r,u)}const p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch)),m=Cartesian3.magnitudeSquared(Cartesian3.subtract(u,s,fromPointsScratch));let g=o,_=c,y=p;f>y&&(y=f,g=a,_=l),m>y&&(y=m,g=s,_=u);const C=fromPointsRitterCenter;C.x=.5*(g.x+_.x),C.y=.5*(g.y+_.y),C.z=.5*(g.z+_.z);let T=Cartesian3.magnitudeSquared(Cartesian3.subtract(_,C,fromPointsScratch)),S=Math.sqrt(T);const A=fromPointsMinBoxPt;A.x=o.x,A.y=a.y,A.z=s.z;const v=fromPointsMaxBoxPt;v.x=c.x,v.y=l.y,v.z=u.z;const E=Cartesian3.midpoint(A,v,fromPointsNaiveCenterScratch);let b=0;for(h=0;h<d;h+=n){r.x=e[h]+t.x,r.y=e[h+1]+t.y,r.z=e[h+2]+t.z;const n=Cartesian3.magnitude(Cartesian3.subtract(r,E,fromPointsScratch));n>b&&(b=n);const i=Cartesian3.magnitudeSquared(Cartesian3.subtract(r,C,fromPointsScratch));if(i>T){const e=Math.sqrt(i);S=.5*(S+e),T=S*S;const t=e-S;C.x=(S*C.x+t*r.x)/e,C.y=(S*C.y+t*r.y)/e,C.z=(S*C.z+t*r.z)/e}}return S<b?(Cartesian3.clone(C,i.center),i.radius=S):(Cartesian3.clone(E,i.center),i.radius=b),i},BoundingSphere.fromEncodedCartesianVertices=function(e,t,n){if(defined(n)||(n=new BoundingSphere),!defined(e)||!defined(t)||e.length!==t.length||0===e.length)return n.center=Cartesian3.clone(Cartesian3.ZERO,n.center),n.radius=0,n;const i=fromPointsCurrentPos;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const r=Cartesian3.clone(i,fromPointsXMin),o=Cartesian3.clone(i,fromPointsYMin),a=Cartesian3.clone(i,fromPointsZMin),s=Cartesian3.clone(i,fromPointsXMax),c=Cartesian3.clone(i,fromPointsYMax),l=Cartesian3.clone(i,fromPointsZMax),u=e.length;let d;for(d=0;d<u;d+=3){const n=e[d]+t[d],u=e[d+1]+t[d+1],h=e[d+2]+t[d+2];i.x=n,i.y=u,i.z=h,n<r.x&&Cartesian3.clone(i,r),n>s.x&&Cartesian3.clone(i,s),u<o.y&&Cartesian3.clone(i,o),u>c.y&&Cartesian3.clone(i,c),h<a.z&&Cartesian3.clone(i,a),h>l.z&&Cartesian3.clone(i,l)}const h=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,r,fromPointsScratch)),p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch));let m=r,g=s,_=h;p>_&&(_=p,m=o,g=c),f>_&&(_=f,m=a,g=l);const y=fromPointsRitterCenter;y.x=.5*(m.x+g.x),y.y=.5*(m.y+g.y),y.z=.5*(m.z+g.z);let C=Cartesian3.magnitudeSquared(Cartesian3.subtract(g,y,fromPointsScratch)),T=Math.sqrt(C);const S=fromPointsMinBoxPt;S.x=r.x,S.y=o.y,S.z=a.z;const A=fromPointsMaxBoxPt;A.x=s.x,A.y=c.y,A.z=l.z;const v=Cartesian3.midpoint(S,A,fromPointsNaiveCenterScratch);let E=0;for(d=0;d<u;d+=3){i.x=e[d]+t[d],i.y=e[d+1]+t[d+1],i.z=e[d+2]+t[d+2];const n=Cartesian3.magnitude(Cartesian3.subtract(i,v,fromPointsScratch));n>E&&(E=n);const r=Cartesian3.magnitudeSquared(Cartesian3.subtract(i,y,fromPointsScratch));if(r>C){const e=Math.sqrt(r);T=.5*(T+e),C=T*T;const t=e-T;y.x=(T*y.x+t*i.x)/e,y.y=(T*y.y+t*i.y)/e,y.z=(T*y.z+t*i.z)/e}}return T<E?(Cartesian3.clone(y,n.center),n.radius=T):(Cartesian3.clone(v,n.center),n.radius=E),n},BoundingSphere.fromCornerPoints=function(e,t,n){defined(n)||(n=new BoundingSphere);const i=Cartesian3.midpoint(e,t,n.center);return n.radius=Cartesian3.distance(i,t),n},BoundingSphere.fromEllipsoid=function(e,t){return defined(t)||(t=new BoundingSphere),Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=e.maximumRadius,t};const fromBoundingSpheresScratch=new Cartesian3;BoundingSphere.fromBoundingSpheres=function(e,t){if(defined(t)||(t=new BoundingSphere),!defined(e)||0===e.length)return t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=0,t;const n=e.length;if(1===n)return BoundingSphere.clone(e[0],t);if(2===n)return BoundingSphere.union(e[0],e[1],t);const i=[];let r;for(r=0;r<n;r++)i.push(e[r].center);const o=(t=BoundingSphere.fromPoints(i,t)).center;let a=t.radius;for(r=0;r<n;r++){const t=e[r];a=Math.max(a,Cartesian3.distance(o,t.center,fromBoundingSpheresScratch)+t.radius)}return t.radius=a,t};const fromOrientedBoundingBoxScratchU=new Cartesian3,fromOrientedBoundingBoxScratchV=new Cartesian3,fromOrientedBoundingBoxScratchW=new Cartesian3;BoundingSphere.fromOrientedBoundingBox=function(e,t){defined(t)||(t=new BoundingSphere);const n=e.halfAxes,i=Matrix3.getColumn(n,0,fromOrientedBoundingBoxScratchU),r=Matrix3.getColumn(n,1,fromOrientedBoundingBoxScratchV),o=Matrix3.getColumn(n,2,fromOrientedBoundingBoxScratchW);return Cartesian3.add(i,r,i),Cartesian3.add(i,o,i),t.center=Cartesian3.clone(e.center,t.center),t.radius=Cartesian3.magnitude(i),t},BoundingSphere.clone=function(e,t){if(defined(e))return defined(t)?(t.center=Cartesian3.clone(e.center,t.center),t.radius=e.radius,t):new BoundingSphere(e.center,e.radius)},BoundingSphere.packedLength=4,BoundingSphere.pack=function(e,t,n){n=defaultValue(n,0);const i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t},BoundingSphere.unpack=function(e,t,n){t=defaultValue(t,0),defined(n)||(n=new BoundingSphere);const i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};const unionScratch=new Cartesian3,unionScratchCenter=new Cartesian3;BoundingSphere.union=function(e,t,n){defined(n)||(n=new BoundingSphere);const i=e.center,r=e.radius,o=t.center,a=t.radius,s=Cartesian3.subtract(o,i,unionScratch),c=Cartesian3.magnitude(s);if(r>=c+a)return e.clone(n),n;if(a>=c+r)return t.clone(n),n;const l=.5*(r+c+a),u=Cartesian3.multiplyByScalar(s,(-r+l)/c,unionScratchCenter);return Cartesian3.add(u,i,u),Cartesian3.clone(u,n.center),n.radius=l,n};const expandScratch=new Cartesian3;BoundingSphere.expand=function(e,t,n){n=BoundingSphere.clone(e,n);const i=Cartesian3.magnitude(Cartesian3.subtract(t,n.center,expandScratch));return i>n.radius&&(n.radius=i),n},BoundingSphere.intersectPlane=function(e,t){const n=e.center,i=e.radius,r=t.normal,o=Cartesian3.dot(r,n)+t.distance;return o<-i?Intersect$1.OUTSIDE:o<i?Intersect$1.INTERSECTING:Intersect$1.INSIDE},BoundingSphere.transform=function(e,t,n){return defined(n)||(n=new BoundingSphere),n.center=Matrix4.multiplyByPoint(t,e.center,n.center),n.radius=Matrix4.getMaximumScale(t)*e.radius,n};const distanceSquaredToScratch=new Cartesian3;BoundingSphere.distanceSquaredTo=function(e,t){const n=Cartesian3.subtract(e.center,t,distanceSquaredToScratch),i=Cartesian3.magnitude(n)-e.radius;return i<=0?0:i*i},BoundingSphere.transformWithoutScale=function(e,t,n){return defined(n)||(n=new BoundingSphere),n.center=Matrix4.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const scratchCartesian3$d=new Cartesian3;BoundingSphere.computePlaneDistances=function(e,t,n,i){defined(i)||(i=new Interval);const r=Cartesian3.subtract(e.center,t,scratchCartesian3$d),o=Cartesian3.dot(n,r);return i.start=o-e.radius,i.stop=o+e.radius,i};const projectTo2DNormalScratch=new Cartesian3,projectTo2DEastScratch=new Cartesian3,projectTo2DNorthScratch=new Cartesian3,projectTo2DWestScratch=new Cartesian3,projectTo2DSouthScratch=new Cartesian3,projectTo2DCartographicScratch=new Cartographic,projectTo2DPositionsScratch=new Array(8);for(let e=0;e<8;++e)projectTo2DPositionsScratch[e]=new Cartesian3;const projectTo2DProjection=new GeographicProjection;BoundingSphere.projectTo2D=function(e,t,n){const i=(t=defaultValue(t,projectTo2DProjection)).ellipsoid;let r=e.center;const o=e.radius;let a;a=Cartesian3.equals(r,Cartesian3.ZERO)?Cartesian3.clone(Cartesian3.UNIT_X,projectTo2DNormalScratch):i.geodeticSurfaceNormal(r,projectTo2DNormalScratch);const s=Cartesian3.cross(Cartesian3.UNIT_Z,a,projectTo2DEastScratch);Cartesian3.normalize(s,s);const c=Cartesian3.cross(a,s,projectTo2DNorthScratch);Cartesian3.normalize(c,c),Cartesian3.multiplyByScalar(a,o,a),Cartesian3.multiplyByScalar(c,o,c),Cartesian3.multiplyByScalar(s,o,s);const l=Cartesian3.negate(c,projectTo2DSouthScratch),u=Cartesian3.negate(s,projectTo2DWestScratch),d=projectTo2DPositionsScratch;let h=d[0];Cartesian3.add(a,c,h),Cartesian3.add(h,s,h),h=d[1],Cartesian3.add(a,c,h),Cartesian3.add(h,u,h),h=d[2],Cartesian3.add(a,l,h),Cartesian3.add(h,u,h),h=d[3],Cartesian3.add(a,l,h),Cartesian3.add(h,s,h),Cartesian3.negate(a,a),h=d[4],Cartesian3.add(a,c,h),Cartesian3.add(h,s,h),h=d[5],Cartesian3.add(a,c,h),Cartesian3.add(h,u,h),h=d[6],Cartesian3.add(a,l,h),Cartesian3.add(h,u,h),h=d[7],Cartesian3.add(a,l,h),Cartesian3.add(h,s,h);const p=d.length;for(let e=0;e<p;++e){const n=d[e];Cartesian3.add(r,n,n);const o=i.cartesianToCartographic(n,projectTo2DCartographicScratch);t.project(o,n)}r=(n=BoundingSphere.fromPoints(d,n)).center;const f=r.x,m=r.y,g=r.z;return r.x=g,r.y=f,r.z=m,n},BoundingSphere.isOccluded=function(e,t){return!t.isBoundingSphereVisible(e)},BoundingSphere.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&e.radius===t.radius},BoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this,e)},BoundingSphere.prototype.distanceSquaredTo=function(e){return BoundingSphere.distanceSquaredTo(this,e)},BoundingSphere.prototype.computePlaneDistances=function(e,t,n){return BoundingSphere.computePlaneDistances(this,e,t,n)},BoundingSphere.prototype.isOccluded=function(e){return BoundingSphere.isOccluded(this,e)},BoundingSphere.prototype.equals=function(e){return BoundingSphere.equals(this,e)},BoundingSphere.prototype.clone=function(e){return BoundingSphere.clone(this,e)},BoundingSphere.prototype.volume=function(){const e=this.radius;return volumeConstant*e*e*e};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?n.path:t)}},n.exports),n.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var punycode=createCommonjsModule((function(e,t){!function(n){var i=t&&!t.nodeType&&t,r=e&&!e.nodeType&&e,o="object"==typeof commonjsGlobal&&commonjsGlobal;o.global!==o&&o.window!==o&&o.self!==o||(n=o);var a,s,c=2147483647,l=36,u=/^xn--/,d=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,m=String.fromCharCode;function g(e){throw new RangeError(p[e])}function _(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function y(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+_((e=e.replace(h,".")).split("."),t).join(".")}function C(e){for(var t,n,i=[],r=0,o=e.length;r<o;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<o?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function T(e){return _(e,(function(e){var t="";return e>65535&&(t+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=m(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function A(e,t,n){var i=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;i+=l)e=f(e/35);return f(i+36*e/(e+38))}function v(e){var t,n,i,r,o,a,s,u,d,h,p,m=[],_=e.length,y=0,C=128,S=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&g("not-basic"),m.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<_;){for(o=y,a=1,s=l;r>=_&&g("invalid-input"),((u=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:l)>=l||u>f((c-y)/a))&&g("overflow"),y+=u*a,!(u<(d=s<=S?1:s>=S+26?26:s-S));s+=l)a>f(c/(h=l-d))&&g("overflow"),a*=h;S=A(y-o,t=m.length+1,0==o),f(y/t)>c-C&&g("overflow"),C+=f(y/t),y%=t,m.splice(y++,0,C)}return T(m)}function E(e){var t,n,i,r,o,a,s,u,d,h,p,_,y,T,v,E=[];for(_=(e=C(e)).length,t=128,n=0,o=72,a=0;a<_;++a)(p=e[a])<128&&E.push(m(p));for(i=r=E.length,r&&E.push("-");i<_;){for(s=c,a=0;a<_;++a)(p=e[a])>=t&&p<s&&(s=p);for(s-t>f((c-n)/(y=i+1))&&g("overflow"),n+=(s-t)*y,t=s,a=0;a<_;++a)if((p=e[a])<t&&++n>c&&g("overflow"),p==t){for(u=n,d=l;!(u<(h=d<=o?1:d>=o+26?26:d-o));d+=l)v=u-h,T=l-h,E.push(m(S(h+v%T,0))),u=f(v/T);E.push(m(S(u,0))),o=A(n,y,i==r),n=0,++i}++n,++t}return E.join("")}if(a={version:"1.3.2",ucs2:{decode:C,encode:T},decode:v,encode:E,toASCII:function(e){return y(e,(function(e){return d.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return y(e,(function(e){return u.test(e)?v(e.slice(4).toLowerCase()):e}))}},i&&r)if(e.exports==i)r.exports=a;else for(s in a)a.hasOwnProperty(s)&&(i[s]=a[s]);else n.punycode=a}(commonjsGlobal)})),IPv6=createCommonjsModule((function(e){
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e){var t=e&&e.IPv6;return{best:function(e){var t,n,i=e.toLowerCase().split(":"),r=i.length,o=8;for(""===i[0]&&""===i[1]&&""===i[2]?(i.shift(),i.shift()):""===i[0]&&""===i[1]?i.shift():""===i[r-1]&&""===i[r-2]&&i.pop(),-1!==i[(r=i.length)-1].indexOf(".")&&(o=7),t=0;t<r&&""!==i[t];t++);if(t<o)for(i.splice(t,1,"0000");i.length<o;)i.splice(t,0,"0000");for(var a=0;a<o;a++){n=i[a].split("");for(var s=0;s<3&&"0"===n[0]&&n.length>1;s++)n.splice(0,1);i[a]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(a=0;a<o;a++)h?"0"===i[a]?u+=1:(h=!1,u>l&&(c=d,l=u)):"0"===i[a]&&(h=!0,d=a,u=1);u>l&&(c=d,l=u),l>1&&i.splice(c,l,""),r=i.length;var p="";for(""===i[0]&&(p=":"),a=0;a<r&&(p+=i[a],a!==r-1);a++)p+=":";return""===i[r-1]&&(p+=":"),p},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}},e.exports?e.exports=n():t.IPv6=n(t)})),SecondLevelDomains=createCommonjsModule((function(e){
/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e){var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return!1;var r=n.list[e.slice(t+1)];return!!r&&r.indexOf(" "+e.slice(i+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return null;var r=n.list[e.slice(t+1)];return r?r.indexOf(" "+e.slice(i+1,t)+" ")<0?null:e.slice(i+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n},e.exports?e.exports=n():t.SecondLevelDomains=n(t)})),URI=createCommonjsModule((function(e){
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e,t,n,i){var r=i&&i.URI;function o(e,t){var n=arguments.length>=1,i=arguments.length>=2;if(!(this instanceof o))return n?i?new o(e,t):new o(e):new o;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.19.7";var a=o.prototype,s=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function u(e){return"Array"===l(e)}function d(e,t){var n,i,r={};if("RegExp"===l(t))r=null;else if(u(t))for(n=0,i=t.length;n<i;n++)r[t[n]]=!0;else r[t]=!0;for(n=0,i=e.length;n<i;n++)(r&&void 0!==r[e[n]]||!r&&t.test(e[n]))&&(e.splice(n,1),i--,n--);return e}function h(e,t){var n,i;if(u(t)){for(n=0,i=t.length;n<i;n++)if(!h(e,t[n]))return!1;return!0}var r=l(t);for(n=0,i=e.length;n<i;n++)if("RegExp"===r){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function p(e,t){if(!u(e)||!u(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function f(e){return e.replace(/^\/+|\/+$/g,"")}function m(e){return escape(e)}function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:o.preventInvalidHostname,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.preventInvalidHostname=!1,o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\._-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=g,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=g,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(e,t){var n=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var _,y={encode:"encode",decode:"decode"},C=function(e,t){return function(n){try{return o[t](n+"").replace(o.characters[e][t].expression,(function(n){return o.characters[e][t].map[n]}))}catch(e){return n}}};for(_ in y)o[_+"PathSegment"]=C("pathname",y[_]),o[_+"UrnPathSegment"]=C("urnpath",y[_]);var T=function(e,t,n){return function(i){var r;r=n?function(e){return o[t](o[n](e))}:o[t];for(var a=(i+"").split(e),s=0,c=a.length;s<c;s++)a[s]=r(a[s]);return a.join(e)}};function S(e){return function(t,n){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function A(e,t){return function(n,i){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!i),this)}}o.decodePath=T("/","decodePathSegment"),o.decodeUrnPath=T(":","decodeUrnPathSegment"),o.recodePath=T("/","encodePathSegment","decode"),o.recodeUrnPath=T(":","encodeUrnPathSegment","decode"),o.encodeReserved=C("reserved","encode"),o.parse=function(e,t){var n;return t||(t={preventInvalidHostname:o.preventInvalidHostname}),(n=e.indexOf("#"))>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===(e=e.replace(/^(https?|ftp|wss?)?:[/\\]*/,"$1://")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3).replace(/\\/g,"/")?(e=e.substring(n+3),e=o.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){e||(e="");var n,i,r=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===r&&(r=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,r)||null,"/"===t.port&&(t.port=null);else{var a=e.indexOf(":"),s=e.indexOf("/"),c=e.indexOf(":",a+1);-1!==c&&(-1===s||c<s)?(t.hostname=e.substring(0,r)||null,t.port=null):(i=e.substring(0,r).split(":"),t.hostname=i[0]||null,t.port=i[1]||null)}return t.hostname&&"/"!==e.substring(r).charAt(0)&&(r++,e="/"+e),t.preventInvalidHostname&&o.ensureValidHostname(t.hostname,t.protocol),t.port&&o.ensureValidPort(t.port),e.substring(r)||"/"},o.parseAuthority=function(e,t){return e=o.parseUserinfo(e,t),o.parseHost(e,t)},o.parseUserinfo=function(e,t){var n=e;-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/"));var i,r=e.indexOf("/"),a=e.lastIndexOf("@",r>-1?r:e.length-1);return a>-1&&(-1===r||a<r)?(i=e.substring(0,a).split(":"),t.username=i[0]?o.decode(i[0]):null,i.shift(),t.password=i[0]?o.decode(i.join(":")):null,e=n.substring(a+1)):(t.username=null,t.password=null),e},o.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,i,r,a={},c=e.split("&"),l=c.length,u=0;u<l;u++)n=c[u].split("="),i=o.decodeQuery(n.shift(),t),r=n.length?o.decodeQuery(n.join("="),t):null,"__proto__"!==i&&(s.call(a,i)?("string"!=typeof a[i]&&null!==a[i]||(a[i]=[a[i]]),a[i].push(r)):a[i]=r);return a},o.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=o.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&n&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},o.buildHost=function(e){var t="";return e.hostname?(o.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},o.buildAuthority=function(e){return o.buildUserinfo(e)+o.buildHost(e)},o.buildUserinfo=function(e){var t="";return e.username&&(t+=o.encode(e.username)),e.password&&(t+=":"+o.encode(e.password)),t&&(t+="@"),t},o.buildQuery=function(e,t,n){var i,r,a,c,l="";for(r in e)if("__proto__"!==r&&s.call(e,r))if(u(e[r]))for(i={},a=0,c=e[r].length;a<c;a++)void 0!==e[r][a]&&void 0===i[e[r][a]+""]&&(l+="&"+o.buildQueryParameter(r,e[r][a],n),!0!==t&&(i[e[r][a]+""]=!0));else void 0!==e[r]&&(l+="&"+o.buildQueryParameter(r,e[r],n));return l.substring(1)},o.buildQueryParameter=function(e,t,n){return o.encodeQuery(e,n)+(null!==t?"="+o.encodeQuery(t,n):"")},o.addQuery=function(e,t,n){if("object"==typeof t)for(var i in t)s.call(t,i)&&o.addQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=n);"string"==typeof e[t]&&(e[t]=[e[t]]),u(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},o.setQuery=function(e,t,n){if("object"==typeof t)for(var i in t)s.call(t,i)&&o.setQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===n?null:n}},o.removeQuery=function(e,t,n){var i,r,a;if(u(t))for(i=0,r=t.length;i<r;i++)e[t[i]]=void 0;else if("RegExp"===l(t))for(a in e)t.test(a)&&(e[a]=void 0);else if("object"==typeof t)for(a in t)s.call(t,a)&&o.removeQuery(e,a,t[a]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==n?"RegExp"===l(n)?!u(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=d(e[t],n):e[t]!==String(n)||u(n)&&1!==n.length?u(e[t])&&(e[t]=d(e[t],n)):e[t]=void 0:e[t]=void 0}},o.hasQuery=function(e,t,n,i){switch(l(t)){case"String":break;case"RegExp":for(var r in e)if(s.call(e,r)&&t.test(r)&&(void 0===n||o.hasQuery(e,r,n)))return!0;return!1;case"Object":for(var a in t)if(s.call(t,a)&&!o.hasQuery(e,a,t[a]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":return n===Boolean(u(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!u(e[t])&&(i?h:p)(e[t],n);case"RegExp":return u(e[t])?!!i&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return u(e[t])?!!i&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.joinPaths=function(){for(var e=[],t=[],n=0,i=0;i<arguments.length;i++){var r=new o(arguments[i]);e.push(r);for(var a=r.segment(),s=0;s<a.length;s++)"string"==typeof a[s]&&t.push(a[s]),a[s]&&n++}if(!t.length||!n)return new o("");var c=new o("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},o.commonPath=function(e,t){var n,i=Math.min(e.length,t.length);for(n=0;n<i;n++)if(e.charAt(n)!==t.charAt(n)){n--;break}return n<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(n)&&"/"===t.charAt(n)||(n=e.substring(0,n).lastIndexOf("/")),e.substring(0,n+1))},o.withinString=function(e,t,n){n||(n={});var i=n.start||o.findUri.start,r=n.end||o.findUri.end,a=n.trim||o.findUri.trim,s=n.parens||o.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(i.lastIndex=0;;){var l=i.exec(e);if(!l)break;var u=l.index;if(n.ignoreHtml){var d=e.slice(Math.max(u-3,0),u);if(d&&c.test(d))continue}for(var h=u+e.slice(u).search(r),p=e.slice(u,h),f=-1;;){var m=s.exec(p);if(!m)break;var g=m.index+m[0].length;f=Math.max(f,g)}if(!((p=f>-1?p.slice(0,f)+p.slice(f).replace(a,""):p.replace(a,"")).length<=l[0].length||n.ignore&&n.ignore.test(p))){var _=t(p,u,h=u+p.length,e);void 0!==_?(_=String(_),e=e.slice(0,u)+_+e.slice(h),i.lastIndex=u+_.length):i.lastIndex=h}}return i.lastIndex=0,e},o.ensureValidHostname=function(t,n){var i=!!t,r=!1;if(!!n&&(r=h(o.hostProtocols,n)),r&&!i)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return i.URITemplate&&"function"==typeof i.URITemplate.noConflict&&(t.URITemplate=i.URITemplate.noConflict()),i.IPv6&&"function"==typeof i.IPv6.noConflict&&(t.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&"function"==typeof i.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=i.SecondLevelDomains.noConflict()),t}return i.URI===this&&(i.URI=r),this},a.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},a.clone=function(){return new o(this)},a.valueOf=a.toString=function(){return this.build(!1)._string},a.protocol=S("protocol"),a.username=S("username"),a.password=S("password"),a.hostname=S("hostname"),a.port=S("port"),a.query=A("query","?"),a.fragment=A("fragment","#"),a.search=function(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},a.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},a.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(n):n}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},a.path=a.pathname,a.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var i=e instanceof o,r="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName&&(e=e[o.getDomAttribute(e)]||"",r=!1),!i&&r&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!i&&!r)throw new TypeError("invalid input");var a=i?e._parts:e;for(n in a)"query"!==n&&s.call(this._parts,n)&&(this._parts[n]=a[n]);a.query&&this.query(a.query,!1)}return this.build(!t),this},a.is=function(e){var t=!1,i=!1,r=!1,a=!1,s=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,i=o.ip4_expression.test(this._parts.hostname),r=o.ip6_expression.test(this._parts.hostname),s=(a=!(t=i||r))&&n&&n.has(this._parts.hostname),c=a&&o.idn_expression.test(this._parts.hostname),l=a&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return a;case"sld":return s;case"ip":return t;case"ip4":case"ipv4":case"inet4":return i;case"ip6":case"ipv6":case"inet6":return r;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var v=a.protocol,E=a.port,b=a.hostname;a.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return v.call(this,e,t)},a.scheme=a.protocol,a.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),o.ensureValidPort(e))),E.call(this,e,t))},a.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(e,this._parts.protocol)}return b.call(this,e,t)},a.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var i=o(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},a.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},a.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},a.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=o.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},a.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=o.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},a.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var i=this._parts.hostname.length-this.domain().length,r=this._parts.hostname.substring(0,i),a=new RegExp("^"+c(r));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&o.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,e),this.build(!t),this},a.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var i=this._parts.hostname.length-this.tld(t).length-1;return i=this._parts.hostname.lastIndexOf(".",i-1)+1,this._parts.hostname.substring(i)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var r=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(r,e)}return this.build(!t),this},a.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var i=this._parts.hostname.lastIndexOf("."),r=this._parts.hostname.substring(i+1);return!0!==t&&n&&n.list[r.toLowerCase()]&&n.get(this._parts.hostname)||r}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},a.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,i=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?o.decodePath(i):i}var r=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,r),s=new RegExp("^"+c(a));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),this.build(!t),this},a.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),i=this._parts.path.substring(n+1);return e?o.decodePathSegment(i):i}var r=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(r=!0);var a=new RegExp(c(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e),r?this.normalizePath(t):this.build(!t),this},a.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,i,r=this.filename(),a=r.lastIndexOf(".");return-1===a?"":(n=r.substring(a+1),i=/^[a-z0-9%]+$/i.test(n)?n:"",e?o.decodePathSegment(i):i)}"."===e.charAt(0)&&(e=e.substring(1));var s,l=this.suffix();if(l)s=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return s&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e)),this.build(!t),this},a.segment=function(e,t,n){var i=this._parts.urn?":":"/",r=this.path(),o="/"===r.substring(0,1),a=r.split(i);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(o&&a.shift(),e<0&&(e=Math.max(a.length+e,0)),void 0===t)return void 0===e?a:a[e];if(null===e||void 0===a[e])if(u(t)){a=[];for(var s=0,c=t.length;s<c;s++)(t[s].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(f(t[s])))}else(t||"string"==typeof t)&&(t=f(t),""===a[a.length-1]?a[a.length-1]=t:a.push(t));else t?a[e]=f(t):a.splice(e,1);return o&&a.unshift(""),this.path(a.join(i),n)},a.segmentCoded=function(e,t,n){var i,r,a;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(u(i=this.segment(e,t,n)))for(r=0,a=i.length;r<a;r++)i[r]=o.decode(i[r]);else i=void 0!==i?o.decode(i):void 0;return i}if(u(t))for(r=0,a=t.length;r<a;r++)t[r]=o.encode(t[r]);else t="string"==typeof t||t instanceof String?o.encode(t):t;return this.segment(e,t,n)};var x=a.query;return a.query=function(e,t){if(!0===e)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),i=e.call(this,n);return this._parts.query=o.buildQuery(i||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=o.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):x.call(this,e,t)},a.setQuery=function(e,t,n){var i=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)i[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var r in e)s.call(e,r)&&(i[r]=e[r])}return this._parts.query=o.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},a.addQuery=function(e,t,n){var i=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(i,e,void 0===t?null:t),this._parts.query=o.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},a.removeQuery=function(e,t,n){var i=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(i,e,t),this._parts.query=o.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},a.hasQuery=function(e,t,n){var i=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(i,e,t,n)},a.setSearch=a.setQuery,a.addSearch=a.addQuery,a.removeSearch=a.removeQuery,a.hasSearch=a.hasQuery,a.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},a.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},a.normalizeHostname=function(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},a.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},a.normalizePath=function(e){var t,n=this._parts.path;if(!n)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var i,r,a="";for("/"!==(n=o.recodePath(n)).charAt(0)&&(t=!0,n="/"+n),"/.."!==n.slice(-3)&&"/."!==n.slice(-2)||(n+="/"),n=n.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(a=n.substring(1).match(/^(\.\.\/)+/)||"")&&(a=a[0]);-1!==(i=n.search(/\/\.\.(\/|$)/));)0!==i?(-1===(r=n.substring(0,i).lastIndexOf("/"))&&(r=i),n=n.substring(0,r)+n.substring(i+3)):n=n.substring(3);return t&&this.is("relative")&&(n=a+n.substring(1)),this._parts.path=n,this.build(!e),this},a.normalizePathname=a.normalizePath,a.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},a.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},a.normalizeSearch=a.normalizeQuery,a.normalizeHash=a.normalizeFragment,a.iso8859=function(){var e=o.encode,t=o.decode;o.encode=escape,o.decode=decodeURIComponent;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},a.unicode=function(){var e=o.encode,t=o.decode;o.encode=g,o.decode=unescape;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},a.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";if(t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(n+="/"),n+=t.path(!0),t._parts.query){for(var i="",r=0,a=t._parts.query.split("&"),s=a.length;r<s;r++){var c=(a[r]||"").split("=");i+="&"+o.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(i+="="+o.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+i.substring(1)}return n+=o.decodeQuery(t.hash(),!0)},a.absoluteTo=function(e){var t,n,i,r=this.clone(),a=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof o||(e=new o(e)),r._parts.protocol)return r;if(r._parts.protocol=e._parts.protocol,this._parts.hostname)return r;for(n=0;i=a[n];n++)r._parts[i]=e._parts[i];return r._parts.path?(".."===r._parts.path.substring(-2)&&(r._parts.path+="/"),"/"!==r.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),r._parts.path=(t?t+"/":"")+r._parts.path,r.normalizePath())):(r._parts.path=e._parts.path,r._parts.query||(r._parts.query=e._parts.query)),r.build(),r},a.relativeTo=function(e){var t,n,i,r,a,s=this.clone().normalize();if(s._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new o(e).normalize(),t=s._parts,n=e._parts,r=s.path(),a=e.path(),"/"!==r.charAt(0))throw new Error("URI is already relative");if("/"!==a.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===n.protocol&&(t.protocol=null),t.username!==n.username||t.password!==n.password)return s.build();if(null!==t.protocol||null!==t.username||null!==t.password)return s.build();if(t.hostname!==n.hostname||t.port!==n.port)return s.build();if(t.hostname=null,t.port=null,r===a)return t.path="",s.build();if(!(i=o.commonPath(r,a)))return s.build();var c=n.path.substring(i.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(i.length)||"./",s.build()},a.equals=function(e){var t,n,i,r,a,c=this.clone(),l=new o(e),d={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(i=c.query(),r=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(i.length!==r.length)return!1;for(a in t=o.parseQuery(i,this._parts.escapeQuerySpace),n=o.parseQuery(r,this._parts.escapeQuerySpace),t)if(s.call(t,a)){if(u(t[a])){if(!p(t[a],n[a]))return!1}else if(t[a]!==n[a])return!1;d[a]=!0}for(a in n)if(s.call(n,a)&&!d[a])return!1;return!0},a.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},a.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},a.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},o},e.exports?e.exports=n(punycode,IPv6,SecondLevelDomains):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)}));function getAbsoluteUri(e,t){let n;return"undefined"!=typeof document&&(n=document),getAbsoluteUri._implementation(e,t,n)}getAbsoluteUri._implementation=function(e,t,n){if(!defined(t)){if(void 0===n)return e;t=defaultValue(n.baseURI,n.location.href)}const i=new URI(e);return""!==i.scheme()?i.toString():i.absoluteTo(t).toString()};var when=createCommonjsModule((function(e,t){
/** @license MIT License (c) copyright B Cavalier & J Hann */
var n;n=function(){var e,t,n;function i(e,t,n,i){return r(e).then(t,n,i)}function r(e){var t,n;return e instanceof o?t=e:c(e)?(n=s(),e.then((function(e){n.resolve(e)}),(function(e){n.reject(e)}),(function(e){n.progress(e)})),t=n.promise):t=function(e){var t=new o((function(t){try{return r(t?t(e):e)}catch(e){return a(e)}}));return t}(e),t}function o(e){this.then=e}function a(e){var t=new o((function(t,n){try{return n?r(n(e)):a(e)}catch(e){return a(e)}}));return t}function s(){var e,t,i,c,l,u;return e=new o(d),t=[],i=[],c=function(e,n,r){var o,a;return o=s(),a="function"==typeof r?function(e){try{o.progress(r(e))}catch(e){o.progress(e)}}:function(e){o.progress(e)},t.push((function(t){t.then(e,n).then(o.resolve,o.reject,a)})),i.push(a),o.promise},l=function(e){return h(i,e),e},u=function(e){return e=r(e),c=e.then,u=r,l=f,h(t,e),i=t=n,e},{then:d,resolve:p,reject:m,progress:g,promise:e,resolver:{resolve:p,reject:m,progress:g}};function d(e,t,n){return c(e,t,n)}function p(e){return u(e)}function m(e){return u(a(e))}function g(e){return l(e)}}function c(e){return e&&"function"==typeof e.then}function l(e,t,n,r,o){return p(2,arguments),i(e,(function(e){var a,c,l,u,d,h,p,m,g,_;if(g=e.length>>>0,a=Math.max(0,Math.min(t,g)),l=[],c=g-a+1,u=[],d=s(),a)for(m=d.progress,p=function(e){u.push(e),--c||(h=p=f,d.reject(u))},h=function(e){l.push(e),--a||(h=p=f,d.resolve(l))},_=0;_<g;++_)_ in e&&i(e[_],C,y,m);else d.resolve(l);return d.then(n,r,o);function y(e){p(e)}function C(e){h(e)}}))}function u(e,t,n,i){return p(1,arguments),d(e,m).then(t,n,i)}function d(e,t){return i(e,(function(e){var n,r,o,a,c,l;if(o=r=e.length>>>0,n=[],l=s(),o)for(a=function(e,r){i(e,t).then((function(e){n[r]=e,--o||l.resolve(n)}),l.reject)},c=0;c<r;c++)c in e?a(e[c],c):--o;else l.resolve(n);return l.promise}))}function h(e,t){for(var n,i=0;n=e[i++];)n(t)}function p(e,t){for(var n,i=t.length;i>e;)if(null!=(n=t[--i])&&"function"!=typeof n)throw new Error("arg "+i+" must be a function")}function f(){}function m(e){return e}return i.defer=s,i.resolve=r,i.reject=function(e){return i(e,a)},i.join=function(){return d(arguments,m)},i.all=u,i.map=d,i.reduce=function(n,r){var o=t.call(arguments,1);return i(n,(function(t){var n;return n=t.length,o[0]=function(e,t,o){return i(e,(function(e){return i(t,(function(t){return r(e,t,o,n)}))}))},e.apply(t,o)}))},i.any=function(e,t,n,i){return l(e,1,(function(e){return t?t(e[0]):e[0]}),n,i)},i.some=l,i.chain=function(e,t,n){var r=arguments.length>2;return i(e,(function(e){return e=r?n:e,t.resolve(e),e}),(function(e){return t.reject(e),a(e)}),t.progress)},i.isPromise=c,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then((function(){return e}))},spread:function(e){return this.then((function(t){return u(t,(function(t){return e.apply(n,t)}))}))}},t=[].slice,e=[].reduce||function(e){var t,n,i,r,o;if(o=0,r=(t=Object(this)).length>>>0,(n=arguments).length<=1)for(;;){if(o in t){i=t[o++];break}if(++o>=r)throw new TypeError}else i=n[1];for(;o<r;++o)o in t&&(i=e(i,t[o],o,t));return i},i},e.exports=n()}));function clone$1(e,t){if(null===e||"object"!=typeof e)return e;t=defaultValue(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let r=e[i];t&&(r=clone$1(r,t)),n[i]=r}return n}function combine$2(e,t,n){n=defaultValue(n,!1);const i={},r=defined(e),o=defined(t);let a,s,c;if(r)for(a in e)e.hasOwnProperty(a)&&(s=e[a],o&&n&&"object"==typeof s&&t.hasOwnProperty(a)?(c=t[a],i[a]="object"==typeof c?combine$2(s,c,n):s):i[a]=s);if(o)for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(c=t[a],i[a]=c);return i}function getBaseUri(e,t){let n="";const i=e.lastIndexOf("/");return-1!==i&&(n=e.substring(0,i+1)),t?(0!==(e=new URI(e)).query().length&&(n+="?"+e.query()),0!==e.fragment().length&&(n+="#"+e.fragment()),n):n}function getExtensionFromUri(e){const t=new URI(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return-1!==i&&(n=n.substr(i+1)),i=n.lastIndexOf("."),n=-1===i?"":n.substr(i+1),n}const blobUriRegex=/^blob:/i;function isBlobUri(e){return blobUriRegex.test(e)}let a$2;function isCrossOriginUrl(e){defined(a$2)||(a$2=document.createElement("a")),a$2.href=window.location.href;const t=a$2.host,n=a$2.protocol;return a$2.href=e,a$2.href=a$2.href,n!==a$2.protocol||t!==a$2.host}const dataUriRegex$2=/^data:/i;function isDataUri(e){return dataUriRegex$2.test(e)}function loadAndExecuteScript(e){const t=when.defer(),n=document.createElement("script");n.async=!0,n.src=e;const i=document.getElementsByTagName("head")[0];return n.onload=function(){n.onload=void 0,i.removeChild(n),t.resolve()},n.onerror=function(e){t.reject(e)},i.appendChild(n),t.promise}function objectToQuery(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=encodeURIComponent(n)+"=";if(Array.isArray(i))for(let e=0,n=i.length;e<n;++e)t+=r+encodeURIComponent(i[e])+"&";else t+=r+encodeURIComponent(i)+"&"}return t=t.slice(0,-1),t}function queryToObject(e){const t={};if(""===e)return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let e=0,i=n.length;e<i;++e){const i=n[e].split("="),r=decodeURIComponent(i[0]);let o=i[1];o=defined(o)?decodeURIComponent(o):"";const a=t[r];"string"==typeof a?t[r]=[a,o]:Array.isArray(a)?a.push(o):t[r]=o}return t}const RequestState={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5};var RequestState$1=Object.freeze(RequestState);const RequestType={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3};var RequestType$1=Object.freeze(RequestType);function Request(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.throttleByServer,!1),n=defaultValue(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=defaultValue(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=defaultValue(e.type,RequestType$1.OTHER),this.serverKey=void 0,this.state=RequestState$1.UNISSUED,this.deferred=void 0,this.cancelled=!1}function parseResponseHeaders(e){const t={};if(!e)return t;const n=e.split("\r\n");for(let e=0;e<n.length;++e){const i=n[e],r=i.indexOf(": ");if(r>0){const e=i.substring(0,r),n=i.substring(r+2);t[e]=n}}return t}function RequestErrorEvent(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=parseResponseHeaders(this.responseHeaders))}function Event(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}function compareNumber(e,t){return t-e}function Heap(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function swap$3(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function sortRequests(e,t){return e.priority-t.priority}Request.prototype.cancel=function(){this.cancelled=!0},Request.prototype.clone=function(e){return defined(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new Request(this)},RequestErrorEvent.prototype.toString=function(){let e="Request has failed.";return defined(this.statusCode)&&(e+=" Status Code: "+this.statusCode),e},Object.defineProperties(Event.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),Event.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}},Event.prototype.removeEventListener=function(e,t){const n=this._listeners,i=this._scopes;let r=-1;for(let o=0;o<n.length;o++)if(n[o]===e&&i[o]===t){r=o;break}return-1!==r&&(this._insideRaiseEvent?(this._toRemove.push(r),n[r]=void 0,i[r]=void 0):(n.splice(r,1),i.splice(r,1)),!0)},Event.prototype.raiseEvent=function(){let e;this._insideRaiseEvent=!0;const t=this._listeners,n=this._scopes;let i=t.length;for(e=0;e<i;e++){defined(t[e])&&t[e].apply(n[e],arguments)}const r=this._toRemove;if(i=r.length,i>0){for(r.sort(compareNumber),e=0;e<i;e++){const i=r[e];t.splice(i,1),n.splice(i,1)}r.length=0}this._insideRaiseEvent=!1},Object.defineProperties(Heap.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){const t=this._length;if(e<t){const n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}}),Heap.prototype.reserve=function(e){e=defaultValue(e,this._length),this._array.length=e},Heap.prototype.heapify=function(e){e=defaultValue(e,0);const t=this._length,n=this._comparator,i=this._array;let r=-1,o=!0;for(;o;){const a=2*(e+1),s=a-1;r=s<t&&n(i[s],i[e])<0?s:e,a<t&&n(i[a],i[r])<0&&(r=a),r!==e?(swap$3(i,r,e),e=r):o=!1}},Heap.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)},Heap.prototype.insert=function(e){const t=this._array,n=this._comparator,i=this._maximumLength;let r,o=this._length++;for(o<t.length?t[o]=e:t.push(e);0!==o;){const e=Math.floor((o-1)/2);if(!(n(t[o],t[e])<0))break;swap$3(t,o,e),o=e}return defined(i)&&this._length>i&&(r=t[i],this._length=i),r},Heap.prototype.pop=function(e){if(e=defaultValue(e,0),0===this._length)return;const t=this._array,n=t[e];return swap$3(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};const statistics={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let priorityHeapLength=20;const requestHeap=new Heap({comparator:sortRequests});requestHeap.maximumLength=priorityHeapLength,requestHeap.reserve(priorityHeapLength);const activeRequests=[];let numberOfActiveRequestsByServer={};const pageUri="undefined"!=typeof document?new URI(document.location.href):new URI,requestCompletedEvent=new Event;function RequestScheduler(){}function updatePriority(e){defined(e.priorityFunction)&&(e.priority=e.priorityFunction())}function issueRequest(e){return e.state===RequestState$1.UNISSUED&&(e.state=RequestState$1.ISSUED,e.deferred=when.defer()),e.deferred.promise}function getRequestReceivedFunction(e){return function(t){if(e.state===RequestState$1.CANCELLED)return;const n=e.deferred;--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.deferred=void 0,n.resolve(t)}}function getRequestFailedFunction(e){return function(t){e.state!==RequestState$1.CANCELLED&&(++statistics.numberOfFailedRequests,--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],requestCompletedEvent.raiseEvent(t),e.state=RequestState$1.FAILED,e.deferred.reject(t))}}function startRequest(e){const t=issueRequest(e);return e.state=RequestState$1.ACTIVE,activeRequests.push(e),++statistics.numberOfActiveRequests,++statistics.numberOfActiveRequestsEver,++numberOfActiveRequestsByServer[e.serverKey],e.requestFunction().then(getRequestReceivedFunction(e)).otherwise(getRequestFailedFunction(e)),t}function cancelRequest(e){const t=e.state===RequestState$1.ACTIVE;if(e.state=RequestState$1.CANCELLED,++statistics.numberOfCancelledRequests,defined(e.deferred)){const t=e.deferred;e.deferred=void 0,t.reject()}t&&(--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],++statistics.numberOfCancelledActiveRequests),defined(e.cancelFunction)&&e.cancelFunction()}function updateStatistics(){RequestScheduler.debugShowStatistics&&(0===statistics.numberOfActiveRequests&&statistics.lastNumberOfActiveRequests>0&&(statistics.numberOfAttemptedRequests>0&&(console.log("Number of attempted requests: "+statistics.numberOfAttemptedRequests),statistics.numberOfAttemptedRequests=0),statistics.numberOfCancelledRequests>0&&(console.log("Number of cancelled requests: "+statistics.numberOfCancelledRequests),statistics.numberOfCancelledRequests=0),statistics.numberOfCancelledActiveRequests>0&&(console.log("Number of cancelled active requests: "+statistics.numberOfCancelledActiveRequests),statistics.numberOfCancelledActiveRequests=0),statistics.numberOfFailedRequests>0&&(console.log("Number of failed requests: "+statistics.numberOfFailedRequests),statistics.numberOfFailedRequests=0)),statistics.lastNumberOfActiveRequests=statistics.numberOfActiveRequests)}RequestScheduler.maximumRequests=50,RequestScheduler.maximumRequestsPerServer=6,RequestScheduler.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18},RequestScheduler.throttleRequests=!0,RequestScheduler.debugShowStatistics=!1,RequestScheduler.requestCompletedEvent=requestCompletedEvent,Object.defineProperties(RequestScheduler,{statistics:{get:function(){return statistics}},priorityHeapLength:{get:function(){return priorityHeapLength},set:function(e){if(e<priorityHeapLength)for(;requestHeap.length>e;){cancelRequest(requestHeap.pop())}priorityHeapLength=e,requestHeap.maximumLength=e,requestHeap.reserve(e)}}}),RequestScheduler.serverHasOpenSlots=function(e,t){t=defaultValue(t,1);const n=defaultValue(RequestScheduler.requestsByServer[e],RequestScheduler.maximumRequestsPerServer);return numberOfActiveRequestsByServer[e]+t<=n},RequestScheduler.heapHasOpenSlots=function(e){return requestHeap.length+e<=priorityHeapLength},RequestScheduler.update=function(){let e,t,n=0;const i=activeRequests.length;for(e=0;e<i;++e)t=activeRequests[e],t.cancelled&&cancelRequest(t),t.state===RequestState$1.ACTIVE?n>0&&(activeRequests[e-n]=t):++n;activeRequests.length-=n;const r=requestHeap.internalArray,o=requestHeap.length;for(e=0;e<o;++e)updatePriority(r[e]);requestHeap.resort();const a=Math.max(RequestScheduler.maximumRequests-activeRequests.length,0);let s=0;for(;s<a&&requestHeap.length>0;)t=requestHeap.pop(),t.cancelled?cancelRequest(t):!t.throttleByServer||RequestScheduler.serverHasOpenSlots(t.serverKey)?(startRequest(t),++s):cancelRequest(t);updateStatistics()},RequestScheduler.getServerKey=function(e){let t=new URI(e);""===t.scheme()&&(t=new URI(e).absoluteTo(pageUri),t.normalize());let n=t.authority();/:/.test(n)||(n=n+":"+("https"===t.scheme()?"443":"80"));return defined(numberOfActiveRequestsByServer[n])||(numberOfActiveRequestsByServer[n]=0),n},RequestScheduler.request=function(e){if(isDataUri(e.url)||isBlobUri(e.url))return requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.requestFunction();if(++statistics.numberOfAttemptedRequests,defined(e.serverKey)||(e.serverKey=RequestScheduler.getServerKey(e.url)),RequestScheduler.throttleRequests&&e.throttleByServer&&!RequestScheduler.serverHasOpenSlots(e.serverKey))return;if(!RequestScheduler.throttleRequests||!e.throttle)return startRequest(e);if(activeRequests.length>=RequestScheduler.maximumRequests)return;updatePriority(e);const t=requestHeap.insert(e);if(defined(t)){if(t===e)return;cancelRequest(t)}return issueRequest(e)},RequestScheduler.clearForSpecs=function(){for(;requestHeap.length>0;){cancelRequest(requestHeap.pop())}const e=activeRequests.length;for(let t=0;t<e;++t)cancelRequest(activeRequests[t]);activeRequests.length=0,numberOfActiveRequestsByServer={},statistics.numberOfAttemptedRequests=0,statistics.numberOfActiveRequests=0,statistics.numberOfCancelledRequests=0,statistics.numberOfCancelledActiveRequests=0,statistics.numberOfFailedRequests=0,statistics.numberOfActiveRequestsEver=0,statistics.lastNumberOfActiveRequests=0},RequestScheduler.numberOfActiveRequestsByServer=function(e){return numberOfActiveRequestsByServer[e]},RequestScheduler.requestHeap=requestHeap;const TrustedServers={};let _servers={};function getAuthority(e){const t=new URI(e);t.normalize();let n=t.authority();if(0!==n.length){if(t.authority(n),-1!==n.indexOf("@")){const e=n.split("@");n=e[1]}if(-1===n.indexOf(":")){let e=t.scheme();if(0===e.length&&(e=window.location.protocol,e=e.substring(0,e.length-1)),"http"===e)n+=":80";else{if("https"!==e)return;n+=":443"}}return n}}TrustedServers.add=function(e,t){const n=e.toLowerCase()+":"+t;defined(_servers[n])||(_servers[n]=!0)},TrustedServers.remove=function(e,t){const n=e.toLowerCase()+":"+t;defined(_servers[n])&&delete _servers[n]},TrustedServers.contains=function(e){const t=getAuthority(e);return!(!defined(t)||!defined(_servers[t]))},TrustedServers.clear=function(){_servers={}};const xhrBlobSupported=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob","blob"===e.responseType}catch(e){return!1}}();function parseQuery(e,t,n,i){const r=e.query();if(0===r.length)return{};let o;if(-1===r.indexOf("=")){const e={};e[r]=void 0,o=e}else o=queryToObject(r);t._queryParameters=n?combineQueryParameters(o,t._queryParameters,i):o,e.search("")}function stringifyQuery(e,t){const n=t._queryParameters,i=Object.keys(n);1!==i.length||defined(n[i[0]])?e.search(objectToQuery(n)):e.search(i[0])}function defaultClone(e,t){return defined(e)?defined(e.clone)?e.clone():clone$1(e):t}function checkAndResetRequest(e){if(e.state===RequestState$1.ISSUED||e.state===RequestState$1.ACTIVE)throw new RuntimeError("The Resource is already being fetched.");e.state=RequestState$1.UNISSUED,e.deferred=void 0}function combineQueryParameters(e,t,n){if(!n)return combine$2(e,t);const i=clone$1(e,!0);for(const e in t)if(t.hasOwnProperty(e)){let n=i[e];const r=t[e];defined(n)?(Array.isArray(n)||(n=i[e]=[n]),i[e]=n.concat(r)):i[e]=Array.isArray(r)?r.slice():r}return i}function Resource(e){"string"==typeof(e=defaultValue(e,defaultValue.EMPTY_OBJECT))&&(e={url:e}),this._url=void 0,this._templateValues=defaultClone(e.templateValues,{}),this._queryParameters=defaultClone(e.queryParameters,{}),this.headers=defaultClone(e.headers,{}),this.request=defaultValue(e.request,new Request),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=defaultValue(e.retryAttempts,0),this._retryCount=0;const t=new URI(e.url);parseQuery(t,this,!0,!0),t.fragment(""),this._url=t.toString()}let supportsImageBitmapOptionsPromise;function fetchImage(e){const t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,r=e.preferImageBitmap,o=t.request;o.url=t.url,o.requestFunction=function(){let e=!1;t.isDataUri||t.isBlobUri||(e=t.isCrossOriginUrl);const a=when.defer();return Resource._Implementations.createImage(o,e,a,n,i,r),a.promise};const a=RequestScheduler.request(o);if(defined(a))return a.otherwise((function(e){return o.state!==RequestState$1.FAILED?when.reject(e):t.retryOnError(e).then((function(a){return a?(o.state=RequestState$1.UNISSUED,o.deferred=void 0,fetchImage({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:r})):when.reject(e)}))}))}function fetchJsonp(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const r=e.request;r.url=e.url,r.requestFunction=function(){const t=when.defer();return window[n]=function(e){t.resolve(e);try{delete window[n]}catch(e){window[n]=void 0}},Resource._Implementations.loadAndExecuteScript(e.url,n,t),t.promise};const o=RequestScheduler.request(r);if(defined(o))return o.otherwise((function(i){return r.state!==RequestState$1.FAILED?when.reject(i):e.retryOnError(i).then((function(o){return o?(r.state=RequestState$1.UNISSUED,r.deferred=void 0,fetchJsonp(e,t,n)):when.reject(i)}))}))}Resource.createIfNeeded=function(e){return e instanceof Resource?e.getDerivedResource({request:e.request}):"string"!=typeof e?e:new Resource({url:e})},Resource.supportsImageBitmapOptions=function(){if(defined(supportsImageBitmapOptionsPromise))return supportsImageBitmapOptionsPromise;if("function"!=typeof createImageBitmap)return supportsImageBitmapOptionsPromise=when.resolve(!1),supportsImageBitmapOptionsPromise;return supportsImageBitmapOptionsPromise=Resource.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4////fwAJ+wP9CNHoHgAAAABJRU5ErkJggg=="}).then((function(e){return createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(e){return!0})).otherwise((function(){return!1})),supportsImageBitmapOptionsPromise},Object.defineProperties(Resource,{isBlobSupported:{get:function(){return xhrBlobSupported}}}),Object.defineProperties(Resource.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){const t=new URI(e);parseQuery(t,this,!1),t.fragment(""),this._url=t.toString()}},extension:{get:function(){return getExtensionFromUri(this._url)}},isDataUri:{get:function(){return isDataUri(this._url)}},isBlobUri:{get:function(){return isBlobUri(this._url)}},isCrossOriginUrl:{get:function(){return isCrossOriginUrl(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}}),Resource.prototype.toString=function(){return this.getUrlComponent(!0,!0)},Resource.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;const n=new URI(this._url);e&&stringifyQuery(n,this);let i=n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}");const r=this._templateValues;return i=i.replace(/{(.*?)}/g,(function(e,t){const n=r[t];return defined(n)?encodeURIComponent(n):e})),t&&defined(this.proxy)&&(i=this.proxy.getURL(i)),i},Resource.prototype.setQueryParameters=function(e,t){this._queryParameters=t?combineQueryParameters(this._queryParameters,e,!1):combineQueryParameters(e,this._queryParameters,!1)},Resource.prototype.appendQueryParameters=function(e){this._queryParameters=combineQueryParameters(e,this._queryParameters,!0)},Resource.prototype.setTemplateValues=function(e,t){this._templateValues=t?combine$2(this._templateValues,e):combine$2(e,this._templateValues)},Resource.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,defined(e.url)){const n=new URI(e.url);parseQuery(n,t,!0,defaultValue(e.preserveQueryParameters,!1)),n.fragment(""),""!==n.scheme()?t._url=n.toString():t._url=n.absoluteTo(new URI(getAbsoluteUri(this._url))).toString()}return defined(e.queryParameters)&&(t._queryParameters=combine$2(e.queryParameters,t._queryParameters)),defined(e.templateValues)&&(t._templateValues=combine$2(e.templateValues,t.templateValues)),defined(e.headers)&&(t.headers=combine$2(e.headers,t.headers)),defined(e.proxy)&&(t.proxy=e.proxy),defined(e.request)&&(t.request=e.request),defined(e.retryCallback)&&(t.retryCallback=e.retryCallback),defined(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},Resource.prototype.retryOnError=function(e){const t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return when(!1);const n=this;return when(t(this,e)).then((function(e){return++n._retryCount,e}))},Resource.prototype.clone=function(e){return defined(e)||(e=new Resource({url:this._url})),e._url=this._url,e._queryParameters=clone$1(this._queryParameters),e._templateValues=clone$1(this._templateValues),e.headers=clone$1(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e},Resource.prototype.getBaseUri=function(e){return getBaseUri(this.getUrlComponent(e),e)},Resource.prototype.appendForwardSlash=function(){this._url=appendForwardSlash(this._url)},Resource.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},Resource.fetchArrayBuffer=function(e){return new Resource(e).fetchArrayBuffer()},Resource.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},Resource.fetchBlob=function(e){return new Resource(e).fetchBlob()},Resource.prototype.fetchImage=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.preferImageBitmap,!1),n=defaultValue(e.preferBlob,!1),i=defaultValue(e.flipY,!1),r=defaultValue(e.skipColorSpaceConversion,!1);if(checkAndResetRequest(this.request),!xhrBlobSupported||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return fetchImage({resource:this,flipY:i,skipColorSpaceConversion:r,preferImageBitmap:t});const o=this.fetchBlob();if(!defined(o))return;let a,s,c,l;return Resource.supportsImageBitmapOptions().then((function(e){return a=e,s=a&&t,o})).then((function(e){if(!defined(e))return;if(l=e,s)return Resource.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r});const t=window.URL.createObjectURL(e);return c=new Resource({url:t}),fetchImage({resource:c,flipY:i,skipColorSpaceConversion:r,preferImageBitmap:!1})})).then((function(e){if(defined(e))return e.blob=l,s||window.URL.revokeObjectURL(c.url),e})).otherwise((function(e){return defined(c)&&window.URL.revokeObjectURL(c.url),e.blob=l,when.reject(e)}))},Resource.fetchImage=function(e){return new Resource(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},Resource.prototype.fetchText=function(){return this.fetch({responseType:"text"})},Resource.fetchText=function(e){return new Resource(e).fetchText()},Resource.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(defined(e))return e.then((function(e){if(defined(e))return JSON.parse(e)}))},Resource.fetchJson=function(e){return new Resource(e).fetchJson()},Resource.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},Resource.fetchXML=function(e){return new Resource(e).fetchXML()},Resource.prototype.fetchJsonp=function(e){let t;e=defaultValue(e,"callback"),checkAndResetRequest(this.request);do{t="loadJsonp"+CesiumMath.nextRandomNumber().toString().substring(2,8)}while(defined(window[t]));return fetchJsonp(this,e,t)},Resource.fetchJsonp=function(e){return new Resource(e).fetchJsonp(e.callbackParameterName)},Resource.prototype._makeRequest=function(e){const t=this;checkAndResetRequest(t.request);const n=t.request;n.url=t.url,n.requestFunction=function(){const i=e.responseType,r=combine$2(e.headers,t.headers),o=e.overrideMimeType,a=e.method,s=e.data,c=when.defer(),l=Resource._Implementations.loadWithXhr(t.url,i,a,s,r,c,o);return defined(l)&&defined(l.abort)&&(n.cancelFunction=function(){l.abort()}),c.promise};const i=RequestScheduler.request(n);if(defined(i))return i.then((function(e){return n.cancelFunction=void 0,e})).otherwise((function(i){return n.cancelFunction=void 0,n.state!==RequestState$1.FAILED?when.reject(i):t.retryOnError(i).then((function(r){return r?(n.state=RequestState$1.UNISSUED,n.deferred=void 0,t.fetch(e)):when.reject(i)}))}))};const dataUriRegex$1=/^data:(.*?)(;base64)?,(.*)$/;function decodeDataUriText(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function decodeDataUriArrayBuffer(e,t){const n=decodeDataUriText(e,t),i=new ArrayBuffer(n.length),r=new Uint8Array(i);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return i}function decodeDataUri(e,t){t=defaultValue(t,"");const n=e[1],i=!!e[2],r=e[3];let o,a;switch(t){case"":case"text":return decodeDataUriText(i,r);case"arraybuffer":return decodeDataUriArrayBuffer(i,r);case"blob":return o=decodeDataUriArrayBuffer(i,r),new Blob([o],{type:n});case"document":return a=new DOMParser,a.parseFromString(decodeDataUriText(i,r),n);case"json":return JSON.parse(decodeDataUriText(i,r))}}function loadImageElement(e,t,n){const i=new Image;i.onload=function(){n.resolve(i)},i.onerror=function(e){n.reject(e)},t&&(TrustedServers.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e}function decodeResponse(e,t){switch(t){case"text":return e.toString("utf8");case"json":return JSON.parse(e.toString("utf8"));default:return new Uint8Array(e).buffer}}function loadWithHttpRequest(e,t,n,i,r,o,a){const s=require("url").parse(e),c="https:"===s.protocol?require("https"):require("http"),l=require("zlib"),u={protocol:s.protocol,hostname:s.hostname,port:s.port,path:s.path,query:s.query,method:n,headers:r};c.request(u).on("response",(function(e){if(e.statusCode<200||e.statusCode>=300)return void o.reject(new RequestErrorEvent(e.statusCode,e,e.headers));const n=[];e.on("data",(function(e){n.push(e)})),e.on("end",(function(){const i=Buffer.concat(n);"gzip"===e.headers["content-encoding"]?l.gunzip(i,(function(e,n){e?o.reject(new RuntimeError("Error decompressing response.")):o.resolve(decodeResponse(n,t))})):o.resolve(decodeResponse(i,t))}))})).on("error",(function(e){o.reject(new RequestErrorEvent)})).end()}Resource.prototype.fetch=function(e){return(e=defaultClone(e,{})).method="GET",this._makeRequest(e)},Resource.fetch=function(e){return new Resource(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.delete=function(e){return(e=defaultClone(e,{})).method="DELETE",this._makeRequest(e)},Resource.delete=function(e){return new Resource(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},Resource.prototype.head=function(e){return(e=defaultClone(e,{})).method="HEAD",this._makeRequest(e)},Resource.head=function(e){return new Resource(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.options=function(e){return(e=defaultClone(e,{})).method="OPTIONS",this._makeRequest(e)},Resource.options=function(e){return new Resource(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.post=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="POST",t.data=e,this._makeRequest(t)},Resource.post=function(e){return new Resource(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.put=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PUT",t.data=e,this._makeRequest(t)},Resource.put=function(e){return new Resource(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.patch=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PATCH",t.data=e,this._makeRequest(t)},Resource.patch=function(e){return new Resource(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource._Implementations={},Resource._Implementations.createImage=function(e,t,n,i,r,o){const a=e.url;Resource.supportsImageBitmapOptions().then((function(s){if(!s||!o)return void loadImageElement(a,t,n);const c=when.defer(),l=Resource._Implementations.loadWithXhr(a,"blob","GET",void 0,void 0,c,void 0,void 0,void 0);return defined(l)&&defined(l.abort)&&(e.cancelFunction=function(){l.abort()}),c.promise.then((function(e){if(defined(e))return Resource.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r});n.reject(new RuntimeError("Successfully retrieved "+a+" but it contained no content."))})).then(n.resolve)})).otherwise(n.reject)},Resource.createImageBitmapFromBlob=function(e,t){return Check.defined("options",t),Check.typeOf.bool("options.flipY",t.flipY),Check.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),Check.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};const noXMLHttpRequest="undefined"==typeof XMLHttpRequest;Resource._Implementations.loadWithXhr=function(e,t,n,i,r,o,a){const s=dataUriRegex$1.exec(e);if(null!==s)return void o.resolve(decodeDataUri(s,t));if(noXMLHttpRequest)return void loadWithHttpRequest(e,t,n,i,r,o);const c=new XMLHttpRequest;if(TrustedServers.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),defined(a)&&defined(c.overrideMimeType)&&c.overrideMimeType(a),defined(r))for(const e in r)r.hasOwnProperty(e)&&c.setRequestHeader(e,r[e]);defined(t)&&(c.responseType=t);let l=!1;return"string"==typeof e&&(l=0===e.indexOf("file://")||"undefined"!=typeof window&&"file://"===window.location.origin),c.onload=function(){if((c.status<200||c.status>=300)&&(!l||0!==c.status))return void o.reject(new RequestErrorEvent(c.status,c.response,c.getAllResponseHeaders()));const e=c.response,i=c.responseType;if("HEAD"===n||"OPTIONS"===n){const e=c.getAllResponseHeaders().trim().split(/[\r\n]+/),t={};return e.forEach((function(e){const n=e.split(": "),i=n.shift();t[i]=n.join(": ")})),void o.resolve(t)}if(204===c.status)o.resolve();else if(!defined(e)||defined(t)&&i!==t)if("json"===t&&"string"==typeof e)try{o.resolve(JSON.parse(e))}catch(e){o.reject(e)}else(""===i||"document"===i)&&defined(c.responseXML)&&c.responseXML.hasChildNodes()?o.resolve(c.responseXML):""!==i&&"text"!==i||!defined(c.responseText)?o.reject(new RuntimeError("Invalid XMLHttpRequest response type.")):o.resolve(c.responseText);else o.resolve(e)},c.onerror=function(e){o.reject(new RequestErrorEvent)},c.send(i),c},Resource._Implementations.loadAndExecuteScript=function(e,t,n){return loadAndExecuteScript(e).otherwise(n.reject)},Resource._DefaultImplementations={},Resource._DefaultImplementations.createImage=Resource._Implementations.createImage,Resource._DefaultImplementations.loadWithXhr=Resource._Implementations.loadWithXhr,Resource._DefaultImplementations.loadAndExecuteScript=Resource._Implementations.loadAndExecuteScript,Resource.DEFAULT=Object.freeze(new Resource({url:"undefined"==typeof document?"":document.location.href.split("?")[0]}));var cesiumScriptRegex=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/,a$1,baseResource,implementation$2;function getBaseUrlFromCesiumScript(){for(var e=document.getElementsByTagName("script"),t=0,n=e.length;t<n;++t){var i=e[t].getAttribute("src"),r=cesiumScriptRegex.exec(i);if(null!==r)return r[1]}}function tryMakeAbsolute(e){return"undefined"==typeof document?e:(defined(a$1)||(a$1=document.createElement("a")),a$1.href=e,a$1.href=a$1.href,a$1.href)}function getCesiumBaseUrl(){return defined(baseResource)||(e="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:"object"==typeof define&&defined(define.amd)&&!define.amd.toUrlUndefined&&defined(require.toUrl)?getAbsoluteUri("..",buildModuleUrl("Core/buildModuleUrl.js")):getBaseUrlFromCesiumScript(),(baseResource=new Resource({url:tryMakeAbsolute(e)})).appendForwardSlash()),baseResource;var e}function buildModuleUrlFromRequireToUrl(e){return tryMakeAbsolute(require.toUrl("../"+e))}function buildModuleUrlFromBaseUrl(e){return getCesiumBaseUrl().getDerivedResource({url:e}).url}function buildModuleUrl(e){return defined(implementation$2)||(implementation$2="object"==typeof define&&defined(define.amd)&&!define.amd.toUrlUndefined&&defined(require.toUrl)?buildModuleUrlFromRequireToUrl:buildModuleUrlFromBaseUrl),implementation$2(e)}function Cartesian2(e,t){this.x=defaultValue(e,0),this.y=defaultValue(t,0)}buildModuleUrl._cesiumScriptRegex=cesiumScriptRegex,buildModuleUrl._buildModuleUrlFromBaseUrl=buildModuleUrlFromBaseUrl,buildModuleUrl._clearBaseResource=function(){baseResource=void 0},buildModuleUrl.setBaseUrl=function(e){baseResource=Resource.DEFAULT.getDerivedResource({url:e})},buildModuleUrl.getCesiumBaseUrl=getCesiumBaseUrl,Cartesian2.fromElements=function(e,t,n){return defined(n)?(n.x=e,n.y=t,n):new Cartesian2(e,t)},Cartesian2.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t):new Cartesian2(e.x,e.y)},Cartesian2.fromCartesian3=Cartesian2.clone,Cartesian2.fromCartesian4=Cartesian2.clone,Cartesian2.packedLength=2,Cartesian2.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n]=e.y,t},Cartesian2.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian2),n.x=e[t++],n.y=e[t],n},Cartesian2.packArray=function(e,t){const n=e.length,i=2*n;if(defined(t)){if(!Array.isArray(t)&&t.length!==i)throw new DeveloperError("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let i=0;i<n;++i)Cartesian2.pack(e[i],t,2*i);return t},Cartesian2.unpackArray=function(e,t){const n=e.length;defined(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const n=i/2;t[n]=Cartesian2.unpack(e,i,t[n])}return t},Cartesian2.fromArray=Cartesian2.unpack,Cartesian2.maximumComponent=function(e){return Math.max(e.x,e.y)},Cartesian2.minimumComponent=function(e){return Math.min(e.x,e.y)},Cartesian2.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},Cartesian2.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},Cartesian2.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},Cartesian2.magnitude=function(e){return Math.sqrt(Cartesian2.magnitudeSquared(e))};const distanceScratch$1=new Cartesian2;Cartesian2.distance=function(e,t){return Cartesian2.subtract(e,t,distanceScratch$1),Cartesian2.magnitude(distanceScratch$1)},Cartesian2.distanceSquared=function(e,t){return Cartesian2.subtract(e,t,distanceScratch$1),Cartesian2.magnitudeSquared(distanceScratch$1)},Cartesian2.normalize=function(e,t){const n=Cartesian2.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},Cartesian2.dot=function(e,t){return e.x*t.x+e.y*t.y},Cartesian2.cross=function(e,t){return e.x*t.y-e.y*t.x},Cartesian2.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},Cartesian2.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n},Cartesian2.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},Cartesian2.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},Cartesian2.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},Cartesian2.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},Cartesian2.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},Cartesian2.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const lerpScratch$1=new Cartesian2;Cartesian2.lerp=function(e,t,n,i){return Cartesian2.multiplyByScalar(t,n,lerpScratch$1),i=Cartesian2.multiplyByScalar(e,1-n,i),Cartesian2.add(lerpScratch$1,i,i)};const angleBetweenScratch=new Cartesian2,angleBetweenScratch2=new Cartesian2;Cartesian2.angleBetween=function(e,t){return Cartesian2.normalize(e,angleBetweenScratch),Cartesian2.normalize(t,angleBetweenScratch2),CesiumMath.acosClamped(Cartesian2.dot(angleBetweenScratch,angleBetweenScratch2))};const mostOrthogonalAxisScratch=new Cartesian2;function GeographicTilingScheme(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._rectangle=defaultValue(e.rectangle,Rectangle.MAX_VALUE),this._projection=new GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=defaultValue(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=defaultValue(e.numberOfLevelZeroTilesY,1)}Cartesian2.mostOrthogonalAxis=function(e,t){const n=Cartesian2.normalize(e,mostOrthogonalAxisScratch);return Cartesian2.abs(n,n),t=n.x<=n.y?Cartesian2.clone(Cartesian2.UNIT_X,t):Cartesian2.clone(Cartesian2.UNIT_Y,t)},Cartesian2.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y},Cartesian2.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},Cartesian2.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,n,i)&&CesiumMath.equalsEpsilon(e.y,t.y,n,i)},Cartesian2.ZERO=Object.freeze(new Cartesian2(0,0)),Cartesian2.ONE=Object.freeze(new Cartesian2(1,1)),Cartesian2.UNIT_X=Object.freeze(new Cartesian2(1,0)),Cartesian2.UNIT_Y=Object.freeze(new Cartesian2(0,1)),Cartesian2.prototype.clone=function(e){return Cartesian2.clone(this,e)},Cartesian2.prototype.equals=function(e){return Cartesian2.equals(this,e)},Cartesian2.prototype.equalsEpsilon=function(e,t,n){return Cartesian2.equalsEpsilon(this,e,t,n)},Cartesian2.prototype.toString=function(){return"("+this.x+", "+this.y+")"},Object.defineProperties(GeographicTilingScheme.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},GeographicTilingScheme.prototype.rectangleToNativeRectangle=function(e,t){const n=CesiumMath.toDegrees(e.west),i=CesiumMath.toDegrees(e.south),r=CesiumMath.toDegrees(e.east),o=CesiumMath.toDegrees(e.north);return defined(t)?(t.west=n,t.south=i,t.east=r,t.north=o,t):new Rectangle(n,i,r,o)},GeographicTilingScheme.prototype.tileXYToNativeRectangle=function(e,t,n,i){const r=this.tileXYToRectangle(e,t,n,i);return r.west=CesiumMath.toDegrees(r.west),r.south=CesiumMath.toDegrees(r.south),r.east=CesiumMath.toDegrees(r.east),r.north=CesiumMath.toDegrees(r.north),r},GeographicTilingScheme.prototype.tileXYToRectangle=function(e,t,n,i){const r=this._rectangle,o=this.getNumberOfXTilesAtLevel(n),a=this.getNumberOfYTilesAtLevel(n),s=r.width/o,c=e*s+r.west,l=(e+1)*s+r.west,u=r.height/a,d=r.north-t*u,h=r.north-(t+1)*u;return defined(i)||(i=new Rectangle(c,h,l,d)),i.west=c,i.south=h,i.east=l,i.north=d,i},GeographicTilingScheme.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Rectangle.contains(i,e))return;const r=this.getNumberOfXTilesAtLevel(t),o=this.getNumberOfYTilesAtLevel(t),a=i.width/r,s=i.height/o;let c=e.longitude;i.east<i.west&&(c+=CesiumMath.TWO_PI);let l=(c-i.west)/a|0;l>=r&&(l=r-1);let u=(i.north-e.latitude)/s|0;return u>=o&&(u=o-1),defined(n)?(n.x=l,n.y=u,n):new Cartesian2(l,u)};const scratchDiagonalCartesianNE=new Cartesian3,scratchDiagonalCartesianSW=new Cartesian3,scratchDiagonalCartographic=new Cartographic,scratchCenterCartesian=new Cartesian3,scratchSurfaceCartesian=new Cartesian3,scratchBoundingSphere$4=new BoundingSphere,tilingScheme=new GeographicTilingScheme,scratchCorners=[new Cartographic,new Cartographic,new Cartographic,new Cartographic],scratchTileXY=new Cartesian2,ApproximateTerrainHeights={};function getTileXYLevel(e){Cartographic.fromRadians(e.east,e.north,0,scratchCorners[0]),Cartographic.fromRadians(e.west,e.north,0,scratchCorners[1]),Cartographic.fromRadians(e.east,e.south,0,scratchCorners[2]),Cartographic.fromRadians(e.west,e.south,0,scratchCorners[3]);let t=0,n=0,i=0,r=0;const o=ApproximateTerrainHeights._terrainHeightsMaxLevel;let a;for(a=0;a<=o;++a){let e=!1;for(let t=0;t<4;++t){const n=scratchCorners[t];if(tilingScheme.positionToTileXY(n,a,scratchTileXY),0===t)i=scratchTileXY.x,r=scratchTileXY.y;else if(i!==scratchTileXY.x||r!==scratchTileXY.y){e=!0;break}}if(e)break;t=i,n=r}if(0!==a)return{x:t,y:n,level:a>o?o:a-1}}
/*! @license DOMPurify 2.3.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.4/LICENSE */
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}ApproximateTerrainHeights.initialize=function(){let e=ApproximateTerrainHeights._initPromise;return defined(e)||(e=Resource.fetchJson(buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){ApproximateTerrainHeights._terrainHeights=e})),ApproximateTerrainHeights._initPromise=e),e},ApproximateTerrainHeights.getMinimumMaximumHeights=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const n=getTileXYLevel(e);let i=ApproximateTerrainHeights._defaultMinTerrainHeight,r=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(n)){const o=n.level+"-"+n.x+"-"+n.y,a=ApproximateTerrainHeights._terrainHeights[o];defined(a)&&(i=a[0],r=a[1]),t.cartographicToCartesian(Rectangle.northeast(e,scratchDiagonalCartographic),scratchDiagonalCartesianNE),t.cartographicToCartesian(Rectangle.southwest(e,scratchDiagonalCartographic),scratchDiagonalCartesianSW),Cartesian3.midpoint(scratchDiagonalCartesianSW,scratchDiagonalCartesianNE,scratchCenterCartesian);const s=t.scaleToGeodeticSurface(scratchCenterCartesian,scratchSurfaceCartesian);if(defined(s)){const e=Cartesian3.distance(scratchCenterCartesian,s);i=Math.min(i,-e)}else i=ApproximateTerrainHeights._defaultMinTerrainHeight}return i=Math.max(ApproximateTerrainHeights._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:r}},ApproximateTerrainHeights.getBoundingSphere=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const n=getTileXYLevel(e);let i=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(n)){const e=n.level+"-"+n.x+"-"+n.y,t=ApproximateTerrainHeights._terrainHeights[e];defined(t)&&(i=t[1])}const r=BoundingSphere.fromRectangle3D(e,t,0);return BoundingSphere.fromRectangle3D(e,t,i,scratchBoundingSphere$4),BoundingSphere.union(r,scratchBoundingSphere$4,r)},ApproximateTerrainHeights._terrainHeightsMaxLevel=6,ApproximateTerrainHeights._defaultMaxTerrainHeight=9e3,ApproximateTerrainHeights._defaultMinTerrainHeight=-1e5,ApproximateTerrainHeights._terrainHeights=void 0,ApproximateTerrainHeights._initPromise=void 0,Object.defineProperties(ApproximateTerrainHeights,{initialized:{get:function(){return defined(ApproximateTerrainHeights._terrainHeights)}}});var hasOwnProperty=Object.hasOwnProperty,setPrototypeOf=Object.setPrototypeOf,isFrozen=Object.isFrozen,getPrototypeOf=Object.getPrototypeOf,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,freeze=Object.freeze,seal=Object.seal,create=Object.create,_ref="undefined"!=typeof Reflect&&Reflect,apply=_ref.apply,construct=_ref.construct;apply||(apply=function(e,t,n){return e.apply(t,n)}),freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),construct||(construct=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(_toConsumableArray(t))))});var arrayForEach=unapply(Array.prototype.forEach),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),stringToLowerCase=unapply(String.prototype.toLowerCase),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(e){return function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return apply(e,t,i)}}function unconstruct(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return construct(e,n)}}function addToSet(e,t){setPrototypeOf&&setPrototypeOf(e,null);for(var n=t.length;n--;){var i=t[n];if("string"==typeof i){var r=stringToLowerCase(i);r!==i&&(isFrozen(t)||(t[n]=r),i=r)}e[i]=!0}return e}function clone(e){var t=create(null),n=void 0;for(n in e)apply(hasOwnProperty,e,[n])&&(t[n]=e[n]);return t}function lookupGetter(e,t){for(;null!==e;){var n=getOwnPropertyDescriptor(e,t);if(n){if(n.get)return unapply(n.get);if("function"==typeof n.value)return unapply(n.value)}e=getPrototypeOf(e)}return function(e){return console.warn("fallback value for",e),null}}var html=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html$1=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),svg$1=freeze(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl$1=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ERB_EXPR=seal(/<%[\s\S]*|[\s\S]*%>/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _toConsumableArray$1(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var getGlobal=function(){return"undefined"==typeof window?null:window},_createTrustedTypesPolicy=function(e,t){if("object"!==(void 0===e?"undefined":_typeof(e))||"function"!=typeof e.createPolicy)return null;var n=null,i="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(i)&&(n=t.currentScript.getAttribute(i));var r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function createDOMPurify(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal(),t=function(e){return createDOMPurify(e)};if(t.version="2.3.4",t.removed=[],!e||!e.document||9!==e.document.nodeType)return t.isSupported=!1,t;var n=e.document,i=e.document,r=e.DocumentFragment,o=e.HTMLTemplateElement,a=e.Node,s=e.Element,c=e.NodeFilter,l=e.NamedNodeMap,u=void 0===l?e.NamedNodeMap||e.MozNamedAttrMap:l,d=e.HTMLFormElement,h=e.DOMParser,p=e.trustedTypes,f=s.prototype,m=lookupGetter(f,"cloneNode"),g=lookupGetter(f,"nextSibling"),_=lookupGetter(f,"childNodes"),y=lookupGetter(f,"parentNode");if("function"==typeof o){var C=i.createElement("template");C.content&&C.content.ownerDocument&&(i=C.content.ownerDocument)}var T=_createTrustedTypesPolicy(p,n),S=T&&Z?T.createHTML(""):"",A=i,v=A.implementation,E=A.createNodeIterator,b=A.createDocumentFragment,x=A.getElementsByTagName,P=n.importNode,D={};try{D=clone(i).documentMode?i.documentMode:{}}catch(e){}var w={};t.isSupported="function"==typeof y&&v&&void 0!==v.createHTMLDocument&&9!==D;var M=MUSTACHE_EXPR,I=ERB_EXPR,R=DATA_ATTR,O=ARIA_ATTR,B=IS_SCRIPT_OR_DATA,L=ATTR_WHITESPACE,F=IS_ALLOWED_URI,N=null,V=addToSet({},[].concat(_toConsumableArray$1(html),_toConsumableArray$1(svg),_toConsumableArray$1(svgFilters),_toConsumableArray$1(mathMl),_toConsumableArray$1(text))),k=null,U=addToSet({},[].concat(_toConsumableArray$1(html$1),_toConsumableArray$1(svg$1),_toConsumableArray$1(mathMl$1),_toConsumableArray$1(xml))),G=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,z=null,H=!0,W=!0,q=!1,j=!1,X=!1,Y=!1,K=!1,J=!1,Q=!1,Z=!1,ee=!0,te=!0,ne=!1,ie={},re=null,oe=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ae=null,se=addToSet({},["audio","video","img","source","image","track"]),ce=null,le=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",de="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml",pe=he,fe=!1,me=void 0,ge=["application/xhtml+xml","text/html"],_e="text/html",ye=void 0,Ce=null,Te=i.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Ae=function(e){Ce&&Ce===e||(e&&"object"===(void 0===e?"undefined":_typeof(e))||(e={}),e=clone(e),N="ALLOWED_TAGS"in e?addToSet({},e.ALLOWED_TAGS):V,k="ALLOWED_ATTR"in e?addToSet({},e.ALLOWED_ATTR):U,ce="ADD_URI_SAFE_ATTR"in e?addToSet(clone(le),e.ADD_URI_SAFE_ATTR):le,ae="ADD_DATA_URI_TAGS"in e?addToSet(clone(se),e.ADD_DATA_URI_TAGS):se,re="FORBID_CONTENTS"in e?addToSet({},e.FORBID_CONTENTS):oe,$="FORBID_TAGS"in e?addToSet({},e.FORBID_TAGS):{},z="FORBID_ATTR"in e?addToSet({},e.FORBID_ATTR):{},ie="USE_PROFILES"in e&&e.USE_PROFILES,H=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,j=e.SAFE_FOR_TEMPLATES||!1,X=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,Z=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||F,pe=e.NAMESPACE||he,e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(G.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),me=me=-1===ge.indexOf(e.PARSER_MEDIA_TYPE)?_e:e.PARSER_MEDIA_TYPE,ye="application/xhtml+xml"===me?function(e){return e}:stringToLowerCase,j&&(W=!1),Q&&(J=!0),ie&&(N=addToSet({},[].concat(_toConsumableArray$1(text))),k=[],!0===ie.html&&(addToSet(N,html),addToSet(k,html$1)),!0===ie.svg&&(addToSet(N,svg),addToSet(k,svg$1),addToSet(k,xml)),!0===ie.svgFilters&&(addToSet(N,svgFilters),addToSet(k,svg$1),addToSet(k,xml)),!0===ie.mathMl&&(addToSet(N,mathMl),addToSet(k,mathMl$1),addToSet(k,xml))),e.ADD_TAGS&&(N===V&&(N=clone(N)),addToSet(N,e.ADD_TAGS)),e.ADD_ATTR&&(k===U&&(k=clone(k)),addToSet(k,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&addToSet(ce,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(re===oe&&(re=clone(re)),addToSet(re,e.FORBID_CONTENTS)),te&&(N["#text"]=!0),X&&addToSet(N,["html","head","body"]),N.table&&(addToSet(N,["tbody"]),delete $.tbody),freeze&&freeze(e),Ce=e)},ve=addToSet({},["mi","mo","mn","ms","mtext"]),Ee=addToSet({},["foreignobject","desc","title","annotation-xml"]),be=addToSet({},svg);addToSet(be,svgFilters),addToSet(be,svgDisallowed);var xe=addToSet({},mathMl);addToSet(xe,mathMlDisallowed);var Pe=function(e){var t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});var n=stringToLowerCase(e.tagName),i=stringToLowerCase(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===he?"svg"===n:t.namespaceURI===ue?"svg"===n&&("annotation-xml"===i||ve[i]):Boolean(be[n]);if(e.namespaceURI===ue)return t.namespaceURI===he?"math"===n:t.namespaceURI===de?"math"===n&&Ee[i]:Boolean(xe[n]);if(e.namespaceURI===he){if(t.namespaceURI===de&&!Ee[i])return!1;if(t.namespaceURI===ue&&!ve[i])return!1;var r=addToSet({},["title","style","font","a","script"]);return!xe[n]&&(r[n]||!be[n])}return!1},De=function(e){arrayPush(t.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=S}catch(t){e.remove()}}},we=function(e,n){try{arrayPush(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){arrayPush(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),"is"===e&&!k[e])if(J||Q)try{De(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,n=void 0;if(K)e="<remove></remove>"+e;else{var r=stringMatch(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=T?T.createHTML(e):e;if(pe===he)try{t=(new h).parseFromString(o,me)}catch(e){}if(!t||!t.documentElement){t=v.createDocument(pe,"template",null);try{t.documentElement.innerHTML=fe?"":o}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),pe===he?x.call(t,X?"html":"body")[0]:X?t.documentElement:a},Ie=function(e){return E.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Re=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Oe=function(e){return"object"===(void 0===a?"undefined":_typeof(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":_typeof(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Be=function(e,n,i){w[e]&&arrayForEach(w[e],(function(e){e.call(t,n,i,Ce)}))},Le=function(e){var n=void 0;if(Be("beforeSanitizeElements",e,null),Re(e))return De(e),!0;if(stringMatch(e.nodeName,/[\u0080-\uFFFF]/))return De(e),!0;var i=ye(e.nodeName);if(Be("uponSanitizeElement",e,{tagName:i,allowedTags:N}),!Oe(e.firstElementChild)&&(!Oe(e.content)||!Oe(e.content.firstElementChild))&&regExpTest(/<[/\w]/g,e.innerHTML)&&regExpTest(/<[/\w]/g,e.textContent))return De(e),!0;if("select"===i&&regExpTest(/<template/i,e.innerHTML))return De(e),!0;if(!N[i]||$[i]){if(te&&!re[i]){var r=y(e)||e.parentNode,o=_(e)||e.childNodes;if(o&&r)for(var a=o.length-1;a>=0;--a)r.insertBefore(m(o[a],!0),g(e))}if(!$[i]&&Ne(i)){if(G.tagNameCheck instanceof RegExp&&regExpTest(G.tagNameCheck,i))return!1;if(G.tagNameCheck instanceof Function&&G.tagNameCheck(i))return!1}return De(e),!0}return e instanceof s&&!Pe(e)?(De(e),!0):"noscript"!==i&&"noembed"!==i||!regExpTest(/<\/no(script|embed)/i,e.innerHTML)?(j&&3===e.nodeType&&(n=e.textContent,n=stringReplace(n,M," "),n=stringReplace(n,I," "),e.textContent!==n&&(arrayPush(t.removed,{element:e.cloneNode()}),e.textContent=n)),Be("afterSanitizeElements",e,null),!1):(De(e),!0)},Fe=function(e,t,n){if(ee&&("id"===t||"name"===t)&&(n in i||n in Te))return!1;if(W&&!z[t]&&regExpTest(R,t));else if(H&&regExpTest(O,t));else if(!k[t]||z[t]){if(!(Ne(e)&&(G.tagNameCheck instanceof RegExp&&regExpTest(G.tagNameCheck,e)||G.tagNameCheck instanceof Function&&G.tagNameCheck(e))&&(G.attributeNameCheck instanceof RegExp&&regExpTest(G.attributeNameCheck,t)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(t))||"is"===t&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&regExpTest(G.tagNameCheck,n)||G.tagNameCheck instanceof Function&&G.tagNameCheck(n))))return!1}else if(ce[t]);else if(regExpTest(F,stringReplace(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==stringIndexOf(n,"data:")||!ae[e]){if(q&&!regExpTest(B,stringReplace(n,L,"")));else if(n)return!1}else;return!0},Ne=function(e){return e.indexOf("-")>0},Ve=function(e){var n=void 0,i=void 0,r=void 0,o=void 0;Be("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k};for(o=a.length;o--;){var c=n=a[o],l=c.name,u=c.namespaceURI;if(i=stringTrim(n.value),r=ye(l),s.attrName=r,s.attrValue=i,s.keepAttr=!0,s.forceKeepAttr=void 0,Be("uponSanitizeAttribute",e,s),i=s.attrValue,!s.forceKeepAttr&&(we(l,e),s.keepAttr))if(regExpTest(/\/>/i,i))we(l,e);else{j&&(i=stringReplace(i,M," "),i=stringReplace(i,I," "));var d=ye(e.nodeName);if(Fe(d,r,i))try{u?e.setAttributeNS(u,l,i):e.setAttribute(l,i),arrayPop(t.removed)}catch(e){}}}Be("afterSanitizeAttributes",e,null)}},ke=function e(t){var n=void 0,i=Ie(t);for(Be("beforeSanitizeShadowDOM",t,null);n=i.nextNode();)Be("uponSanitizeShadowNode",n,null),Le(n)||(n.content instanceof r&&e(n.content),Ve(n));Be("afterSanitizeShadowDOM",t,null)};return t.sanitize=function(i,o){var s=void 0,c=void 0,l=void 0,u=void 0,d=void 0;if((fe=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!Oe(i)){if("function"!=typeof i.toString)throw typeErrorCreate("toString is not a function");if("string"!=typeof(i=i.toString()))throw typeErrorCreate("dirty is not a string, aborting")}if(!t.isSupported){if("object"===_typeof(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof i)return e.toStaticHTML(i);if(Oe(i))return e.toStaticHTML(i.outerHTML)}return i}if(Y||Ae(o),t.removed=[],"string"==typeof i&&(ne=!1),ne);else if(i instanceof a)1===(c=(s=Me("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===c.nodeName||"HTML"===c.nodeName?s=c:s.appendChild(c);else{if(!J&&!j&&!X&&-1===i.indexOf("<"))return T&&Z?T.createHTML(i):i;if(!(s=Me(i)))return J?null:S}s&&K&&De(s.firstChild);for(var h=Ie(ne?i:s);l=h.nextNode();)3===l.nodeType&&l===u||Le(l)||(l.content instanceof r&&ke(l.content),Ve(l),u=l);if(u=null,ne)return i;if(J){if(Q)for(d=b.call(s.ownerDocument);s.firstChild;)d.appendChild(s.firstChild);else d=s;return k.shadowroot&&(d=P.call(n,d,!0)),d}var p=X?s.outerHTML:s.innerHTML;return j&&(p=stringReplace(p,M," "),p=stringReplace(p,I," ")),T&&Z?T.createHTML(p):p},t.setConfig=function(e){Ae(e),Y=!0},t.clearConfig=function(){Ce=null,Y=!1},t.isValidAttribute=function(e,t,n){Ce||Ae({});var i=ye(e),r=ye(t);return Fe(i,r,n)},t.addHook=function(e,t){"function"==typeof t&&(w[e]=w[e]||[],arrayPush(w[e],t))},t.removeHook=function(e){w[e]&&arrayPop(w[e])},t.removeHooks=function(e){w[e]&&(w[e]=[])},t.removeAllHooks=function(){w={}},t}var purify=createDOMPurify();let nextCreditId=0;const creditToId={};function Credit(e,t){let n;const i=e;defined(creditToId[i])?n=creditToId[i]:(n=nextCreditId++,creditToId[i]=n),t=defaultValue(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Credit.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen}},element:{get:function(){if(!defined(this._element)){const e=purify.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;const n=t.querySelectorAll("a");for(let e=0;e<n.length;e++)n[e].setAttribute("target","_blank");this._element=t}return this._element}}}),Credit.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e._id===t._id},Credit.prototype.equals=function(e){return Credit.equals(this,e)},Credit.getIonCredit=function(e){const t=defined(e.collapsible)&&!e.collapsible,n=new Credit(e.html,t);return n._isIon=-1!==n.html.indexOf("ion-credit.png"),n},Credit.clone=function(e){if(defined(e))return new Credit(e.html,e.showOnScreen)};const HeightmapEncoding={NONE:0,LERC:1};var HeightmapEncoding$1=Object.freeze(HeightmapEncoding);function AxisAlignedBoundingBox(e,t,n){this.minimum=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.maximum=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),n=defined(n)?Cartesian3.clone(n):Cartesian3.midpoint(this.minimum,this.maximum,new Cartesian3),this.center=n}AxisAlignedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new AxisAlignedBoundingBox),!defined(e)||0===e.length)return t.minimum=Cartesian3.clone(Cartesian3.ZERO,t.minimum),t.maximum=Cartesian3.clone(Cartesian3.ZERO,t.maximum),t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t;let n=e[0].x,i=e[0].y,r=e[0].z,o=e[0].x,a=e[0].y,s=e[0].z;const c=e.length;for(let t=1;t<c;t++){const c=e[t],l=c.x,u=c.y,d=c.z;n=Math.min(l,n),o=Math.max(l,o),i=Math.min(u,i),a=Math.max(u,a),r=Math.min(d,r),s=Math.max(d,s)}const l=t.minimum;l.x=n,l.y=i,l.z=r;const u=t.maximum;return u.x=o,u.y=a,u.z=s,t.center=Cartesian3.midpoint(l,u,t.center),t},AxisAlignedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(t.minimum=Cartesian3.clone(e.minimum,t.minimum),t.maximum=Cartesian3.clone(e.maximum,t.maximum),t.center=Cartesian3.clone(e.center,t.center),t):new AxisAlignedBoundingBox(e.minimum,e.maximum,e.center)},AxisAlignedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Cartesian3.equals(e.minimum,t.minimum)&&Cartesian3.equals(e.maximum,t.maximum)};let intersectScratch=new Cartesian3;function EllipsoidalOccluder(e,t){this._ellipsoid=e,this._cameraPosition=new Cartesian3,this._cameraPositionInScaledSpace=new Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,defined(t)&&(this.cameraPosition=t)}AxisAlignedBoundingBox.intersectPlane=function(e,t){intersectScratch=Cartesian3.subtract(e.maximum,e.minimum,intersectScratch);const n=Cartesian3.multiplyByScalar(intersectScratch,.5,intersectScratch),i=t.normal,r=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),o=Cartesian3.dot(e.center,i)+t.distance;return o-r>0?Intersect$1.INSIDE:o+r<0?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},AxisAlignedBoundingBox.prototype.clone=function(e){return AxisAlignedBoundingBox.clone(this,e)},AxisAlignedBoundingBox.prototype.intersectPlane=function(e){return AxisAlignedBoundingBox.intersectPlane(this,e)},AxisAlignedBoundingBox.prototype.equals=function(e){return AxisAlignedBoundingBox.equals(this,e)},Object.defineProperties(EllipsoidalOccluder.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){const t=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),n=Cartesian3.magnitudeSquared(t)-1;Cartesian3.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=t,this._distanceToLimbInScaledSpaceSquared=n}}});const scratchCartesian$9=new Cartesian3;EllipsoidalOccluder.prototype.isPointVisible=function(e){return isScaledSpacePointVisible(this._ellipsoid.transformPositionToScaledSpace(e,scratchCartesian$9),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},EllipsoidalOccluder.prototype.isScaledSpacePointVisible=function(e){return isScaledSpacePointVisible(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const scratchCameraPositionInScaledSpaceShrunk=new Cartesian3;EllipsoidalOccluder.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,r;return defined(t)&&t<0&&n.minimumRadius>-t?(r=scratchCameraPositionInScaledSpaceShrunk,r.x=this._cameraPosition.x/(n.radii.x+t),r.y=this._cameraPosition.y/(n.radii.y+t),r.z=this._cameraPosition.z/(n.radii.z+t),i=r.x*r.x+r.y*r.y+r.z*r.z-1):(r=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),isScaledSpacePointVisible(e,r,i)},EllipsoidalOccluder.prototype.computeHorizonCullingPoint=function(e,t,n){return computeHorizonCullingPointFromPositions(this._ellipsoid,e,t,n)};const scratchEllipsoidShrunk=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE);EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){return computeHorizonCullingPointFromPositions(getPossiblyShrunkEllipsoid(this._ellipsoid,n,scratchEllipsoidShrunk),e,t,i)},EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,r){return computeHorizonCullingPointFromVertices(this._ellipsoid,e,t,n,i,r)},EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,r,o){return computeHorizonCullingPointFromVertices(getPossiblyShrunkEllipsoid(this._ellipsoid,r,scratchEllipsoidShrunk),e,t,n,i,o)};const subsampleScratch=[];EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){const i=Rectangle.subsample(e,t,0,subsampleScratch),r=BoundingSphere.fromPoints(i);if(!(Cartesian3.magnitude(r.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(r.center,i,n)};const scratchEllipsoidShrunkRadii=new Cartesian3;function getPossiblyShrunkEllipsoid(e,t,n){if(defined(t)&&t<0&&e.minimumRadius>-t){const i=Cartesian3.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,scratchEllipsoidShrunkRadii);e=Ellipsoid.fromCartesian3(i,n)}return e}function computeHorizonCullingPointFromPositions(e,t,n,i){defined(i)||(i=new Cartesian3);const r=computeScaledSpaceDirectionToPoint(e,t);let o=0;for(let t=0,i=n.length;t<i;++t){const i=computeMagnitude(e,n[t],r);if(i<0)return;o=Math.max(o,i)}return magnitudeToPoint(r,o,i)}const positionScratch$c=new Cartesian3;function computeHorizonCullingPointFromVertices(e,t,n,i,r,o){defined(o)||(o=new Cartesian3),i=defaultValue(i,3),r=defaultValue(r,Cartesian3.ZERO);const a=computeScaledSpaceDirectionToPoint(e,t);let s=0;for(let t=0,o=n.length;t<o;t+=i){positionScratch$c.x=n[t]+r.x,positionScratch$c.y=n[t+1]+r.y,positionScratch$c.z=n[t+2]+r.z;const i=computeMagnitude(e,positionScratch$c,a);if(i<0)return;s=Math.max(s,i)}return magnitudeToPoint(a,s,o)}function isScaledSpacePointVisible(e,t,n){const i=t,r=n,o=Cartesian3.subtract(e,i,scratchCartesian$9),a=-Cartesian3.dot(o,i);return!(r<0?a>0:a>r&&a*a/Cartesian3.magnitudeSquared(o)>r)}const scaledSpaceScratch=new Cartesian3,directionScratch=new Cartesian3;function computeMagnitude(e,t,n){const i=e.transformPositionToScaledSpace(t,scaledSpaceScratch);let r=Cartesian3.magnitudeSquared(i),o=Math.sqrt(r);const a=Cartesian3.divideByScalar(i,o,directionScratch);r=Math.max(1,r),o=Math.max(1,o);const s=1/o;return 1/(Cartesian3.dot(a,n)*s-Cartesian3.magnitude(Cartesian3.cross(a,n,a))*(Math.sqrt(r-1)*s))}function magnitudeToPoint(e,t,n){if(!(t<=0||t===1/0||t!=t))return Cartesian3.multiplyByScalar(e,t,n)}const directionToPointScratch=new Cartesian3;function computeScaledSpaceDirectionToPoint(e,t){return Cartesian3.equals(t,Cartesian3.ZERO)?t:(e.transformPositionToScaledSpace(t,directionToPointScratch),Cartesian3.normalize(directionToPointScratch,directionToPointScratch))}const QuadraticRealPolynomial={};function addWithCancellationCheck$1(e,t,n){const i=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}QuadraticRealPolynomial.computeDiscriminant=function(e,t,n){return t*t-4*e*n},QuadraticRealPolynomial.computeRealRoots=function(e,t,n){let i;if(0===e)return 0===t?[]:[-n/t];if(0===t){if(0===n)return[0,0];const t=Math.abs(n),r=Math.abs(e);if(t<r&&t/r<CesiumMath.EPSILON14)return[0,0];if(t>r&&r/t<CesiumMath.EPSILON14)return[];if(i=-n/e,i<0)return[];const o=Math.sqrt(i);return[-o,o]}if(0===n)return i=-t/e,i<0?[i,0]:[0,i];const r=addWithCancellationCheck$1(t*t,-(4*e*n),CesiumMath.EPSILON14);if(r<0)return[];const o=-.5*addWithCancellationCheck$1(t,CesiumMath.sign(t)*Math.sqrt(r),CesiumMath.EPSILON14);return t>0?[o/e,n/o]:[n/o,o/e]};const CubicRealPolynomial={};function computeRealRoots(e,t,n,i){const r=e,o=t/3,a=n/3,s=i,c=r*a,l=o*s,u=o*o,d=a*a,h=r*a-u,p=r*s-o*a,f=o*s-d,m=4*h*f-p*p;let g,_;if(m<0){let e,t,n;u*l>=c*d?(e=r,t=h,n=-2*o*h+r*p):(e=s,t=f,n=-s*p+2*a*f);const i=-(n<0?-1:1)*Math.abs(e)*Math.sqrt(-m);_=-n+i;const y=_/2,C=y<0?-Math.pow(-y,1/3):Math.pow(y,1/3),T=_===i?-C:-t/C;return g=t<=0?C+T:-n/(C*C+T*T+t),u*l>=c*d?[(g-o)/r]:[-s/(g+a)]}const y=h,C=-2*o*h+r*p,T=f,S=-s*p+2*a*f,A=Math.sqrt(m),v=Math.sqrt(3)/2;let E=Math.abs(Math.atan2(r*A,-C)/3);g=2*Math.sqrt(-y);let b=Math.cos(E);_=g*b;let x=g*(-b/2-v*Math.sin(E));const P=_+x>2*o?_-o:x-o,D=r,w=P/D;E=Math.abs(Math.atan2(s*A,-S)/3),g=2*Math.sqrt(-T),b=Math.cos(E),_=g*b,x=g*(-b/2-v*Math.sin(E));const M=-s,I=_+x<2*a?_+a:x+a,R=M/I,O=-P*I-D*M,B=(a*O-o*(P*M))/(-o*O+a*(D*I));return w<=B?w<=R?B<=R?[w,B,R]:[w,R,B]:[R,w,B]:w<=R?[B,w,R]:B<=R?[B,R,w]:[R,B,w]}CubicRealPolynomial.computeDiscriminant=function(e,t,n,i){const r=t*t,o=n*n;return 18*e*t*n*i+r*o-27*(e*e)*(i*i)-4*(e*o*n+r*t*i)},CubicRealPolynomial.computeRealRoots=function(e,t,n,i){let r,o;if(0===e)return QuadraticRealPolynomial.computeRealRoots(t,n,i);if(0===t){if(0===n){if(0===i)return[0,0,0];o=-i/e;const t=o<0?-Math.pow(-o,1/3):Math.pow(o,1/3);return[t,t,t]}return 0===i?(r=QuadraticRealPolynomial.computeRealRoots(e,0,n),0===r.Length?[0]:[r[0],0,r[1]]):computeRealRoots(e,0,n,i)}return 0===n?0===i?(o=-t/e,o<0?[o,0,0]:[0,0,o]):computeRealRoots(e,t,0,i):0===i?(r=QuadraticRealPolynomial.computeRealRoots(e,t,n),0===r.length?[0]:r[1]<=0?[r[0],r[1],0]:r[0]>=0?[0,r[0],r[1]]:[r[0],0,r[1]]):computeRealRoots(e,t,n,i)};const QuarticRealPolynomial={};function original(e,t,n,i){const r=e*e,o=t-3*r/8,a=n-t*e/2+r*e/8,s=i-n*e/4+t*r/16-3*r*r/256,c=CubicRealPolynomial.computeRealRoots(1,2*o,o*o-4*s,-a*a);if(c.length>0){const t=-e/4,n=c[c.length-1];if(Math.abs(n)<CesiumMath.EPSILON14){const e=QuadraticRealPolynomial.computeRealRoots(1,o,s);if(2===e.length){const n=e[0],i=e[1];let r;if(n>=0&&i>=0){const e=Math.sqrt(n),r=Math.sqrt(i);return[t-r,t-e,t+e,t+r]}if(n>=0&&i<0)return r=Math.sqrt(n),[t-r,t+r];if(n<0&&i>=0)return r=Math.sqrt(i),[t-r,t+r]}return[]}if(n>0){const e=Math.sqrt(n),i=(o+n-a/e)/2,r=(o+n+a/e)/2,s=QuadraticRealPolynomial.computeRealRoots(1,e,i),c=QuadraticRealPolynomial.computeRealRoots(1,-e,r);return 0!==s.length?(s[0]+=t,s[1]+=t,0!==c.length?(c[0]+=t,c[1]+=t,s[1]<=c[0]?[s[0],s[1],c[0],c[1]]:c[1]<=s[0]?[c[0],c[1],s[0],s[1]]:s[0]>=c[0]&&s[1]<=c[1]?[c[0],s[0],s[1],c[1]]:c[0]>=s[0]&&c[1]<=s[1]?[s[0],c[0],c[1],s[1]]:s[0]>c[0]&&s[0]<c[1]?[c[0],s[0],c[1],s[1]]:[s[0],c[0],s[1],c[1]]):s):0!==c.length?(c[0]+=t,c[1]+=t,c):[]}}return[]}function neumark(e,t,n,i){const r=e*e,o=-2*t,a=n*e+t*t-4*i,s=r*i-n*t*e+n*n,c=CubicRealPolynomial.computeRealRoots(1,o,a,s);if(c.length>0){const o=c[0],a=t-o,s=a*a,l=e/2,u=a/2,d=s-4*i,h=s+4*Math.abs(i),p=r-4*o,f=r+4*Math.abs(o);let m,g,_,y,C,T;if(o<0||d*f<p*h){const t=Math.sqrt(p);m=t/2,g=0===t?0:(e*u-n)/t}else{const t=Math.sqrt(d);m=0===t?0:(e*u-n)/t,g=t/2}0===l&&0===m?(_=0,y=0):CesiumMath.sign(l)===CesiumMath.sign(m)?(_=l+m,y=o/_):(y=l-m,_=o/y),0===u&&0===g?(C=0,T=0):CesiumMath.sign(u)===CesiumMath.sign(g)?(C=u+g,T=i/C):(T=u-g,C=i/T);const S=QuadraticRealPolynomial.computeRealRoots(1,_,C),A=QuadraticRealPolynomial.computeRealRoots(1,y,T);if(0!==S.length)return 0!==A.length?S[1]<=A[0]?[S[0],S[1],A[0],A[1]]:A[1]<=S[0]?[A[0],A[1],S[0],S[1]]:S[0]>=A[0]&&S[1]<=A[1]?[A[0],S[0],S[1],A[1]]:A[0]>=S[0]&&A[1]<=S[1]?[S[0],A[0],A[1],S[1]]:S[0]>A[0]&&S[0]<A[1]?[A[0],S[0],A[1],S[1]]:[S[0],A[0],S[1],A[1]]:S;if(0!==A.length)return A}return[]}function Ray(e,t){t=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),Cartesian3.equals(t,Cartesian3.ZERO)||Cartesian3.normalize(t,t),this.origin=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.direction=t}QuarticRealPolynomial.computeDiscriminant=function(e,t,n,i,r){const o=e*e,a=t*t,s=a*t,c=n*n,l=c*n,u=i*i,d=u*i,h=r*r;return a*c*u-4*s*d-4*e*l*u+18*e*t*n*d-27*o*u*u+256*(o*e)*(h*r)+r*(18*s*n*i-4*a*l+16*e*c*c-80*e*t*c*i-6*e*a*u+144*o*n*u)+h*(144*e*a*n-27*a*a-128*o*c-192*o*t*i)},QuarticRealPolynomial.computeRealRoots=function(e,t,n,i,r){if(Math.abs(e)<CesiumMath.EPSILON15)return CubicRealPolynomial.computeRealRoots(t,n,i,r);const o=t/e,a=n/e,s=i/e,c=r/e;let l=o<0?1:0;switch(l+=a<0?l+1:l,l+=s<0?l+1:l,l+=c<0?l+1:l,l){case 0:case 3:case 4:case 6:case 7:case 9:case 10:case 12:case 13:case 14:case 15:return original(o,a,s,c);case 1:case 2:case 5:case 8:case 11:return neumark(o,a,s,c);default:return}},Ray.clone=function(e,t){if(defined(e))return defined(t)?(t.origin=Cartesian3.clone(e.origin),t.direction=Cartesian3.clone(e.direction),t):new Ray(e.origin,e.direction)},Ray.getPoint=function(e,t,n){return defined(n)||(n=new Cartesian3),n=Cartesian3.multiplyByScalar(e.direction,t,n),Cartesian3.add(e.origin,n,n)};const IntersectionTests={rayPlane:function(e,t,n){defined(n)||(n=new Cartesian3);const i=e.origin,r=e.direction,o=t.normal,a=Cartesian3.dot(o,r);if(Math.abs(a)<CesiumMath.EPSILON15)return;const s=(-t.distance-Cartesian3.dot(o,i))/a;return s<0?void 0:(n=Cartesian3.multiplyByScalar(r,s,n),Cartesian3.add(i,n,n))}},scratchEdge0=new Cartesian3,scratchEdge1=new Cartesian3,scratchPVec=new Cartesian3,scratchTVec=new Cartesian3,scratchQVec=new Cartesian3;IntersectionTests.rayTriangleParametric=function(e,t,n,i,r){r=defaultValue(r,!1);const o=e.origin,a=e.direction,s=Cartesian3.subtract(n,t,scratchEdge0),c=Cartesian3.subtract(i,t,scratchEdge1),l=Cartesian3.cross(a,c,scratchPVec),u=Cartesian3.dot(s,l);let d,h,p,f,m;if(r){if(u<CesiumMath.EPSILON6)return;if(d=Cartesian3.subtract(o,t,scratchTVec),p=Cartesian3.dot(d,l),p<0||p>u)return;if(h=Cartesian3.cross(d,s,scratchQVec),f=Cartesian3.dot(a,h),f<0||p+f>u)return;m=Cartesian3.dot(c,h)/u}else{if(Math.abs(u)<CesiumMath.EPSILON6)return;const e=1/u;if(d=Cartesian3.subtract(o,t,scratchTVec),p=Cartesian3.dot(d,l)*e,p<0||p>1)return;if(h=Cartesian3.cross(d,s,scratchQVec),f=Cartesian3.dot(a,h)*e,f<0||p+f>1)return;m=Cartesian3.dot(c,h)*e}return m},IntersectionTests.rayTriangle=function(e,t,n,i,r,o){const a=IntersectionTests.rayTriangleParametric(e,t,n,i,r);if(defined(a)&&!(a<0))return defined(o)||(o=new Cartesian3),Cartesian3.multiplyByScalar(e.direction,a,o),Cartesian3.add(e.origin,o,o)};const scratchLineSegmentTriangleRay=new Ray;function solveQuadratic(e,t,n,i){const r=t*t-4*e*n;if(r<0)return;if(r>0){const n=1/(2*e),o=Math.sqrt(r),a=(-t+o)*n,s=(-t-o)*n;return a<s?(i.root0=a,i.root1=s):(i.root0=s,i.root1=a),i}const o=-t/(2*e);return 0!==o?(i.root0=i.root1=o,i):void 0}IntersectionTests.lineSegmentTriangle=function(e,t,n,i,r,o,a){const s=scratchLineSegmentTriangleRay;Cartesian3.clone(e,s.origin),Cartesian3.subtract(t,e,s.direction),Cartesian3.normalize(s.direction,s.direction);const c=IntersectionTests.rayTriangleParametric(s,n,i,r,o);if(!(!defined(c)||c<0||c>Cartesian3.distance(e,t)))return defined(a)||(a=new Cartesian3),Cartesian3.multiplyByScalar(s.direction,c,a),Cartesian3.add(s.origin,a,a)};const raySphereRoots={root0:0,root1:0};function raySphere(e,t,n){defined(n)||(n=new Interval);const i=e.origin,r=e.direction,o=t.center,a=t.radius*t.radius,s=Cartesian3.subtract(i,o,scratchPVec),c=solveQuadratic(Cartesian3.dot(r,r),2*Cartesian3.dot(r,s),Cartesian3.magnitudeSquared(s)-a,raySphereRoots);if(defined(c))return n.start=c.root0,n.stop=c.root1,n}IntersectionTests.raySphere=function(e,t,n){if(defined(n=raySphere(e,t,n))&&!(n.stop<0))return n.start=Math.max(n.start,0),n};const scratchLineSegmentRay=new Ray;IntersectionTests.lineSegmentSphere=function(e,t,n,i){const r=scratchLineSegmentRay;Cartesian3.clone(e,r.origin);const o=Cartesian3.subtract(t,e,r.direction),a=Cartesian3.magnitude(o);if(Cartesian3.normalize(o,o),!(!defined(i=raySphere(r,n,i))||i.stop<0||i.start>a))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,a),i};const scratchQ=new Cartesian3,scratchW$1=new Cartesian3;function addWithCancellationCheck(e,t,n){const i=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}function quadraticVectorExpression(e,t,n,i,r){const o=i*i,a=r*r,s=(e[Matrix3.COLUMN1ROW1]-e[Matrix3.COLUMN2ROW2])*a,c=r*(i*addWithCancellationCheck(e[Matrix3.COLUMN1ROW0],e[Matrix3.COLUMN0ROW1],CesiumMath.EPSILON15)+t.y),l=e[Matrix3.COLUMN0ROW0]*o+e[Matrix3.COLUMN2ROW2]*a+i*t.x+n,u=a*addWithCancellationCheck(e[Matrix3.COLUMN2ROW1],e[Matrix3.COLUMN1ROW2],CesiumMath.EPSILON15),d=r*(i*addWithCancellationCheck(e[Matrix3.COLUMN2ROW0],e[Matrix3.COLUMN0ROW2])+t.z);let h;const p=[];if(0===d&&0===u){if(h=QuadraticRealPolynomial.computeRealRoots(s,c,l),0===h.length)return p;const e=h[0],t=Math.sqrt(Math.max(1-e*e,0));if(p.push(new Cartesian3(i,r*e,r*-t)),p.push(new Cartesian3(i,r*e,r*t)),2===h.length){const e=h[1],t=Math.sqrt(Math.max(1-e*e,0));p.push(new Cartesian3(i,r*e,r*-t)),p.push(new Cartesian3(i,r*e,r*t))}return p}const f=d*d,m=u*u,g=d*u,_=s*s+m,y=2*(c*s+g),C=2*l*s+c*c-m+f,T=2*(l*c-g),S=l*l-f;if(0===_&&0===y&&0===C&&0===T)return p;h=QuarticRealPolynomial.computeRealRoots(_,y,C,T,S);const A=h.length;if(0===A)return p;for(let e=0;e<A;++e){const t=h[e],n=t*t,o=Math.max(1-n,0),a=Math.sqrt(o);let f;f=CesiumMath.sign(s)===CesiumMath.sign(l)?addWithCancellationCheck(s*n+l,c*t,CesiumMath.EPSILON12):CesiumMath.sign(l)===CesiumMath.sign(c*t)?addWithCancellationCheck(s*n,c*t+l,CesiumMath.EPSILON12):addWithCancellationCheck(s*n+c*t,l,CesiumMath.EPSILON12);const m=f*addWithCancellationCheck(u*t,d,CesiumMath.EPSILON15);m<0?p.push(new Cartesian3(i,r*t,r*a)):m>0?p.push(new Cartesian3(i,r*t,r*-a)):0!==a?(p.push(new Cartesian3(i,r*t,r*-a)),p.push(new Cartesian3(i,r*t,r*a)),++e):p.push(new Cartesian3(i,r*t,r*a))}return p}IntersectionTests.rayEllipsoid=function(e,t){const n=t.oneOverRadii,i=Cartesian3.multiplyComponents(n,e.origin,scratchQ),r=Cartesian3.multiplyComponents(n,e.direction,scratchW$1),o=Cartesian3.magnitudeSquared(i),a=Cartesian3.dot(i,r);let s,c,l,u,d;if(o>1){if(a>=0)return;const e=a*a;if(s=o-1,c=Cartesian3.magnitudeSquared(r),l=c*s,e<l)return;if(e>l){u=a*a-l,d=-a+Math.sqrt(u);const e=d/c,t=s/d;return e<t?new Interval(e,t):{start:t,stop:e}}const t=Math.sqrt(s/c);return new Interval(t,t)}return o<1?(s=o-1,c=Cartesian3.magnitudeSquared(r),l=c*s,u=a*a-l,d=-a+Math.sqrt(u),new Interval(0,d/c)):a<0?(c=Cartesian3.magnitudeSquared(r),new Interval(0,-a/c)):void 0};const firstAxisScratch=new Cartesian3,secondAxisScratch=new Cartesian3,thirdAxisScratch=new Cartesian3,referenceScratch=new Cartesian3,bCart=new Cartesian3,bScratch=new Matrix3,btScratch=new Matrix3,diScratch=new Matrix3,dScratch$1=new Matrix3,cScratch=new Matrix3,tempMatrix=new Matrix3,aScratch=new Matrix3,sScratch$1=new Cartesian3,closestScratch=new Cartesian3,surfPointScratch=new Cartographic;IntersectionTests.grazingAltitudeLocation=function(e,t){const n=e.origin,i=e.direction;if(!Cartesian3.equals(n,Cartesian3.ZERO)){const e=t.geodeticSurfaceNormal(n,firstAxisScratch);if(Cartesian3.dot(i,e)>=0)return n}const r=defined(this.rayEllipsoid(e,t)),o=t.transformPositionToScaledSpace(i,firstAxisScratch),a=Cartesian3.normalize(o,o),s=Cartesian3.mostOrthogonalAxis(o,referenceScratch),c=Cartesian3.normalize(Cartesian3.cross(s,a,secondAxisScratch),secondAxisScratch),l=Cartesian3.normalize(Cartesian3.cross(a,c,thirdAxisScratch),thirdAxisScratch),u=bScratch;u[0]=a.x,u[1]=a.y,u[2]=a.z,u[3]=c.x,u[4]=c.y,u[5]=c.z,u[6]=l.x,u[7]=l.y,u[8]=l.z;const d=Matrix3.transpose(u,btScratch),h=Matrix3.fromScale(t.radii,diScratch),p=Matrix3.fromScale(t.oneOverRadii,dScratch$1),f=cScratch;f[0]=0,f[1]=-i.z,f[2]=i.y,f[3]=i.z,f[4]=0,f[5]=-i.x,f[6]=-i.y,f[7]=i.x,f[8]=0;const m=Matrix3.multiply(Matrix3.multiply(d,p,tempMatrix),f,tempMatrix),g=Matrix3.multiply(Matrix3.multiply(m,h,aScratch),u,aScratch),_=Matrix3.multiplyByVector(m,n,bCart),y=quadraticVectorExpression(g,Cartesian3.negate(_,firstAxisScratch),0,0,1);let C,T;const S=y.length;if(S>0){let e=Cartesian3.clone(Cartesian3.ZERO,closestScratch),o=Number.NEGATIVE_INFINITY;for(let t=0;t<S;++t){C=Matrix3.multiplyByVector(h,Matrix3.multiplyByVector(u,y[t],sScratch$1),sScratch$1);const r=Cartesian3.normalize(Cartesian3.subtract(C,n,referenceScratch),referenceScratch),a=Cartesian3.dot(r,i);a>o&&(o=a,e=Cartesian3.clone(C,e))}const a=t.cartesianToCartographic(e,surfPointScratch);return o=CesiumMath.clamp(o,0,1),T=Cartesian3.magnitude(Cartesian3.subtract(e,n,referenceScratch))*Math.sqrt(1-o*o),T=r?-T:T,a.height=T,t.cartographicToCartesian(a,new Cartesian3)}};const lineSegmentPlaneDifference=new Cartesian3;function Plane(e,t){this.normal=Cartesian3.clone(e),this.distance=t}IntersectionTests.lineSegmentPlane=function(e,t,n,i){defined(i)||(i=new Cartesian3);const r=Cartesian3.subtract(t,e,lineSegmentPlaneDifference),o=n.normal,a=Cartesian3.dot(o,r);if(Math.abs(a)<CesiumMath.EPSILON6)return;const s=Cartesian3.dot(o,e),c=-(n.distance+s)/a;return c<0||c>1?void 0:(Cartesian3.multiplyByScalar(r,c,i),Cartesian3.add(e,i,i),i)},IntersectionTests.trianglePlaneIntersection=function(e,t,n,i){const r=i.normal,o=i.distance,a=Cartesian3.dot(r,e)+o<0,s=Cartesian3.dot(r,t)+o<0,c=Cartesian3.dot(r,n)+o<0;let l,u,d=0;if(d+=a?1:0,d+=s?1:0,d+=c?1:0,1!==d&&2!==d||(l=new Cartesian3,u=new Cartesian3),1===d){if(a)return IntersectionTests.lineSegmentPlane(e,t,i,l),IntersectionTests.lineSegmentPlane(e,n,i,u),{positions:[e,t,n,l,u],indices:[0,3,4,1,2,4,1,4,3]};if(s)return IntersectionTests.lineSegmentPlane(t,n,i,l),IntersectionTests.lineSegmentPlane(t,e,i,u),{positions:[e,t,n,l,u],indices:[1,3,4,2,0,4,2,4,3]};if(c)return IntersectionTests.lineSegmentPlane(n,e,i,l),IntersectionTests.lineSegmentPlane(n,t,i,u),{positions:[e,t,n,l,u],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===d){if(!a)return IntersectionTests.lineSegmentPlane(t,e,i,l),IntersectionTests.lineSegmentPlane(n,e,i,u),{positions:[e,t,n,l,u],indices:[1,2,4,1,4,3,0,3,4]};if(!s)return IntersectionTests.lineSegmentPlane(n,t,i,l),IntersectionTests.lineSegmentPlane(e,t,i,u),{positions:[e,t,n,l,u],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return IntersectionTests.lineSegmentPlane(e,n,i,l),IntersectionTests.lineSegmentPlane(t,n,i,u),{positions:[e,t,n,l,u],indices:[0,1,4,0,4,3,2,3,4]}}},Plane.fromPointNormal=function(e,t,n){const i=-Cartesian3.dot(t,e);return defined(n)?(Cartesian3.clone(t,n.normal),n.distance=i,n):new Plane(t,i)};const scratchNormal$7=new Cartesian3;Plane.fromCartesian4=function(e,t){const n=Cartesian3.fromCartesian4(e,scratchNormal$7),i=e.w;return defined(t)?(Cartesian3.clone(n,t.normal),t.distance=i,t):new Plane(n,i)},Plane.getPointDistance=function(e,t){return Cartesian3.dot(e.normal,t)+e.distance};const scratchCartesian$8=new Cartesian3;Plane.projectPointOntoPlane=function(e,t,n){defined(n)||(n=new Cartesian3);const i=Plane.getPointDistance(e,t),r=Cartesian3.multiplyByScalar(e.normal,i,scratchCartesian$8);return Cartesian3.subtract(t,r,n)};const scratchInverseTranspose=new Matrix4,scratchPlaneCartesian4=new Cartesian4,scratchTransformNormal=new Cartesian3;function binarySearch(e,t,n){let i,r,o=0,a=e.length-1;for(;o<=a;)if(i=~~((o+a)/2),r=n(e[i],t),r<0)o=i+1;else{if(!(r>0))return i;a=i-1}return~(a+1)}function EarthOrientationParametersSample(e,t,n,i,r){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=r}function GregorianDate(e,t,n,i,r,o,a,s){this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=r,this.second=o,this.millisecond=a,this.isLeapSecond=s}function isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function LeapSecond(e,t){this.julianDate=e,this.offset=t}Plane.transform=function(e,t,n){const i=e.normal,r=e.distance,o=Matrix4.inverseTranspose(t,scratchInverseTranspose);let a=Cartesian4.fromElements(i.x,i.y,i.z,r,scratchPlaneCartesian4);a=Matrix4.multiplyByVector(o,a,a);const s=Cartesian3.fromCartesian4(a,scratchTransformNormal);return a=Cartesian4.divideByScalar(a,Cartesian3.magnitude(s),a),Plane.fromCartesian4(a,n)},Plane.clone=function(e,t){return defined(t)?(Cartesian3.clone(e.normal,t.normal),t.distance=e.distance,t):new Plane(e.normal,e.distance)},Plane.equals=function(e,t){return e.distance===t.distance&&Cartesian3.equals(e.normal,t.normal)},Plane.ORIGIN_XY_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_Z,0)),Plane.ORIGIN_YZ_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_X,0)),Plane.ORIGIN_ZX_PLANE=Object.freeze(new Plane(Cartesian3.UNIT_Y,0));const TimeConstants={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:2400000.5};var TimeConstants$1=Object.freeze(TimeConstants);const TimeStandard={UTC:0,TAI:1};var TimeStandard$1=Object.freeze(TimeStandard);const gregorianDateScratch=new GregorianDate,daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31],daysInLeapFeburary=29;function compareLeapSecondDates$1(e,t){return JulianDate.compare(e.julianDate,t.julianDate)}const binarySearchScratchLeapSecond=new LeapSecond;function convertUtcToTai(e){binarySearchScratchLeapSecond.julianDate=e;const t=JulianDate.leapSeconds;let n=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates$1);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;if(n>0){JulianDate.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset)}JulianDate.addSeconds(e,i,e)}function convertTaiToUtc(e,t){binarySearchScratchLeapSecond.julianDate=e;const n=JulianDate.leapSeconds;let i=binarySearch(n,binarySearchScratchLeapSecond,compareLeapSecondDates$1);if(i<0&&(i=~i),0===i)return JulianDate.addSeconds(e,-n[0].offset,t);if(i>=n.length)return JulianDate.addSeconds(e,-n[i-1].offset,t);const r=JulianDate.secondsDifference(n[i].julianDate,e);return 0===r?JulianDate.addSeconds(e,-n[i].offset,t):r<=1?void 0:JulianDate.addSeconds(e,-n[--i].offset,t)}function setComponents(e,t,n){const i=t/TimeConstants$1.SECONDS_PER_DAY|0;return e+=i,(t-=TimeConstants$1.SECONDS_PER_DAY*i)<0&&(e--,t+=TimeConstants$1.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function computeJulianDateComponents(e,t,n,i,r,o,a){const s=(t-14)/12|0,c=e+4800+s;let l=(1461*c/4|0)+(367*(t-2-12*s)/12|0)-(3*((c+100)/100|0)/4|0)+n-32075;(i-=12)<0&&(i+=24);const u=o+(i*TimeConstants$1.SECONDS_PER_HOUR+r*TimeConstants$1.SECONDS_PER_MINUTE+a*TimeConstants$1.SECONDS_PER_MILLISECOND);return u>=43200&&(l-=1),[l,u]}const matchCalendarYear=/^(\d{4})$/,matchCalendarMonth=/^(\d{4})-(\d{2})$/,matchOrdinalDate=/^(\d{4})-?(\d{3})$/,matchWeekDate=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,matchCalendarDate=/^(\d{4})-?(\d{2})-?(\d{2})$/,utcOffset=/([Z+\-])?(\d{2})?:?(\d{2})?$/,matchHours=/^(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutes=/^(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutesSeconds=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source;function JulianDate(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=defaultValue(e,0),t=defaultValue(t,0),n=defaultValue(n,TimeStandard$1.UTC);const i=0|e;setComponents(i,t+=(e-i)*TimeConstants$1.SECONDS_PER_DAY,this),n===TimeStandard$1.UTC&&convertUtcToTai(this)}JulianDate.fromGregorianDate=function(e,t){const n=computeJulianDateComponents(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return defined(t)?(setComponents(n[0],n[1],t),convertUtcToTai(t),t):new JulianDate(n[0],n[1],TimeStandard$1.UTC)},JulianDate.fromDate=function(e,t){const n=computeJulianDateComponents(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return defined(t)?(setComponents(n[0],n[1],t),convertUtcToTai(t),t):new JulianDate(n[0],n[1],TimeStandard$1.UTC)},JulianDate.fromIso8601=function(e,t){let n,i=(e=e.replace(",",".")).split("T"),r=1,o=1,a=0,s=0,c=0,l=0;const u=i[0],d=i[1];let h,p,f;if(i=u.match(matchCalendarDate),null!==i)n=+i[1],r=+i[2],o=+i[3];else if(i=u.match(matchCalendarMonth),null!==i)n=+i[1],r=+i[2];else if(i=u.match(matchCalendarYear),null!==i)n=+i[1];else{let e;if(i=u.match(matchOrdinalDate),null!==i)n=+i[1],e=+i[2],p=isLeapYear(n);else if(i=u.match(matchWeekDate),null!==i){n=+i[1];e=7*+i[2]+(+i[3]||0)-new Date(Date.UTC(n,0,4)).getUTCDay()-3}h=new Date(Date.UTC(n,0,1)),h.setUTCDate(e),r=h.getUTCMonth()+1,o=h.getUTCDate()}if(p=isLeapYear(n),defined(d)){i=d.match(matchHoursMinutesSeconds),null!==i?(a=+i[1],s=+i[2],c=+i[3],l=1e3*+(i[4]||0),f=5):(i=d.match(matchHoursMinutes),null!==i?(a=+i[1],s=+i[2],c=60*+(i[3]||0),f=4):(i=d.match(matchHours),null!==i&&(a=+i[1],s=60*+(i[2]||0),f=3)));const e=i[f],t=+i[f+1],u=+(i[f+2]||0);switch(e){case"+":a-=t,s-=u;break;case"-":a+=t,s+=u;break;case"Z":break;default:s+=new Date(Date.UTC(n,r-1,o,a,s)).getTimezoneOffset()}}const m=60===c;for(m&&c--;s>=60;)s-=60,a++;for(;a>=24;)a-=24,o++;for(h=p&&2===r?daysInLeapFeburary:daysInMonth[r-1];o>h;)o-=h,r++,r>12&&(r-=12,n++),h=p&&2===r?daysInLeapFeburary:daysInMonth[r-1];for(;s<0;)s+=60,a--;for(;a<0;)a+=24,o--;for(;o<1;)r--,r<1&&(r+=12,n--),h=p&&2===r?daysInLeapFeburary:daysInMonth[r-1],o+=h;const g=computeJulianDateComponents(n,r,o,a,s,c,l);return defined(t)?(setComponents(g[0],g[1],t),convertUtcToTai(t)):t=new JulianDate(g[0],g[1],TimeStandard$1.UTC),m&&JulianDate.addSeconds(t,1,t),t},JulianDate.now=function(e){return JulianDate.fromDate(new Date,e)};const toGregorianDateScratch=new JulianDate(0,0,TimeStandard$1.TAI);function EarthOrientationParameters(e){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=defaultValue(e.addNewLeapSeconds,!0),defined(e.data))onDataReady(this,e.data);else if(defined(e.url)){const t=Resource.createIfNeeded(e.url),n=this;this._downloadPromise=t.fetchJson().then((function(e){onDataReady(n,e)})).otherwise((function(){n._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."}))}else onDataReady(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}function compareLeapSecondDates(e,t){return JulianDate.compare(e.julianDate,t)}function onDataReady(e,t){if(!defined(t.columnNames))return void(e._dataError="Error in loaded EOP data: The columnNames property is required.");if(!defined(t.samples))return void(e._dataError="Error in loaded EOP data: The samples property is required.");const n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),r=t.columnNames.indexOf("yPoleWanderRadians"),o=t.columnNames.indexOf("ut1MinusUtcSeconds"),a=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),s=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||r<0||o<0||a<0||s<0||c<0)return void(e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const l=e._samples=t.samples,u=e._dates=[];let d;e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=r,e._ut1MinusUtcSecondsColumn=o,e._xCelestialPoleOffsetRadiansColumn=a,e._yCelestialPoleOffsetRadiansColumn=s,e._taiMinusUtcSecondsColumn=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;const h=e._addNewLeapSeconds;for(let t=0,i=l.length;t<i;t+=e._columnCount){const e=l[t+n],i=l[t+c],r=new JulianDate(e+TimeConstants$1.MODIFIED_JULIAN_DATE_DIFFERENCE,i,TimeStandard$1.TAI);if(u.push(r),h){if(i!==d&&defined(d)){const e=JulianDate.leapSeconds,t=binarySearch(e,r,compareLeapSecondDates);if(t<0){const n=new LeapSecond(r,i);e.splice(~t,0,n)}}d=i}}}function fillResultFromIndex(e,t,n,i,r){const o=n*i;r.xPoleWander=t[o+e._xPoleWanderRadiansColumn],r.yPoleWander=t[o+e._yPoleWanderRadiansColumn],r.xPoleOffset=t[o+e._xCelestialPoleOffsetRadiansColumn],r.yPoleOffset=t[o+e._yCelestialPoleOffsetRadiansColumn],r.ut1MinusUtc=t[o+e._ut1MinusUtcSecondsColumn]}function linearInterp(e,t,n){return t+e*(n-t)}function interpolate(e,t,n,i,r,o,a){const s=e._columnCount;if(o>t.length-1)return a.xPoleWander=0,a.yPoleWander=0,a.xPoleOffset=0,a.yPoleOffset=0,a.ut1MinusUtc=0,a;const c=t[r],l=t[o];if(c.equals(l)||i.equals(c))return fillResultFromIndex(e,n,r,s,a),a;if(i.equals(l))return fillResultFromIndex(e,n,o,s,a),a;const u=JulianDate.secondsDifference(i,c)/JulianDate.secondsDifference(l,c),d=r*s,h=o*s;let p=n[d+e._ut1MinusUtcSecondsColumn],f=n[h+e._ut1MinusUtcSecondsColumn];const m=f-p;if(m>.5||m<-.5){const t=n[d+e._taiMinusUtcSecondsColumn],r=n[h+e._taiMinusUtcSecondsColumn];t!==r&&(l.equals(i)?p=f:f-=r-t)}return a.xPoleWander=linearInterp(u,n[d+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),a.yPoleWander=linearInterp(u,n[d+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),a.xPoleOffset=linearInterp(u,n[d+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),a.yPoleOffset=linearInterp(u,n[d+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),a.ut1MinusUtc=linearInterp(u,p,f),a}function HeadingPitchRoll(e,t,n){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.roll=defaultValue(n,0)}function Iau2006XysSample(e,t,n){this.x=e,this.y=t,this.s=n}function Iau2006XysData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._xysFileUrlTemplate=Resource.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=defaultValue(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=defaultValue(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new JulianDate(this._sampleZeroJulianEphemerisDate,0,TimeStandard$1.TAI),this._stepSizeDays=defaultValue(e.stepSizeDays,1),this._samplesPerXysFile=defaultValue(e.samplesPerXysFile,1e3),this._totalSamples=defaultValue(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),r=Math.pow(this._stepSizeDays,t);for(let e=0;e<=t;++e){n[e]=r,i[e]=e*this._stepSizeDays;for(let i=0;i<=t;++i)i!==e&&(n[e]*=e-i);n[e]=1/n[e]}this._work=new Array(t+1),this._coef=new Array(t+1)}JulianDate.toGregorianDate=function(e,t){let n=!1,i=convertTaiToUtc(e,toGregorianDateScratch);defined(i)||(JulianDate.addSeconds(e,-1,toGregorianDateScratch),i=convertTaiToUtc(toGregorianDateScratch,toGregorianDateScratch),n=!0);let r=i.dayNumber;const o=i.secondsOfDay;o>=43200&&(r+=1);let a=r+68569|0;const s=4*a/146097|0;a=a-((146097*s+3)/4|0)|0;const c=4e3*(a+1)/1461001|0;a=a-(1461*c/4|0)+31|0;const l=80*a/2447|0,u=a-(2447*l/80|0)|0;a=l/11|0;const d=l+2-12*a|0,h=100*(s-49)+c+a|0;let p=o/TimeConstants$1.SECONDS_PER_HOUR|0,f=o-p*TimeConstants$1.SECONDS_PER_HOUR;const m=f/TimeConstants$1.SECONDS_PER_MINUTE|0;f-=m*TimeConstants$1.SECONDS_PER_MINUTE;let g=0|f;const _=(f-g)/TimeConstants$1.SECONDS_PER_MILLISECOND;return p+=12,p>23&&(p-=24),n&&(g+=1),defined(t)?(t.year=h,t.month=d,t.day=u,t.hour=p,t.minute=m,t.second=g,t.millisecond=_,t.isLeapSecond=n,t):new GregorianDate(h,d,u,p,m,g,_,n)},JulianDate.toDate=function(e){const t=JulianDate.toGregorianDate(e,gregorianDateScratch);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},JulianDate.toIso8601=function(e,t){const n=JulianDate.toGregorianDate(e,gregorianDateScratch);let i=n.year,r=n.month,o=n.day,a=n.hour;const s=n.minute,c=n.second,l=n.millisecond;let u;return 1e4===i&&1===r&&1===o&&0===a&&0===s&&0===c&&0===l&&(i=9999,r=12,o=31,a=24),defined(t)||0===l?defined(t)&&0!==t?(u=(.01*l).toFixed(t).replace(".","").slice(0,t),i.toString().padStart(4,"0")+"-"+r.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+a.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"."+u+"Z"):i.toString().padStart(4,"0")+"-"+r.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+a.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"Z":(u=(.01*l).toString().replace(".",""),i.toString().padStart(4,"0")+"-"+r.toString().padStart(2,"0")+"-"+o.toString().padStart(2,"0")+"T"+a.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")+"."+u+"Z")},JulianDate.clone=function(e,t){if(defined(e))return defined(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new JulianDate(e.dayNumber,e.secondsOfDay,TimeStandard$1.TAI)},JulianDate.compare=function(e,t){const n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},JulianDate.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},JulianDate.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(JulianDate.secondsDifference(e,t))<=n},JulianDate.totalDays=function(e){return e.dayNumber+e.secondsOfDay/TimeConstants$1.SECONDS_PER_DAY},JulianDate.secondsDifference=function(e,t){return(e.dayNumber-t.dayNumber)*TimeConstants$1.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)},JulianDate.daysDifference=function(e,t){return e.dayNumber-t.dayNumber+(e.secondsOfDay-t.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY},JulianDate.computeTaiMinusUtc=function(e){binarySearchScratchLeapSecond.julianDate=e;const t=JulianDate.leapSeconds;let n=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates$1);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset},JulianDate.addSeconds=function(e,t,n){return setComponents(e.dayNumber,e.secondsOfDay+t,n)},JulianDate.addMinutes=function(e,t,n){const i=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_MINUTE;return setComponents(e.dayNumber,i,n)},JulianDate.addHours=function(e,t,n){const i=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_HOUR;return setComponents(e.dayNumber,i,n)},JulianDate.addDays=function(e,t,n){return setComponents(e.dayNumber+t,e.secondsOfDay,n)},JulianDate.lessThan=function(e,t){return JulianDate.compare(e,t)<0},JulianDate.lessThanOrEquals=function(e,t){return JulianDate.compare(e,t)<=0},JulianDate.greaterThan=function(e,t){return JulianDate.compare(e,t)>0},JulianDate.greaterThanOrEquals=function(e,t){return JulianDate.compare(e,t)>=0},JulianDate.prototype.clone=function(e){return JulianDate.clone(this,e)},JulianDate.prototype.equals=function(e){return JulianDate.equals(this,e)},JulianDate.prototype.equalsEpsilon=function(e,t){return JulianDate.equalsEpsilon(this,e,t)},JulianDate.prototype.toString=function(){return JulianDate.toIso8601(this)},JulianDate.leapSeconds=[new LeapSecond(new JulianDate(2441317,43210,TimeStandard$1.TAI),10),new LeapSecond(new JulianDate(2441499,43211,TimeStandard$1.TAI),11),new LeapSecond(new JulianDate(2441683,43212,TimeStandard$1.TAI),12),new LeapSecond(new JulianDate(2442048,43213,TimeStandard$1.TAI),13),new LeapSecond(new JulianDate(2442413,43214,TimeStandard$1.TAI),14),new LeapSecond(new JulianDate(2442778,43215,TimeStandard$1.TAI),15),new LeapSecond(new JulianDate(2443144,43216,TimeStandard$1.TAI),16),new LeapSecond(new JulianDate(2443509,43217,TimeStandard$1.TAI),17),new LeapSecond(new JulianDate(2443874,43218,TimeStandard$1.TAI),18),new LeapSecond(new JulianDate(2444239,43219,TimeStandard$1.TAI),19),new LeapSecond(new JulianDate(2444786,43220,TimeStandard$1.TAI),20),new LeapSecond(new JulianDate(2445151,43221,TimeStandard$1.TAI),21),new LeapSecond(new JulianDate(2445516,43222,TimeStandard$1.TAI),22),new LeapSecond(new JulianDate(2446247,43223,TimeStandard$1.TAI),23),new LeapSecond(new JulianDate(2447161,43224,TimeStandard$1.TAI),24),new LeapSecond(new JulianDate(2447892,43225,TimeStandard$1.TAI),25),new LeapSecond(new JulianDate(2448257,43226,TimeStandard$1.TAI),26),new LeapSecond(new JulianDate(2448804,43227,TimeStandard$1.TAI),27),new LeapSecond(new JulianDate(2449169,43228,TimeStandard$1.TAI),28),new LeapSecond(new JulianDate(2449534,43229,TimeStandard$1.TAI),29),new LeapSecond(new JulianDate(2450083,43230,TimeStandard$1.TAI),30),new LeapSecond(new JulianDate(2450630,43231,TimeStandard$1.TAI),31),new LeapSecond(new JulianDate(2451179,43232,TimeStandard$1.TAI),32),new LeapSecond(new JulianDate(2453736,43233,TimeStandard$1.TAI),33),new LeapSecond(new JulianDate(2454832,43234,TimeStandard$1.TAI),34),new LeapSecond(new JulianDate(2456109,43235,TimeStandard$1.TAI),35),new LeapSecond(new JulianDate(2457204,43236,TimeStandard$1.TAI),36),new LeapSecond(new JulianDate(2457754,43237,TimeStandard$1.TAI),37)],EarthOrientationParameters.NONE=Object.freeze({getPromiseToLoad:function(){return when.resolve()},compute:function(e,t){return defined(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new EarthOrientationParametersSample(0,0,0,0,0),t}}),EarthOrientationParameters.prototype.getPromiseToLoad=function(){return when(this._downloadPromise)},EarthOrientationParameters.prototype.compute=function(e,t){if(!defined(this._samples)){if(defined(this._dataError))throw new RuntimeError(this._dataError);return}if(defined(t)||(t=new EarthOrientationParametersSample(0,0,0,0,0)),0===this._samples.length)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;const n=this._dates,i=this._lastIndex;let r=0,o=0;if(defined(i)){const a=n[i],s=n[i+1],c=JulianDate.lessThanOrEquals(a,e),l=!defined(s),u=l||JulianDate.greaterThanOrEquals(s,e);if(c&&u)return r=i,!l&&s.equals(e)&&++r,o=r+1,interpolate(this,n,this._samples,e,r,o,t),t}let a=binarySearch(n,e,JulianDate.compare,this._dateColumn);return a>=0?(a<n.length-1&&n[a+1].equals(e)&&++a,r=a,o=a):(o=~a,r=o-1,r<0&&(r=0)),this._lastIndex=r,interpolate(this,n,this._samples,e,r,o,t),t},HeadingPitchRoll.fromQuaternion=function(e,t){defined(t)||(t=new HeadingPitchRoll);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),r=2*(e.w*e.x+e.y*e.z),o=1-2*(e.y*e.y+e.z*e.z),a=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(a,o),t.roll=Math.atan2(r,i),t.pitch=-CesiumMath.asinClamped(n),t},HeadingPitchRoll.fromDegrees=function(e,t,n,i){return defined(i)||(i=new HeadingPitchRoll),i.heading=e*CesiumMath.RADIANS_PER_DEGREE,i.pitch=t*CesiumMath.RADIANS_PER_DEGREE,i.roll=n*CesiumMath.RADIANS_PER_DEGREE,i},HeadingPitchRoll.clone=function(e,t){if(defined(e))return defined(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new HeadingPitchRoll(e.heading,e.pitch,e.roll)},HeadingPitchRoll.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll},HeadingPitchRoll.equalsEpsilon=function(e,t,n,i){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.heading,t.heading,n,i)&&CesiumMath.equalsEpsilon(e.pitch,t.pitch,n,i)&&CesiumMath.equalsEpsilon(e.roll,t.roll,n,i)},HeadingPitchRoll.prototype.clone=function(e){return HeadingPitchRoll.clone(this,e)},HeadingPitchRoll.prototype.equals=function(e){return HeadingPitchRoll.equals(this,e)},HeadingPitchRoll.prototype.equalsEpsilon=function(e,t,n){return HeadingPitchRoll.equalsEpsilon(this,e,t,n)},HeadingPitchRoll.prototype.toString=function(){return"("+this.heading+", "+this.pitch+", "+this.roll+")"};const julianDateScratch$1=new JulianDate(0,0,TimeStandard$1.TAI);function getDaysSinceEpoch(e,t,n){const i=julianDateScratch$1;return i.dayNumber=t,i.secondsOfDay=n,JulianDate.daysDifference(i,e._sampleZeroDateTT)}function requestXysChunk(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];const n=when.defer();let i;e._chunkDownloadsInProgress[t]=n;const r=e._xysFileUrlTemplate;return i=defined(r)?r.getDerivedResource({templateValues:{0:t}}):new Resource({url:buildModuleUrl("Assets/IAU2006_XYS/IAU2006_XYS_"+t+".json")}),when(i.fetchJson(),(function(i){e._chunkDownloadsInProgress[t]=!1;const r=e._samples,o=i.samples,a=t*e._samplesPerXysFile*3;for(let e=0,t=o.length;e<t;++e)r[a+e]=o[e];n.resolve()})),n.promise}let _supportsFullscreen;Iau2006XysData.prototype.preload=function(e,t,n,i){const r=getDaysSinceEpoch(this,e,t),o=getDaysSinceEpoch(this,n,i);let a=r/this._stepSizeDays-this._interpolationOrder/2|0;a<0&&(a=0);let s=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;s>=this._totalSamples&&(s=this._totalSamples-1);const c=a/this._samplesPerXysFile|0,l=s/this._samplesPerXysFile|0,u=[];for(let e=c;e<=l;++e)u.push(requestXysChunk(this,e));return when.all(u)},Iau2006XysData.prototype.computeXysRadians=function(e,t,n){const i=getDaysSinceEpoch(this,e,t);if(i<0)return;const r=i/this._stepSizeDays|0;if(r>=this._totalSamples)return;const o=this._interpolationOrder;let a=r-(o/2|0);a<0&&(a=0);let s=a+o;s>=this._totalSamples&&(s=this._totalSamples-1,a=s-o,a<0&&(a=0));let c=!1;const l=this._samples;if(defined(l[3*a])||(requestXysChunk(this,a/this._samplesPerXysFile|0),c=!0),defined(l[3*s])||(requestXysChunk(this,s/this._samplesPerXysFile|0),c=!0),c)return;defined(n)?(n.x=0,n.y=0,n.s=0):n=new Iau2006XysSample(0,0,0);const u=i-a*this._stepSizeDays,d=this._work,h=this._denominators,p=this._coef,f=this._xTable;let m,g;for(m=0;m<=o;++m)d[m]=u-f[m];for(m=0;m<=o;++m){for(p[m]=1,g=0;g<=o;++g)g!==m&&(p[m]*=d[g]);p[m]*=h[m];let e=3*(a+m);n.x+=p[m]*l[e++],n.y+=p[m]*l[e++],n.s+=p[m]*l[e]}return n};const _names={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},Fullscreen={};let theNavigator,isChromeResult,chromeVersionResult,isSafariResult,safariVersionResult,isWebkitResult,webkitVersionResult,isInternetExplorerResult,internetExplorerVersionResult,isEdgeResult,edgeVersionResult,isFirefoxResult,firefoxVersionResult,isWindowsResult,hasPointerEvents,imageRenderingValueResult,supportsImageRenderingPixelatedResult;function extractVersion(e){const t=e.split(".");for(let e=0,n=t.length;e<n;++e)t[e]=parseInt(t[e],10);return t}function isChrome(){if(!defined(isChromeResult)&&(isChromeResult=!1,!isEdge())){const e=/ Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isChromeResult=!0,chromeVersionResult=extractVersion(e[1]))}return isChromeResult}function chromeVersion(){return isChrome()&&chromeVersionResult}function isSafari(){if(!defined(isSafariResult)&&(isSafariResult=!1,!isChrome()&&!isEdge()&&/ Safari\/[\.0-9]+/.test(theNavigator.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isSafariResult=!0,safariVersionResult=extractVersion(e[1]))}return isSafariResult}function safariVersion(){return isSafari()&&safariVersionResult}function isWebkit(){if(!defined(isWebkitResult)){isWebkitResult=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);null!==e&&(isWebkitResult=!0,webkitVersionResult=extractVersion(e[1]),webkitVersionResult.isNightly=!!e[2])}return isWebkitResult}function webkitVersion(){return isWebkit()&&webkitVersionResult}function isInternetExplorer(){if(!defined(isInternetExplorerResult)){let e;isInternetExplorerResult=!1,"Microsoft Internet Explorer"===theNavigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent),null!==e&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1]))):"Netscape"===theNavigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent),null!==e&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1])))}return isInternetExplorerResult}function internetExplorerVersion(){return isInternetExplorer()&&internetExplorerVersionResult}function isEdge(){if(!defined(isEdgeResult)){isEdgeResult=!1;const e=/ Edge\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isEdgeResult=!0,edgeVersionResult=extractVersion(e[1]))}return isEdgeResult}function edgeVersion(){return isEdge()&&edgeVersionResult}function isFirefox(){if(!defined(isFirefoxResult)){isFirefoxResult=!1;const e=/Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isFirefoxResult=!0,firefoxVersionResult=extractVersion(e[1]))}return isFirefoxResult}function isWindows(){return defined(isWindowsResult)||(isWindowsResult=/Windows/i.test(theNavigator.appVersion)),isWindowsResult}function firefoxVersion(){return isFirefox()&&firefoxVersionResult}function supportsPointerEvents(){return defined(hasPointerEvents)||(hasPointerEvents=!isFirefox()&&"undefined"!=typeof PointerEvent&&(!defined(theNavigator.pointerEnabled)||theNavigator.pointerEnabled)),hasPointerEvents}function supportsImageRenderingPixelated(){if(!defined(supportsImageRenderingPixelatedResult)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;supportsImageRenderingPixelatedResult=defined(t)&&""!==t,supportsImageRenderingPixelatedResult&&(imageRenderingValueResult=t)}return supportsImageRenderingPixelatedResult}function imageRenderingValue(){return supportsImageRenderingPixelated()?imageRenderingValueResult:void 0}function supportsWebP(){return supportsWebP._result}Object.defineProperties(Fullscreen,{element:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenElement]}},changeEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenchange}},errorEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenerror}},enabled:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenEnabled]}},fullscreen:{get:function(){if(Fullscreen.supportsFullscreen())return null!==Fullscreen.element}}}),Fullscreen.supportsFullscreen=function(){if(defined(_supportsFullscreen))return _supportsFullscreen;_supportsFullscreen=!1;const e=document.body;if("function"==typeof e.requestFullscreen)return _names.requestFullscreen="requestFullscreen",_names.exitFullscreen="exitFullscreen",_names.fullscreenEnabled="fullscreenEnabled",_names.fullscreenElement="fullscreenElement",_names.fullscreenchange="fullscreenchange",_names.fullscreenerror="fullscreenerror",_supportsFullscreen=!0,_supportsFullscreen;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,r=t.length;i<r;++i){const r=t[i];n=r+"RequestFullscreen","function"==typeof e[n]?(_names.requestFullscreen=n,_supportsFullscreen=!0):(n=r+"RequestFullScreen","function"==typeof e[n]&&(_names.requestFullscreen=n,_supportsFullscreen=!0)),n=r+"ExitFullscreen","function"==typeof document[n]?_names.exitFullscreen=n:(n=r+"CancelFullScreen","function"==typeof document[n]&&(_names.exitFullscreen=n)),n=r+"FullscreenEnabled",void 0!==document[n]?_names.fullscreenEnabled=n:(n=r+"FullScreenEnabled",void 0!==document[n]&&(_names.fullscreenEnabled=n)),n=r+"FullscreenElement",void 0!==document[n]?_names.fullscreenElement=n:(n=r+"FullScreenElement",void 0!==document[n]&&(_names.fullscreenElement=n)),n=r+"fullscreenchange",void 0!==document["on"+n]&&("ms"===r&&(n="MSFullscreenChange"),_names.fullscreenchange=n),n=r+"fullscreenerror",void 0!==document["on"+n]&&("ms"===r&&(n="MSFullscreenError"),_names.fullscreenerror=n)}return _supportsFullscreen},Fullscreen.requestFullscreen=function(e,t){Fullscreen.supportsFullscreen()&&e[_names.requestFullscreen]({vrDisplay:t})},Fullscreen.exitFullscreen=function(){Fullscreen.supportsFullscreen()&&document[_names.exitFullscreen]()},Fullscreen._names=_names,theNavigator="undefined"!=typeof navigator?navigator:{},supportsWebP._promise=void 0,supportsWebP._result=void 0,supportsWebP.initialize=function(){if(defined(supportsWebP._promise))return supportsWebP._promise;const e=when.defer();if(supportsWebP._promise=e.promise,isEdge())return supportsWebP._result=!1,e.resolve(supportsWebP._result),e.promise;const t=new Image;return t.onload=function(){supportsWebP._result=t.width>0&&t.height>0,e.resolve(supportsWebP._result)},t.onerror=function(){supportsWebP._result=!1,e.resolve(supportsWebP._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.promise},Object.defineProperties(supportsWebP,{initialized:{get:function(){return defined(supportsWebP._result)}}});const typedArrayTypes=[];"undefined"!=typeof ArrayBuffer&&(typedArrayTypes.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),"undefined"!=typeof Uint8ClampedArray&&typedArrayTypes.push(Uint8ClampedArray),"undefined"!=typeof Uint8ClampedArray&&typedArrayTypes.push(Uint8ClampedArray),"undefined"!=typeof BigInt64Array&&typedArrayTypes.push(BigInt64Array),"undefined"!=typeof BigUint64Array&&typedArrayTypes.push(BigUint64Array));const FeatureDetection={isChrome:isChrome,chromeVersion:chromeVersion,isSafari:isSafari,safariVersion:safariVersion,isWebkit:isWebkit,webkitVersion:webkitVersion,isInternetExplorer:isInternetExplorer,internetExplorerVersion:internetExplorerVersion,isEdge:isEdge,edgeVersion:edgeVersion,isFirefox:isFirefox,firefoxVersion:firefoxVersion,isWindows:isWindows,hardwareConcurrency:defaultValue(theNavigator.hardwareConcurrency,3),supportsPointerEvents:supportsPointerEvents,supportsImageRenderingPixelated:supportsImageRenderingPixelated,supportsWebP:supportsWebP,imageRenderingValue:imageRenderingValue,typedArrayTypes:typedArrayTypes};function Quaternion(e,t,n,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0),this.w=defaultValue(i,0)}FeatureDetection.supportsBasis=function(e){return FeatureDetection.supportsWebAssembly()&&e.context.supportsBasis},FeatureDetection.supportsFullscreen=function(){return Fullscreen.supportsFullscreen()},FeatureDetection.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},FeatureDetection.supportsBigInt64Array=function(){return"undefined"!=typeof BigInt64Array},FeatureDetection.supportsBigUint64Array=function(){return"undefined"!=typeof BigUint64Array},FeatureDetection.supportsBigInt=function(){return"undefined"!=typeof BigInt},FeatureDetection.supportsWebWorkers=function(){return"undefined"!=typeof Worker},FeatureDetection.supportsWebAssembly=function(){return"undefined"!=typeof WebAssembly&&!FeatureDetection.isEdge()};let fromAxisAngleScratch=new Cartesian3;Quaternion.fromAxisAngle=function(e,t,n){const i=t/2,r=Math.sin(i);fromAxisAngleScratch=Cartesian3.normalize(e,fromAxisAngleScratch);const o=fromAxisAngleScratch.x*r,a=fromAxisAngleScratch.y*r,s=fromAxisAngleScratch.z*r,c=Math.cos(i);return defined(n)?(n.x=o,n.y=a,n.z=s,n.w=c,n):new Quaternion(o,a,s,c)};const fromRotationMatrixNext=[1,2,0],fromRotationMatrixQuat=new Array(3);Quaternion.fromRotationMatrix=function(e,t){let n,i,r,o,a;const s=e[Matrix3.COLUMN0ROW0],c=e[Matrix3.COLUMN1ROW1],l=e[Matrix3.COLUMN2ROW2],u=s+c+l;if(u>0)n=Math.sqrt(u+1),a=.5*n,n=.5/n,i=(e[Matrix3.COLUMN1ROW2]-e[Matrix3.COLUMN2ROW1])*n,r=(e[Matrix3.COLUMN2ROW0]-e[Matrix3.COLUMN0ROW2])*n,o=(e[Matrix3.COLUMN0ROW1]-e[Matrix3.COLUMN1ROW0])*n;else{const t=fromRotationMatrixNext;let u=0;c>s&&(u=1),l>s&&l>c&&(u=2);const d=t[u],h=t[d];n=Math.sqrt(e[Matrix3.getElementIndex(u,u)]-e[Matrix3.getElementIndex(d,d)]-e[Matrix3.getElementIndex(h,h)]+1);const p=fromRotationMatrixQuat;p[u]=.5*n,n=.5/n,a=(e[Matrix3.getElementIndex(h,d)]-e[Matrix3.getElementIndex(d,h)])*n,p[d]=(e[Matrix3.getElementIndex(d,u)]+e[Matrix3.getElementIndex(u,d)])*n,p[h]=(e[Matrix3.getElementIndex(h,u)]+e[Matrix3.getElementIndex(u,h)])*n,i=-p[0],r=-p[1],o=-p[2]}return defined(t)?(t.x=i,t.y=r,t.z=o,t.w=a,t):new Quaternion(i,r,o,a)};const scratchHPRQuaternion$1=new Quaternion;let scratchHeadingQuaternion=new Quaternion,scratchPitchQuaternion=new Quaternion,scratchRollQuaternion=new Quaternion;Quaternion.fromHeadingPitchRoll=function(e,t){return scratchRollQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_X,e.roll,scratchHPRQuaternion$1),scratchPitchQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-e.pitch,t),t=Quaternion.multiply(scratchPitchQuaternion,scratchRollQuaternion,scratchPitchQuaternion),scratchHeadingQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e.heading,scratchHPRQuaternion$1),Quaternion.multiply(scratchHeadingQuaternion,t,t)};const sampledQuaternionAxis=new Cartesian3,sampledQuaternionRotation=new Cartesian3,sampledQuaternionTempQuaternion=new Quaternion,sampledQuaternionQuaternion0=new Quaternion,sampledQuaternionQuaternion0Conjugate=new Quaternion;Quaternion.packedLength=4,Quaternion.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},Quaternion.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Quaternion),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n},Quaternion.packedInterpolationLength=3,Quaternion.convertPackedArrayForInterpolation=function(e,t,n,i){Quaternion.unpack(e,4*n,sampledQuaternionQuaternion0Conjugate),Quaternion.conjugate(sampledQuaternionQuaternion0Conjugate,sampledQuaternionQuaternion0Conjugate);for(let r=0,o=n-t+1;r<o;r++){const n=3*r;Quaternion.unpack(e,4*(t+r),sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0Conjugate,sampledQuaternionTempQuaternion),sampledQuaternionTempQuaternion.w<0&&Quaternion.negate(sampledQuaternionTempQuaternion,sampledQuaternionTempQuaternion),Quaternion.computeAxis(sampledQuaternionTempQuaternion,sampledQuaternionAxis);const o=Quaternion.computeAngle(sampledQuaternionTempQuaternion);defined(i)||(i=[]),i[n]=sampledQuaternionAxis.x*o,i[n+1]=sampledQuaternionAxis.y*o,i[n+2]=sampledQuaternionAxis.z*o}},Quaternion.unpackInterpolationResult=function(e,t,n,i,r){defined(r)||(r=new Quaternion),Cartesian3.fromArray(e,0,sampledQuaternionRotation);const o=Cartesian3.magnitude(sampledQuaternionRotation);return Quaternion.unpack(t,4*i,sampledQuaternionQuaternion0),0===o?Quaternion.clone(Quaternion.IDENTITY,sampledQuaternionTempQuaternion):Quaternion.fromAxisAngle(sampledQuaternionRotation,o,sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0,r)},Quaternion.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Quaternion(e.x,e.y,e.z,e.w)},Quaternion.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},Quaternion.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Quaternion.magnitude=function(e){return Math.sqrt(Quaternion.magnitudeSquared(e))},Quaternion.normalize=function(e,t){const n=1/Quaternion.magnitude(e),i=e.x*n,r=e.y*n,o=e.z*n,a=e.w*n;return t.x=i,t.y=r,t.z=o,t.w=a,t},Quaternion.inverse=function(e,t){const n=Quaternion.magnitudeSquared(e);return t=Quaternion.conjugate(e,t),Quaternion.multiplyByScalar(t,1/n,t)},Quaternion.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},Quaternion.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},Quaternion.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Quaternion.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Quaternion.multiply=function(e,t,n){const i=e.x,r=e.y,o=e.z,a=e.w,s=t.x,c=t.y,l=t.z,u=t.w,d=a*s+i*u+r*l-o*c,h=a*c-i*l+r*u+o*s,p=a*l+i*c-r*s+o*u,f=a*u-i*s-r*c-o*l;return n.x=d,n.y=h,n.z=p,n.w=f,n},Quaternion.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},Quaternion.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},Quaternion.computeAxis=function(e,t){const n=e.w;if(Math.abs(n-1)<CesiumMath.EPSILON6)return t.x=t.y=t.z=0,t;const i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},Quaternion.computeAngle=function(e){return Math.abs(e.w-1)<CesiumMath.EPSILON6?0:2*Math.acos(e.w)};let lerpScratch=new Quaternion;Quaternion.lerp=function(e,t,n,i){return lerpScratch=Quaternion.multiplyByScalar(t,n,lerpScratch),i=Quaternion.multiplyByScalar(e,1-n,i),Quaternion.add(lerpScratch,i,i)};let slerpEndNegated=new Quaternion,slerpScaledP=new Quaternion,slerpScaledR=new Quaternion;Quaternion.slerp=function(e,t,n,i){let r=Quaternion.dot(e,t),o=t;if(r<0&&(r=-r,o=slerpEndNegated=Quaternion.negate(t,slerpEndNegated)),1-r<CesiumMath.EPSILON6)return Quaternion.lerp(e,o,n,i);const a=Math.acos(r);return slerpScaledP=Quaternion.multiplyByScalar(e,Math.sin((1-n)*a),slerpScaledP),slerpScaledR=Quaternion.multiplyByScalar(o,Math.sin(n*a),slerpScaledR),i=Quaternion.add(slerpScaledP,slerpScaledR,i),Quaternion.multiplyByScalar(i,1/Math.sin(a),i)},Quaternion.log=function(e,t){const n=CesiumMath.acosClamped(e.w);let i=0;return 0!==n&&(i=n/Math.sin(n)),Cartesian3.multiplyByScalar(e,i,t)},Quaternion.exp=function(e,t){const n=Cartesian3.magnitude(e);let i=0;return 0!==n&&(i=Math.sin(n)/n),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=Math.cos(n),t};const squadScratchCartesian0=new Cartesian3,squadScratchCartesian1=new Cartesian3,squadScratchQuaternion0=new Quaternion,squadScratchQuaternion1=new Quaternion;Quaternion.computeInnerQuadrangle=function(e,t,n,i){const r=Quaternion.conjugate(t,squadScratchQuaternion0);Quaternion.multiply(r,n,squadScratchQuaternion1);const o=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian0);Quaternion.multiply(r,e,squadScratchQuaternion1);const a=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian1);return Cartesian3.add(o,a,o),Cartesian3.multiplyByScalar(o,.25,o),Cartesian3.negate(o,o),Quaternion.exp(o,squadScratchQuaternion0),Quaternion.multiply(t,squadScratchQuaternion0,i)},Quaternion.squad=function(e,t,n,i,r,o){const a=Quaternion.slerp(e,t,r,squadScratchQuaternion0),s=Quaternion.slerp(n,i,r,squadScratchQuaternion1);return Quaternion.slerp(a,s,2*r*(1-r),o)};const fastSlerpScratchQuaternion=new Quaternion,opmu=1.9011074535173003,u=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],v=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bT=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bD=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){const t=e+1,n=2*t+1;u[e]=1/(t*n),v[e]=t/n}u[7]=opmu/136,v[7]=8*opmu/17,Quaternion.fastSlerp=function(e,t,n,i){let r,o=Quaternion.dot(e,t);o>=0?r=1:(r=-1,o=-o);const a=o-1,s=1-n,c=n*n,l=s*s;for(let e=7;e>=0;--e)bT[e]=(u[e]*c-v[e])*a,bD[e]=(u[e]*l-v[e])*a;const d=r*n*(1+bT[0]*(1+bT[1]*(1+bT[2]*(1+bT[3]*(1+bT[4]*(1+bT[5]*(1+bT[6]*(1+bT[7])))))))),h=s*(1+bD[0]*(1+bD[1]*(1+bD[2]*(1+bD[3]*(1+bD[4]*(1+bD[5]*(1+bD[6]*(1+bD[7])))))))),p=Quaternion.multiplyByScalar(e,h,fastSlerpScratchQuaternion);return Quaternion.multiplyByScalar(t,d,i),Quaternion.add(p,i,i)},Quaternion.fastSquad=function(e,t,n,i,r,o){const a=Quaternion.fastSlerp(e,t,r,squadScratchQuaternion0),s=Quaternion.fastSlerp(n,i,r,squadScratchQuaternion1);return Quaternion.fastSlerp(a,s,2*r*(1-r),o)},Quaternion.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Quaternion.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},Quaternion.ZERO=Object.freeze(new Quaternion(0,0,0,0)),Quaternion.IDENTITY=Object.freeze(new Quaternion(0,0,0,1)),Quaternion.prototype.clone=function(e){return Quaternion.clone(this,e)},Quaternion.prototype.equals=function(e){return Quaternion.equals(this,e)},Quaternion.prototype.equalsEpsilon=function(e,t){return Quaternion.equalsEpsilon(this,e,t)},Quaternion.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"};const Transforms={},vectorProductLocalFrame={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},degeneratePositionLocalFrame={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},localFrameToFixedFrameCache={},scratchCalculateCartesian={east:new Cartesian3,north:new Cartesian3,up:new Cartesian3,west:new Cartesian3,south:new Cartesian3,down:new Cartesian3};let scratchFirstCartesian=new Cartesian3,scratchSecondCartesian=new Cartesian3,scratchThirdCartesian=new Cartesian3;Transforms.localFrameToFixedFrameGenerator=function(e,t){if(!vectorProductLocalFrame.hasOwnProperty(e)||!vectorProductLocalFrame[e].hasOwnProperty(t))throw new DeveloperError("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=vectorProductLocalFrame[e][t];let i;const r=e+t;return defined(localFrameToFixedFrameCache[r])?i=localFrameToFixedFrameCache[r]:(i=function(i,r,o){if(defined(o)||(o=new Matrix4),Cartesian3.equalsEpsilon(i,Cartesian3.ZERO,CesiumMath.EPSILON14))Cartesian3.unpack(degeneratePositionLocalFrame[e],0,scratchFirstCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[t],0,scratchSecondCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[n],0,scratchThirdCartesian);else if(CesiumMath.equalsEpsilon(i.x,0,CesiumMath.EPSILON14)&&CesiumMath.equalsEpsilon(i.y,0,CesiumMath.EPSILON14)){const r=CesiumMath.sign(i.z);Cartesian3.unpack(degeneratePositionLocalFrame[e],0,scratchFirstCartesian),"east"!==e&&"west"!==e&&Cartesian3.multiplyByScalar(scratchFirstCartesian,r,scratchFirstCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[t],0,scratchSecondCartesian),"east"!==t&&"west"!==t&&Cartesian3.multiplyByScalar(scratchSecondCartesian,r,scratchSecondCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[n],0,scratchThirdCartesian),"east"!==n&&"west"!==n&&Cartesian3.multiplyByScalar(scratchThirdCartesian,r,scratchThirdCartesian)}else{(r=defaultValue(r,Ellipsoid.WGS84)).geodeticSurfaceNormal(i,scratchCalculateCartesian.up);const o=scratchCalculateCartesian.up,a=scratchCalculateCartesian.east;a.x=-i.y,a.y=i.x,a.z=0,Cartesian3.normalize(a,scratchCalculateCartesian.east),Cartesian3.cross(o,a,scratchCalculateCartesian.north),Cartesian3.multiplyByScalar(scratchCalculateCartesian.up,-1,scratchCalculateCartesian.down),Cartesian3.multiplyByScalar(scratchCalculateCartesian.east,-1,scratchCalculateCartesian.west),Cartesian3.multiplyByScalar(scratchCalculateCartesian.north,-1,scratchCalculateCartesian.south),scratchFirstCartesian=scratchCalculateCartesian[e],scratchSecondCartesian=scratchCalculateCartesian[t],scratchThirdCartesian=scratchCalculateCartesian[n]}return o[0]=scratchFirstCartesian.x,o[1]=scratchFirstCartesian.y,o[2]=scratchFirstCartesian.z,o[3]=0,o[4]=scratchSecondCartesian.x,o[5]=scratchSecondCartesian.y,o[6]=scratchSecondCartesian.z,o[7]=0,o[8]=scratchThirdCartesian.x,o[9]=scratchThirdCartesian.y,o[10]=scratchThirdCartesian.z,o[11]=0,o[12]=i.x,o[13]=i.y,o[14]=i.z,o[15]=1,o},localFrameToFixedFrameCache[r]=i),i},Transforms.eastNorthUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("east","north"),Transforms.northEastDownToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","east"),Transforms.northUpEastToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","up"),Transforms.northWestUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","west");const scratchHPRQuaternion=new Quaternion,scratchScale$6=new Cartesian3(1,1,1),scratchHPRMatrix4=new Matrix4;Transforms.headingPitchRollToFixedFrame=function(e,t,n,i,r){i=defaultValue(i,Transforms.eastNorthUpToFixedFrame);const o=Quaternion.fromHeadingPitchRoll(t,scratchHPRQuaternion),a=Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO,o,scratchScale$6,scratchHPRMatrix4);return r=i(e,n,r),Matrix4.multiply(r,a,r)};const scratchENUMatrix4=new Matrix4,scratchHPRMatrix3=new Matrix3;Transforms.headingPitchRollQuaternion=function(e,t,n,i,r){const o=Transforms.headingPitchRollToFixedFrame(e,t,n,i,scratchENUMatrix4),a=Matrix4.getMatrix3(o,scratchHPRMatrix3);return Quaternion.fromRotationMatrix(a,r)};const noScale=new Cartesian3(1,1,1),hprCenterScratch=new Cartesian3,ffScratch=new Matrix4,hprTransformScratch=new Matrix4,hprRotationScratch=new Matrix3,hprQuaternionScratch=new Quaternion;Transforms.fixedFrameToHeadingPitchRoll=function(e,t,n,i){t=defaultValue(t,Ellipsoid.WGS84),n=defaultValue(n,Transforms.eastNorthUpToFixedFrame),defined(i)||(i=new HeadingPitchRoll);const r=Matrix4.getTranslation(e,hprCenterScratch);if(Cartesian3.equals(r,Cartesian3.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let o=Matrix4.inverseTransformation(n(r,t,ffScratch),ffScratch),a=Matrix4.setScale(e,noScale,hprTransformScratch);a=Matrix4.setTranslation(a,Cartesian3.ZERO,a),o=Matrix4.multiply(o,a,o);let s=Quaternion.fromRotationMatrix(Matrix4.getMatrix3(o,hprRotationScratch),hprQuaternionScratch);return s=Quaternion.normalize(s,s),HeadingPitchRoll.fromQuaternion(s,i)};const gmstConstant0=24110.54841,gmstConstant1=8640184.812866,gmstConstant2=.093104,gmstConstant3=-62e-7,rateCoef=11772758384668e-32,wgs84WRPrecessing=72921158553e-15,twoPiOverSecondsInDay=CesiumMath.TWO_PI/86400;let dateInUtc=new JulianDate;Transforms.computeTemeToPseudoFixedMatrix=function(e,t){dateInUtc=JulianDate.addSeconds(e,-JulianDate.computeTaiMinusUtc(e),dateInUtc);const n=dateInUtc.dayNumber,i=dateInUtc.secondsOfDay;let r;const o=n-2451545;r=i>=43200?(o+.5)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY:(o-.5)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY;const a=(gmstConstant0+r*(gmstConstant1+r*(gmstConstant2+r*gmstConstant3)))*twoPiOverSecondsInDay%CesiumMath.TWO_PI+(wgs84WRPrecessing+rateCoef*(n-2451545.5))*((i+.5*TimeConstants$1.SECONDS_PER_DAY)%TimeConstants$1.SECONDS_PER_DAY),s=Math.cos(a),c=Math.sin(a);return defined(t)?(t[0]=s,t[1]=-c,t[2]=0,t[3]=c,t[4]=s,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(s,c,0,-c,s,0,0,0,1)},Transforms.iau2006XysData=new Iau2006XysData,Transforms.earthOrientationParameters=EarthOrientationParameters.NONE;const ttMinusTai=32.184,j2000ttDays=2451545;Transforms.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+ttMinusTai,i=e.stop.dayNumber,r=e.stop.secondsOfDay+ttMinusTai,o=Transforms.iau2006XysData.preload(t,n,i,r),a=Transforms.earthOrientationParameters.getPromiseToLoad();return when.all([o,a])},Transforms.computeIcrfToFixedMatrix=function(e,t){defined(t)||(t=new Matrix3);const n=Transforms.computeFixedToIcrfMatrix(e,t);if(defined(n))return Matrix3.transpose(n,t)};const xysScratch=new Iau2006XysSample(0,0,0),eopScratch=new EarthOrientationParametersSample(0,0,0,0,0,0),rotation1Scratch=new Matrix3,rotation2Scratch=new Matrix3;Transforms.computeFixedToIcrfMatrix=function(e,t){defined(t)||(t=new Matrix3);const n=Transforms.earthOrientationParameters.compute(e,eopScratch);if(!defined(n))return;const i=e.dayNumber,r=e.secondsOfDay+ttMinusTai,o=Transforms.iau2006XysData.computeXysRadians(i,r,xysScratch);if(!defined(o))return;const a=o.x+n.xPoleOffset,s=o.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-a*a-s*s)),l=rotation1Scratch;l[0]=1-c*a*a,l[3]=-c*a*s,l[6]=a,l[1]=-c*a*s,l[4]=1-c*s*s,l[7]=s,l[2]=-a,l[5]=-s,l[8]=1-c*(a*a+s*s);const u=Matrix3.fromRotationZ(-o.s,rotation2Scratch),d=Matrix3.multiply(l,u,rotation1Scratch),h=e.dayNumber-2451545,p=(e.secondsOfDay-JulianDate.computeTaiMinusUtc(e)+n.ut1MinusUtc)/TimeConstants$1.SECONDS_PER_DAY;let f=.779057273264+p+.00273781191135448*(h+p);f=f%1*CesiumMath.TWO_PI;const m=Matrix3.fromRotationZ(f,rotation2Scratch),g=Matrix3.multiply(d,m,rotation1Scratch),_=Math.cos(n.xPoleWander),y=Math.cos(n.yPoleWander),C=Math.sin(n.xPoleWander),T=Math.sin(n.yPoleWander);let S=i-j2000ttDays+r/TimeConstants$1.SECONDS_PER_DAY;S/=36525;const A=-47e-6*S*CesiumMath.RADIANS_PER_DEGREE/3600,v=Math.cos(A),E=Math.sin(A),b=rotation2Scratch;return b[0]=_*v,b[1]=_*E,b[2]=C,b[3]=-y*E+T*C*v,b[4]=y*v+T*C*E,b[5]=-T*_,b[6]=-T*E-y*C*v,b[7]=T*v-y*C*E,b[8]=y*_,Matrix3.multiply(g,b,t)};const pointToWindowCoordinatesTemp=new Cartesian4;Transforms.pointToWindowCoordinates=function(e,t,n,i){return(i=Transforms.pointToGLWindowCoordinates(e,t,n,i)).y=2*t[5]-i.y,i},Transforms.pointToGLWindowCoordinates=function(e,t,n,i){defined(i)||(i=new Cartesian2);const r=pointToWindowCoordinatesTemp;return Matrix4.multiplyByVector(e,Cartesian4.fromElements(n.x,n.y,n.z,1,r),r),Cartesian4.multiplyByScalar(r,1/r.w,r),Matrix4.multiplyByVector(t,r,r),Cartesian2.fromCartesian4(r,i)};const normalScratch$5=new Cartesian3,rightScratch$1=new Cartesian3,upScratch=new Cartesian3;Transforms.rotationMatrixFromPositionVelocity=function(e,t,n,i){const r=defaultValue(n,Ellipsoid.WGS84).geodeticSurfaceNormal(e,normalScratch$5);let o=Cartesian3.cross(t,r,rightScratch$1);Cartesian3.equalsEpsilon(o,Cartesian3.ZERO,CesiumMath.EPSILON6)&&(o=Cartesian3.clone(Cartesian3.UNIT_X,o));const a=Cartesian3.cross(o,t,upScratch);return Cartesian3.normalize(a,a),Cartesian3.cross(t,a,o),Cartesian3.negate(o,o),Cartesian3.normalize(o,o),defined(i)||(i=new Matrix3),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=o.x,i[4]=o.y,i[5]=o.z,i[6]=a.x,i[7]=a.y,i[8]=a.z,i};const swizzleMatrix=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),scratchCartographic$h=new Cartographic,scratchCartesian3Projection$1=new Cartesian3,scratchCenter$8=new Cartesian3,scratchRotation$2=new Matrix3,scratchFromENU=new Matrix4,scratchToENU=new Matrix4;Transforms.basisTo2D=function(e,t,n){const i=Matrix4.getTranslation(t,scratchCenter$8),r=e.ellipsoid,o=r.cartesianToCartographic(i,scratchCartographic$h),a=e.project(o,scratchCartesian3Projection$1);Cartesian3.fromElements(a.z,a.x,a.y,a);const s=Transforms.eastNorthUpToFixedFrame(i,r,scratchFromENU),c=Matrix4.inverseTransformation(s,scratchToENU),l=Matrix4.getMatrix3(t,scratchRotation$2),u=Matrix4.multiplyByMatrix3(c,l,n);return Matrix4.multiply(swizzleMatrix,u,n),Matrix4.setTranslation(n,a,n),n},Transforms.wgs84To2DModelMatrix=function(e,t,n){const i=e.ellipsoid,r=Transforms.eastNorthUpToFixedFrame(t,i,scratchFromENU),o=Matrix4.inverseTransformation(r,scratchToENU),a=i.cartesianToCartographic(t,scratchCartographic$h),s=e.project(a,scratchCartesian3Projection$1);Cartesian3.fromElements(s.z,s.x,s.y,s);const c=Matrix4.fromTranslation(s,scratchFromENU);return Matrix4.multiply(swizzleMatrix,o,n),Matrix4.multiply(c,n,n),n};const scratchCart4=new Cartesian4;function EllipsoidTangentPlane(e,t){e=(t=defaultValue(t,Ellipsoid.WGS84)).scaleToGeodeticSurface(e);const n=Transforms.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(n,0,scratchCart4)),this._yAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(n,1,scratchCart4));const i=Cartesian3.fromCartesian4(Matrix4.getColumn(n,2,scratchCart4));this._plane=Plane.fromPointNormal(e,i)}Object.defineProperties(EllipsoidTangentPlane.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});const tmp=new AxisAlignedBoundingBox;EllipsoidTangentPlane.fromPoints=function(e,t){return new EllipsoidTangentPlane(AxisAlignedBoundingBox.fromPoints(e,tmp).center,t)};const scratchProjectPointOntoPlaneRay=new Ray,scratchProjectPointOntoPlaneCartesian3=new Cartesian3;EllipsoidTangentPlane.prototype.projectPointOntoPlane=function(e,t){const n=scratchProjectPointOntoPlaneRay;n.origin=e,Cartesian3.normalize(e,n.direction);let i=IntersectionTests.rayPlane(n,this._plane,scratchProjectPointOntoPlaneCartesian3);if(defined(i)||(Cartesian3.negate(n.direction,n.direction),i=IntersectionTests.rayPlane(n,this._plane,scratchProjectPointOntoPlaneCartesian3)),defined(i)){const e=Cartesian3.subtract(i,this._origin,i),n=Cartesian3.dot(this._xAxis,e),r=Cartesian3.dot(this._yAxis,e);return defined(t)?(t.x=n,t.y=r,t):new Cartesian2(n,r)}},EllipsoidTangentPlane.prototype.projectPointsOntoPlane=function(e,t){defined(t)||(t=[]);let n=0;const i=e.length;for(let r=0;r<i;r++){const i=this.projectPointOntoPlane(e[r],t[n]);defined(i)&&(t[n]=i,n++)}return t.length=n,t},EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane=function(e,t){defined(t)||(t=new Cartesian2);const n=scratchProjectPointOntoPlaneRay;n.origin=e,Cartesian3.clone(this._plane.normal,n.direction);let i=IntersectionTests.rayPlane(n,this._plane,scratchProjectPointOntoPlaneCartesian3);defined(i)||(Cartesian3.negate(n.direction,n.direction),i=IntersectionTests.rayPlane(n,this._plane,scratchProjectPointOntoPlaneCartesian3));const r=Cartesian3.subtract(i,this._origin,i),o=Cartesian3.dot(this._xAxis,r),a=Cartesian3.dot(this._yAxis,r);return t.x=o,t.y=a,t},EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane=function(e,t){defined(t)||(t=[]);const n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};const projectPointsOntoEllipsoidScratch=new Cartesian3;function OrientedBoundingBox(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.halfAxes=Matrix3.clone(defaultValue(t,Matrix3.ZERO))}EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid=function(e,t){defined(t)||(t=new Cartesian3);const n=this._ellipsoid,i=this._origin,r=this._xAxis,o=this._yAxis,a=projectPointsOntoEllipsoidScratch;return Cartesian3.multiplyByScalar(r,e.x,a),t=Cartesian3.add(i,a,t),Cartesian3.multiplyByScalar(o,e.y,a),Cartesian3.add(t,a,t),n.scaleToGeocentricSurface(t,t),t},EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.projectPointOntoEllipsoid(e[i],t[i]);return t},OrientedBoundingBox.packedLength=Cartesian3.packedLength+Matrix3.packedLength,OrientedBoundingBox.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e.center,t,n),Matrix3.pack(e.halfAxes,t,n+Cartesian3.packedLength),t},OrientedBoundingBox.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new OrientedBoundingBox),Cartesian3.unpack(e,t,n.center),Matrix3.unpack(e,t+Cartesian3.packedLength,n.halfAxes),n};const scratchCartesian1$8=new Cartesian3,scratchCartesian2$b=new Cartesian3,scratchCartesian3$c=new Cartesian3,scratchCartesian4$6=new Cartesian3,scratchCartesian5$2=new Cartesian3,scratchCartesian6$1=new Cartesian3,scratchCovarianceResult=new Matrix3,scratchEigenResult={unitary:new Matrix3,diagonal:new Matrix3};OrientedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new OrientedBoundingBox),!defined(e)||0===e.length)return t.halfAxes=Matrix3.ZERO,t.center=Cartesian3.ZERO,t;let n;const i=e.length,r=Cartesian3.clone(e[0],scratchCartesian1$8);for(n=1;n<i;n++)Cartesian3.add(r,e[n],r);const o=1/i;Cartesian3.multiplyByScalar(r,o,r);let a,s=0,c=0,l=0,u=0,d=0,h=0;for(n=0;n<i;n++)a=Cartesian3.subtract(e[n],r,scratchCartesian2$b),s+=a.x*a.x,c+=a.x*a.y,l+=a.x*a.z,u+=a.y*a.y,d+=a.y*a.z,h+=a.z*a.z;s*=o,c*=o,l*=o,u*=o,d*=o,h*=o;const p=scratchCovarianceResult;p[0]=s,p[1]=c,p[2]=l,p[3]=c,p[4]=u,p[5]=d,p[6]=l,p[7]=d,p[8]=h;const f=Matrix3.computeEigenDecomposition(p,scratchEigenResult),m=Matrix3.clone(f.unitary,t.halfAxes);let g=Matrix3.getColumn(m,0,scratchCartesian4$6),_=Matrix3.getColumn(m,1,scratchCartesian5$2),y=Matrix3.getColumn(m,2,scratchCartesian6$1),C=-Number.MAX_VALUE,T=-Number.MAX_VALUE,S=-Number.MAX_VALUE,A=Number.MAX_VALUE,v=Number.MAX_VALUE,E=Number.MAX_VALUE;for(n=0;n<i;n++)a=e[n],C=Math.max(Cartesian3.dot(g,a),C),T=Math.max(Cartesian3.dot(_,a),T),S=Math.max(Cartesian3.dot(y,a),S),A=Math.min(Cartesian3.dot(g,a),A),v=Math.min(Cartesian3.dot(_,a),v),E=Math.min(Cartesian3.dot(y,a),E);g=Cartesian3.multiplyByScalar(g,.5*(A+C),g),_=Cartesian3.multiplyByScalar(_,.5*(v+T),_),y=Cartesian3.multiplyByScalar(y,.5*(E+S),y);const b=Cartesian3.add(g,_,t.center);Cartesian3.add(b,y,b);const x=scratchCartesian3$c;return x.x=C-A,x.y=T-v,x.z=S-E,Cartesian3.multiplyByScalar(x,.5,x),Matrix3.multiplyByScale(t.halfAxes,x,t.halfAxes),t};const scratchOffset=new Cartesian3,scratchScale$5=new Cartesian3;function fromPlaneExtents(e,t,n,i,r,o,a,s,c,l,u){defined(u)||(u=new OrientedBoundingBox);const d=u.halfAxes;Matrix3.setColumn(d,0,t,d),Matrix3.setColumn(d,1,n,d),Matrix3.setColumn(d,2,i,d);let h=scratchOffset;h.x=(r+o)/2,h.y=(a+s)/2,h.z=(c+l)/2;const p=scratchScale$5;p.x=(o-r)/2,p.y=(s-a)/2,p.z=(l-c)/2;const f=u.center;return h=Matrix3.multiplyByVector(d,h,h),Cartesian3.add(e,h,f),Matrix3.multiplyByScale(d,p,d),u}const scratchRectangleCenterCartographic=new Cartographic,scratchRectangleCenter=new Cartesian3,scratchPerimeterCartographicNC=new Cartographic,scratchPerimeterCartographicNW=new Cartographic,scratchPerimeterCartographicCW=new Cartographic,scratchPerimeterCartographicSW=new Cartographic,scratchPerimeterCartographicSC=new Cartographic,scratchPerimeterCartesianNC=new Cartesian3,scratchPerimeterCartesianNW=new Cartesian3,scratchPerimeterCartesianCW=new Cartesian3,scratchPerimeterCartesianSW=new Cartesian3,scratchPerimeterCartesianSC=new Cartesian3,scratchPerimeterProjectedNC=new Cartesian2,scratchPerimeterProjectedNW=new Cartesian2,scratchPerimeterProjectedCW=new Cartesian2,scratchPerimeterProjectedSW=new Cartesian2,scratchPerimeterProjectedSC=new Cartesian2,scratchPlaneOrigin=new Cartesian3,scratchPlaneNormal$1=new Cartesian3,scratchPlaneXAxis=new Cartesian3,scratchHorizonCartesian=new Cartesian3,scratchHorizonProjected=new Cartesian2,scratchMaxY=new Cartesian3,scratchMinY=new Cartesian3,scratchZ=new Cartesian3,scratchPlane$2=new Plane(Cartesian3.UNIT_X,0);OrientedBoundingBox.fromRectangle=function(e,t,n,i,r){let o,a,s,c,l,u,d;if(t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,Ellipsoid.WGS84),e.width<=CesiumMath.PI){const h=Rectangle.center(e,scratchRectangleCenterCartographic),p=new EllipsoidTangentPlane(i.cartographicToCartesian(h,scratchRectangleCenter),i);d=p.plane;const f=h.longitude,m=e.south<0&&e.north>0?0:h.latitude,g=Cartographic.fromRadians(f,e.north,n,scratchPerimeterCartographicNC),_=Cartographic.fromRadians(e.west,e.north,n,scratchPerimeterCartographicNW),y=Cartographic.fromRadians(e.west,m,n,scratchPerimeterCartographicCW),C=Cartographic.fromRadians(e.west,e.south,n,scratchPerimeterCartographicSW),T=Cartographic.fromRadians(f,e.south,n,scratchPerimeterCartographicSC),S=i.cartographicToCartesian(g,scratchPerimeterCartesianNC);let A=i.cartographicToCartesian(_,scratchPerimeterCartesianNW);const v=i.cartographicToCartesian(y,scratchPerimeterCartesianCW);let E=i.cartographicToCartesian(C,scratchPerimeterCartesianSW);const b=i.cartographicToCartesian(T,scratchPerimeterCartesianSC),x=p.projectPointToNearestOnPlane(S,scratchPerimeterProjectedNC),P=p.projectPointToNearestOnPlane(A,scratchPerimeterProjectedNW),D=p.projectPointToNearestOnPlane(v,scratchPerimeterProjectedCW),w=p.projectPointToNearestOnPlane(E,scratchPerimeterProjectedSW),M=p.projectPointToNearestOnPlane(b,scratchPerimeterProjectedSC);return o=Math.min(P.x,D.x,w.x),a=-o,c=Math.max(P.y,x.y),s=Math.min(w.y,M.y),_.height=C.height=t,A=i.cartographicToCartesian(_,scratchPerimeterCartesianNW),E=i.cartographicToCartesian(C,scratchPerimeterCartesianSW),l=Math.min(Plane.getPointDistance(d,A),Plane.getPointDistance(d,E)),u=n,fromPlaneExtents(p.origin,p.xAxis,p.yAxis,p.zAxis,o,a,s,c,l,u,r)}const h=e.south>0,p=e.north<0,f=h?e.south:p?e.north:0,m=Rectangle.center(e,scratchRectangleCenterCartographic).longitude,g=Cartesian3.fromRadians(m,f,n,i,scratchPlaneOrigin);g.z=0;const _=Math.abs(g.x)<CesiumMath.EPSILON10&&Math.abs(g.y)<CesiumMath.EPSILON10?Cartesian3.UNIT_X:Cartesian3.normalize(g,scratchPlaneNormal$1),y=Cartesian3.UNIT_Z,C=Cartesian3.cross(_,y,scratchPlaneXAxis);d=Plane.fromPointNormal(g,_,scratchPlane$2);const T=Cartesian3.fromRadians(m+CesiumMath.PI_OVER_TWO,f,n,i,scratchHorizonCartesian);a=Cartesian3.dot(Plane.projectPointOntoPlane(d,T,scratchHorizonProjected),C),o=-a,c=Cartesian3.fromRadians(0,e.north,p?t:n,i,scratchMaxY).z,s=Cartesian3.fromRadians(0,e.south,h?t:n,i,scratchMinY).z;const S=Cartesian3.fromRadians(e.east,f,n,i,scratchZ);return l=Plane.getPointDistance(d,S),u=0,fromPlaneExtents(g,C,y,_,o,a,s,c,l,u,r)},OrientedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(Cartesian3.clone(e.center,t.center),Matrix3.clone(e.halfAxes,t.halfAxes),t):new OrientedBoundingBox(e.center,e.halfAxes)},OrientedBoundingBox.intersectPlane=function(e,t){const n=e.center,i=t.normal,r=e.halfAxes,o=i.x,a=i.y,s=i.z,c=Math.abs(o*r[Matrix3.COLUMN0ROW0]+a*r[Matrix3.COLUMN0ROW1]+s*r[Matrix3.COLUMN0ROW2])+Math.abs(o*r[Matrix3.COLUMN1ROW0]+a*r[Matrix3.COLUMN1ROW1]+s*r[Matrix3.COLUMN1ROW2])+Math.abs(o*r[Matrix3.COLUMN2ROW0]+a*r[Matrix3.COLUMN2ROW1]+s*r[Matrix3.COLUMN2ROW2]),l=Cartesian3.dot(i,n)+t.distance;return l<=-c?Intersect$1.OUTSIDE:l>=c?Intersect$1.INSIDE:Intersect$1.INTERSECTING};const scratchCartesianU=new Cartesian3,scratchCartesianV=new Cartesian3,scratchCartesianW=new Cartesian3,scratchValidAxis2=new Cartesian3,scratchValidAxis3=new Cartesian3,scratchPPrime=new Cartesian3;OrientedBoundingBox.distanceSquaredTo=function(e,t){const n=Cartesian3.subtract(t,e.center,scratchOffset),i=e.halfAxes;let r=Matrix3.getColumn(i,0,scratchCartesianU),o=Matrix3.getColumn(i,1,scratchCartesianV),a=Matrix3.getColumn(i,2,scratchCartesianW);const s=Cartesian3.magnitude(r),c=Cartesian3.magnitude(o),l=Cartesian3.magnitude(a);let u=!0,d=!0,h=!0;s>0?Cartesian3.divideByScalar(r,s,r):u=!1,c>0?Cartesian3.divideByScalar(o,c,o):d=!1,l>0?Cartesian3.divideByScalar(a,l,a):h=!1;const p=!u+!d+!h;let f,m,g;if(1===p){let e=r;f=o,m=a,d?h||(e=a,m=r):(e=o,f=r),g=Cartesian3.cross(f,m,scratchValidAxis3),e===r?r=g:e===o?o=g:e===a&&(a=g)}else if(2===p){f=r,d?f=o:h&&(f=a);let e=Cartesian3.UNIT_Y;e.equalsEpsilon(f,CesiumMath.EPSILON3)&&(e=Cartesian3.UNIT_X),m=Cartesian3.cross(f,e,scratchValidAxis2),Cartesian3.normalize(m,m),g=Cartesian3.cross(f,m,scratchValidAxis3),Cartesian3.normalize(g,g),f===r?(o=m,a=g):f===o?(a=m,r=g):f===a&&(r=m,o=g)}else 3===p&&(r=Cartesian3.UNIT_X,o=Cartesian3.UNIT_Y,a=Cartesian3.UNIT_Z);const _=scratchPPrime;_.x=Cartesian3.dot(n,r),_.y=Cartesian3.dot(n,o),_.z=Cartesian3.dot(n,a);let y,C=0;return _.x<-s?(y=_.x+s,C+=y*y):_.x>s&&(y=_.x-s,C+=y*y),_.y<-c?(y=_.y+c,C+=y*y):_.y>c&&(y=_.y-c,C+=y*y),_.z<-l?(y=_.z+l,C+=y*y):_.z>l&&(y=_.z-l,C+=y*y),C};const scratchCorner=new Cartesian3,scratchToCenter$1=new Cartesian3;OrientedBoundingBox.computePlaneDistances=function(e,t,n,i){defined(i)||(i=new Interval);let r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;const a=e.center,s=e.halfAxes,c=Matrix3.getColumn(s,0,scratchCartesianU),l=Matrix3.getColumn(s,1,scratchCartesianV),u=Matrix3.getColumn(s,2,scratchCartesianW),d=Cartesian3.add(c,l,scratchCorner);Cartesian3.add(d,u,d),Cartesian3.add(d,a,d);const h=Cartesian3.subtract(d,t,scratchToCenter$1);let p=Cartesian3.dot(n,h);return r=Math.min(p,r),o=Math.max(p,o),Cartesian3.add(a,c,d),Cartesian3.add(d,l,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.add(a,c,d),Cartesian3.subtract(d,l,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.add(a,c,d),Cartesian3.subtract(d,l,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.subtract(a,c,d),Cartesian3.add(d,l,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.subtract(a,c,d),Cartesian3.add(d,l,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.subtract(a,c,d),Cartesian3.subtract(d,l,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),Cartesian3.subtract(a,c,d),Cartesian3.subtract(d,l,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(n,h),r=Math.min(p,r),o=Math.max(p,o),i.start=r,i.stop=o,i};const scratchBoundingSphere$3=new BoundingSphere;OrientedBoundingBox.isOccluded=function(e,t){const n=BoundingSphere.fromOrientedBoundingBox(e,scratchBoundingSphere$3);return!t.isBoundingSphereVisible(n)},OrientedBoundingBox.prototype.intersectPlane=function(e){return OrientedBoundingBox.intersectPlane(this,e)},OrientedBoundingBox.prototype.distanceSquaredTo=function(e){return OrientedBoundingBox.distanceSquaredTo(this,e)},OrientedBoundingBox.prototype.computePlaneDistances=function(e,t,n){return OrientedBoundingBox.computePlaneDistances(this,e,t,n)},OrientedBoundingBox.prototype.isOccluded=function(e){return OrientedBoundingBox.isOccluded(this,e)},OrientedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Matrix3.equals(e.halfAxes,t.halfAxes)},OrientedBoundingBox.prototype.clone=function(e){return OrientedBoundingBox.clone(this,e)},OrientedBoundingBox.prototype.equals=function(e){return OrientedBoundingBox.equals(this,e)};const WebGLConstants={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047};var WebGLConstants$1=Object.freeze(WebGLConstants);const ComponentDatatype={BYTE:WebGLConstants$1.BYTE,UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,SHORT:WebGLConstants$1.SHORT,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,INT:WebGLConstants$1.INT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,FLOAT:WebGLConstants$1.FLOAT,DOUBLE:WebGLConstants$1.DOUBLE,getSizeInBytes:function(e){switch(e){case ComponentDatatype.BYTE:return Int8Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case ComponentDatatype.SHORT:return Int16Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case ComponentDatatype.INT:return Int32Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case ComponentDatatype.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case ComponentDatatype.DOUBLE:return Float64Array.BYTES_PER_ELEMENT}},fromTypedArray:function(e){return e instanceof Int8Array?ComponentDatatype.BYTE:e instanceof Uint8Array?ComponentDatatype.UNSIGNED_BYTE:e instanceof Int16Array?ComponentDatatype.SHORT:e instanceof Uint16Array?ComponentDatatype.UNSIGNED_SHORT:e instanceof Int32Array?ComponentDatatype.INT:e instanceof Uint32Array?ComponentDatatype.UNSIGNED_INT:e instanceof Float32Array?ComponentDatatype.FLOAT:e instanceof Float64Array?ComponentDatatype.DOUBLE:void 0},validate:function(e){return defined(e)&&(e===ComponentDatatype.BYTE||e===ComponentDatatype.UNSIGNED_BYTE||e===ComponentDatatype.SHORT||e===ComponentDatatype.UNSIGNED_SHORT||e===ComponentDatatype.INT||e===ComponentDatatype.UNSIGNED_INT||e===ComponentDatatype.FLOAT||e===ComponentDatatype.DOUBLE)},createTypedArray:function(e,t){switch(e){case ComponentDatatype.BYTE:return new Int8Array(t);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t);case ComponentDatatype.SHORT:return new Int16Array(t);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t);case ComponentDatatype.INT:return new Int32Array(t);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t);case ComponentDatatype.FLOAT:return new Float32Array(t);case ComponentDatatype.DOUBLE:return new Float64Array(t)}},createArrayBufferView:function(e,t,n,i){switch(n=defaultValue(n,0),i=defaultValue(i,(t.byteLength-n)/ComponentDatatype.getSizeInBytes(e)),e){case ComponentDatatype.BYTE:return new Int8Array(t,n,i);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case ComponentDatatype.SHORT:return new Int16Array(t,n,i);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case ComponentDatatype.INT:return new Int32Array(t,n,i);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t,n,i);case ComponentDatatype.FLOAT:return new Float32Array(t,n,i);case ComponentDatatype.DOUBLE:return new Float64Array(t,n,i)}},fromName:function(e){switch(e){case"BYTE":return ComponentDatatype.BYTE;case"UNSIGNED_BYTE":return ComponentDatatype.UNSIGNED_BYTE;case"SHORT":return ComponentDatatype.SHORT;case"UNSIGNED_SHORT":return ComponentDatatype.UNSIGNED_SHORT;case"INT":return ComponentDatatype.INT;case"UNSIGNED_INT":return ComponentDatatype.UNSIGNED_INT;case"FLOAT":return ComponentDatatype.FLOAT;case"DOUBLE":return ComponentDatatype.DOUBLE}}};var ComponentDatatype$1=Object.freeze(ComponentDatatype);function Matrix2(e,t,n,i){this[0]=defaultValue(e,0),this[1]=defaultValue(n,0),this[2]=defaultValue(t,0),this[3]=defaultValue(i,0)}Matrix2.packedLength=4,Matrix2.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t},Matrix2.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix2),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n},Matrix2.clone=function(e,t){if(defined(e))return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Matrix2(e[0],e[2],e[1],e[3])},Matrix2.fromArray=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Matrix2),n[0]=e[t],n[1]=e[t+1],n[2]=e[t+2],n[3]=e[t+3],n},Matrix2.fromColumnMajorArray=function(e,t){return Matrix2.clone(e,t)},Matrix2.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Matrix2(e[0],e[1],e[2],e[3])},Matrix2.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Matrix2(e.x,0,0,e.y)},Matrix2.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Matrix2(e,0,0,e)},Matrix2.fromRotation=function(e,t){const n=Math.cos(e),i=Math.sin(e);return defined(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Matrix2(n,-i,i,n)},Matrix2.toArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},Matrix2.getElementIndex=function(e,t){return 2*e+t},Matrix2.getColumn=function(e,t,n){const i=2*t,r=e[i],o=e[i+1];return n.x=r,n.y=o,n},Matrix2.setColumn=function(e,t,n,i){const r=2*t;return(i=Matrix2.clone(e,i))[r]=n.x,i[r+1]=n.y,i},Matrix2.getRow=function(e,t,n){const i=e[t],r=e[t+2];return n.x=i,n.y=r,n},Matrix2.setRow=function(e,t,n,i){return(i=Matrix2.clone(e,i))[t]=n.x,i[t+2]=n.y,i};const scratchColumn=new Cartesian2;Matrix2.getScale=function(e,t){return t.x=Cartesian2.magnitude(Cartesian2.fromElements(e[0],e[1],scratchColumn)),t.y=Cartesian2.magnitude(Cartesian2.fromElements(e[2],e[3],scratchColumn)),t};const scratchScale$4=new Cartesian2;Matrix2.getMaximumScale=function(e){return Matrix2.getScale(e,scratchScale$4),Cartesian2.maximumComponent(scratchScale$4)},Matrix2.multiply=function(e,t,n){const i=e[0]*t[0]+e[2]*t[1],r=e[0]*t[2]+e[2]*t[3],o=e[1]*t[0]+e[3]*t[1],a=e[1]*t[2]+e[3]*t[3];return n[0]=i,n[1]=o,n[2]=r,n[3]=a,n},Matrix2.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n},Matrix2.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n},Matrix2.multiplyByVector=function(e,t,n){const i=e[0]*t.x+e[2]*t.y,r=e[1]*t.x+e[3]*t.y;return n.x=i,n.y=r,n},Matrix2.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},Matrix2.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n},Matrix2.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Matrix2.transpose=function(e,t){const n=e[0],i=e[2],r=e[1],o=e[3];return t[0]=n,t[1]=i,t[2]=r,t[3]=o,t},Matrix2.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},Matrix2.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},Matrix2.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]},Matrix2.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},Matrix2.IDENTITY=Object.freeze(new Matrix2(1,0,0,1)),Matrix2.ZERO=Object.freeze(new Matrix2(0,0,0,0)),Matrix2.COLUMN0ROW0=0,Matrix2.COLUMN0ROW1=1,Matrix2.COLUMN1ROW0=2,Matrix2.COLUMN1ROW1=3,Object.defineProperties(Matrix2.prototype,{length:{get:function(){return Matrix2.packedLength}}}),Matrix2.prototype.clone=function(e){return Matrix2.clone(this,e)},Matrix2.prototype.equals=function(e){return Matrix2.equals(this,e)},Matrix2.prototype.equalsEpsilon=function(e,t){return Matrix2.equalsEpsilon(this,e,t)},Matrix2.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"};const AttributeType={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",getMathType:function(e){switch(e){case AttributeType.SCALAR:return Number;case AttributeType.VEC2:return Cartesian2;case AttributeType.VEC3:return Cartesian3;case AttributeType.VEC4:return Cartesian4;case AttributeType.MAT2:return Matrix2;case AttributeType.MAT3:return Matrix3;case AttributeType.MAT4:return Matrix4}},getNumberOfComponents:function(e){switch(e){case AttributeType.SCALAR:return 1;case AttributeType.VEC2:return 2;case AttributeType.VEC3:return 3;case AttributeType.VEC4:case AttributeType.MAT2:return 4;case AttributeType.MAT3:return 9;case AttributeType.MAT4:return 16}},getGlslType:function(e){switch(e){case AttributeType.SCALAR:return"float";case AttributeType.VEC2:return"vec2";case AttributeType.VEC3:return"vec3";case AttributeType.VEC4:return"vec4";case AttributeType.MAT2:return"mat2";case AttributeType.MAT3:return"mat3";case AttributeType.MAT4:return"mat4"}}};var AttributeType$1=Object.freeze(AttributeType);const RIGHT_SHIFT=1/256,LEFT_SHIFT=256,AttributeCompression={octEncodeInRange:function(e,t,n){if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){const e=n.x,t=n.y;n.x=(1-Math.abs(t))*CesiumMath.signNotZero(e),n.y=(1-Math.abs(e))*CesiumMath.signNotZero(t)}return n.x=CesiumMath.toSNorm(n.x,t),n.y=CesiumMath.toSNorm(n.y,t),n},octEncode:function(e,t){return AttributeCompression.octEncodeInRange(e,255,t)}},octEncodeScratch=new Cartesian2,uint8ForceArray=new Uint8Array(1);function forceUint8(e){return uint8ForceArray[0]=e,uint8ForceArray[0]}AttributeCompression.octEncodeToCartesian4=function(e,t){return AttributeCompression.octEncodeInRange(e,65535,octEncodeScratch),t.x=forceUint8(octEncodeScratch.x*RIGHT_SHIFT),t.y=forceUint8(octEncodeScratch.x),t.z=forceUint8(octEncodeScratch.y*RIGHT_SHIFT),t.w=forceUint8(octEncodeScratch.y),t},AttributeCompression.octDecodeInRange=function(e,t,n,i){if(i.x=CesiumMath.fromSNorm(e,n),i.y=CesiumMath.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const e=i.x;i.x=(1-Math.abs(i.y))*CesiumMath.signNotZero(e),i.y=(1-Math.abs(e))*CesiumMath.signNotZero(i.y)}return Cartesian3.normalize(i,i)},AttributeCompression.octDecode=function(e,t,n){return AttributeCompression.octDecodeInRange(e,t,255,n)},AttributeCompression.octDecodeFromCartesian4=function(e,t){const n=e.x,i=e.y,r=e.z,o=e.w,a=n*LEFT_SHIFT+i,s=r*LEFT_SHIFT+o;return AttributeCompression.octDecodeInRange(a,s,65535,t)},AttributeCompression.octPackFloat=function(e){return 256*e.x+e.y};const scratchEncodeCart2=new Cartesian2;function zigZagDecode(e){return e>>1^-(1&e)}AttributeCompression.octEncodeFloat=function(e){return AttributeCompression.octEncode(e,scratchEncodeCart2),AttributeCompression.octPackFloat(scratchEncodeCart2)},AttributeCompression.octDecodeFloat=function(e,t){const n=e/256,i=Math.floor(n),r=256*(n-i);return AttributeCompression.octDecode(i,r,t)},AttributeCompression.octPack=function(e,t,n,i){const r=AttributeCompression.octEncodeFloat(e),o=AttributeCompression.octEncodeFloat(t),a=AttributeCompression.octEncode(n,scratchEncodeCart2);return i.x=65536*a.x+r,i.y=65536*a.y+o,i},AttributeCompression.octUnpack=function(e,t,n,i){let r=e.x/65536;const o=Math.floor(r),a=65536*(r-o);r=e.y/65536;const s=Math.floor(r),c=65536*(r-s);AttributeCompression.octDecodeFloat(a,t),AttributeCompression.octDecodeFloat(c,n),AttributeCompression.octDecode(o,s,i)},AttributeCompression.compressTextureCoordinates=function(e){return 4096*(4095*e.x|0)+(4095*e.y|0)},AttributeCompression.decompressTextureCoordinates=function(e,t){const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-4096*i)/4095,t},AttributeCompression.zigZagDeltaDecode=function(e,t,n){const i=e.length;let r=0,o=0,a=0;for(let s=0;s<i;++s)r+=zigZagDecode(e[s]),o+=zigZagDecode(t[s]),e[s]=r,t[s]=o,defined(n)&&(a+=zigZagDecode(n[s]),n[s]=a)},AttributeCompression.dequantize=function(e,t,n,i){const r=AttributeType$1.getNumberOfComponents(n);let o;switch(t){case ComponentDatatype$1.BYTE:o=127;break;case ComponentDatatype$1.UNSIGNED_BYTE:o=255;break;case ComponentDatatype$1.SHORT:o=32767;break;case ComponentDatatype$1.UNSIGNED_SHORT:o=65535;break;case ComponentDatatype$1.INT:o=2147483647;break;case ComponentDatatype$1.UNSIGNED_INT:o=4294967295}const a=new Float32Array(i*r);for(let t=0;t<i;t++)for(let n=0;n<r;n++){const i=t*r+n;a[i]=Math.max(e[i]/o,-1)}return a},AttributeCompression.decodeRGB565=function(e,t){const n=e.length;defined(t)||(t=new Float32Array(3*n));const i=1/31;for(let r=0;r<n;r++){const n=e[r],o=n>>11,a=n>>5&63,s=31&n,c=3*r;t[c]=o*i,t[c+1]=.015873015873015872*a,t[c+2]=s*i}return t};const TerrainExaggeration={getHeight:function(e,t,n){return(e-n)*t+n}},scratchCartographic$g=new Cartesian3;TerrainExaggeration.getPosition=function(e,t,n,i,r){const o=t.cartesianToCartographic(e,scratchCartographic$g),a=TerrainExaggeration.getHeight(o.height,n,i);return Cartesian3.fromRadians(o.longitude,o.latitude,a,t,r)};const TerrainQuantization={NONE:0,BITS12:1};var TerrainQuantization$1=Object.freeze(TerrainQuantization);const cartesian3Scratch$3=new Cartesian3,cartesian3DimScratch=new Cartesian3,cartesian2Scratch=new Cartesian2,matrix4Scratch$1=new Matrix4,matrix4Scratch2=new Matrix4,SHIFT_LEFT_12=Math.pow(2,12);function TerrainEncoding(e,t,n,i,r,o,a,s,c,l){let u,d,h=TerrainQuantization$1.NONE;if(defined(t)&&defined(n)&&defined(i)&&defined(r)){const e=t.minimum,o=t.maximum,a=Cartesian3.subtract(o,e,cartesian3DimScratch),s=i-n;h=Math.max(Cartesian3.maximumComponent(a),s)<SHIFT_LEFT_12-1?TerrainQuantization$1.BITS12:TerrainQuantization$1.NONE,u=Matrix4.inverseTransformation(r,new Matrix4);const c=Cartesian3.negate(e,cartesian3Scratch$3);Matrix4.multiply(Matrix4.fromTranslation(c,matrix4Scratch$1),u,u);const l=cartesian3Scratch$3;l.x=1/a.x,l.y=1/a.y,l.z=1/a.z,Matrix4.multiply(Matrix4.fromScale(l,matrix4Scratch$1),u,u),d=Matrix4.clone(r),Matrix4.setTranslation(d,Cartesian3.ZERO,d),r=Matrix4.clone(r,new Matrix4);const p=Matrix4.fromTranslation(e,matrix4Scratch$1),f=Matrix4.fromScale(a,matrix4Scratch2),m=Matrix4.multiply(p,f,matrix4Scratch$1);Matrix4.multiply(r,m,r),Matrix4.multiply(d,m,d)}this.quantization=h,this.minimumHeight=n,this.maximumHeight=i,this.center=Cartesian3.clone(e),this.toScaledENU=u,this.fromScaledENU=r,this.matrix=d,this.hasVertexNormals=o,this.hasWebMercatorT=defaultValue(a,!1),this.hasGeodeticSurfaceNormals=defaultValue(s,!1),this.exaggeration=defaultValue(c,1),this.exaggerationRelativeHeight=defaultValue(l,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}TerrainEncoding.prototype.encode=function(e,t,n,i,r,o,a,s){const c=i.x,l=i.y;if(this.quantization===TerrainQuantization$1.BITS12){(n=Matrix4.multiplyByPoint(this.toScaledENU,n,cartesian3Scratch$3)).x=CesiumMath.clamp(n.x,0,1),n.y=CesiumMath.clamp(n.y,0,1),n.z=CesiumMath.clamp(n.z,0,1);const i=this.maximumHeight-this.minimumHeight,o=CesiumMath.clamp((r-this.minimumHeight)/i,0,1);Cartesian2.fromElements(n.x,n.y,cartesian2Scratch);const s=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(n.z,o,cartesian2Scratch);const u=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(c,l,cartesian2Scratch);const d=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);if(e[t++]=s,e[t++]=u,e[t++]=d,this.hasWebMercatorT){Cartesian2.fromElements(a,0,cartesian2Scratch);const n=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);e[t++]=n}}else Cartesian3.subtract(n,this.center,cartesian3Scratch$3),e[t++]=cartesian3Scratch$3.x,e[t++]=cartesian3Scratch$3.y,e[t++]=cartesian3Scratch$3.z,e[t++]=r,e[t++]=c,e[t++]=l,this.hasWebMercatorT&&(e[t++]=a);return this.hasVertexNormals&&(e[t++]=AttributeCompression.octPackFloat(o)),this.hasGeodeticSurfaceNormals&&(e[t++]=s.x,e[t++]=s.y,e[t++]=s.z),t};const scratchPosition$d=new Cartesian3,scratchGeodeticSurfaceNormal=new Cartesian3;TerrainEncoding.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,r=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const o=this.stride;for(let a=0;a<r;a++){for(let n=0;n<i;n++){const r=a*i+n;t[a*o+n]=e[r]}const r=this.decodePosition(t,a,scratchPosition$d),s=n.geodeticSurfaceNormal(r,scratchGeodeticSurfaceNormal),c=a*o+this._offsetGeodeticSurfaceNormal;t[c]=s.x,t[c+1]=s.y,t[c+2]=s.z}},TerrainEncoding.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;const n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();const r=this.stride;for(let o=0;o<i;o++)for(let i=0;i<r;i++){const a=o*n+i;t[o*r+i]=e[a]}},TerrainEncoding.prototype.decodePosition=function(e,t,n){if(defined(n)||(n=new Cartesian3),t*=this.stride,this.quantization===TerrainQuantization$1.BITS12){const i=AttributeCompression.decompressTextureCoordinates(e[t],cartesian2Scratch);n.x=i.x,n.y=i.y;const r=AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch);return n.z=r.x,Matrix4.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],Cartesian3.add(n,this.center,n)},TerrainEncoding.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);const i=this.exaggeration,r=this.exaggerationRelativeHeight;if(1!==i&&this.hasGeodeticSurfaceNormals){const o=this.decodeGeodeticSurfaceNormal(e,t,scratchGeodeticSurfaceNormal),a=this.decodeHeight(e,t),s=TerrainExaggeration.getHeight(a,i,r)-a;n.x+=o.x*s,n.y+=o.y*s,n.z+=o.z*s}return n},TerrainEncoding.prototype.decodeTextureCoordinates=function(e,t,n){return defined(n)||(n=new Cartesian2),t*=this.stride,this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+2],n):Cartesian2.fromElements(e[t+4],e[t+5],n)},TerrainEncoding.prototype.decodeHeight=function(e,t){if(t*=this.stride,this.quantization===TerrainQuantization$1.BITS12){return AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight}return e[t+3]},TerrainEncoding.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+3],cartesian2Scratch).x:e[t+6]},TerrainEncoding.prototype.getOctEncodedNormal=function(e,t,n){const i=e[t=t*this.stride+this._offsetVertexNormal]/256,r=Math.floor(i),o=256*(i-r);return Cartesian2.fromElements(r,o,n)},TerrainEncoding.prototype.decodeGeodeticSurfaceNormal=function(e,t,n){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,n.x=e[t],n.y=e[t+1],n.z=e[t+2],n},TerrainEncoding.prototype._calculateStrideAndOffsets=function(){let e=0;if(this.quantization===TerrainQuantization$1.BITS12)e+=3;else e+=6;this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};const attributesIndicesNone={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},attributesIndicesBits12={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};function WebMercatorProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}TerrainEncoding.prototype.getAttributes=function(e){const t=ComponentDatatype$1.FLOAT,n=ComponentDatatype$1.getSizeInBytes(t),i=this.stride*n;let r=0;const o=[];function a(a,s){o.push({index:a,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:s,offsetInBytes:r,strideInBytes:i}),r+=s*n}if(this.quantization===TerrainQuantization$1.NONE){a(attributesIndicesNone.position3DAndHeight,4);let e=2;e+=this.hasWebMercatorT?1:0,e+=this.hasVertexNormals?1:0,a(attributesIndicesNone.textureCoordAndEncodedNormals,e),this.hasGeodeticSurfaceNormals&&a(attributesIndicesNone.geodeticSurfaceNormal,3)}else{const e=this.hasWebMercatorT||this.hasVertexNormals,t=this.hasWebMercatorT&&this.hasVertexNormals;a(attributesIndicesBits12.compressed0,e?4:3),t&&a(attributesIndicesBits12.compressed1,1),this.hasGeodeticSurfaceNormals&&a(attributesIndicesBits12.geodeticSurfaceNormal,3)}return o},TerrainEncoding.prototype.getAttributeLocations=function(){return this.quantization===TerrainQuantization$1.NONE?attributesIndicesNone:attributesIndicesBits12},TerrainEncoding.clone=function(e,t){if(defined(e))return defined(t)||(t=new TerrainEncoding),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=Cartesian3.clone(e.center),t.toScaledENU=Matrix4.clone(e.toScaledENU),t.fromScaledENU=Matrix4.clone(e.fromScaledENU),t.matrix=Matrix4.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t},Object.defineProperties(WebMercatorProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),WebMercatorProjection.mercatorAngleToGeodeticLatitude=function(e){return CesiumMath.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},WebMercatorProjection.geodeticLatitudeToMercatorAngle=function(e){e>WebMercatorProjection.MaximumLatitude?e=WebMercatorProjection.MaximumLatitude:e<-WebMercatorProjection.MaximumLatitude&&(e=-WebMercatorProjection.MaximumLatitude);const t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},WebMercatorProjection.MaximumLatitude=WebMercatorProjection.mercatorAngleToGeodeticLatitude(Math.PI),WebMercatorProjection.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,r=WebMercatorProjection.geodeticLatitudeToMercatorAngle(e.latitude)*n,o=e.height;return defined(t)?(t.x=i,t.y=r,t.z=o,t):new Cartesian3(i,r,o)},WebMercatorProjection.prototype.unproject=function(e,t){const n=this._oneOverSemimajorAxis,i=e.x*n,r=WebMercatorProjection.mercatorAngleToGeodeticLatitude(e.y*n),o=e.z;return defined(t)?(t.longitude=i,t.latitude=r,t.height=o,t):new Cartographic(i,r,o)};const HeightmapTessellator={};HeightmapTessellator.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const cartesian3Scratch$2=new Cartesian3,matrix4Scratch=new Matrix4,minimumScratch=new Cartesian3,maximumScratch=new Cartesian3;function returnTrue(){return!0}function destroyObject(e,t){function n(){}for(const t in e)"function"==typeof e[t]&&(e[t]=n);e.isDestroyed=returnTrue}function canTransferArrayBuffer(){if(!defined(TaskProcessor._canTransferArrayBuffer)){const e=new Worker(getWorkerUrl("Workers/transferTypedArrayTest.js"));e.postMessage=defaultValue(e.webkitPostMessage,e.postMessage);const t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch(e){return TaskProcessor._canTransferArrayBuffer=!1,TaskProcessor._canTransferArrayBuffer}const i=when.defer();e.onmessage=function(n){const r=n.data.array,o=defined(r)&&r[0]===t;i.resolve(o),e.terminate(),TaskProcessor._canTransferArrayBuffer=o},TaskProcessor._canTransferArrayBuffer=i.promise}return TaskProcessor._canTransferArrayBuffer}HeightmapTessellator.computeVertices=function(e){const t=Math.cos,n=Math.sin,i=Math.sqrt,r=Math.atan,o=Math.exp,a=CesiumMath.PI_OVER_TWO,s=CesiumMath.toRadians,c=e.heightmap,l=e.width,u=e.height,d=e.skirtHeight,h=d>0,p=defaultValue(e.isGeographic,!0),f=defaultValue(e.ellipsoid,Ellipsoid.WGS84),m=1/f.maximumRadius,g=Rectangle.clone(e.nativeRectangle),_=Rectangle.clone(e.rectangle);let y,C,T,S;defined(_)?(y=_.west,C=_.south,T=_.east,S=_.north):p?(y=s(g.west),C=s(g.south),T=s(g.east),S=s(g.north)):(y=g.west*m,C=a-2*r(o(-g.south*m)),T=g.east*m,S=a-2*r(o(-g.north*m)));let A=e.relativeToCenter;const v=defined(A);A=v?A:Cartesian3.ZERO;const E=defaultValue(e.includeWebMercatorT,!1),b=defaultValue(e.exaggeration,1),x=defaultValue(e.exaggerationRelativeHeight,0),P=1!==b,D=defaultValue(e.structure,HeightmapTessellator.DEFAULT_STRUCTURE),w=defaultValue(D.heightScale,HeightmapTessellator.DEFAULT_STRUCTURE.heightScale),M=defaultValue(D.heightOffset,HeightmapTessellator.DEFAULT_STRUCTURE.heightOffset),I=defaultValue(D.elementsPerHeight,HeightmapTessellator.DEFAULT_STRUCTURE.elementsPerHeight),R=defaultValue(D.stride,HeightmapTessellator.DEFAULT_STRUCTURE.stride),O=defaultValue(D.elementMultiplier,HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier),B=defaultValue(D.isBigEndian,HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian);let L=Rectangle.computeWidth(g),F=Rectangle.computeHeight(g);const N=L/(l-1),V=F/(u-1);p||(L*=m,F*=m);const k=f.radiiSquared,U=k.x,G=k.y,$=k.z;let z=65536,H=-65536;const W=Transforms.eastNorthUpToFixedFrame(A,f),q=Matrix4.inverseTransformation(W,matrix4Scratch);let j,X;E&&(j=WebMercatorProjection.geodeticLatitudeToMercatorAngle(C),X=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(S)-j));const Y=minimumScratch;Y.x=Number.POSITIVE_INFINITY,Y.y=Number.POSITIVE_INFINITY,Y.z=Number.POSITIVE_INFINITY;const K=maximumScratch;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;let J=Number.POSITIVE_INFINITY;const Q=l*u,Z=Q+(d>0?2*l+2*u:0),ee=new Array(Z),te=new Array(Z),ne=new Array(Z),ie=E?new Array(Z):[],re=P?new Array(Z):[];let oe=0,ae=u,se=0,ce=l;h&&(--oe,++ae,--se,++ce);const le=1e-5;for(let e=oe;e<ae;++e){let h=e;h<0&&(h=0),h>=u&&(h=u-1);let _=g.north-V*h;_=p?s(_):a-2*r(o(-_*m));let A=(_-C)/(S-C);A=CesiumMath.clamp(A,0,1);const v=e===oe,b=e===ae-1;d>0&&(v?_+=le*F:b&&(_-=le*F));const x=t(_),D=n(_),k=$*D;let W;E&&(W=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(_)-j)*X);for(let e=se;e<ce;++e){let r=e;r<0&&(r=0),r>=l&&(r=l-1);const o=h*(l*R)+r*R;let a;if(1===I)a=c[o];else{let e;if(a=0,B)for(e=0;e<I;++e)a=a*O+c[o+e];else for(e=I-1;e>=0;--e)a=a*O+c[o+e]}a=a*w+M,H=Math.max(H,a),z=Math.min(z,a);let _=g.west+N*r;p?_=s(_):_*=m;let C=(_-y)/(T-y);C=CesiumMath.clamp(C,0,1);let S=h*l+r;if(d>0){const t=e===se,n=e===ce-1,i=v||b||t||n;if((v||b)&&(t||n))continue;i&&(a-=d,t?(S=Q+(u-h-1),_-=le*L):b?S=Q+u+(l-r-1):n?(S=Q+u+l+h,_+=le*L):v&&(S=Q+u+l+u+r))}const F=x*t(_),V=x*n(_),$=U*F,j=G*V,X=1/i($*F+j*V+k*D),Z=$*X,oe=j*X,ae=k*X,ue=new Cartesian3;ue.x=Z+F*a,ue.y=oe+V*a,ue.z=ae+D*a,Matrix4.multiplyByPoint(q,ue,cartesian3Scratch$2),Cartesian3.minimumByComponent(cartesian3Scratch$2,Y,Y),Cartesian3.maximumByComponent(cartesian3Scratch$2,K,K),J=Math.min(J,a),ee[S]=ue,ne[S]=new Cartesian2(C,A),te[S]=a,E&&(ie[S]=W),P&&(re[S]=f.geodeticSurfaceNormal(ue))}}const ue=BoundingSphere.fromPoints(ee);let de,he;if(defined(_)&&(de=OrientedBoundingBox.fromRectangle(_,z,H,f)),v){he=new EllipsoidalOccluder(f).computeHorizonCullingPointPossiblyUnderEllipsoid(A,ee,z)}const pe=new TerrainEncoding(A,new AxisAlignedBoundingBox(Y,K,A),J,H,W,!1,E,P,b,x),fe=new Float32Array(Z*pe.stride);let me=0;for(let e=0;e<Z;++e)me=pe.encode(fe,me,ee[e],ne[e],te[e],void 0,ie[e],re[e]);return{vertices:fe,maximumHeight:H,minimumHeight:z,encoding:pe,boundingSphere3D:ue,orientedBoundingBox:de,occludeePointInScaledSpace:he}};const taskCompletedEvent=new Event;function completeTask(e,t){--e._activeTasks;const n=t.id;if(!defined(n))return;const i=e._deferreds,r=i[n];if(defined(t.error)){let e=t.error;"RuntimeError"===e.name?(e=new RuntimeError(t.error.message),e.stack=t.error.stack):"DeveloperError"===e.name&&(e=new DeveloperError(t.error.message),e.stack=t.error.stack),taskCompletedEvent.raiseEvent(e),r.reject(e)}else taskCompletedEvent.raiseEvent(),r.resolve(t.result);delete i[n]}function getWorkerUrl(e){let t=buildModuleUrl(e);if(isCrossOriginUrl(t)){const e='importScripts("'+t+'");';let n;try{n=new Blob([e],{type:"application/javascript"})}catch(t){const i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);i.append(e),n=i.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(n)}return t}let bootstrapperUrlResult;function getBootstrapperUrl(){return defined(bootstrapperUrlResult)||(bootstrapperUrlResult=getWorkerUrl("Workers/cesiumWorkerBootstrapper.js")),bootstrapperUrlResult}function createWorker(e){const t=new Worker(getBootstrapperUrl());t.postMessage=defaultValue(t.webkitPostMessage,t.postMessage);const n={loaderConfig:{paths:{Workers:buildModuleUrl("Workers")},baseUrl:buildModuleUrl.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(n),t.onmessage=function(t){completeTask(e,t.data)},t}function getWebAssemblyLoaderConfig(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!FeatureDetection.supportsWebAssembly()){if(!defined(t.fallbackModulePath))throw new RuntimeError("This browser does not support Web Assembly, and no backup module was provided for "+e._workerPath);return n.modulePath=buildModuleUrl(t.fallbackModulePath),when.resolve(n)}return n.modulePath=buildModuleUrl(t.modulePath),n.wasmBinaryFile=buildModuleUrl(t.wasmBinaryFile),Resource.fetchArrayBuffer({url:n.wasmBinaryFile}).then((function(e){return n.wasmBinary=e,n}))}function TaskProcessor(e,t){const n=new URI(e);this._workerPath=0!==n.scheme().length&&0===n.fragment().length?e:TaskProcessor._workerModulePrefix+e,this._maximumActiveTasks=defaultValue(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}const emptyTransferableObjectArray=[];function TerrainData(){DeveloperError.throwInstantiationError()}function TerrainMesh(e,t,n,i,r,o,a,s,c,l,u,d,h,p,f,m){this.center=e,this.vertices=t,this.stride=defaultValue(l,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=r,this.minimumHeight=o,this.maximumHeight=a,this.boundingSphere3D=s,this.occludeePointInScaledSpace=c,this.orientedBoundingBox=u,this.encoding=d,this.westIndicesSouthToNorth=h,this.southIndicesEastToWest=p,this.eastIndicesNorthToSouth=f,this.northIndicesWestToEast=m}TaskProcessor.prototype.scheduleTask=function(e,t){if(defined(this._worker)||(this._worker=createWorker(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;const n=this;return when(canTransferArrayBuffer(),(function(i){defined(t)?i||(t.length=0):t=emptyTransferableObjectArray;const r=n._nextID++,o=when.defer();return n._deferreds[r]=o,n._worker.postMessage({id:r,parameters:e,canTransferArrayBuffer:i},t),o.promise}))},TaskProcessor.prototype.initWebAssemblyModule=function(e){defined(this._worker)||(this._worker=createWorker(this));const t=when.defer(),n=this,i=this._worker;return getWebAssemblyLoaderConfig(this,e).then((function(e){return when(canTransferArrayBuffer(),(function(r){let o;const a=e.wasmBinary;defined(a)&&r&&(o=[a]),i.onmessage=function(e){i.onmessage=function(e){completeTask(n,e.data)},t.resolve(e.data)},i.postMessage({webAssemblyConfig:e},o)}))})),t},TaskProcessor.prototype.isDestroyed=function(){return!1},TaskProcessor.prototype.destroy=function(){return defined(this._worker)&&this._worker.terminate(),destroyObject(this)},TaskProcessor.taskCompletedEvent=taskCompletedEvent,TaskProcessor._defaultWorkerModulePrefix="Workers/",TaskProcessor._workerModulePrefix=TaskProcessor._defaultWorkerModulePrefix,TaskProcessor._canTransferArrayBuffer=void 0,Object.defineProperties(TerrainData.prototype,{credits:{get:DeveloperError.throwInstantiationError},waterMask:{get:DeveloperError.throwInstantiationError}}),TerrainData.prototype.interpolateHeight=DeveloperError.throwInstantiationError,TerrainData.prototype.isChildAvailable=DeveloperError.throwInstantiationError,TerrainData.prototype.createMesh=DeveloperError.throwInstantiationError,TerrainData.prototype.upsample=DeveloperError.throwInstantiationError,TerrainData.prototype.wasCreatedByUpsampling=DeveloperError.throwInstantiationError,TerrainData.maximumAsynchronousTasks=5;const IndexDatatype={UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,getSizeInBytes:function(e){switch(e){case IndexDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},fromSizeInBytes:function(e){switch(e){case 2:return IndexDatatype.UNSIGNED_SHORT;case 4:return IndexDatatype.UNSIGNED_INT;case 1:return IndexDatatype.UNSIGNED_BYTE}},validate:function(e){return defined(e)&&(e===IndexDatatype.UNSIGNED_BYTE||e===IndexDatatype.UNSIGNED_SHORT||e===IndexDatatype.UNSIGNED_INT)},createTypedArray:function(e,t){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},createTypedArrayFromArrayBuffer:function(e,t,n,i){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)}};var IndexDatatype$1=Object.freeze(IndexDatatype);function TerrainProvider(){DeveloperError.throwInstantiationError()}Object.defineProperties(TerrainProvider.prototype,{errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},hasWaterMask:{get:DeveloperError.throwInstantiationError},hasVertexNormals:{get:DeveloperError.throwInstantiationError},availability:{get:DeveloperError.throwInstantiationError}});const regularGridIndicesCache=[];TerrainProvider.getRegularGridIndices=function(e,t){let n=regularGridIndicesCache[e];defined(n)||(regularGridIndicesCache[e]=n=[]);let i=n[t];return defined(i)||(i=e*t<CesiumMath.SIXTY_FOUR_KILOBYTES?n[t]=new Uint16Array((e-1)*(t-1)*6):n[t]=new Uint32Array((e-1)*(t-1)*6),addRegularGridIndices(e,t,i,0)),i};const regularGridAndEdgeIndicesCache=[];TerrainProvider.getRegularGridIndicesAndEdgeIndices=function(e,t){let n=regularGridAndEdgeIndicesCache[e];defined(n)||(regularGridAndEdgeIndicesCache[e]=n=[]);let i=n[t];if(!defined(i)){const r=TerrainProvider.getRegularGridIndices(e,t),o=getEdgeIndices(e,t),a=o.westIndicesSouthToNorth,s=o.southIndicesEastToWest,c=o.eastIndicesNorthToSouth,l=o.northIndicesWestToEast;i=n[t]={indices:r,westIndicesSouthToNorth:a,southIndicesEastToWest:s,eastIndicesNorthToSouth:c,northIndicesWestToEast:l}}return i};const regularGridAndSkirtAndEdgeIndicesCache=[];function getEdgeIndices(e,t){const n=new Array(t),i=new Array(e),r=new Array(t),o=new Array(e);let a;for(a=0;a<e;++a)o[a]=a,i[a]=e*t-1-a;for(a=0;a<t;++a)r[a]=(a+1)*e-1,n[a]=(t-a-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:r,northIndicesWestToEast:o}}function addRegularGridIndices(e,t,n,i){let r=0;for(let o=0;o<t-1;++o){for(let t=0;t<e-1;++t){const t=r,o=t+e,a=o+1,s=t+1;n[i++]=t,n[i++]=o,n[i++]=s,n[i++]=s,n[i++]=o,n[i++]=a,++r}++r}}function addSkirtIndices(e,t,n,i){let r=e[0];const o=e.length;for(let a=1;a<o;++a){const o=e[a];n[i++]=r,n[i++]=o,n[i++]=t,n[i++]=t,n[i++]=o,n[i++]=t+1,r=o,++t}return i}function HeightmapTerrainData(e){this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=defaultValue(e.childTileMask,15),this._encoding=defaultValue(e.encoding,HeightmapEncoding$1.NONE);const t=HeightmapTessellator.DEFAULT_STRUCTURE;let n=e.structure;defined(n)?n!==t&&(n.heightScale=defaultValue(n.heightScale,t.heightScale),n.heightOffset=defaultValue(n.heightOffset,t.heightOffset),n.elementsPerHeight=defaultValue(n.elementsPerHeight,t.elementsPerHeight),n.stride=defaultValue(n.stride,t.stride),n.elementMultiplier=defaultValue(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=defaultValue(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===HeightmapEncoding$1.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){let n=regularGridAndSkirtAndEdgeIndicesCache[e];defined(n)||(regularGridAndSkirtAndEdgeIndicesCache[e]=n=[]);let i=n[t];if(!defined(i)){const r=e*t,o=(e-1)*(t-1)*6,a=2*e+2*t,s=r+a,c=o+6*Math.max(0,a-4),l=getEdgeIndices(e,t),u=l.westIndicesSouthToNorth,d=l.southIndicesEastToWest,h=l.eastIndicesNorthToSouth,p=l.northIndicesWestToEast,f=IndexDatatype$1.createTypedArray(s,c);addRegularGridIndices(e,t,f,0),TerrainProvider.addSkirtIndices(u,d,h,p,r,f,o),i=n[t]={indices:f,westIndicesSouthToNorth:u,southIndicesEastToWest:d,eastIndicesNorthToSouth:h,northIndicesWestToEast:p,indexCountWithoutSkirts:o}}return i},TerrainProvider.addSkirtIndices=function(e,t,n,i,r,o,a){let s=r;a=addSkirtIndices(e,s,o,a),s+=e.length,a=addSkirtIndices(t,s,o,a),s+=t.length,a=addSkirtIndices(n,s,o,a),s+=n.length,addSkirtIndices(i,s,o,a)},TerrainProvider.heightmapTerrainQuality=.25,TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return 2*e.maximumRadius*Math.PI*TerrainProvider.heightmapTerrainQuality/(t*n)},TerrainProvider.prototype.requestTileGeometry=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getTileDataAvailable=DeveloperError.throwInstantiationError,TerrainProvider.prototype.loadTileDataAvailability=DeveloperError.throwInstantiationError,Object.defineProperties(HeightmapTerrainData.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const createMeshTaskName$2="createVerticesFromHeightmap",createMeshTaskProcessorNoThrottle$2=new TaskProcessor(createMeshTaskName$2),createMeshTaskProcessorThrottle$2=new TaskProcessor(createMeshTaskName$2,TerrainData.maximumAsynchronousTasks);function interpolateHeight$2(e,t,n,i,r,o,a,s,c,l){const u=(c-o.west)*(a-1)/(o.east-o.west),d=(l-o.south)*(s-1)/(o.north-o.south);let h=0|u,p=h+1;p>=a&&(p=a-1,h=a-2);let f=0|d,m=f+1;m>=s&&(m=s-1,f=s-2);const g=d-f;f=s-1-f,m=s-1-m;return triangleInterpolateHeight(u-h,g,getHeight(e,t,n,i,r,f*a+h),getHeight(e,t,n,i,r,f*a+p),getHeight(e,t,n,i,r,m*a+h),getHeight(e,t,n,i,r,m*a+p))}function interpolateMeshHeight$2(e,t,n,i,r,o,a,s,c){const l=(s-r.west)*(o-1)/(r.east-r.west),u=(c-r.south)*(a-1)/(r.north-r.south);let d=0|l,h=d+1;h>=o&&(h=o-1,d=o-2);let p=0|u,f=p+1;f>=a&&(f=a-1,p=a-2);const m=u-p;p=a-1-p,f=a-1-f;return triangleInterpolateHeight(l-d,m,(t.decodeHeight(e,p*o+d)-n)/i,(t.decodeHeight(e,p*o+h)-n)/i,(t.decodeHeight(e,f*o+d)-n)/i,(t.decodeHeight(e,f*o+h)-n)/i)}function triangleInterpolateHeight(e,t,n,i,r,o){return t<e?n+e*(i-n)+t*(o-i):n+e*(o-r)+t*(r-n)}function getHeight(e,t,n,i,r,o){o*=i;let a,s=0;if(r)for(a=0;a<t;++a)s=s*n+e[o+a];else for(a=t-1;a>=0;--a)s=s*n+e[o+a];return s}function setHeight(e,t,n,i,r,o,a,s){let c;if(a*=r,o)for(c=0;c<t-1;++c)e[a+c]=s/i|0,s-=e[a+c]*i,i/=n;else for(c=t-1;c>0;--c)e[a+c]=s/i|0,s-=e[a+c]*i,i/=n;e[a+c]=s}function TileAvailability(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}HeightmapTerrainData.prototype.createMesh=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,n=e.x,i=e.y,r=e.level,o=defaultValue(e.exaggeration,1),a=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,r),u=t.tileXYToRectangle(n,i,r),d=c.cartographicToCartesian(Rectangle.center(u)),h=this._structure,p=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<r);this._skirtHeight=Math.min(4*p,1e3);const f=(s?createMeshTaskProcessorThrottle$2:createMeshTaskProcessorNoThrottle$2).scheduleTask({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:u,relativeToCenter:d,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof GeographicProjection,exaggeration:o,exaggerationRelativeHeight:a,encoding:this._encoding});if(!defined(f))return;const m=this;return when(f,(function(e){let t;t=m._skirtHeight>0?TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices(e.gridWidth,e.gridHeight):TerrainProvider.getRegularGridIndicesAndEdgeIndices(e.gridWidth,e.gridHeight);const n=e.gridWidth*e.gridHeight;return m._mesh=new TerrainMesh(d,new Float32Array(e.vertices),t.indices,t.indexCountWithoutSkirts,n,e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),t.westIndicesSouthToNorth,t.southIndicesEastToWest,t.eastIndicesNorthToSouth,t.northIndicesWestToEast),m._buffer=void 0,m._mesh}))},HeightmapTerrainData.prototype._createMeshSync=function(e){const t=e.tilingScheme,n=e.x,i=e.y,r=e.level,o=defaultValue(e.exaggeration,1),a=defaultValue(e.exaggerationRelativeHeight,0),s=t.ellipsoid,c=t.tileXYToNativeRectangle(n,i,r),l=t.tileXYToRectangle(n,i,r),u=s.cartographicToCartesian(Rectangle.center(l)),d=this._structure,h=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(s,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<r);this._skirtHeight=Math.min(4*h,1e3);const p=HeightmapTessellator.computeVertices({heightmap:this._buffer,structure:d,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:l,relativeToCenter:u,ellipsoid:s,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof GeographicProjection,exaggeration:o,exaggerationRelativeHeight:a});let f;this._buffer=void 0,f=this._skirtHeight>0?TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):TerrainProvider.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const m=p.gridWidth*p.gridHeight;return this._mesh=new TerrainMesh(u,p.vertices,f.indices,f.indexCountWithoutSkirts,m,p.minimumHeight,p.maximumHeight,p.boundingSphere3D,p.occludeePointInScaledSpace,p.encoding.stride,p.orientedBoundingBox,p.encoding,f.westIndicesSouthToNorth,f.southIndicesEastToWest,f.eastIndicesNorthToSouth,f.northIndicesWestToEast),this._mesh},HeightmapTerrainData.prototype.interpolateHeight=function(e,t,n){const i=this._width,r=this._height,o=this._structure,a=o.stride,s=o.elementsPerHeight,c=o.elementMultiplier,l=o.isBigEndian,u=o.heightOffset,d=o.heightScale,h=defined(this._mesh),p=this._encoding===HeightmapEncoding$1.LERC;if(!h&&p)return;let f;if(h){f=interpolateMeshHeight$2(this._mesh.vertices,this._mesh.encoding,u,d,e,i,r,t,n)}else f=interpolateHeight$2(this._buffer,s,c,a,l,e,i,r,t,n),f=f*d+u;return f},HeightmapTerrainData.prototype.upsample=function(e,t,n,i,r,o,a){const s=this._mesh;if(!defined(s))return;const c=this._width,l=this._height,u=this._structure,d=u.stride,h=new this._bufferType(c*l*d),p=s.vertices,f=s.encoding,m=e.tileXYToRectangle(t,n,i),g=e.tileXYToRectangle(r,o,a),_=u.heightOffset,y=u.heightScale,C=u.elementsPerHeight,T=u.elementMultiplier,S=u.isBigEndian,A=Math.pow(T,C-1);for(let e=0;e<l;++e){const t=CesiumMath.lerp(g.north,g.south,e/(l-1));for(let n=0;n<c;++n){let i=interpolateMeshHeight$2(p,f,_,y,m,c,l,CesiumMath.lerp(g.west,g.east,n/(c-1)),t);i=i<u.lowestEncodedHeight?u.lowestEncodedHeight:i,i=i>u.highestEncodedHeight?u.highestEncodedHeight:i,setHeight(h,C,T,A,d,S,e*c+n,i)}}return new HeightmapTerrainData({buffer:h,width:c,height:l,childTileMask:0,structure:this._structure,createdByUpsampling:!0})},HeightmapTerrainData.prototype.isChildAvailable=function(e,t,n,i){let r=2;return n!==2*e&&++r,i!==2*t&&(r-=2),0!=(this._childTileMask&1<<r)},HeightmapTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};const rectangleScratch$6=new Rectangle;function findNode$1(e,t,n,i){const r=i.length;for(let o=0;o<r;++o){const r=i[o];if(r.x===t&&r.y===n&&r.level===e)return!0}return!1}TileAvailability.prototype.addAvailableTileRange=function(e,t,n,i,r){const o=this._tilingScheme,a=this._rootNodes;if(0===e)for(let s=n;s<=r;++s)for(let n=t;n<=i;++n)findNode$1(e,n,s,a)||a.push(new QuadtreeNode(o,void 0,0,n,s));o.tileXYToRectangle(t,n,e,rectangleScratch$6);const s=rectangleScratch$6.west,c=rectangleScratch$6.north;o.tileXYToRectangle(i,r,e,rectangleScratch$6);const l=rectangleScratch$6.east,u=new RectangleWithLevel(e,s,rectangleScratch$6.south,l,c);for(let e=0;e<a.length;++e){const t=a[e];rectanglesOverlap(t.extent,u)&&putRectangleInQuadtree(this._maximumLevel,t,u)}},TileAvailability.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(rectangleContainsPosition(i.extent,e)){t=i;break}}return defined(t)?findMaxLevelFromNode(void 0,t,e):-1};const rectanglesScratch=[],remainingToCoverByLevelScratch=[],westScratch$1=new Rectangle,eastScratch=new Rectangle;TileAvailability.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=rectanglesScratch;t.length=0,e.east<e.west?(t.push(Rectangle.fromRadians(-Math.PI,e.south,e.east,e.north,westScratch$1)),t.push(Rectangle.fromRadians(e.west,e.south,Math.PI,e.north,eastScratch))):t.push(e);const n=remainingToCoverByLevelScratch;let i;for(n.length=0,i=0;i<this._rootNodes.length;++i)updateCoverageWithNode(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(defined(n[i])&&0===n[i].length)return i;return 0};const cartographicScratch$4=new Cartographic;function QuadtreeNode(e,t,n,i,r){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=r,this.extent=e.tileXYToRectangle(i,r,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}function RectangleWithLevel(e,t,n,i,r){this.level=e,this.west=t,this.south=n,this.east=i,this.north=r}function rectanglesOverlap(e,t){const n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),r=Math.min(e.east,t.east);return i<Math.min(e.north,t.north)&&n<r}function putRectangleInQuadtree(e,t,n){for(;t.level<e;)if(rectangleFullyContainsRectangle(t.nw.extent,n))t=t.nw;else if(rectangleFullyContainsRectangle(t.ne.extent,n))t=t.ne;else if(rectangleFullyContainsRectangle(t.sw.extent,n))t=t.sw;else{if(!rectangleFullyContainsRectangle(t.se.extent,n))break;t=t.se}if(0===t.rectangles.length||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let e=binarySearch(t.rectangles,n.level,rectangleLevelComparator);e<0&&(e=~e),t.rectangles.splice(e,0,n)}}function rectangleLevelComparator(e,t){return e.level-t}function rectangleFullyContainsRectangle(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function rectangleContainsPosition(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function findMaxLevelFromNode(e,t,n){let i=0,r=!1;for(;!r;){const e=t._nw&&rectangleContainsPosition(t._nw.extent,n),o=t._ne&&rectangleContainsPosition(t._ne.extent,n),a=t._sw&&rectangleContainsPosition(t._sw.extent,n),s=t._se&&rectangleContainsPosition(t._se.extent,n);if(e+o+a+s>1){e&&(i=Math.max(i,findMaxLevelFromNode(t,t._nw,n))),o&&(i=Math.max(i,findMaxLevelFromNode(t,t._ne,n))),a&&(i=Math.max(i,findMaxLevelFromNode(t,t._sw,n))),s&&(i=Math.max(i,findMaxLevelFromNode(t,t._se,n)));break}e?t=t._nw:o?t=t._ne:a?t=t._sw:s?t=t._se:r=!0}for(;t!==e;){const e=t.rectangles;for(let t=e.length-1;t>=0&&e[t].level>i;--t){const r=e[t];rectangleContainsPosition(r,n)&&(i=r.level)}t=t.parent}return i}function updateCoverageWithNode(e,t,n){if(!t)return;let i,r=!1;for(i=0;i<n.length;++i)r=r||rectanglesOverlap(t.extent,n[i]);if(!r)return;const o=t.rectangles;for(i=0;i<o.length;++i){const t=o[i];e[t.level]||(e[t.level]=n),e[t.level]=subtractRectangle(e[t.level],t)}updateCoverageWithNode(e,t._nw,n),updateCoverageWithNode(e,t._ne,n),updateCoverageWithNode(e,t._sw,n),updateCoverageWithNode(e,t._se,n)}function subtractRectangle(e,t){const n=[];for(let i=0;i<e.length;++i){const r=e[i];rectanglesOverlap(r,t)?(r.west<t.west&&n.push(new Rectangle(r.west,r.south,t.west,r.north)),r.east>t.east&&n.push(new Rectangle(t.east,r.south,r.east,r.north)),r.south<t.south&&n.push(new Rectangle(Math.max(t.west,r.west),r.south,Math.min(t.east,r.east),t.south)),r.north>t.north&&n.push(new Rectangle(Math.max(t.west,r.west),t.north,Math.min(t.east,r.east),r.north))):n.push(r)}return n}function formatError(e){let t;const n=e.name,i=e.message;t=defined(n)&&defined(i)?n+": "+i:e.toString();const r=e.stack;return defined(r)&&(t+="\n"+r),t}function TileProviderError(e,t,n,i,r,o,a){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=r,this.timesRetried=defaultValue(o,0),this.retry=!1,this.error=a}function WebMercatorTilingScheme(e){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._numberOfLevelZeroTilesX=defaultValue(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=defaultValue(e.numberOfLevelZeroTilesY,1),this._projection=new WebMercatorProjection(this._ellipsoid),defined(e.rectangleSouthwestInMeters)&&defined(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const e=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new Cartesian2(-e,-e),this._rectangleNortheastInMeters=new Cartesian2(e,e)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new Rectangle(t.longitude,t.latitude,n.longitude,n.latitude)}TileAvailability.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,rectangleScratch$6);return Rectangle.center(i,cartographicScratch$4),this.computeMaximumLevelAtPosition(cartographicScratch$4)>=e},TileAvailability.prototype.computeChildMaskForTile=function(e,t,n){const i=e+1;if(i>=this._maximumLevel)return 0;let r=0;return r|=this.isTileAvailable(i,2*t,2*n+1)?1:0,r|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,r|=this.isTileAvailable(i,2*t,2*n)?4:0,r|=this.isTileAvailable(i,2*t+1,2*n)?8:0,r},Object.defineProperties(QuadtreeNode.prototype,{nw:{get:function(){return this._nw||(this._nw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y+1)),this._sw}},se:{get:function(){return this._se||(this._se=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y+1)),this._se}}}),TileProviderError.handleError=function(e,t,n,i,r,o,a,s,c){let l=e;return defined(e)?(l.provider=t,l.message=i,l.x=r,l.y=o,l.level=a,l.retry=!1,l.error=c,++l.timesRetried):l=new TileProviderError(t,i,r,o,a,0,c),n.numberOfListeners>0?n.raiseEvent(l):console.log('An error occurred in "'+t.constructor.name+'": '+formatError(i)),l.retry&&defined(s)&&s(),l},TileProviderError.handleSuccess=function(e){defined(e)&&(e.timesRetried=-1)},Object.defineProperties(WebMercatorTilingScheme.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),WebMercatorTilingScheme.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},WebMercatorTilingScheme.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},WebMercatorTilingScheme.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(Rectangle.southwest(e)),r=n.project(Rectangle.northeast(e));return defined(t)?(t.west=i.x,t.south=i.y,t.east=r.x,t.north=r.y,t):new Rectangle(i.x,i.y,r.x,r.y)},WebMercatorTilingScheme.prototype.tileXYToNativeRectangle=function(e,t,n,i){const r=this.getNumberOfXTilesAtLevel(n),o=this.getNumberOfYTilesAtLevel(n),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/r,s=this._rectangleSouthwestInMeters.x+e*a,c=this._rectangleSouthwestInMeters.x+(e+1)*a,l=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/o,u=this._rectangleNortheastInMeters.y-t*l,d=this._rectangleNortheastInMeters.y-(t+1)*l;return defined(i)?(i.west=s,i.south=d,i.east=c,i.north=u,i):new Rectangle(s,d,c,u)},WebMercatorTilingScheme.prototype.tileXYToRectangle=function(e,t,n,i){const r=this.tileXYToNativeRectangle(e,t,n,i),o=this._projection,a=o.unproject(new Cartesian2(r.west,r.south)),s=o.unproject(new Cartesian2(r.east,r.north));return r.west=a.longitude,r.south=a.latitude,r.east=s.longitude,r.north=s.latitude,r},WebMercatorTilingScheme.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Rectangle.contains(i,e))return;const r=this.getNumberOfXTilesAtLevel(t),o=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/r,s=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/o,c=this._projection.project(e);let l=(c.x-this._rectangleSouthwestInMeters.x)/a|0;l>=r&&(l=r-1);let u=(this._rectangleNortheastInMeters.y-c.y)/s|0;return u>=o&&(u=o-1),defined(n)?(n.x=l,n.y=u,n):new Cartesian2(l,u)};const ALL_CHILDREN=15;function ArcGISTiledElevationTerrainProvider(e){this._resource=void 0,this._credit=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._maxLevel=void 0,this._terrainDataStructure=void 0,this._ready=!1,this._width=void 0,this._height=void 0,this._encoding=void 0;const t=e.token;this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailablityLoaded=void 0,this._availableCache={};const n=this,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._readyPromise=when(e.url).then((function(e){let i=Resource.createIfNeeded(e);i.appendForwardSlash(),defined(t)&&(i=i.getDerivedResource({queryParameters:{token:t}})),n._resource=i;return i.getDerivedResource({queryParameters:{f:"pjson"}}).fetchJson()})).then((function(e){const t=e.copyrightText;defined(t)&&(n._credit=new Credit(t));const r=e.spatialReference,o=defaultValue(r.latestWkid,r.wkid),a=e.extent,s={ellipsoid:i};if(4326===o)s.rectangle=Rectangle.fromDegrees(a.xmin,a.ymin,a.xmax,a.ymax),n._tilingScheme=new GeographicTilingScheme(s);else{if(3857!==o)return when.reject(new RuntimeError("Invalid spatial reference"));s.rectangleSouthwestInMeters=new Cartesian2(a.xmin,a.ymin),s.rectangleNortheastInMeters=new Cartesian2(a.xmax,a.ymax),n._tilingScheme=new WebMercatorTilingScheme(s)}const c=e.tileInfo;if(!defined(c))return when.reject(new RuntimeError("tileInfo is required"));n._width=c.rows+1,n._height=c.cols+1,n._encoding="LERC"===c.format?HeightmapEncoding$1.LERC:HeightmapEncoding$1.NONE,n._lodCount=c.lods.length-1;return(n._hasAvailability=-1!==e.capabilities.indexOf("Tilemap"))&&(n._tilesAvailable=new TileAvailability(n._tilingScheme,n._lodCount),n._tilesAvailable.addAvailableTileRange(0,0,0,n._tilingScheme.getNumberOfXTilesAtLevel(0),n._tilingScheme.getNumberOfYTilesAtLevel(0)),n._tilesAvailablityLoaded=new TileAvailability(n._tilingScheme,n._lodCount)),n._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._width,n._tilingScheme.getNumberOfXTilesAtLevel(0)),e.bandCount>1&&console.log("ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."),n._terrainDataStructure={elementMultiplier:1,lowestEncodedHeight:e.minValues[0],highestEncodedHeight:e.maxValues[0]},n._ready=!0,!0})).otherwise((function(e){const t="An error occurred while accessing "+n._resource.url+".";return TileProviderError.handleError(void 0,n,n._errorEvent,t),when.reject(e)})),this._errorEvent=new Event}function isTileAvailable(e,t,n,i){if(!e._hasAvailability)return;const r=e._tilesAvailablityLoaded,o=e._tilesAvailable;return!(t>e._lodCount)&&(!!o.isTileAvailable(t,n,i)||!r.isTileAvailable(t,n,i)&&void 0)}function findRange(e,t,n,i){const r=t-1,o=n-1,a=i[e.y*t+e.x],s=[],c={startX:e.x,startY:e.y,endX:0,endY:0},l=new Cartesian2(e.x+1,e.y+1);let u=!1,d=!1;for(;!u||!d;){let n=l.x;const h=d?l.y+1:l.y;if(!u){for(let n=e.y;n<h;++n)if(i[n*t+l.x]!==a){u=!0;break}u?(s.push(new Cartesian2(l.x,e.y)),--l.x,--n,c.endX=l.x):l.x===r?(c.endX=l.x,u=!0):++l.x}if(!d){const r=l.y*t;for(let t=e.x;t<=n;++t)if(i[r+t]!==a){d=!0;break}d?(s.push(new Cartesian2(e.x,l.y)),--l.y,c.endY=l.y):l.y===o?(c.endY=l.y,d=!0):++l.y}}return{endingIndices:s,range:c,value:a}}function computeAvailability(e,t,n,i,r){const o=[];if(r.every((function(e){return e===r[0]})))return 1===r[0]&&o.push({startX:e,startY:t,endX:e+n-1,endY:t+i-1}),o;let a=[new Cartesian2(0,0)];for(;a.length>0;){const s=findRange(a.pop(),n,i,r);if(1===s.value){const n=s.range;n.startX+=e,n.endX+=e,n.startY+=t,n.endY+=t,o.push(n)}const c=s.endingIndices;c.length>0&&(a=a.concat(c))}return o}function requestAvailability(e,t,n,i){if(!e._hasAvailability)return{};const r=128*Math.floor(n/128),o=128*Math.floor(i/128),a=Math.min(1<<t,128),s="tilemap/"+t+"/"+o+"/"+r+"/"+a+"/"+a,c=e._availableCache;if(defined(c[s]))return c[s];const l=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});let u=e._resource.getDerivedResource({url:s,request:l}).fetchJson();return defined(u)?(u=u.then((function(s){const c=computeAvailability(r,o,a,a,s.data);e._tilesAvailablityLoaded.addAvailableTileRange(t,r,o,r+a,o+a);const l=e._tilesAvailable;for(let e=0;e<c.length;++e){const n=c[e];l.addAvailableTileRange(t,n.startX,n.startY,n.endX,n.endY)}return isTileAvailable(e,t,n,i)})),c[s]={promise:u,request:l},u=u.always((function(e){return delete c[s],e})),{promise:u,request:l}):{}}Object.defineProperties(ArcGISTiledElevationTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){return this._tilesAvailable}}}),ArcGISTiledElevationTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){const r=this._resource.getDerivedResource({url:"tile/"+n+"/"+t+"/"+e,request:i}),o=this._hasAvailability;let a,s=when.resolve(!0);if(o&&!defined(isTileAvailable(this,n+1,2*e,2*t))){const i=requestAvailability(this,n+1,2*e,2*t);s=i.promise,a=i.request}const c=r.fetchArrayBuffer();if(!defined(c)||!defined(s))return;const l=this,u=this._tilesAvailable;return when.join(c,s).then((function(i){return new HeightmapTerrainData({buffer:i[0],width:l._width,height:l._height,childTileMask:o?u.computeChildMaskForTile(n,e,t):ALL_CHILDREN,structure:l._terrainDataStructure,encoding:l._encoding})})).otherwise((function(e){return defined(a)&&a.state===RequestState$1.CANCELLED?(i.cancel(),i.deferred.promise.always((function(){return i.state=RequestState$1.CANCELLED,when.reject(e)}))):when.reject(e)}))},ArcGISTiledElevationTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},ArcGISTiledElevationTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){if(!this._hasAvailability)return;const i=isTileAvailable(this,n,e,t);if(defined(i))return i;requestAvailability(this,n,e,t)},ArcGISTiledElevationTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){};const ArcType={NONE:0,GEODESIC:1,RHUMB:2};var ArcType$1=Object.freeze(ArcType);function arrayFill(e,t,n,i){if("function"==typeof e.fill)return e.fill(t,n,i);const r=e.length>>>0,o=defaultValue(n,0);let a=o<0?Math.max(r+o,0):Math.min(o,r);const s=defaultValue(i,r),c=s<0?Math.max(r+s,0):Math.min(s,r);for(;a<c;)e[a]=t,a++;return e}const removeDuplicatesEpsilon=CesiumMath.EPSILON10;function arrayRemoveDuplicates(e,t,n,i){if(!defined(e))return;n=defaultValue(n,!1);const r=defined(i),o=e.length;if(o<2)return e;let a,s,c,l=e[0],u=0,d=-1;for(a=1;a<o;++a)s=e[a],t(l,s,removeDuplicatesEpsilon)?(defined(c)||(c=e.slice(0,a),u=a-1,d=0),r&&i.push(a)):(defined(c)&&(c.push(s),u=a,r&&(d=i.length)),l=s);return n&&t(e[0],e[o-1],removeDuplicatesEpsilon)&&(r&&(defined(c)?i.splice(d,0,u):i.push(o-1)),defined(c)?c.length-=1:c=e.slice(0,-1)),defined(c)?c:e}function arraySlice(e,t,n){if("function"==typeof e.slice)return e.slice(t,n);let i=Array.prototype.slice.call(e,t,n);const r=FeatureDetection.typedArrayTypes,o=r.length;for(let t=0;t<o;++t)if(e instanceof r[t]){i=new r[t](i);break}return i}function AssociativeArray(){this._array=[],this._hash={}}Object.defineProperties(AssociativeArray.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}}),AssociativeArray.prototype.contains=function(e){return defined(this._hash[e])},AssociativeArray.prototype.set=function(e,t){t!==this._hash[e]&&(this.remove(e),this._hash[e]=t,this._array.push(t))},AssociativeArray.prototype.get=function(e){return this._hash[e]},AssociativeArray.prototype.remove=function(e){const t=this._hash[e],n=defined(t);if(n){const n=this._array;n.splice(n.indexOf(t),1),delete this._hash[e]}return n},AssociativeArray.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)};const scratchCartesian1$7=new Cartesian3,scratchCartesian2$a=new Cartesian3,scratchCartesian3$b=new Cartesian3;function barycentricCoordinates(e,t,n,i,r){let o,a,s,c,l,u,d,h;if(defined(r)||(r=new Cartesian3),defined(t.z)){if(Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,r);if(Cartesian3.equalsEpsilon(e,n,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,r);if(Cartesian3.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,r);o=Cartesian3.subtract(n,t,scratchCartesian1$7),a=Cartesian3.subtract(i,t,scratchCartesian2$a),s=Cartesian3.subtract(e,t,scratchCartesian3$b),c=Cartesian3.dot(o,o),l=Cartesian3.dot(o,a),u=Cartesian3.dot(o,s),d=Cartesian3.dot(a,a),h=Cartesian3.dot(a,s)}else{if(Cartesian2.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,r);if(Cartesian2.equalsEpsilon(e,n,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,r);if(Cartesian2.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,r);o=Cartesian2.subtract(n,t,scratchCartesian1$7),a=Cartesian2.subtract(i,t,scratchCartesian2$a),s=Cartesian2.subtract(e,t,scratchCartesian3$b),c=Cartesian2.dot(o,o),l=Cartesian2.dot(o,a),u=Cartesian2.dot(o,s),d=Cartesian2.dot(a,a),h=Cartesian2.dot(a,s)}r.y=d*u-l*h,r.z=c*h-l*u;const p=c*d-l*l;if(0!==p)return r.y/=p,r.z/=p,r.x=1-r.y-r.z,r}const url="https://dev.virtualearth.net/REST/v1/Locations";function BingMapsGeocoderService(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this._key=t;const n={key:t};defined(e.culture)&&(n.culture=e.culture),this._resource=new Resource({url:url,queryParameters:n})}function BoundingRectangle(e,t,n,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.width=defaultValue(n,0),this.height=defaultValue(i,0)}Object.defineProperties(BingMapsGeocoderService.prototype,{url:{get:function(){return url}},key:{get:function(){return this._key}}}),BingMapsGeocoderService.prototype.geocode=function(e){return this._resource.getDerivedResource({queryParameters:{query:e}}).fetchJsonp("jsonp").then((function(e){if(0===e.resourceSets.length)return[];return e.resourceSets[0].resources.map((function(e){const t=e.bbox,n=t[0],i=t[1],r=t[2],o=t[3];return{displayName:e.name,destination:Rectangle.fromDegrees(i,n,o,r)}}))}))},BoundingRectangle.packedLength=4,BoundingRectangle.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t},BoundingRectangle.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new BoundingRectangle),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n},BoundingRectangle.fromPoints=function(e,t){if(defined(t)||(t=new BoundingRectangle),!defined(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,r=e[0].y,o=e[0].x,a=e[0].y;for(let t=1;t<n;t++){const n=e[t],s=n.x,c=n.y;i=Math.min(s,i),o=Math.max(s,o),r=Math.min(c,r),a=Math.max(c,a)}return t.x=i,t.y=r,t.width=o-i,t.height=a-r,t};const defaultProjection=new GeographicProjection,fromRectangleLowerLeft=new Cartographic,fromRectangleUpperRight=new Cartographic;BoundingRectangle.fromRectangle=function(e,t,n){if(defined(n)||(n=new BoundingRectangle),!defined(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;const i=(t=defaultValue(t,defaultProjection)).project(Rectangle.southwest(e,fromRectangleLowerLeft)),r=t.project(Rectangle.northeast(e,fromRectangleUpperRight));return Cartesian2.subtract(r,i,r),n.x=i.x,n.y=i.y,n.width=r.x,n.height=r.y,n},BoundingRectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new BoundingRectangle(e.x,e.y,e.width,e.height)},BoundingRectangle.union=function(e,t,n){defined(n)||(n=new BoundingRectangle);const i=Math.min(e.x,t.x),r=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width),a=Math.max(e.y+e.height,t.y+t.height);return n.x=i,n.y=r,n.width=o-i,n.height=a-r,n},BoundingRectangle.expand=function(e,t,n){n=BoundingRectangle.clone(e,n);const i=t.x-n.x,r=t.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),r>n.height?n.height=r:r<0&&(n.height-=r,n.y=t.y),n},BoundingRectangle.intersect=function(e,t){const n=e.x,i=e.y,r=t.x,o=t.y;return n>r+t.width||n+e.width<r||i+e.height<o||i>o+t.height?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},BoundingRectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},BoundingRectangle.prototype.clone=function(e){return BoundingRectangle.clone(this,e)},BoundingRectangle.prototype.intersect=function(e){return BoundingRectangle.intersect(this,e)},BoundingRectangle.prototype.equals=function(e){return BoundingRectangle.equals(this,e)};const GeometryType={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};var GeometryType$1=Object.freeze(GeometryType);const PrimitiveType={POINTS:WebGLConstants$1.POINTS,LINES:WebGLConstants$1.LINES,LINE_LOOP:WebGLConstants$1.LINE_LOOP,LINE_STRIP:WebGLConstants$1.LINE_STRIP,TRIANGLES:WebGLConstants$1.TRIANGLES,TRIANGLE_STRIP:WebGLConstants$1.TRIANGLE_STRIP,TRIANGLE_FAN:WebGLConstants$1.TRIANGLE_FAN,validate:function(e){return e===PrimitiveType.POINTS||e===PrimitiveType.LINES||e===PrimitiveType.LINE_LOOP||e===PrimitiveType.LINE_STRIP||e===PrimitiveType.TRIANGLES||e===PrimitiveType.TRIANGLE_STRIP||e===PrimitiveType.TRIANGLE_FAN}};var PrimitiveType$1=Object.freeze(PrimitiveType);function Geometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=defaultValue(e.geometryType,GeometryType$1.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Geometry.computeNumberOfVertices=function(e){let t=-1;for(const n in e.attributes)if(e.attributes.hasOwnProperty(n)&&defined(e.attributes[n])&&defined(e.attributes[n].values)){const i=e.attributes[n];t=i.values.length/i.componentsPerAttribute}return t};const rectangleCenterScratch$3=new Cartographic,enuCenterScratch=new Cartesian3,fixedFrameToEnuScratch=new Matrix4,boundingRectanglePointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic],boundingRectanglePointsEnuScratch=[new Cartesian2,new Cartesian2,new Cartesian2],points2DScratch$2=[new Cartesian2,new Cartesian2,new Cartesian2],pointEnuScratch=new Cartesian3,enuRotationScratch=new Quaternion,enuRotationMatrixScratch=new Matrix4,rotation2DScratch$1=new Matrix2;function GeometryAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.values=e.values}function GeometryAttributes(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.bitangent=e.bitangent,this.tangent=e.tangent,this.color=e.color}Geometry._textureCoordinateRotationPoints=function(e,t,n,i){let r;const o=Rectangle.center(i,rectangleCenterScratch$3),a=Cartographic.toCartesian(o,n,enuCenterScratch),s=Transforms.eastNorthUpToFixedFrame(a,n,fixedFrameToEnuScratch),c=Matrix4.inverse(s,fixedFrameToEnuScratch),l=boundingRectanglePointsEnuScratch,u=boundingRectanglePointsCartographicScratch;u[0].longitude=i.west,u[0].latitude=i.south,u[1].longitude=i.west,u[1].latitude=i.north,u[2].longitude=i.east,u[2].latitude=i.south;let d=pointEnuScratch;for(r=0;r<3;r++)Cartographic.toCartesian(u[r],n,d),d=Matrix4.multiplyByPointAsVector(c,d,d),l[r].x=d.x,l[r].y=d.y;const h=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-t,enuRotationScratch),p=Matrix3.fromQuaternion(h,enuRotationMatrixScratch),f=e.length;let m=Number.POSITIVE_INFINITY,g=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,y=Number.NEGATIVE_INFINITY;for(r=0;r<f;r++)d=Matrix4.multiplyByPointAsVector(c,e[r],d),d=Matrix3.multiplyByVector(p,d,d),m=Math.min(m,d.x),g=Math.min(g,d.y),_=Math.max(_,d.x),y=Math.max(y,d.y);const C=Matrix2.fromRotation(t,rotation2DScratch$1),T=points2DScratch$2;T[0].x=m,T[0].y=g,T[1].x=m,T[1].y=y,T[2].x=_,T[2].y=g;const S=l[0],A=l[2].x-S.x,v=l[1].y-S.y;for(r=0;r<3;r++){const e=T[r];Matrix2.multiplyByVector(C,e,e),e.x=(e.x-S.x)/A,e.y=(e.y-S.y)/v}const E=T[0],b=T[1],x=T[2],P=new Array(6);return Cartesian2.pack(E,P),Cartesian2.pack(b,P,2),Cartesian2.pack(x,P,4),P};const GeometryOffsetAttribute={NONE:0,TOP:1,ALL:2};var GeometryOffsetAttribute$1=Object.freeze(GeometryOffsetAttribute);function VertexFormat(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.position=defaultValue(e.position,!1),this.normal=defaultValue(e.normal,!1),this.st=defaultValue(e.st,!1),this.bitangent=defaultValue(e.bitangent,!1),this.tangent=defaultValue(e.tangent,!1),this.color=defaultValue(e.color,!1)}VertexFormat.POSITION_ONLY=Object.freeze(new VertexFormat({position:!0})),VertexFormat.POSITION_AND_NORMAL=Object.freeze(new VertexFormat({position:!0,normal:!0})),VertexFormat.POSITION_NORMAL_AND_ST=Object.freeze(new VertexFormat({position:!0,normal:!0,st:!0})),VertexFormat.POSITION_AND_ST=Object.freeze(new VertexFormat({position:!0,st:!0})),VertexFormat.POSITION_AND_COLOR=Object.freeze(new VertexFormat({position:!0,color:!0})),VertexFormat.ALL=Object.freeze(new VertexFormat({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),VertexFormat.DEFAULT=VertexFormat.POSITION_NORMAL_AND_ST,VertexFormat.packedLength=6,VertexFormat.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.position?1:0,t[n++]=e.normal?1:0,t[n++]=e.st?1:0,t[n++]=e.tangent?1:0,t[n++]=e.bitangent?1:0,t[n]=e.color?1:0,t},VertexFormat.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new VertexFormat),n.position=1===e[t++],n.normal=1===e[t++],n.st=1===e[t++],n.tangent=1===e[t++],n.bitangent=1===e[t++],n.color=1===e[t],n},VertexFormat.clone=function(e,t){if(defined(e))return defined(t)||(t=new VertexFormat),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};const diffScratch$1=new Cartesian3;function BoxGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,n=e.maximum,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._minimum=Cartesian3.clone(t),this._maximum=Cartesian3.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}BoxGeometry.fromDimensions=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,n=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxGeometry({minimum:Cartesian3.negate(n,new Cartesian3),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},BoxGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxGeometry({minimum:e.minimum,maximum:e.maximum})},BoxGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+1,BoxGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._minimum,t,n),Cartesian3.pack(e._maximum,t,n+Cartesian3.packedLength),VertexFormat.pack(e._vertexFormat,t,n+2*Cartesian3.packedLength),t[n+2*Cartesian3.packedLength+VertexFormat.packedLength]=defaultValue(e._offsetAttribute,-1),t};const scratchMin$4=new Cartesian3,scratchMax$4=new Cartesian3,scratchVertexFormat$c=new VertexFormat,scratchOptions$n={minimum:scratchMin$4,maximum:scratchMax$4,vertexFormat:scratchVertexFormat$c,offsetAttribute:void 0};let unitBoxGeometry;BoxGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchMin$4),r=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax$4),o=VertexFormat.unpack(e,t+2*Cartesian3.packedLength,scratchVertexFormat$c),a=e[t+2*Cartesian3.packedLength+VertexFormat.packedLength];return defined(n)?(n._minimum=Cartesian3.clone(i,n._minimum),n._maximum=Cartesian3.clone(r,n._maximum),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._offsetAttribute=-1===a?void 0:a,n):(scratchOptions$n.offsetAttribute=-1===a?void 0:a,new BoxGeometry(scratchOptions$n))},BoxGeometry.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(Cartesian3.equals(t,n))return;const r=new GeometryAttributes;let o,a;if(i.position&&(i.st||i.normal||i.tangent||i.bitangent)){if(i.position&&(a=new Float64Array(72),a[0]=t.x,a[1]=t.y,a[2]=n.z,a[3]=n.x,a[4]=t.y,a[5]=n.z,a[6]=n.x,a[7]=n.y,a[8]=n.z,a[9]=t.x,a[10]=n.y,a[11]=n.z,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=n.x,a[16]=t.y,a[17]=t.z,a[18]=n.x,a[19]=n.y,a[20]=t.z,a[21]=t.x,a[22]=n.y,a[23]=t.z,a[24]=n.x,a[25]=t.y,a[26]=t.z,a[27]=n.x,a[28]=n.y,a[29]=t.z,a[30]=n.x,a[31]=n.y,a[32]=n.z,a[33]=n.x,a[34]=t.y,a[35]=n.z,a[36]=t.x,a[37]=t.y,a[38]=t.z,a[39]=t.x,a[40]=n.y,a[41]=t.z,a[42]=t.x,a[43]=n.y,a[44]=n.z,a[45]=t.x,a[46]=t.y,a[47]=n.z,a[48]=t.x,a[49]=n.y,a[50]=t.z,a[51]=n.x,a[52]=n.y,a[53]=t.z,a[54]=n.x,a[55]=n.y,a[56]=n.z,a[57]=t.x,a[58]=n.y,a[59]=n.z,a[60]=t.x,a[61]=t.y,a[62]=t.z,a[63]=n.x,a[64]=t.y,a[65]=t.z,a[66]=n.x,a[67]=t.y,a[68]=n.z,a[69]=t.x,a[70]=t.y,a[71]=n.z,r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})),i.normal){const e=new Float32Array(72);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=1,e[9]=0,e[10]=0,e[11]=1,e[12]=0,e[13]=0,e[14]=-1,e[15]=0,e[16]=0,e[17]=-1,e[18]=0,e[19]=0,e[20]=-1,e[21]=0,e[22]=0,e[23]=-1,e[24]=1,e[25]=0,e[26]=0,e[27]=1,e[28]=0,e[29]=0,e[30]=1,e[31]=0,e[32]=0,e[33]=1,e[34]=0,e[35]=0,e[36]=-1,e[37]=0,e[38]=0,e[39]=-1,e[40]=0,e[41]=0,e[42]=-1,e[43]=0,e[44]=0,e[45]=-1,e[46]=0,e[47]=0,e[48]=0,e[49]=1,e[50]=0,e[51]=0,e[52]=1,e[53]=0,e[54]=0,e[55]=1,e[56]=0,e[57]=0,e[58]=1,e[59]=0,e[60]=0,e[61]=-1,e[62]=0,e[63]=0,e[64]=-1,e[65]=0,e[66]=0,e[67]=-1,e[68]=0,e[69]=0,e[70]=-1,e[71]=0,r.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(i.st){const e=new Float32Array(48);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=1,e[5]=1,e[6]=0,e[7]=1,e[8]=1,e[9]=0,e[10]=0,e[11]=0,e[12]=0,e[13]=1,e[14]=1,e[15]=1,e[16]=0,e[17]=0,e[18]=1,e[19]=0,e[20]=1,e[21]=1,e[22]=0,e[23]=1,e[24]=1,e[25]=0,e[26]=0,e[27]=0,e[28]=0,e[29]=1,e[30]=1,e[31]=1,e[32]=1,e[33]=0,e[34]=0,e[35]=0,e[36]=0,e[37]=1,e[38]=1,e[39]=1,e[40]=0,e[41]=0,e[42]=1,e[43]=0,e[44]=1,e[45]=1,e[46]=0,e[47]=1,r.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:e})}if(i.tangent){const e=new Float32Array(72);e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=1,e[7]=0,e[8]=0,e[9]=1,e[10]=0,e[11]=0,e[12]=-1,e[13]=0,e[14]=0,e[15]=-1,e[16]=0,e[17]=0,e[18]=-1,e[19]=0,e[20]=0,e[21]=-1,e[22]=0,e[23]=0,e[24]=0,e[25]=1,e[26]=0,e[27]=0,e[28]=1,e[29]=0,e[30]=0,e[31]=1,e[32]=0,e[33]=0,e[34]=1,e[35]=0,e[36]=0,e[37]=-1,e[38]=0,e[39]=0,e[40]=-1,e[41]=0,e[42]=0,e[43]=-1,e[44]=0,e[45]=0,e[46]=-1,e[47]=0,e[48]=-1,e[49]=0,e[50]=0,e[51]=-1,e[52]=0,e[53]=0,e[54]=-1,e[55]=0,e[56]=0,e[57]=-1,e[58]=0,e[59]=0,e[60]=1,e[61]=0,e[62]=0,e[63]=1,e[64]=0,e[65]=0,e[66]=1,e[67]=0,e[68]=0,e[69]=1,e[70]=0,e[71]=0,r.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(i.bitangent){const e=new Float32Array(72);e[0]=0,e[1]=1,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=1,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=1,e[14]=0,e[15]=0,e[16]=1,e[17]=0,e[18]=0,e[19]=1,e[20]=0,e[21]=0,e[22]=1,e[23]=0,e[24]=0,e[25]=0,e[26]=1,e[27]=0,e[28]=0,e[29]=1,e[30]=0,e[31]=0,e[32]=1,e[33]=0,e[34]=0,e[35]=1,e[36]=0,e[37]=0,e[38]=1,e[39]=0,e[40]=0,e[41]=1,e[42]=0,e[43]=0,e[44]=1,e[45]=0,e[46]=0,e[47]=1,e[48]=0,e[49]=0,e[50]=1,e[51]=0,e[52]=0,e[53]=1,e[54]=0,e[55]=0,e[56]=1,e[57]=0,e[58]=0,e[59]=1,e[60]=0,e[61]=0,e[62]=1,e[63]=0,e[64]=0,e[65]=1,e[66]=0,e[67]=0,e[68]=1,e[69]=0,e[70]=0,e[71]=1,r.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}o=new Uint16Array(36),o[0]=0,o[1]=1,o[2]=2,o[3]=0,o[4]=2,o[5]=3,o[6]=6,o[7]=5,o[8]=4,o[9]=7,o[10]=6,o[11]=4,o[12]=8,o[13]=9,o[14]=10,o[15]=8,o[16]=10,o[17]=11,o[18]=14,o[19]=13,o[20]=12,o[21]=15,o[22]=14,o[23]=12,o[24]=18,o[25]=17,o[26]=16,o[27]=19,o[28]=18,o[29]=16,o[30]=20,o[31]=21,o[32]=22,o[33]=20,o[34]=22,o[35]=23}else a=new Float64Array(24),a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=n.x,a[4]=t.y,a[5]=t.z,a[6]=n.x,a[7]=n.y,a[8]=t.z,a[9]=t.x,a[10]=n.y,a[11]=t.z,a[12]=t.x,a[13]=t.y,a[14]=n.z,a[15]=n.x,a[16]=t.y,a[17]=n.z,a[18]=n.x,a[19]=n.y,a[20]=n.z,a[21]=t.x,a[22]=n.y,a[23]=n.z,r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a}),o=new Uint16Array(36),o[0]=4,o[1]=5,o[2]=6,o[3]=4,o[4]=6,o[5]=7,o[6]=1,o[7]=0,o[8]=3,o[9]=1,o[10]=3,o[11]=2,o[12]=1,o[13]=6,o[14]=5,o[15]=1,o[16]=2,o[17]=6,o[18]=2,o[19]=3,o[20]=7,o[21]=2,o[22]=7,o[23]=6,o[24]=3,o[25]=0,o[26]=4,o[27]=3,o[28]=4,o[29]=7,o[30]=0,o[31]=1,o[32]=5,o[33]=0,o[34]=5,o[35]=4;const s=Cartesian3.subtract(n,t,diffScratch$1),c=.5*Cartesian3.magnitude(s);if(defined(e._offsetAttribute)){const t=a.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),r.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:r,indices:o,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,c),offsetAttribute:e._offsetAttribute})},BoxGeometry.getUnitBox=function(){return defined(unitBoxGeometry)||(unitBoxGeometry=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitBoxGeometry};const diffScratch=new Cartesian3;function BoxOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,n=e.maximum;this._min=Cartesian3.clone(t),this._max=Cartesian3.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}BoxOutlineGeometry.fromDimensions=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,n=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxOutlineGeometry({minimum:Cartesian3.negate(n,new Cartesian3),maximum:n,offsetAttribute:e.offsetAttribute})},BoxOutlineGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxOutlineGeometry({minimum:e.minimum,maximum:e.maximum})},BoxOutlineGeometry.packedLength=2*Cartesian3.packedLength+1,BoxOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._min,t,n),Cartesian3.pack(e._max,t,n+Cartesian3.packedLength),t[n+2*Cartesian3.packedLength]=defaultValue(e._offsetAttribute,-1),t};const scratchMin$3=new Cartesian3,scratchMax$3=new Cartesian3,scratchOptions$m={minimum:scratchMin$3,maximum:scratchMax$3,offsetAttribute:void 0};let implementation$1;function cancelAnimationFramePolyfill(e){implementation$1(e)}function CartographicGeocoderService(){}function Spline(){this.times=void 0,this.points=void 0,DeveloperError.throwInstantiationError()}function LinearSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,n=e.times;this._times=n,this._points=t,this._lastTimeIndex=0}BoxOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchMin$3),r=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax$3),o=e[t+2*Cartesian3.packedLength];return defined(n)?(n._min=Cartesian3.clone(i,n._min),n._max=Cartesian3.clone(r,n._max),n._offsetAttribute=-1===o?void 0:o,n):(scratchOptions$m.offsetAttribute=-1===o?void 0:o,new BoxOutlineGeometry(scratchOptions$m))},BoxOutlineGeometry.createGeometry=function(e){const t=e._min,n=e._max;if(Cartesian3.equals(t,n))return;const i=new GeometryAttributes,r=new Uint16Array(24),o=new Float64Array(24);o[0]=t.x,o[1]=t.y,o[2]=t.z,o[3]=n.x,o[4]=t.y,o[5]=t.z,o[6]=n.x,o[7]=n.y,o[8]=t.z,o[9]=t.x,o[10]=n.y,o[11]=t.z,o[12]=t.x,o[13]=t.y,o[14]=n.z,o[15]=n.x,o[16]=t.y,o[17]=n.z,o[18]=n.x,o[19]=n.y,o[20]=n.z,o[21]=t.x,o[22]=n.y,o[23]=n.z,i.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:o}),r[0]=4,r[1]=5,r[2]=5,r[3]=6,r[4]=6,r[5]=7,r[6]=7,r[7]=4,r[8]=0,r[9]=1,r[10]=1,r[11]=2,r[12]=2,r[13]=3,r[14]=3,r[15]=0,r[16]=0,r[17]=4,r[18]=1,r[19]=5,r[20]=2,r[21]=6,r[22]=3,r[23]=7;const a=Cartesian3.subtract(n,t,diffScratch),s=.5*Cartesian3.magnitude(a);if(defined(e._offsetAttribute)){const t=o.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),i.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:i,indices:r,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,s),offsetAttribute:e._offsetAttribute})},"undefined"!=typeof cancelAnimationFrame&&(implementation$1=cancelAnimationFrame),function(){if(!defined(implementation$1)&&"undefined"!=typeof window){const e=["webkit","moz","ms","o"];let t=0;const n=e.length;for(;t<n&&!defined(implementation$1);)implementation$1=window[e[t]+"CancelAnimationFrame"],defined(implementation$1)||(implementation$1=window[e[t]+"CancelRequestAnimationFrame"]),++t}defined(implementation$1)||(implementation$1=clearTimeout)}(),CartographicGeocoderService.prototype.geocode=function(e){const t=e.match(/[^\s,\n]+/g);if(2===t.length||3===t.length){let n=+t[0],i=+t[1];const r=3===t.length?+t[2]:300;if(isNaN(n)&&isNaN(i)){const e=/^(\d+.?\d*)([nsew])/i;for(let r=0;r<t.length;++r){const o=t[r].match(e);e.test(t[r])&&3===o.length&&(/^[ns]/i.test(o[2])?i=/^[n]/i.test(o[2])?+o[1]:-o[1]:/^[ew]/i.test(o[2])&&(n=/^[e]/i.test(o[2])?+o[1]:-o[1]))}}if(!isNaN(n)&&!isNaN(i)&&!isNaN(r)){const t={displayName:e,destination:Cartesian3.fromDegrees(n,i,r)};return when.resolve([t])}}return when.resolve([])},Spline.prototype.evaluate=DeveloperError.throwInstantiationError,Spline.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(e>=n[t=defaultValue(t,0)]){if(t+1<i&&e<n[t+1])return t;if(t+2<i&&e<n[t+2])return t+1}else if(t-1>=0&&e>=n[t-1])return t-1;let r;if(e>n[t])for(r=t;r<i-1&&!(e>=n[r]&&e<n[r+1]);++r);else for(r=t-1;r>=0&&!(e>=n[r]&&e<n[r+1]);--r);return r===i-1&&(r=i-2),r},Spline.prototype.wrapTime=function(e){const t=this.times,n=t[t.length-1],i=t[0],r=n-i;let o;return e<i&&(o=Math.floor((i-e)/r)+1,e+=o*r),e>n&&(o=Math.floor((e-n)/r)+1,e-=o*r),e},Spline.prototype.clampTime=function(e){const t=this.times;return CesiumMath.clamp(e,t[0],t[t.length-1])},Object.defineProperties(LinearSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),LinearSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,LinearSpline.prototype.wrapTime=Spline.prototype.wrapTime,LinearSpline.prototype.clampTime=Spline.prototype.clampTime,LinearSpline.prototype.evaluate=function(e,t){const n=this.points,i=this.times,r=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),o=(e-i[r])/(i[r+1]-i[r]);return defined(t)||(t=new Cartesian3),Cartesian3.lerp(n[r],n[r+1],o,t)};const TridiagonalSystemSolver={solve:function(e,t,n,i){const r=new Array(n.length),o=new Array(i.length),a=new Array(i.length);let s,c;for(s=0;s<o.length;s++)o[s]=new Cartesian3,a[s]=new Cartesian3;for(r[0]=n[0]/t[0],o[0]=Cartesian3.multiplyByScalar(i[0],1/t[0],o[0]),s=1;s<r.length;++s)c=1/(t[s]-r[s-1]*e[s-1]),r[s]=n[s]*c,o[s]=Cartesian3.subtract(i[s],Cartesian3.multiplyByScalar(o[s-1],e[s-1],o[s]),o[s]),o[s]=Cartesian3.multiplyByScalar(o[s],c,o[s]);for(c=1/(t[s]-r[s-1]*e[s-1]),o[s]=Cartesian3.subtract(i[s],Cartesian3.multiplyByScalar(o[s-1],e[s-1],o[s]),o[s]),o[s]=Cartesian3.multiplyByScalar(o[s],c,o[s]),a[a.length-1]=o[o.length-1],s=a.length-2;s>=0;--s)a[s]=Cartesian3.subtract(o[s],Cartesian3.multiplyByScalar(a[s+1],r[s],a[s]),a[s]);return a}},scratchLower=[],scratchDiagonal=[],scratchUpper=[],scratchRight$3=[];function generateClamped(e,t,n){const i=scratchLower,r=scratchUpper,o=scratchDiagonal,a=scratchRight$3;let s;i.length=r.length=e.length-1,o.length=a.length=e.length,i[0]=o[0]=1,r[0]=0;let c=a[0];for(defined(c)||(c=a[0]=new Cartesian3),Cartesian3.clone(t,c),s=1;s<i.length-1;++s)i[s]=r[s]=1,o[s]=4,c=a[s],defined(c)||(c=a[s]=new Cartesian3),Cartesian3.subtract(e[s+1],e[s-1],c),Cartesian3.multiplyByScalar(c,3,c);return i[s]=0,r[s]=1,o[s]=4,c=a[s],defined(c)||(c=a[s]=new Cartesian3),Cartesian3.subtract(e[s+1],e[s-1],c),Cartesian3.multiplyByScalar(c,3,c),o[s+1]=1,c=a[s+1],defined(c)||(c=a[s+1]=new Cartesian3),Cartesian3.clone(n,c),TridiagonalSystemSolver.solve(i,o,r,a)}function generateNatural(e){const t=scratchLower,n=scratchUpper,i=scratchDiagonal,r=scratchRight$3;let o;t.length=n.length=e.length-1,i.length=r.length=e.length,t[0]=n[0]=1,i[0]=2;let a=r[0];for(defined(a)||(a=r[0]=new Cartesian3),Cartesian3.subtract(e[1],e[0],a),Cartesian3.multiplyByScalar(a,3,a),o=1;o<t.length;++o)t[o]=n[o]=1,i[o]=4,a=r[o],defined(a)||(a=r[o]=new Cartesian3),Cartesian3.subtract(e[o+1],e[o-1],a),Cartesian3.multiplyByScalar(a,3,a);return i[o]=2,a=r[o],defined(a)||(a=r[o]=new Cartesian3),Cartesian3.subtract(e[o],e[o-1],a),Cartesian3.multiplyByScalar(a,3,a),TridiagonalSystemSolver.solve(t,i,n,r)}function HermiteSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,n=e.times,i=e.inTangents,r=e.outTangents;this._times=n,this._points=t,this._inTangents=i,this._outTangents=r,this._lastTimeIndex=0}Object.defineProperties(HermiteSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},inTangents:{get:function(){return this._inTangents}},outTangents:{get:function(){return this._outTangents}}}),HermiteSpline.createC1=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,n=e.points,i=e.tangents,r=i.slice(0,i.length-1);return new HermiteSpline({times:t,points:n,inTangents:i.slice(1,i.length),outTangents:r})},HermiteSpline.createNaturalCubic=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,n=e.points;if(n.length<3)return new LinearSpline({points:n,times:t});const i=generateNatural(n),r=i.slice(0,i.length-1);return new HermiteSpline({times:t,points:n,inTangents:i.slice(1,i.length),outTangents:r})},HermiteSpline.createClampedCubic=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,n=e.points,i=e.firstTangent,r=e.lastTangent;if(n.length<3)return new LinearSpline({points:n,times:t});const o=generateClamped(n,i,r),a=o.slice(0,o.length-1);return new HermiteSpline({times:t,points:n,inTangents:o.slice(1,o.length),outTangents:a})},HermiteSpline.hermiteCoefficientMatrix=new Matrix4(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0),HermiteSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval;const scratchTimeVec$1=new Cartesian4,scratchTemp=new Cartesian3;HermiteSpline.prototype.wrapTime=Spline.prototype.wrapTime,HermiteSpline.prototype.clampTime=Spline.prototype.clampTime,HermiteSpline.prototype.evaluate=function(e,t){defined(t)||(t=new Cartesian3);const n=this.points,i=this.times,r=this.inTangents,o=this.outTangents,a=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),s=(e-i[a])/(i[a+1]-i[a]),c=scratchTimeVec$1;c.z=s,c.y=s*s,c.x=c.y*s,c.w=1;const l=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,c,c);return t=Cartesian3.multiplyByScalar(n[a],l.x,t),Cartesian3.multiplyByScalar(n[a+1],l.y,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(o[a],l.z,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(r[a],l.w,scratchTemp),Cartesian3.add(t,scratchTemp,t)};const scratchTimeVec=new Cartesian4,scratchTemp0=new Cartesian3,scratchTemp1=new Cartesian3;function createEvaluateFunction$1(e){const t=e.points,n=e.times;if(t.length<3){const e=n[0],i=1/(n[1]-e),r=t[0],o=t[1];return function(t,n){defined(n)||(n=new Cartesian3);const a=(t-e)*i;return Cartesian3.lerp(r,o,a,n)}}return function(i,r){defined(r)||(r=new Cartesian3);const o=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),a=(i-n[o])/(n[o+1]-n[o]),s=scratchTimeVec;let c,l,u,d,h;return s.z=a,s.y=a*a,s.x=s.y*a,s.w=1,0===o?(c=t[0],l=t[1],u=e.firstTangent,d=Cartesian3.subtract(t[2],c,scratchTemp0),Cartesian3.multiplyByScalar(d,.5,d),h=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,s,s)):o===t.length-2?(c=t[o],l=t[o+1],d=e.lastTangent,u=Cartesian3.subtract(l,t[o-1],scratchTemp0),Cartesian3.multiplyByScalar(u,.5,u),h=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,s,s)):(c=t[o-1],l=t[o],u=t[o+1],d=t[o+2],h=Matrix4.multiplyByVector(CatmullRomSpline.catmullRomCoefficientMatrix,s,s)),r=Cartesian3.multiplyByScalar(c,h.x,r),Cartesian3.multiplyByScalar(l,h.y,scratchTemp1),Cartesian3.add(r,scratchTemp1,r),Cartesian3.multiplyByScalar(u,h.z,scratchTemp1),Cartesian3.add(r,scratchTemp1,r),Cartesian3.multiplyByScalar(d,h.w,scratchTemp1),Cartesian3.add(r,scratchTemp1,r)}}const firstTangentScratch=new Cartesian3,lastTangentScratch=new Cartesian3;function CatmullRomSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,n=e.times;let i=e.firstTangent,r=e.lastTangent;if(t.length>2&&(defined(i)||(i=firstTangentScratch,Cartesian3.multiplyByScalar(t[1],2,i),Cartesian3.subtract(i,t[2],i),Cartesian3.subtract(i,t[0],i),Cartesian3.multiplyByScalar(i,.5,i)),!defined(r))){const e=t.length-1;r=lastTangentScratch,Cartesian3.multiplyByScalar(t[e-1],2,r),Cartesian3.subtract(t[e],r,r),Cartesian3.add(r,t[e-2],r),Cartesian3.multiplyByScalar(r,.5,r)}this._times=n,this._points=t,this._firstTangent=Cartesian3.clone(i),this._lastTangent=Cartesian3.clone(r),this._evaluateFunction=createEvaluateFunction$1(this),this._lastTimeIndex=0}function getStringFromTypedArray(e,t,n){return t=defaultValue(t,0),n=defaultValue(n,e.byteLength-t),e=e.subarray(t,t+n),getStringFromTypedArray.decode(e)}function inRange(e,t,n){return t<=e&&e<=n}function utf8Handler(e){let t=0,n=0,i=0,r=128,o=191;const a=[],s=e.length;for(let c=0;c<s;++c){const s=e[c];if(0===i){if(inRange(s,0,127)){a.push(s);continue}if(inRange(s,194,223)){i=1,t=31&s;continue}if(inRange(s,224,239)){224===s&&(r=160),237===s&&(o=159),i=2,t=15&s;continue}if(inRange(s,240,244)){240===s&&(r=144),244===s&&(o=143),i=3,t=7&s;continue}throw new RuntimeError("String decoding failed.")}inRange(s,r,o)?(r=128,o=191,t=t<<6|63&s,++n,n===i&&(a.push(t),t=i=n=0)):(t=i=n=0,r=128,o=191,--c)}return a}function getJsonFromTypedArray(e,t,n){return JSON.parse(getStringFromTypedArray(e,t,n))}Object.defineProperties(CatmullRomSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},firstTangent:{get:function(){return this._firstTangent}},lastTangent:{get:function(){return this._lastTangent}}}),CatmullRomSpline.catmullRomCoefficientMatrix=new Matrix4(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0),CatmullRomSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,CatmullRomSpline.prototype.wrapTime=Spline.prototype.wrapTime,CatmullRomSpline.prototype.clampTime=Spline.prototype.clampTime,CatmullRomSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},getStringFromTypedArray.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)},getStringFromTypedArray.decodeWithFromCharCode=function(e){let t="";const n=utf8Handler(e),i=n.length;for(let e=0;e<i;++e){let i=n[e];i<=65535?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(55296+(i>>10),56320+(1023&i)))}return t},"undefined"!=typeof TextDecoder?getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithTextDecoder:getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithFromCharCode;const Intersections2D={};function QuantizedMeshTerrainData(e){this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;const t=this._quantizedVertices.length/3,n=this._uValues=this._quantizedVertices.subarray(0,t),i=this._vValues=this._quantizedVertices.subarray(t,2*t);function r(e,t){return i[e]-i[t]}function o(e,t){return n[e]-n[t]}this._heightValues=this._quantizedVertices.subarray(2*t,3*t),this._westIndices=sortIndicesIfNecessary(e.westIndices,r,t),this._southIndices=sortIndicesIfNecessary(e.southIndices,o,t),this._eastIndices=sortIndicesIfNecessary(e.eastIndices,r,t),this._northIndices=sortIndicesIfNecessary(e.northIndices,o,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=defaultValue(e.childTileMask,15),this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Intersections2D.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,r,o){let a,s,c;defined(o)?o.length=0:o=[],t?(a=n<e,s=i<e,c=r<e):(a=n>e,s=i>e,c=r>e);const l=a+s+c;let u,d,h,p,f,m;return 1===l?a?(u=(e-n)/(i-n),d=(e-n)/(r-n),o.push(1),o.push(2),1!==d&&(o.push(-1),o.push(0),o.push(2),o.push(d)),1!==u&&(o.push(-1),o.push(0),o.push(1),o.push(u))):s?(h=(e-i)/(r-i),p=(e-i)/(n-i),o.push(2),o.push(0),1!==p&&(o.push(-1),o.push(1),o.push(0),o.push(p)),1!==h&&(o.push(-1),o.push(1),o.push(2),o.push(h))):c&&(f=(e-r)/(n-r),m=(e-r)/(i-r),o.push(0),o.push(1),1!==m&&(o.push(-1),o.push(2),o.push(1),o.push(m)),1!==f&&(o.push(-1),o.push(2),o.push(0),o.push(f))):2===l?a||n===e?s||i===e?c||r===e||(d=(e-n)/(r-n),h=(e-i)/(r-i),o.push(2),o.push(-1),o.push(0),o.push(2),o.push(d),o.push(-1),o.push(1),o.push(2),o.push(h)):(m=(e-r)/(i-r),u=(e-n)/(i-n),o.push(1),o.push(-1),o.push(2),o.push(1),o.push(m),o.push(-1),o.push(0),o.push(1),o.push(u)):(p=(e-i)/(n-i),f=(e-r)/(n-r),o.push(0),o.push(-1),o.push(1),o.push(0),o.push(p),o.push(-1),o.push(2),o.push(0),o.push(f)):3!==l&&(o.push(0),o.push(1),o.push(2)),o},Intersections2D.computeBarycentricCoordinates=function(e,t,n,i,r,o,a,s,c){const l=n-a,u=a-r,d=o-s,h=i-s,p=1/(d*l+u*h),f=t-s,m=e-a,g=(d*m+u*f)*p,_=(-h*m+l*f)*p,y=1-g-_;return defined(c)?(c.x=g,c.y=_,c.z=y,c):new Cartesian3(g,_,y)},Intersections2D.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,r,o,a,s,c){const l=(s-o)*(n-e)-(a-r)*(i-t);if(0===l)return;const u=((a-r)*(t-o)-(s-o)*(e-r))/l,d=((n-e)*(t-o)-(i-t)*(e-r))/l;return u>=0&&u<=1&&d>=0&&d<=1?(defined(c)||(c=new Cartesian2),c.x=e+u*(n-e),c.y=t+u*(i-t),c):void 0},Object.defineProperties(QuantizedMeshTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return defined(this._mesh)}}});const arrayScratch$1=[];function sortIndicesIfNecessary(e,t,n){arrayScratch$1.length=e.length;let i=!1;for(let n=0,r=e.length;n<r;++n)arrayScratch$1[n]=e[n],i=i||n>0&&t(e[n-1],e[n])>0;return i?(arrayScratch$1.sort(t),IndexDatatype$1.createTypedArray(n,arrayScratch$1)):e}const createMeshTaskName$1="createVerticesFromQuantizedTerrainMesh",createMeshTaskProcessorNoThrottle$1=new TaskProcessor(createMeshTaskName$1),createMeshTaskProcessorThrottle$1=new TaskProcessor(createMeshTaskName$1,TerrainData.maximumAsynchronousTasks);QuantizedMeshTerrainData.prototype.createMesh=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,n=e.x,i=e.y,r=e.level,o=defaultValue(e.exaggeration,1),a=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToRectangle(n,i,r),u=(s?createMeshTaskProcessorThrottle$1:createMeshTaskProcessorNoThrottle$1).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:l,relativeToCenter:this._boundingSphere.center,ellipsoid:c,exaggeration:o,exaggerationRelativeHeight:a});if(!defined(u))return;const d=this;return when(u,(function(e){const t=d._quantizedVertices.length/3,n=t+d._westIndices.length+d._southIndices.length+d._eastIndices.length+d._northIndices.length,i=IndexDatatype$1.createTypedArray(n,e.indices),r=new Float32Array(e.vertices),o=e.center,a=e.minimumHeight,s=e.maximumHeight,c=d._boundingSphere,l=d._orientedBoundingBox,u=defaultValue(Cartesian3.clone(e.occludeePointInScaledSpace),d._horizonOcclusionPoint),h=e.vertexStride,p=TerrainEncoding.clone(e.encoding);return d._mesh=new TerrainMesh(o,r,i,e.indexCountWithoutSkirts,t,a,s,c,u,h,l,p,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),d._quantizedVertices=void 0,d._encodedNormals=void 0,d._indices=void 0,d._uValues=void 0,d._vValues=void 0,d._heightValues=void 0,d._westIndices=void 0,d._southIndices=void 0,d._eastIndices=void 0,d._northIndices=void 0,d._mesh}))};const upsampleTaskProcessor$1=new TaskProcessor("upsampleQuantizedTerrainMesh",TerrainData.maximumAsynchronousTasks);QuantizedMeshTerrainData.prototype.upsample=function(e,t,n,i,r,o,a){const s=this._mesh;if(!defined(this._mesh))return;const c=2*t!==r,l=2*n===o,u=e.ellipsoid,d=e.tileXYToRectangle(r,o,a),h=upsampleTaskProcessor$1.scheduleTask({vertices:s.vertices,vertexCountWithoutSkirts:s.vertexCountWithoutSkirts,indices:s.indices,indexCountWithoutSkirts:s.indexCountWithoutSkirts,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:u});if(!defined(h))return;let p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);const f=c?.5*p:this._westSkirtHeight,m=l?.5*p:this._southSkirtHeight,g=c?this._eastSkirtHeight:.5*p,_=l?this._northSkirtHeight:.5*p,y=this._credits;return when(h).then((function(e){const t=new Uint16Array(e.vertices),n=IndexDatatype$1.createTypedArray(t.length/3,e.indices);let i;return defined(e.encodedNormals)&&(i=new Uint8Array(e.encodedNormals)),new QuantizedMeshTerrainData({quantizedVertices:t,indices:n,encodedNormals:i,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:f,southSkirtHeight:m,eastSkirtHeight:g,northSkirtHeight:_,childTileMask:0,credits:y,createdByUpsampling:!0})}))};const maxShort$1=32767,barycentricCoordinateScratch$1=new Cartesian3;function pointInBoundingBox(e,t,n,i,r,o,a,s){const c=Math.min(n,r,a),l=Math.max(n,r,a),u=Math.min(i,o,s),d=Math.max(i,o,s);return e>=c&&e<=l&&t>=u&&t<=d}QuantizedMeshTerrainData.prototype.interpolateHeight=function(e,t,n){let i=CesiumMath.clamp((t-e.west)/e.width,0,1);i*=maxShort$1;let r=CesiumMath.clamp((n-e.south)/e.height,0,1);return r*=maxShort$1,defined(this._mesh)?interpolateMeshHeight$1(this,i,r):interpolateHeight$1(this,i,r)};const texCoordScratch0$1=new Cartesian2,texCoordScratch1$1=new Cartesian2,texCoordScratch2$1=new Cartesian2;function interpolateMeshHeight$1(e,t,n){const i=e._mesh,r=i.vertices,o=i.encoding,a=i.indices;for(let e=0,i=a.length;e<i;e+=3){const i=a[e],s=a[e+1],c=a[e+2],l=o.decodeTextureCoordinates(r,i,texCoordScratch0$1),u=o.decodeTextureCoordinates(r,s,texCoordScratch1$1),d=o.decodeTextureCoordinates(r,c,texCoordScratch2$1);if(pointInBoundingBox(t,n,l.x,l.y,u.x,u.y,d.x,d.y)){const e=Intersections2D.computeBarycentricCoordinates(t,n,l.x,l.y,u.x,u.y,d.x,d.y,barycentricCoordinateScratch$1);if(e.x>=-1e-15&&e.y>=-1e-15&&e.z>=-1e-15){const t=o.decodeHeight(r,i),n=o.decodeHeight(r,s),a=o.decodeHeight(r,c);return e.x*t+e.y*n+e.z*a}}}}function interpolateHeight$1(e,t,n){const i=e._uValues,r=e._vValues,o=e._heightValues,a=e._indices;for(let s=0,c=a.length;s<c;s+=3){const c=a[s],l=a[s+1],u=a[s+2],d=i[c],h=i[l],p=i[u],f=r[c],m=r[l],g=r[u];if(pointInBoundingBox(t,n,d,f,h,m,p,g)){const i=Intersections2D.computeBarycentricCoordinates(t,n,d,f,h,m,p,g,barycentricCoordinateScratch$1);if(i.x>=-1e-15&&i.y>=-1e-15&&i.z>=-1e-15){const t=i.x*o[c]+i.y*o[l]+i.z*o[u];return CesiumMath.lerp(e._minimumHeight,e._maximumHeight,t/maxShort$1)}}}}function LayerInformation(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function CesiumTerrainProvider(e){this._heightmapWidth=65,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=defaultValue(e.requestVertexNormals,!1),this._requestWaterMask=defaultValue(e.requestWaterMask,!1),this._requestMetadata=defaultValue(e.requestMetadata,!0),this._errorEvent=new Event;let t=e.credit;"string"==typeof t&&(t=new Credit(t)),this._credit=t,this._availability=void 0;const n=when.defer();this._ready=!1,this._readyPromise=n,this._tileCredits=void 0;const i=this;let r,o,a;const s=this._layers=[];let c="";const l=[];let u=0;function d(e){let t;if(!e.format)return t="The tile format is not specified in the layer.json file.",void(a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m));if(!e.tiles||0===e.tiles.length)return t="The layer.json file does not specify any tile URL templates.",void(a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m));let n=!1,p=!1,f=!1,g=!0,_=!1;if("heightmap-1.0"===e.format)_=!0,defined(i._heightmapStructure)||(i._heightmapStructure={heightScale:.2,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:65535}),p=!0,i._requestWaterMask=!0;else if(0!==e.format.indexOf("quantized-mesh-1."))return t='The tile format "'+e.format+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m));const y=e.tiles,C=e.maxzoom;if(u=Math.max(u,C),e.projection&&"EPSG:4326"!==e.projection){if("EPSG:3857"!==e.projection)return t='The projection "'+e.projection+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m));i._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:i._ellipsoid})}else i._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:i._ellipsoid});if(i._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(i._tilingScheme.ellipsoid,i._heightmapWidth,i._tilingScheme.getNumberOfXTilesAtLevel(0)),e.scheme&&"tms"!==e.scheme&&"slippyMap"!==e.scheme)return t='The scheme "'+e.scheme+'" is invalid or not supported.',void(a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m));let T;i._scheme=e.scheme,defined(e.extensions)&&-1!==e.extensions.indexOf("octvertexnormals")?n=!0:defined(e.extensions)&&-1!==e.extensions.indexOf("vertexnormals")&&(n=!0,g=!1),defined(e.extensions)&&-1!==e.extensions.indexOf("watermask")&&(p=!0),defined(e.extensions)&&-1!==e.extensions.indexOf("metadata")&&(f=!0);const S=e.metadataAvailability,A=e.available;let v;if(defined(A)&&!defined(S)){v=new TileAvailability(i._tilingScheme,A.length);for(let e=0;e<A.length;++e){const t=A[e],n=i._tilingScheme.getNumberOfYTilesAtLevel(e);defined(l[e])||(l[e]=[]);for(let i=0;i<t.length;++i){const r=t[i],o=n-r.endY-1,a=n-r.startY-1;l[e].push([r.startX,o,r.endX,a]),v.addAvailableTileRange(e,r.startX,o,r.endX,a)}}}else defined(S)&&(T=new TileAvailability(i._tilingScheme,C),v=new TileAvailability(i._tilingScheme,C),l[0]=[[0,0,1,0]],v.addAvailableTileRange(0,0,0,1,0));i._hasWaterMask=i._hasWaterMask||p,i._hasVertexNormals=i._hasVertexNormals||n,i._hasMetadata=i._hasMetadata||f,defined(e.attribution)&&(c.length>0&&(c+=" "),c+=e.attribution),s.push(new LayerInformation({resource:r,version:e.version,isHeightmap:_,tileUrlTemplates:y,availability:v,hasVertexNormals:n,hasWaterMask:p,hasMetadata:f,availabilityLevels:S,availabilityTilesLoaded:T,littleEndianExtensionSize:g}));const E=e.parentUrl;if(defined(E)){if(!defined(v))return console.log("A layer.json can't have a parentUrl if it does't have an available array."),when.resolve();r=r.getDerivedResource({url:E}),r.appendForwardSlash(),o=r.getDerivedResource({url:"layer.json"});const e=o.fetchJson();return when(e,d,h)}return when.resolve()}function h(e){const t="An error occurred while accessing "+o.url+".";a=TileProviderError.handleError(a,i,i._errorEvent,t,void 0,void 0,void 0,m)}function p(e){d(e).then((function(){if(defined(a))return;const e=l.length;if(e>0){const t=i._availability=new TileAvailability(i._tilingScheme,u);for(let n=0;n<e;++n){const e=l[n];for(let i=0;i<e.length;++i){const r=e[i];t.addAvailableTileRange(n,r[0],r[1],r[2],r[3])}}}if(c.length>0){const e=new Credit(c);defined(i._tileCredits)?i._tileCredits.push(e):i._tileCredits=[e]}i._ready=!0,i._readyPromise.resolve(!0)}))}function f(e){defined(e)&&404===e.statusCode?p({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):h()}function m(){when(o.fetchJson()).then(p).otherwise(f)}when(e.url).then((function(e){const t=Resource.createIfNeeded(e);t.appendForwardSlash(),r=t,o=r.getDerivedResource({url:"layer.json"}),i._tileCredits=t.credits,m()})).otherwise((function(e){n.reject(e)}))}QuantizedMeshTerrainData.prototype.isChildAvailable=function(e,t,n,i){let r=2;return n!==2*e&&++r,i!==2*t&&(r-=2),0!=(this._childTileMask&1<<r)},QuantizedMeshTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};const QuantizedMeshExtensionIds={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function getRequestHeader(e){if(!defined(e)||0===e.length)return{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"};return{Accept:"application/vnd.quantized-mesh;extensions="+e.join("-")+",application/octet-stream;q=0.9,*/*;q=0.01"}}function createHeightmapTerrainData(e,t,n,i,r){const o=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new HeightmapTerrainData({buffer:o,childTileMask:new Uint8Array(t,o.byteLength,1)[0],waterMask:new Uint8Array(t,o.byteLength+1,t.byteLength-o.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function createQuantizedMeshTerrainData(e,t,n,i,r,o){const a=o.littleEndianExtensionSize;let s=0;const c=3*Float64Array.BYTES_PER_ELEMENT,l=4*Float64Array.BYTES_PER_ELEMENT,u=3*Uint16Array.BYTES_PER_ELEMENT;let d=Uint16Array.BYTES_PER_ELEMENT,h=3*d;const p=new DataView(t),f=new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0));s+=c;const m=p.getFloat32(s,!0);s+=Float32Array.BYTES_PER_ELEMENT;const g=p.getFloat32(s,!0);s+=Float32Array.BYTES_PER_ELEMENT;const _=new BoundingSphere(new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0)),p.getFloat64(s+c,!0));s+=l;const y=new Cartesian3(p.getFloat64(s,!0),p.getFloat64(s+8,!0),p.getFloat64(s+16,!0));s+=c;const C=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const T=new Uint16Array(t,s,3*C);s+=C*u,C>65536&&(d=Uint32Array.BYTES_PER_ELEMENT,h=3*d);const S=T.subarray(0,C),A=T.subarray(C,2*C),v=T.subarray(2*C,3*C);AttributeCompression.zigZagDeltaDecode(S,A,v),s%d!=0&&(s+=d-s%d);const E=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const b=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,s,3*E);s+=E*h;let x=0;const P=b.length;for(let e=0;e<P;++e){const t=b[e];b[e]=x-t,0===t&&++x}const D=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const w=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,s,D);s+=D*d;const M=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const I=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,s,M);s+=M*d;const R=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const O=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,s,R);s+=R*d;const B=p.getUint32(s,!0);s+=Uint32Array.BYTES_PER_ELEMENT;const L=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,s,B);let F,N;for(s+=B*d;s<p.byteLength;){const c=p.getUint8(s,!0);s+=Uint8Array.BYTES_PER_ELEMENT;const l=p.getUint32(s,a);if(s+=Uint32Array.BYTES_PER_ELEMENT,c===QuantizedMeshExtensionIds.OCT_VERTEX_NORMALS&&e._requestVertexNormals)F=new Uint8Array(t,s,2*C);else if(c===QuantizedMeshExtensionIds.WATER_MASK&&e._requestWaterMask)N=new Uint8Array(t,s,l);else if(c===QuantizedMeshExtensionIds.METADATA&&e._requestMetadata){const a=p.getUint32(s,!0);if(a>0){const i=getJsonFromTypedArray(new Uint8Array(t),s+Uint32Array.BYTES_PER_ELEMENT,a).available;if(defined(i))for(let t=0;t<i.length;++t){const r=n+t+1,a=i[t],s=e._tilingScheme.getNumberOfYTilesAtLevel(r);for(let t=0;t<a.length;++t){const n=a[t],i=s-n.endY-1,c=s-n.startY-1;e.availability.addAvailableTileRange(r,n.startX,i,n.endX,c),o.availability.addAvailableTileRange(r,n.startX,i,n.endX,c)}}}o.availabilityTilesLoaded.addAvailableTileRange(n,i,r,i,r)}s+=l}const V=5*e.getLevelMaximumGeometricError(n),k=e._tilingScheme.tileXYToRectangle(i,r,n);return new QuantizedMeshTerrainData({center:f,minimumHeight:m,maximumHeight:g,boundingSphere:_,orientedBoundingBox:OrientedBoundingBox.fromRectangle(k,m,g,e._tilingScheme.ellipsoid),horizonOcclusionPoint:y,quantizedVertices:T,encodedNormals:F,indices:b,westIndices:w,southIndices:I,eastIndices:O,northIndices:L,westSkirtHeight:V,southSkirtHeight:V,eastSkirtHeight:V,northSkirtHeight:V,childTileMask:e.availability.computeChildMaskForTile(n,i,r),waterMask:N,credits:e._tileCredits})}function requestTileGeometry$1(e,t,n,i,r,o){if(!defined(r))return when.reject(new RuntimeError("Terrain tile doesn't exist"));const a=r.tileUrlTemplates;if(0===a.length)return;let s;if(e._scheme&&"tms"!==e._scheme)s=n;else{s=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1}const c=[];let l,u;e._requestVertexNormals&&r.hasVertexNormals&&c.push(r.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&r.hasWaterMask&&c.push("watermask"),e._requestMetadata&&r.hasMetadata&&c.push("metadata");const d=a[(t+s+i)%a.length],h=r.resource;defined(h._ionEndpoint)&&!defined(h._ionEndpoint.externalType)?(0!==c.length&&(u={extensions:c.join("-")}),l=getRequestHeader(void 0)):l=getRequestHeader(c);const p=h.getDerivedResource({url:d,templateValues:{version:r.version,z:i,x:t,y:s},queryParameters:u,headers:l,request:o}).fetchArrayBuffer();return defined(p)?p.then((function(o){return defined(e._heightmapStructure)?createHeightmapTerrainData(e,o):createQuantizedMeshTerrainData(e,o,i,t,n,r)})):void 0}function getAvailabilityTile(e,t,n,i){if(0===i)return;const r=e.availabilityLevels,o=i%r==0?i-r:(i/r|0)*r,a=1<<i-o;return{level:o,x:t/a|0,y:n/a|0}}function checkLayer(e,t,n,i,r,o){if(!defined(r.availabilityLevels))return{result:!1};let a;const s=function(){delete r.availabilityPromiseCache[a]},c=r.availabilityTilesLoaded,l=r.availability;let u=getAvailabilityTile(r,t,n,i);for(;defined(u);){if(l.isTileAvailable(u.level,u.x,u.y)&&!c.isTileAvailable(u.level,u.x,u.y)){let t;if(!o&&(a=u.level+"-"+u.x+"-"+u.y,t=r.availabilityPromiseCache[a],!defined(t))){const n=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});t=requestTileGeometry$1(e,u.x,u.y,u.level,r,n),defined(t)&&(r.availabilityPromiseCache[a]=t,t.then(s))}return{result:!0,promise:t}}u=getAvailabilityTile(r,u.x,u.y,u.level)}return{result:!1}}CesiumTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){const r=this._layers;let o;const a=r.length;if(1===a)o=r[0];else for(let i=0;i<a;++i){const a=r[i];if(!defined(a.availability)||a.availability.isTileAvailable(n,e,t)){o=a;break}}return requestTileGeometry$1(this,e,t,n,o,i)},Object.defineProperties(CesiumTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){return this._availability}}}),CesiumTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},CesiumTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){if(!defined(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;const i=this._layers,r=i.length;for(let o=0;o<r;++o){if(checkLayer(this,e,t,n,i[o],0===o).result)return}return!1},CesiumTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){if(!defined(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,r=i.length;for(let o=0;o<r;++o){const r=checkLayer(this,e,t,n,i[o],0===o);if(defined(r.promise))return r.promise}},CesiumTerrainProvider._getAvailabilityTile=getAvailabilityTile;const EllipseGeometryLibrary={},rotAxis=new Cartesian3,tempVec=new Cartesian3,unitQuat=new Quaternion,rotMtx=new Matrix3;function pointOnEllipsoid(e,t,n,i,r,o,a,s,c,l){const u=e+t;Cartesian3.multiplyByScalar(i,Math.cos(u),rotAxis),Cartesian3.multiplyByScalar(n,Math.sin(u),tempVec),Cartesian3.add(rotAxis,tempVec,rotAxis);let d=Math.cos(e);d*=d;let h=Math.sin(e);h*=h;const p=o/Math.sqrt(a*d+r*h)/s;return Quaternion.fromAxisAngle(rotAxis,p,unitQuat),Matrix3.fromQuaternion(unitQuat,rotMtx),Matrix3.multiplyByVector(rotMtx,c,l),Cartesian3.normalize(l,l),Cartesian3.multiplyByScalar(l,s,l),l}const scratchCartesian1$6=new Cartesian3,scratchCartesian2$9=new Cartesian3,scratchCartesian3$a=new Cartesian3,scratchNormal$6=new Cartesian3;EllipseGeometryLibrary.raisePositionsToHeight=function(e,t,n){const i=t.ellipsoid,r=t.height,o=t.extrudedHeight,a=n?e.length/3*2:e.length/3,s=new Float64Array(3*a),c=e.length,l=n?c:0;for(let t=0;t<c;t+=3){const a=t+1,c=t+2,u=Cartesian3.fromArray(e,t,scratchCartesian1$6);i.scaleToGeodeticSurface(u,u);const d=Cartesian3.clone(u,scratchCartesian2$9),h=i.geodeticSurfaceNormal(u,scratchNormal$6),p=Cartesian3.multiplyByScalar(h,r,scratchCartesian3$a);Cartesian3.add(u,p,u),n&&(Cartesian3.multiplyByScalar(h,o,p),Cartesian3.add(d,p,d),s[t+l]=d.x,s[a+l]=d.y,s[c+l]=d.z),s[t]=u.x,s[a]=u.y,s[c]=u.z}return s};const unitPosScratch=new Cartesian3,eastVecScratch=new Cartesian3,northVecScratch=new Cartesian3;function GeometryInstance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometry=e.geometry,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=defaultValue(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}function EncodedCartesian3(){this.high=Cartesian3.clone(Cartesian3.ZERO),this.low=Cartesian3.clone(Cartesian3.ZERO)}EllipseGeometryLibrary.computeEllipsePositions=function(e,t,n){const i=e.semiMinorAxis,r=e.semiMajorAxis,o=e.rotation,a=e.center,s=8*e.granularity,c=i*i,l=r*r,u=r*i,d=Cartesian3.magnitude(a),h=Cartesian3.normalize(a,unitPosScratch);let p=Cartesian3.cross(Cartesian3.UNIT_Z,a,eastVecScratch);p=Cartesian3.normalize(p,p);const f=Cartesian3.cross(h,p,northVecScratch);let m=1+Math.ceil(CesiumMath.PI_OVER_TWO/s);const g=CesiumMath.PI_OVER_TWO/(m-1);let _=CesiumMath.PI_OVER_TWO-m*g;_<0&&(m-=Math.ceil(Math.abs(_)/g));const y=t?new Array(3*(m*(m+2)*2)):void 0;let C=0,T=scratchCartesian1$6,S=scratchCartesian2$9;const A=4*m*3;let v=A-1,E=0;const b=n?new Array(A):void 0;let x,P,D,w,M;for(_=CesiumMath.PI_OVER_TWO,T=pointOnEllipsoid(_,o,f,p,c,u,l,d,h,T),t&&(y[C++]=T.x,y[C++]=T.y,y[C++]=T.z),n&&(b[v--]=T.z,b[v--]=T.y,b[v--]=T.x),_=CesiumMath.PI_OVER_TWO-g,x=1;x<m+1;++x){if(T=pointOnEllipsoid(_,o,f,p,c,u,l,d,h,T),S=pointOnEllipsoid(Math.PI-_,o,f,p,c,u,l,d,h,S),t){for(y[C++]=T.x,y[C++]=T.y,y[C++]=T.z,D=2*x+2,P=1;P<D-1;++P)w=P/(D-1),M=Cartesian3.lerp(T,S,w,scratchCartesian3$a),y[C++]=M.x,y[C++]=M.y,y[C++]=M.z;y[C++]=S.x,y[C++]=S.y,y[C++]=S.z}n&&(b[v--]=T.z,b[v--]=T.y,b[v--]=T.x,b[E++]=S.x,b[E++]=S.y,b[E++]=S.z),_=CesiumMath.PI_OVER_TWO-(x+1)*g}for(x=m;x>1;--x){if(_=CesiumMath.PI_OVER_TWO-(x-1)*g,T=pointOnEllipsoid(-_,o,f,p,c,u,l,d,h,T),S=pointOnEllipsoid(_+Math.PI,o,f,p,c,u,l,d,h,S),t){for(y[C++]=T.x,y[C++]=T.y,y[C++]=T.z,D=2*(x-1)+2,P=1;P<D-1;++P)w=P/(D-1),M=Cartesian3.lerp(T,S,w,scratchCartesian3$a),y[C++]=M.x,y[C++]=M.y,y[C++]=M.z;y[C++]=S.x,y[C++]=S.y,y[C++]=S.z}n&&(b[v--]=T.z,b[v--]=T.y,b[v--]=T.x,b[E++]=S.x,b[E++]=S.y,b[E++]=S.z)}_=CesiumMath.PI_OVER_TWO,T=pointOnEllipsoid(-_,o,f,p,c,u,l,d,h,T);const I={};return t&&(y[C++]=T.x,y[C++]=T.y,y[C++]=T.z,I.positions=y,I.numPts=m),n&&(b[v--]=T.z,b[v--]=T.y,b[v--]=T.x,I.outerPositions=b),I},EncodedCartesian3.encode=function(e,t){let n;return defined(t)||(t={high:0,low:0}),e>=0?(n=65536*Math.floor(e/65536),t.high=n,t.low=e-n):(n=65536*Math.floor(-e/65536),t.high=-n,t.low=e+n),t};const scratchEncode={high:0,low:0};EncodedCartesian3.fromCartesian=function(e,t){defined(t)||(t=new EncodedCartesian3);const n=t.high,i=t.low;return EncodedCartesian3.encode(e.x,scratchEncode),n.x=scratchEncode.high,i.x=scratchEncode.low,EncodedCartesian3.encode(e.y,scratchEncode),n.y=scratchEncode.high,i.y=scratchEncode.low,EncodedCartesian3.encode(e.z,scratchEncode),n.z=scratchEncode.high,i.z=scratchEncode.low,t};const encodedP=new EncodedCartesian3;EncodedCartesian3.writeElements=function(e,t,n){EncodedCartesian3.fromCartesian(e,encodedP);const i=encodedP.high,r=encodedP.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=r.x,t[n+4]=r.y,t[n+5]=r.z};const Tipsify={calculateACMR:function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices;let n=e.maximumIndex;const i=defaultValue(e.cacheSize,24),r=t.length;if(!defined(n)){n=0;let e=0,i=t[e];for(;e<r;)i>n&&(n=i),++e,i=t[e]}const o=[];for(let e=0;e<n+1;e++)o[e]=0;let a=i+1;for(let e=0;e<r;++e)a-o[t[e]]>i&&(o[t[e]]=a,++a);return(a-i+1)/(r/3)}};Tipsify.tipsify=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices,n=e.maximumIndex,i=defaultValue(e.cacheSize,24);let r;function o(e,t,n,i,o,a,s){let c,l=-1,u=-1,d=0;for(;d<n.length;){const e=n[d];i[e].numLiveTriangles&&(c=0,o-i[e].timeStamp+2*i[e].numLiveTriangles<=t&&(c=o-i[e].timeStamp),(c>u||-1===u)&&(u=c,l=e)),++d}return-1===l?function(e,t,n,i){for(;t.length>=1;){const n=t[t.length-1];if(t.splice(t.length-1,1),e[n].numLiveTriangles>0)return n}for(;r<i;){if(e[r].numLiveTriangles>0)return++r,r-1;++r}return-1}(i,a,0,s):l}const a=t.length;let s=0,c=0,l=t[c];const u=a;if(defined(n))s=n+1;else{for(;c<u;)l>s&&(s=l),++c,l=t[c];if(-1===s)return 0;++s}const d=[];let h;for(h=0;h<s;h++)d[h]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};c=0;let p=0;for(;c<u;)d[t[c]].vertexTriangles.push(p),++d[t[c]].numLiveTriangles,d[t[c+1]].vertexTriangles.push(p),++d[t[c+1]].numLiveTriangles,d[t[c+2]].vertexTriangles.push(p),++d[t[c+2]].numLiveTriangles,++p,c+=3;let f=0,m=i+1;r=1;let g=[];const _=[];let y,C,T=0;const S=[],A=a/3,v=[];for(h=0;h<A;h++)v[h]=!1;let E,b;for(;-1!==f;){g=[],C=d[f],b=C.vertexTriangles.length;for(let e=0;e<b;++e)if(p=C.vertexTriangles[e],!v[p]){v[p]=!0,c=p+p+p;for(let e=0;e<3;++e)E=t[c],g.push(E),_.push(E),S[T]=E,++T,y=d[E],--y.numLiveTriangles,m-y.timeStamp>i&&(y.timeStamp=m,++m),++c}f=o(0,i,g,d,m,_,s)}return S};const GeometryPipeline={};function addTriangle(e,t,n,i,r){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=r,e[t++]=r,e[t]=n}function trianglesToLines(e){const t=e.length,n=t/3*6,i=IndexDatatype$1.createTypedArray(t,n);let r=0;for(let n=0;n<t;n+=3,r+=6)addTriangle(i,r,e[n],e[n+1],e[n+2]);return i}function triangleStripToLines(e){const t=e.length;if(t>=3){const n=6*(t-2),i=IndexDatatype$1.createTypedArray(t,n);addTriangle(i,0,e[0],e[1],e[2]);let r=6;for(let n=3;n<t;++n,r+=6)addTriangle(i,r,e[n-1],e[n],e[n-2]);return i}return new Uint16Array}function triangleFanToLines(e){if(e.length>0){const t=e.length-1,n=6*(t-1),i=IndexDatatype$1.createTypedArray(t,n),r=e[0];let o=0;for(let n=1;n<t;++n,o+=6)addTriangle(i,o,r,e[n],e[n+1]);return i}return new Uint16Array}function copyAttributesDescriptions(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&defined(e[n])&&defined(e[n].values)){const i=e[n];t[n]=new GeometryAttribute({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function copyVertex(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&defined(t[i])&&defined(t[i].values)){const r=t[i];for(let t=0;t<r.componentsPerAttribute;++t)e[i].values.push(r.values[n*r.componentsPerAttribute+t])}}GeometryPipeline.toWireframe=function(e){const t=e.indices;if(defined(t)){switch(e.primitiveType){case PrimitiveType$1.TRIANGLES:e.indices=trianglesToLines(t);break;case PrimitiveType$1.TRIANGLE_STRIP:e.indices=triangleStripToLines(t);break;case PrimitiveType$1.TRIANGLE_FAN:e.indices=triangleFanToLines(t)}e.primitiveType=PrimitiveType$1.LINES}return e},GeometryPipeline.createLineSegmentsForVectors=function(e,t,n){t=defaultValue(t,"normal"),n=defaultValue(n,1e4);const i=e.attributes.position.values,r=e.attributes[t].values,o=i.length,a=new Float64Array(2*o);let s,c=0;for(let e=0;e<o;e+=3)a[c++]=i[e],a[c++]=i[e+1],a[c++]=i[e+2],a[c++]=i[e]+r[e]*n,a[c++]=i[e+1]+r[e+1]*n,a[c++]=i[e+2]+r[e+2]*n;const l=e.boundingSphere;return defined(l)&&(s=new BoundingSphere(l.center,l.radius+n)),new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})},primitiveType:PrimitiveType$1.LINES,boundingSphere:s})},GeometryPipeline.createAttributeLocations=function(e){const t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={};let r,o=0;const a=t.length;for(r=0;r<a;++r){const e=t[r];defined(n[e])&&(i[e]=o++)}for(const e in n)n.hasOwnProperty(e)&&!defined(i[e])&&(i[e]=o++);return i},GeometryPipeline.reorderForPreVertexCache=function(e){const t=Geometry.computeNumberOfVertices(e),n=e.indices;if(defined(n)){const i=new Int32Array(t);for(let e=0;e<t;e++)i[e]=-1;const r=n,o=r.length,a=IndexDatatype$1.createTypedArray(t,o);let s,c=0,l=0,u=0;for(;c<o;)s=i[r[c]],-1!==s?a[l]=s:(s=r[c],i[s]=u,a[l]=u,++u),++c,++l;e.indices=a;const d=e.attributes;for(const e in d)if(d.hasOwnProperty(e)&&defined(d[e])&&defined(d[e].values)){const n=d[e],r=n.values;let o=0;const a=n.componentsPerAttribute,s=ComponentDatatype$1.createTypedArray(n.componentDatatype,u*a);for(;o<t;){const e=i[o];if(-1!==e)for(let t=0;t<a;t++)s[a*e+t]=r[a*o+t];++o}n.values=s}}return e},GeometryPipeline.reorderForPostVertexCache=function(e,t){const n=e.indices;if(e.primitiveType===PrimitiveType$1.TRIANGLES&&defined(n)){const i=n.length;let r=0;for(let e=0;e<i;e++)n[e]>r&&(r=n[e]);e.indices=Tipsify.tipsify({indices:n,maximumIndex:r,cacheSize:t})}return e},GeometryPipeline.fitToUnsignedShortIndices=function(e){const t=[],n=Geometry.computeNumberOfVertices(e);if(defined(e.indices)&&n>=CesiumMath.SIXTY_FOUR_KILOBYTES){let n=[],i=[],r=0,o=copyAttributesDescriptions(e.attributes);const a=e.indices,s=a.length;let c;e.primitiveType===PrimitiveType$1.TRIANGLES?c=3:e.primitiveType===PrimitiveType$1.LINES?c=2:e.primitiveType===PrimitiveType$1.POINTS&&(c=1);for(let l=0;l<s;l+=c){for(let t=0;t<c;++t){const s=a[l+t];let c=n[s];defined(c)||(c=r++,n[s]=c,copyVertex(o,e.attributes,s)),i.push(c)}r+c>=CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(new Geometry({attributes:o,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),n=[],i=[],r=0,o=copyAttributesDescriptions(e.attributes))}0!==i.length&&t.push(new Geometry({attributes:o,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const scratchProjectTo2DCartesian3=new Cartesian3,scratchProjectTo2DCartographic=new Cartographic;GeometryPipeline.projectTo2D=function(e,t,n,i,r){const o=e.attributes[t],a=(r=defined(r)?r:new GeographicProjection).ellipsoid,s=o.values,c=new Float64Array(s.length);let l=0;for(let e=0;e<s.length;e+=3){const t=Cartesian3.fromArray(s,e,scratchProjectTo2DCartesian3),n=a.cartesianToCartographic(t,scratchProjectTo2DCartographic),i=r.project(n,scratchProjectTo2DCartesian3);c[l++]=i.x,c[l++]=i.y,c[l++]=i.z}return e.attributes[n]=o,e.attributes[i]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};const encodedResult={high:0,low:0};GeometryPipeline.encodeAttribute=function(e,t,n,i){const r=e.attributes[t],o=r.values,a=o.length,s=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;++e)EncodedCartesian3.encode(o[e],encodedResult),s[e]=encodedResult.high,c[e]=encodedResult.low;const l=r.componentsPerAttribute;return e.attributes[n]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:l,values:s}),e.attributes[i]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:l,values:c}),delete e.attributes[t],e};let scratchCartesian3$9=new Cartesian3;function transformPoint(e,t){if(defined(t)){const n=t.values,i=n.length;for(let t=0;t<i;t+=3)Cartesian3.unpack(n,t,scratchCartesian3$9),Matrix4.multiplyByPoint(e,scratchCartesian3$9,scratchCartesian3$9),Cartesian3.pack(scratchCartesian3$9,n,t)}}function transformVector(e,t){if(defined(t)){const n=t.values,i=n.length;for(let t=0;t<i;t+=3)Cartesian3.unpack(n,t,scratchCartesian3$9),Matrix3.multiplyByVector(e,scratchCartesian3$9,scratchCartesian3$9),scratchCartesian3$9=Cartesian3.normalize(scratchCartesian3$9,scratchCartesian3$9),Cartesian3.pack(scratchCartesian3$9,n,t)}}const inverseTranspose=new Matrix4,normalMatrix=new Matrix3;function findAttributesInAllGeometries(e,t){const n=e.length,i={},r=e[0][t].attributes;let o;for(o in r)if(r.hasOwnProperty(o)&&defined(r[o])&&defined(r[o].values)){const a=r[o];let s=a.values.length,c=!0;for(let i=1;i<n;++i){const n=e[i][t].attributes[o];if(!defined(n)||a.componentDatatype!==n.componentDatatype||a.componentsPerAttribute!==n.componentsPerAttribute||a.normalize!==n.normalize){c=!1;break}s+=n.values.length}c&&(i[o]=new GeometryAttribute({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:ComponentDatatype$1.createTypedArray(a.componentDatatype,s)}))}return i}GeometryPipeline.transformToWorldCoordinates=function(e){const t=e.modelMatrix;if(Matrix4.equals(t,Matrix4.IDENTITY))return e;const n=e.geometry.attributes;transformPoint(t,n.position),transformPoint(t,n.prevPosition),transformPoint(t,n.nextPosition),(defined(n.normal)||defined(n.tangent)||defined(n.bitangent))&&(Matrix4.inverse(t,inverseTranspose),Matrix4.transpose(inverseTranspose,inverseTranspose),Matrix4.getMatrix3(inverseTranspose,normalMatrix),transformVector(normalMatrix,n.normal),transformVector(normalMatrix,n.tangent),transformVector(normalMatrix,n.bitangent));const i=e.geometry.boundingSphere;return defined(i)&&(e.geometry.boundingSphere=BoundingSphere.transform(i,t,i)),e.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),e};const tempScratch$1=new Cartesian3;function combineGeometries(e,t){const n=e.length;let i,r,o,a;e[0].modelMatrix;const s=defined(e[0][t].indices),c=e[0][t].primitiveType,l=findAttributesInAllGeometries(e,t);let u,d,h,p;for(i in l)if(l.hasOwnProperty(i))for(u=l[i].values,a=0,r=0;r<n;++r)for(d=e[r][t].attributes[i].values,h=d.length,o=0;o<h;++o)u[a++]=d[o];if(s){let i=0;for(r=0;r<n;++r)i+=e[r][t].indices.length;const o=Geometry.computeNumberOfVertices(new Geometry({attributes:l,primitiveType:PrimitiveType$1.POINTS})),s=IndexDatatype$1.createTypedArray(o,i);let c=0,u=0;for(r=0;r<n;++r){const n=e[r][t].indices,i=n.length;for(a=0;a<i;++a)s[c++]=u+n[a];u+=Geometry.computeNumberOfVertices(e[r][t])}p=s}let f,m=new Cartesian3,g=0;for(r=0;r<n;++r){if(f=e[r][t].boundingSphere,!defined(f)){m=void 0;break}Cartesian3.add(f.center,m,m)}if(defined(m))for(Cartesian3.divideByScalar(m,n,m),r=0;r<n;++r){f=e[r][t].boundingSphere;const n=Cartesian3.magnitude(Cartesian3.subtract(f.center,m,tempScratch$1))+f.radius;n>g&&(g=n)}return new Geometry({attributes:l,indices:p,primitiveType:c,boundingSphere:defined(m)?new BoundingSphere(m,g):void 0})}GeometryPipeline.combineInstances=function(e){const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const i=e[r];defined(i.geometry)?t.push(i):defined(i.westHemisphereGeometry)&&defined(i.eastHemisphereGeometry)&&n.push(i)}const r=[];return t.length>0&&r.push(combineGeometries(t,"geometry")),n.length>0&&(r.push(combineGeometries(n,"westHemisphereGeometry")),r.push(combineGeometries(n,"eastHemisphereGeometry"))),r};const normal=new Cartesian3,v0=new Cartesian3,v1$1=new Cartesian3,v2$1=new Cartesian3;GeometryPipeline.computeNormal=function(e){const t=e.indices,n=e.attributes,i=n.position.values,r=n.position.values.length/3,o=t.length,a=new Array(r),s=new Array(o/3),c=new Array(o);let l;for(l=0;l<r;l++)a[l]={indexOffset:0,count:0,currentCount:0};let u=0;for(l=0;l<o;l+=3){const e=t[l],n=t[l+1],r=t[l+2],o=3*e,c=3*n,d=3*r;v0.x=i[o],v0.y=i[o+1],v0.z=i[o+2],v1$1.x=i[c],v1$1.y=i[c+1],v1$1.z=i[c+2],v2$1.x=i[d],v2$1.y=i[d+1],v2$1.z=i[d+2],a[e].count++,a[n].count++,a[r].count++,Cartesian3.subtract(v1$1,v0,v1$1),Cartesian3.subtract(v2$1,v0,v2$1),s[u]=Cartesian3.cross(v1$1,v2$1,new Cartesian3),u++}let d,h=0;for(l=0;l<r;l++)a[l].indexOffset+=h,h+=a[l].count;for(u=0,l=0;l<o;l+=3){d=a[t[l]];let e=d.indexOffset+d.currentCount;c[e]=u,d.currentCount++,d=a[t[l+1]],e=d.indexOffset+d.currentCount,c[e]=u,d.currentCount++,d=a[t[l+2]],e=d.indexOffset+d.currentCount,c[e]=u,d.currentCount++,u++}const p=new Float32Array(3*r);for(l=0;l<r;l++){const e=3*l;if(d=a[l],Cartesian3.clone(Cartesian3.ZERO,normal),d.count>0){for(u=0;u<d.count;u++)Cartesian3.add(normal,s[c[d.indexOffset+u]],normal);Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&Cartesian3.clone(s[c[d.indexOffset]],normal)}Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&(normal.z=1),Cartesian3.normalize(normal,normal),p[e]=normal.x,p[e+1]=normal.y,p[e+2]=normal.z}return e.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p}),e};const normalScratch$4=new Cartesian3,normalScale=new Cartesian3,tScratch=new Cartesian3;GeometryPipeline.computeTangentAndBitangent=function(e){e.attributes;const t=e.indices,n=e.attributes.position.values,i=e.attributes.normal.values,r=e.attributes.st.values,o=e.attributes.position.values.length/3,a=t.length,s=new Array(3*o);let c,l,u,d;for(c=0;c<s.length;c++)s[c]=0;for(c=0;c<a;c+=3){const e=t[c],i=t[c+1],o=t[c+2];l=3*e,u=3*i,d=3*o;const a=2*e,h=2*i,p=2*o,f=n[l],m=n[l+1],g=n[l+2],_=r[a],y=r[a+1],C=r[h+1]-y,T=r[p+1]-y,S=1/((r[h]-_)*T-(r[p]-_)*C),A=(T*(n[u]-f)-C*(n[d]-f))*S,v=(T*(n[u+1]-m)-C*(n[d+1]-m))*S,E=(T*(n[u+2]-g)-C*(n[d+2]-g))*S;s[l]+=A,s[l+1]+=v,s[l+2]+=E,s[u]+=A,s[u+1]+=v,s[u+2]+=E,s[d]+=A,s[d+1]+=v,s[d+2]+=E}const h=new Float32Array(3*o),p=new Float32Array(3*o);for(c=0;c<o;c++){l=3*c,u=l+1,d=l+2;const e=Cartesian3.fromArray(i,l,normalScratch$4),t=Cartesian3.fromArray(s,l,tScratch),n=Cartesian3.dot(e,t);Cartesian3.multiplyByScalar(e,n,normalScale),Cartesian3.normalize(Cartesian3.subtract(t,normalScale,t),t),h[l]=t.x,h[u]=t.y,h[d]=t.z,Cartesian3.normalize(Cartesian3.cross(e,t,t),t),p[l]=t.x,p[u]=t.y,p[d]=t.z}return e.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h}),e.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p}),e};const scratchCartesian2$8=new Cartesian2,toEncode1=new Cartesian3,toEncode2=new Cartesian3,toEncode3=new Cartesian3;let encodeResult2=new Cartesian2;function indexTriangles(e){if(defined(e.indices))return e;const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,t);for(let e=0;e<t;++e)n[e]=e;return e.indices=n,e}function indexTriangleFan(e){const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,3*(t-2));n[0]=1,n[1]=0,n[2]=2;let i=3;for(let e=3;e<t;++e)n[i++]=e-1,n[i++]=0,n[i++]=e;return e.indices=n,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexTriangleStrip(e){const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,3*(t-2));n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let e=3;e<t-1;e+=2)n[i++]=e,n[i++]=e-1,n[i++]=e+1,e+2<t&&(n[i++]=e,n[i++]=e+1,n[i++]=e+2);return e.indices=n,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexLines(e){if(defined(e.indices))return e;const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,t);for(let e=0;e<t;++e)n[e]=e;return e.indices=n,e}function indexLineStrip(e){const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,2*(t-1));n[0]=0,n[1]=1;let i=2;for(let e=2;e<t;++e)n[i++]=e-1,n[i++]=e;return e.indices=n,e.primitiveType=PrimitiveType$1.LINES,e}function indexLineLoop(e){const t=Geometry.computeNumberOfVertices(e),n=IndexDatatype$1.createTypedArray(t,2*t);n[0]=0,n[1]=1;let i=2;for(let e=2;e<t;++e)n[i++]=e-1,n[i++]=e;return n[i++]=t-1,n[i]=0,e.indices=n,e.primitiveType=PrimitiveType$1.LINES,e}function indexPrimitive(e){switch(e.primitiveType){case PrimitiveType$1.TRIANGLE_FAN:return indexTriangleFan(e);case PrimitiveType$1.TRIANGLE_STRIP:return indexTriangleStrip(e);case PrimitiveType$1.TRIANGLES:return indexTriangles(e);case PrimitiveType$1.LINE_STRIP:return indexLineStrip(e);case PrimitiveType$1.LINE_LOOP:return indexLineLoop(e);case PrimitiveType$1.LINES:return indexLines(e)}return e}function offsetPointFromXZPlane(e,t){Math.abs(e.y)<CesiumMath.EPSILON6&&(e.y=t?-CesiumMath.EPSILON6:CesiumMath.EPSILON6)}function offsetTriangleFromXZPlane(e,t,n){if(0!==e.y&&0!==t.y&&0!==n.y)return offsetPointFromXZPlane(e,e.y<0),offsetPointFromXZPlane(t,t.y<0),void offsetPointFromXZPlane(n,n.y<0);const i=Math.abs(e.y),r=Math.abs(t.y),o=Math.abs(n.y);let a;a=i>r?i>o?CesiumMath.sign(e.y):CesiumMath.sign(n.y):r>o?CesiumMath.sign(t.y):CesiumMath.sign(n.y);const s=a<0;offsetPointFromXZPlane(e,s),offsetPointFromXZPlane(t,s),offsetPointFromXZPlane(n,s)}GeometryPipeline.compressVertices=function(e){const t=e.attributes.extrudeDirection;let n,i;if(defined(t)){const r=t.values;i=r.length/3;const o=new Float32Array(2*i);let a=0;for(n=0;n<i;++n)Cartesian3.fromArray(r,3*n,toEncode1),Cartesian3.equals(toEncode1,Cartesian3.ZERO)?a+=2:(encodeResult2=AttributeCompression.octEncodeInRange(toEncode1,65535,encodeResult2),o[a++]=encodeResult2.x,o[a++]=encodeResult2.y);return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:o}),delete e.attributes.extrudeDirection,e}const r=e.attributes.normal,o=e.attributes.st,a=defined(r),s=defined(o);if(!a&&!s)return e;const c=e.attributes.tangent,l=e.attributes.bitangent,u=defined(c),d=defined(l);let h,p,f,m;a&&(h=r.values),s&&(p=o.values),u&&(f=c.values),d&&(m=l.values);i=(a?h.length:p.length)/(a?3:2);let g=i,_=s&&a?2:1;_+=u||d?1:0,g*=_;const y=new Float32Array(g);let C=0;for(n=0;n<i;++n){s&&(Cartesian2.fromArray(p,2*n,scratchCartesian2$8),y[C++]=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8));const e=3*n;a&&defined(f)&&defined(m)?(Cartesian3.fromArray(h,e,toEncode1),Cartesian3.fromArray(f,e,toEncode2),Cartesian3.fromArray(m,e,toEncode3),AttributeCompression.octPack(toEncode1,toEncode2,toEncode3,scratchCartesian2$8),y[C++]=scratchCartesian2$8.x,y[C++]=scratchCartesian2$8.y):(a&&(Cartesian3.fromArray(h,e,toEncode1),y[C++]=AttributeCompression.octEncodeFloat(toEncode1)),u&&(Cartesian3.fromArray(f,e,toEncode1),y[C++]=AttributeCompression.octEncodeFloat(toEncode1)),d&&(Cartesian3.fromArray(m,e,toEncode1),y[C++]=AttributeCompression.octEncodeFloat(toEncode1)))}return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:_,values:y}),a&&delete e.attributes.normal,s&&delete e.attributes.st,d&&delete e.attributes.bitangent,u&&delete e.attributes.tangent,e};const c3$1=new Cartesian3;function getXZIntersectionOffsetPoints(e,t,n,i){Cartesian3.add(e,Cartesian3.multiplyByScalar(Cartesian3.subtract(t,e,c3$1),e.y/(e.y-t.y),c3$1),n),Cartesian3.clone(n,i),offsetPointFromXZPlane(n,!0),offsetPointFromXZPlane(i,!1)}const u1=new Cartesian3,u2=new Cartesian3,q1=new Cartesian3,q2=new Cartesian3,splitTriangleResult={positions:new Array(7),indices:new Array(9)};function splitTriangle(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;offsetTriangleFromXZPlane(e,t,n);const i=e.y<0,r=t.y<0,o=n.y<0;let a=0;a+=i?1:0,a+=r?1:0,a+=o?1:0;const s=splitTriangleResult.indices;1===a?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,i?(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,n,u2,q2),s[0]=0,s[3]=1,s[4]=2,s[6]=1):r?(getXZIntersectionOffsetPoints(t,n,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=1,s[3]=2,s[4]=0,s[6]=2):o&&(getXZIntersectionOffsetPoints(n,e,u1,q1),getXZIntersectionOffsetPoints(n,t,u2,q2),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2===a&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,i?r?o||(getXZIntersectionOffsetPoints(n,e,u1,q1),getXZIntersectionOffsetPoints(n,t,u2,q2),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(getXZIntersectionOffsetPoints(t,n,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,n,u2,q2),s[0]=1,s[1]=2,s[3]=1,s[6]=0));const c=splitTriangleResult.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,1!==a&&2!==a||(c[3]=u1,c[4]=u2,c[5]=q1,c[6]=q2,c.length=7),splitTriangleResult}function updateGeometryAfterSplit(e,t){const n=e.attributes;if(0===n.position.values.length)return;for(const e in n)if(n.hasOwnProperty(e)&&defined(n[e])&&defined(n[e].values)){const t=n[e];t.values=ComponentDatatype$1.createTypedArray(t.componentDatatype,t.values)}const i=Geometry.computeNumberOfVertices(e);return e.indices=IndexDatatype$1.createTypedArray(i,e.indices),t&&(e.boundingSphere=BoundingSphere.fromVertices(n.position.values)),e}function copyGeometryForSplit(e){const t=e.attributes,n={};for(const e in t)if(t.hasOwnProperty(e)&&defined(t[e])&&defined(t[e].values)){const i=t[e];n[e]=new GeometryAttribute({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return new Geometry({attributes:n,indices:[],primitiveType:e.primitiveType})}function updateInstanceAfterSplit(e,t,n){const i=defined(e.geometry.boundingSphere);t=updateGeometryAfterSplit(t,i),defined(n=updateGeometryAfterSplit(n,i))&&!defined(t)?e.geometry=n:!defined(n)&&defined(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function generateBarycentricInterpolateFunction(e,t){const n=new e,i=new e,r=new e;return function(o,a,s,c,l,u,d,h){const p=e.fromArray(l,o*t,n),f=e.fromArray(l,a*t,i),m=e.fromArray(l,s*t,r);e.multiplyByScalar(p,c.x,p),e.multiplyByScalar(f,c.y,f),e.multiplyByScalar(m,c.z,m);const g=e.add(p,f,p);e.add(g,m,g),h&&e.normalize(g,g),e.pack(g,u,d*t)}}const interpolateAndPackCartesian4=generateBarycentricInterpolateFunction(Cartesian4,4),interpolateAndPackCartesian3=generateBarycentricInterpolateFunction(Cartesian3,3),interpolateAndPackCartesian2=generateBarycentricInterpolateFunction(Cartesian2,2),interpolateAndPackBoolean=function(e,t,n,i,r,o,a){const s=r[e]*i.x,c=r[t]*i.y,l=r[n]*i.z;o[a]=s+c+l>CesiumMath.EPSILON6?1:0},p0Scratch=new Cartesian3,p1Scratch$2=new Cartesian3,p2Scratch$2=new Cartesian3,barycentricScratch=new Cartesian3;function computeTriangleAttributes(e,t,n,i,r,o,a,s,c,l,u,d,h,p,f,m){if(!(defined(o)||defined(a)||defined(s)||defined(c)||defined(l)||0!==p))return;const g=barycentricCoordinates(i,Cartesian3.fromArray(r,3*e,p0Scratch),Cartesian3.fromArray(r,3*t,p1Scratch$2),Cartesian3.fromArray(r,3*n,p2Scratch$2),barycentricScratch);if(defined(g)){if(defined(o)&&interpolateAndPackCartesian3(e,t,n,g,o,d.normal.values,m,!0),defined(l)){const i=Cartesian3.fromArray(l,3*e,p0Scratch),r=Cartesian3.fromArray(l,3*t,p1Scratch$2),o=Cartesian3.fromArray(l,3*n,p2Scratch$2);let a;Cartesian3.multiplyByScalar(i,g.x,i),Cartesian3.multiplyByScalar(r,g.y,r),Cartesian3.multiplyByScalar(o,g.z,o),Cartesian3.equals(i,Cartesian3.ZERO)&&Cartesian3.equals(r,Cartesian3.ZERO)&&Cartesian3.equals(o,Cartesian3.ZERO)?(a=p0Scratch,a.x=0,a.y=0,a.z=0):(a=Cartesian3.add(i,r,i),Cartesian3.add(a,o,a),Cartesian3.normalize(a,a)),Cartesian3.pack(a,d.extrudeDirection.values,3*m)}if(defined(u)&&interpolateAndPackBoolean(e,t,n,g,u,d.applyOffset.values,m),defined(a)&&interpolateAndPackCartesian3(e,t,n,g,a,d.tangent.values,m,!0),defined(s)&&interpolateAndPackCartesian3(e,t,n,g,s,d.bitangent.values,m,!0),defined(c)&&interpolateAndPackCartesian2(e,t,n,g,c,d.st.values,m),p>0)for(let i=0;i<p;i++){const r=h[i];genericInterpolate(e,t,n,g,m,f[r],d[r])}}}function genericInterpolate(e,t,n,i,r,o,a){const s=o.componentsPerAttribute,c=o.values,l=a.values;switch(s){case 4:interpolateAndPackCartesian4(e,t,n,i,c,l,r,!1);break;case 3:interpolateAndPackCartesian3(e,t,n,i,c,l,r,!1);break;case 2:interpolateAndPackCartesian2(e,t,n,i,c,l,r,!1);break;default:l[r]=c[e]*i.x+c[t]*i.y+c[n]*i.z}}function insertSplitPoint(e,t,n,i,r,o){const a=e.position.values.length/3;if(-1!==r){const s=i[r],c=n[s];return-1===c?(n[s]=a,e.position.values.push(o.x,o.y,o.z),t.push(a),a):(t.push(c),c)}return e.position.values.push(o.x,o.y,o.z),t.push(a),a}const NAMED_ATTRIBUTES={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function splitLongitudeTriangles(e){const t=e.geometry,n=t.attributes,i=n.position.values,r=defined(n.normal)?n.normal.values:void 0,o=defined(n.bitangent)?n.bitangent.values:void 0,a=defined(n.tangent)?n.tangent.values:void 0,s=defined(n.st)?n.st.values:void 0,c=defined(n.extrudeDirection)?n.extrudeDirection.values:void 0,l=defined(n.applyOffset)?n.applyOffset.values:void 0,u=t.indices,d=[];for(const e in n)n.hasOwnProperty(e)&&!NAMED_ATTRIBUTES[e]&&defined(n[e])&&d.push(e);const h=d.length,p=copyGeometryForSplit(t),f=copyGeometryForSplit(t);let m,g,_,y,C;const T=[];T.length=i.length/3;const S=[];for(S.length=i.length/3,C=0;C<T.length;++C)T[C]=-1,S[C]=-1;const A=u.length;for(C=0;C<A;C+=3){const e=u[C],t=u[C+1],A=u[C+2];let v=Cartesian3.fromArray(i,3*e),E=Cartesian3.fromArray(i,3*t),b=Cartesian3.fromArray(i,3*A);const x=splitTriangle(v,E,b);if(defined(x)&&x.positions.length>3){const v=x.positions,E=x.indices,b=E.length;for(let x=0;x<b;++x){const b=E[x],P=v[b];P.y<0?(m=f.attributes,g=f.indices,_=T):(m=p.attributes,g=p.indices,_=S),y=insertSplitPoint(m,g,_,u,b<3?C+b:-1,P),computeTriangleAttributes(e,t,A,P,i,r,a,o,s,c,l,m,d,h,n,y)}}else defined(x)&&(v=x.positions[0],E=x.positions[1],b=x.positions[2]),v.y<0?(m=f.attributes,g=f.indices,_=T):(m=p.attributes,g=p.indices,_=S),y=insertSplitPoint(m,g,_,u,C,v),computeTriangleAttributes(e,t,A,v,i,r,a,o,s,c,l,m,d,h,n,y),y=insertSplitPoint(m,g,_,u,C+1,E),computeTriangleAttributes(e,t,A,E,i,r,a,o,s,c,l,m,d,h,n,y),y=insertSplitPoint(m,g,_,u,C+2,b),computeTriangleAttributes(e,t,A,b,i,r,a,o,s,c,l,m,d,h,n,y)}updateInstanceAfterSplit(e,f,p)}const xzPlane=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),offsetScratch$c=new Cartesian3,offsetPointScratch=new Cartesian3;function computeLineAttributes(e,t,n,i,r,o,a){if(!defined(a))return;const s=Cartesian3.fromArray(i,3*e,p0Scratch);Cartesian3.equalsEpsilon(s,n,CesiumMath.EPSILON10)?o.applyOffset.values[r]=a[e]:o.applyOffset.values[r]=a[t]}function splitLongitudeLines(e){const t=e.geometry,n=t.attributes,i=n.position.values,r=defined(n.applyOffset)?n.applyOffset.values:void 0,o=t.indices,a=copyGeometryForSplit(t),s=copyGeometryForSplit(t);let c;const l=o.length,u=[];u.length=i.length/3;const d=[];for(d.length=i.length/3,c=0;c<u.length;++c)u[c]=-1,d[c]=-1;for(c=0;c<l;c+=2){const e=o[c],t=o[c+1],n=Cartesian3.fromArray(i,3*e,p0Scratch),l=Cartesian3.fromArray(i,3*t,p1Scratch$2);let h;Math.abs(n.y)<CesiumMath.EPSILON6&&(n.y<0?n.y=-CesiumMath.EPSILON6:n.y=CesiumMath.EPSILON6),Math.abs(l.y)<CesiumMath.EPSILON6&&(l.y<0?l.y=-CesiumMath.EPSILON6:l.y=CesiumMath.EPSILON6);let p=a.attributes,f=a.indices,m=d,g=s.attributes,_=s.indices,y=u;const C=IntersectionTests.lineSegmentPlane(n,l,xzPlane,p2Scratch$2);if(defined(C)){const T=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,5*CesiumMath.EPSILON9,offsetScratch$c);n.y<0&&(Cartesian3.negate(T,T),p=s.attributes,f=s.indices,m=u,g=a.attributes,_=a.indices,y=d);const S=Cartesian3.add(C,T,offsetPointScratch);h=insertSplitPoint(p,f,m,o,c,n),computeLineAttributes(e,t,n,i,h,p,r),h=insertSplitPoint(p,f,m,o,-1,S),computeLineAttributes(e,t,S,i,h,p,r),Cartesian3.negate(T,T),Cartesian3.add(C,T,S),h=insertSplitPoint(g,_,y,o,-1,S),computeLineAttributes(e,t,S,i,h,g,r),h=insertSplitPoint(g,_,y,o,c+1,l),computeLineAttributes(e,t,l,i,h,g,r)}else{let p,f,m;n.y<0?(p=s.attributes,f=s.indices,m=u):(p=a.attributes,f=a.indices,m=d),h=insertSplitPoint(p,f,m,o,c,n),computeLineAttributes(e,t,n,i,h,p,r),h=insertSplitPoint(p,f,m,o,c+1,l),computeLineAttributes(e,t,l,i,h,p,r)}}updateInstanceAfterSplit(e,s,a)}const cartesian2Scratch0=new Cartesian2,cartesian2Scratch1=new Cartesian2,cartesian3Scratch0=new Cartesian3,cartesian3Scratch2$1=new Cartesian3,cartesian3Scratch3$1=new Cartesian3,cartesian3Scratch4=new Cartesian3,cartesian3Scratch5=new Cartesian3,cartesian3Scratch6=new Cartesian3,cartesian4Scratch0=new Cartesian4;function updateAdjacencyAfterSplit(e){const t=e.attributes,n=t.position.values,i=t.prevPosition.values,r=t.nextPosition.values,o=n.length;for(let e=0;e<o;e+=3){const t=Cartesian3.unpack(n,e,cartesian3Scratch0);if(t.x>0)continue;const a=Cartesian3.unpack(i,e,cartesian3Scratch2$1);(t.y<0&&a.y>0||t.y>0&&a.y<0)&&(e-3>0?(i[e]=n[e-3],i[e+1]=n[e-2],i[e+2]=n[e-1]):Cartesian3.pack(t,i,e));const s=Cartesian3.unpack(r,e,cartesian3Scratch3$1);(t.y<0&&s.y>0||t.y>0&&s.y<0)&&(e+3<o?(r[e]=n[e+3],r[e+1]=n[e+4],r[e+2]=n[e+5]):Cartesian3.pack(t,r,e))}}const offsetScalar=5*CesiumMath.EPSILON9,coplanarOffset=CesiumMath.EPSILON6;function splitLongitudePolyline(e){const t=e.geometry,n=t.attributes,i=n.position.values,r=n.prevPosition.values,o=n.nextPosition.values,a=n.expandAndWidth.values,s=defined(n.st)?n.st.values:void 0,c=defined(n.color)?n.color.values:void 0,l=copyGeometryForSplit(t),u=copyGeometryForSplit(t);let d,h,p,f=!1;const m=i.length/3;for(d=0;d<m;d+=4){const e=d,t=d+2,n=Cartesian3.fromArray(i,3*e,cartesian3Scratch0),m=Cartesian3.fromArray(i,3*t,cartesian3Scratch2$1);if(Math.abs(n.y)<coplanarOffset)for(n.y=coplanarOffset*(m.y<0?-1:1),i[3*d+1]=n.y,i[3*(d+1)+1]=n.y,h=3*e;h<3*e+12;h+=3)r[h]=i[3*d],r[h+1]=i[3*d+1],r[h+2]=i[3*d+2];if(Math.abs(m.y)<coplanarOffset)for(m.y=coplanarOffset*(n.y<0?-1:1),i[3*(d+2)+1]=m.y,i[3*(d+3)+1]=m.y,h=3*e;h<3*e+12;h+=3)o[h]=i[3*(d+2)],o[h+1]=i[3*(d+2)+1],o[h+2]=i[3*(d+2)+2];let g=l.attributes,_=l.indices,y=u.attributes,C=u.indices;const T=IntersectionTests.lineSegmentPlane(n,m,xzPlane,cartesian3Scratch4);if(defined(T)){f=!0;const i=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,offsetScalar,cartesian3Scratch5);n.y<0&&(Cartesian3.negate(i,i),g=u.attributes,_=u.indices,y=l.attributes,C=l.indices);const S=Cartesian3.add(T,i,cartesian3Scratch6);g.position.values.push(n.x,n.y,n.z,n.x,n.y,n.z),g.position.values.push(S.x,S.y,S.z),g.position.values.push(S.x,S.y,S.z),g.prevPosition.values.push(r[3*e],r[3*e+1],r[3*e+2]),g.prevPosition.values.push(r[3*e+3],r[3*e+4],r[3*e+5]),g.prevPosition.values.push(n.x,n.y,n.z,n.x,n.y,n.z),g.nextPosition.values.push(S.x,S.y,S.z),g.nextPosition.values.push(S.x,S.y,S.z),g.nextPosition.values.push(S.x,S.y,S.z),g.nextPosition.values.push(S.x,S.y,S.z),Cartesian3.negate(i,i),Cartesian3.add(T,i,S),y.position.values.push(S.x,S.y,S.z),y.position.values.push(S.x,S.y,S.z),y.position.values.push(m.x,m.y,m.z,m.x,m.y,m.z),y.prevPosition.values.push(S.x,S.y,S.z),y.prevPosition.values.push(S.x,S.y,S.z),y.prevPosition.values.push(S.x,S.y,S.z),y.prevPosition.values.push(S.x,S.y,S.z),y.nextPosition.values.push(m.x,m.y,m.z,m.x,m.y,m.z),y.nextPosition.values.push(o[3*t],o[3*t+1],o[3*t+2]),y.nextPosition.values.push(o[3*t+3],o[3*t+4],o[3*t+5]);const A=Cartesian2.fromArray(a,2*e,cartesian2Scratch0),v=Math.abs(A.y);g.expandAndWidth.values.push(-1,v,1,v),g.expandAndWidth.values.push(-1,-v,1,-v),y.expandAndWidth.values.push(-1,v,1,v),y.expandAndWidth.values.push(-1,-v,1,-v);let E=Cartesian3.magnitudeSquared(Cartesian3.subtract(T,n,cartesian3Scratch3$1));if(E/=Cartesian3.magnitudeSquared(Cartesian3.subtract(m,n,cartesian3Scratch3$1)),defined(c)){const n=Cartesian4.fromArray(c,4*e,cartesian4Scratch0),i=Cartesian4.fromArray(c,4*t,cartesian4Scratch0),r=CesiumMath.lerp(n.x,i.x,E),o=CesiumMath.lerp(n.y,i.y,E),a=CesiumMath.lerp(n.z,i.z,E),s=CesiumMath.lerp(n.w,i.w,E);for(h=4*e;h<4*e+8;++h)g.color.values.push(c[h]);for(g.color.values.push(r,o,a,s),g.color.values.push(r,o,a,s),y.color.values.push(r,o,a,s),y.color.values.push(r,o,a,s),h=4*t;h<4*t+8;++h)y.color.values.push(c[h])}if(defined(s)){const n=Cartesian2.fromArray(s,2*e,cartesian2Scratch0),i=Cartesian2.fromArray(s,2*(d+3),cartesian2Scratch1),r=CesiumMath.lerp(n.x,i.x,E);for(h=2*e;h<2*e+4;++h)g.st.values.push(s[h]);for(g.st.values.push(r,n.y),g.st.values.push(r,i.y),y.st.values.push(r,n.y),y.st.values.push(r,i.y),h=2*t;h<2*t+4;++h)y.st.values.push(s[h])}p=g.position.values.length/3-4,_.push(p,p+2,p+1),_.push(p+1,p+2,p+3),p=y.position.values.length/3-4,C.push(p,p+2,p+1),C.push(p+1,p+2,p+3)}else{let e,t;for(n.y<0?(e=u.attributes,t=u.indices):(e=l.attributes,t=l.indices),e.position.values.push(n.x,n.y,n.z),e.position.values.push(n.x,n.y,n.z),e.position.values.push(m.x,m.y,m.z),e.position.values.push(m.x,m.y,m.z),h=3*d;h<3*d+12;++h)e.prevPosition.values.push(r[h]),e.nextPosition.values.push(o[h]);for(h=2*d;h<2*d+8;++h)e.expandAndWidth.values.push(a[h]),defined(s)&&e.st.values.push(s[h]);if(defined(c))for(h=4*d;h<4*d+16;++h)e.color.values.push(c[h]);p=e.position.values.length/3-4,t.push(p,p+2,p+1),t.push(p+1,p+2,p+3)}}f&&(updateAdjacencyAfterSplit(u),updateAdjacencyAfterSplit(l)),updateInstanceAfterSplit(e,u,l)}GeometryPipeline.splitLongitude=function(e){const t=e.geometry,n=t.boundingSphere;if(defined(n)){if(n.center.x-n.radius>0||BoundingSphere.intersectPlane(n,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING)return e}if(t.geometryType!==GeometryType$1.NONE)switch(t.geometryType){case GeometryType$1.POLYLINES:splitLongitudePolyline(e);break;case GeometryType$1.TRIANGLES:splitLongitudeTriangles(e);break;case GeometryType$1.LINES:splitLongitudeLines(e)}else indexPrimitive(t),t.primitiveType===PrimitiveType$1.TRIANGLES?splitLongitudeTriangles(e):t.primitiveType===PrimitiveType$1.LINES&&splitLongitudeLines(e);return e};const scratchCartesian1$5=new Cartesian3,scratchCartesian2$7=new Cartesian3,scratchCartesian3$8=new Cartesian3,scratchCartesian4$5=new Cartesian3,texCoordScratch=new Cartesian2,textureMatrixScratch$1=new Matrix3,tangentMatrixScratch$1=new Matrix3,quaternionScratch$3=new Quaternion,scratchNormal$5=new Cartesian3,scratchTangent$4=new Cartesian3,scratchBitangent$4=new Cartesian3,scratchCartographic$f=new Cartographic,projectedCenterScratch=new Cartesian3,scratchMinTexCoord=new Cartesian2,scratchMaxTexCoord=new Cartesian2;function computeTopBottomAttributes(e,t,n){const i=t.vertexFormat,r=t.center,o=t.semiMajorAxis,a=t.semiMinorAxis,s=t.ellipsoid,c=t.stRotation,l=n?e.length/3*2:e.length/3,u=t.shadowVolume,d=i.st?new Float32Array(2*l):void 0,h=i.normal?new Float32Array(3*l):void 0,p=i.tangent?new Float32Array(3*l):void 0,f=i.bitangent?new Float32Array(3*l):void 0,m=u?new Float32Array(3*l):void 0;let g=0,_=scratchNormal$5,y=scratchTangent$4,C=scratchBitangent$4;const T=new GeographicProjection(s),S=T.project(s.cartesianToCartographic(r,scratchCartographic$f),projectedCenterScratch),A=s.scaleToGeodeticSurface(r,scratchCartesian1$5);s.geodeticSurfaceNormal(A,A);let v=textureMatrixScratch$1,E=tangentMatrixScratch$1;if(0!==c){let e=Quaternion.fromAxisAngle(A,c,quaternionScratch$3);v=Matrix3.fromQuaternion(e,v),e=Quaternion.fromAxisAngle(A,-c,quaternionScratch$3),E=Matrix3.fromQuaternion(e,E)}else v=Matrix3.clone(Matrix3.IDENTITY,v),E=Matrix3.clone(Matrix3.IDENTITY,E);const b=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),x=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord);let P=e.length;const D=n?P:0,w=D/3*2;for(let t=0;t<P;t+=3){const r=t+1,c=t+2,l=Cartesian3.fromArray(e,t,scratchCartesian1$5);if(i.st){const e=Matrix3.multiplyByVector(v,l,scratchCartesian2$7),t=T.project(s.cartesianToCartographic(e,scratchCartographic$f),scratchCartesian3$8);Cartesian3.subtract(t,S,t),texCoordScratch.x=(t.x+o)/(2*o),texCoordScratch.y=(t.y+a)/(2*a),b.x=Math.min(texCoordScratch.x,b.x),b.y=Math.min(texCoordScratch.y,b.y),x.x=Math.max(texCoordScratch.x,x.x),x.y=Math.max(texCoordScratch.y,x.y),n&&(d[g+w]=texCoordScratch.x,d[g+1+w]=texCoordScratch.y),d[g++]=texCoordScratch.x,d[g++]=texCoordScratch.y}(i.normal||i.tangent||i.bitangent||u)&&(_=s.geodeticSurfaceNormal(l,_),u&&(m[t+D]=-_.x,m[r+D]=-_.y,m[c+D]=-_.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(y=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,_,y),y),Matrix3.multiplyByVector(E,y,y)),i.normal&&(h[t]=_.x,h[r]=_.y,h[c]=_.z,n&&(h[t+D]=-_.x,h[r+D]=-_.y,h[c+D]=-_.z)),i.tangent&&(p[t]=y.x,p[r]=y.y,p[c]=y.z,n&&(p[t+D]=-y.x,p[r+D]=-y.y,p[c+D]=-y.z)),i.bitangent&&(C=Cartesian3.normalize(Cartesian3.cross(_,y,C),C),f[t]=C.x,f[r]=C.y,f[c]=C.z,n&&(f[t+D]=C.x,f[r+D]=C.y,f[c+D]=C.z))))}if(i.st){P=d.length;for(let e=0;e<P;e+=2)d[e]=(d[e]-b.x)/(x.x-b.x),d[e+1]=(d[e+1]-b.y)/(x.y-b.y)}const M=new GeometryAttributes;if(i.position){const i=EllipseGeometryLibrary.raisePositionsToHeight(e,t,n);M.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i})}if(i.st&&(M.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:d})),i.normal&&(M.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),i.tangent&&(M.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),i.bitangent&&(M.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),u&&(M.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),n&&defined(t.offsetAttribute)){let e=new Uint8Array(l);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)e=arrayFill(e,1,0,l/2);else{e=arrayFill(e,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}M.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return M}function topIndices(e){const t=new Array(e*(e+1)*12-6);let n,i,r,o,a,s=0;for(n=0,r=1,o=0;o<3;o++)t[s++]=r++,t[s++]=n,t[s++]=r;for(o=2;o<e+1;++o){for(r=o*(o+1)-1,n=(o-1)*o-1,t[s++]=r++,t[s++]=n,t[s++]=r,i=2*o,a=0;a<i-1;++a)t[s++]=r,t[s++]=n++,t[s++]=n,t[s++]=r++,t[s++]=n,t[s++]=r;t[s++]=r++,t[s++]=n,t[s++]=r}for(i=2*e,++r,++n,o=0;o<i-1;++o)t[s++]=r,t[s++]=n++,t[s++]=n,t[s++]=r++,t[s++]=n,t[s++]=r;for(t[s++]=r,t[s++]=n++,t[s++]=n,t[s++]=r++,t[s++]=n++,t[s++]=n,++n,o=e-1;o>1;--o){for(t[s++]=n++,t[s++]=n,t[s++]=r,i=2*o,a=0;a<i-1;++a)t[s++]=r,t[s++]=n++,t[s++]=n,t[s++]=r++,t[s++]=n,t[s++]=r;t[s++]=n++,t[s++]=n++,t[s++]=r++}for(o=0;o<3;o++)t[s++]=n++,t[s++]=n,t[s++]=r;return t}let boundingSphereCenter$1=new Cartesian3;function computeEllipse$1(e){const t=e.center;boundingSphereCenter$1=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter$1),e.height,boundingSphereCenter$1),boundingSphereCenter$1=Cartesian3.add(t,boundingSphereCenter$1,boundingSphereCenter$1);const n=new BoundingSphere(boundingSphereCenter$1,e.semiMajorAxis),i=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!1),r=i.positions,o=i.numPts,a=computeTopBottomAttributes(r,e,!1);let s=topIndices(o);return s=IndexDatatype$1.createTypedArray(r.length/3,s),{boundingSphere:n,attributes:a,indices:s}}function computeWallAttributes(e,t){const n=t.vertexFormat,i=t.center,r=t.semiMajorAxis,o=t.semiMinorAxis,a=t.ellipsoid,s=t.height,c=t.extrudedHeight,l=t.stRotation,u=e.length/3*2,d=new Float64Array(3*u),h=n.st?new Float32Array(2*u):void 0,p=n.normal?new Float32Array(3*u):void 0,f=n.tangent?new Float32Array(3*u):void 0,m=n.bitangent?new Float32Array(3*u):void 0,g=t.shadowVolume,_=g?new Float32Array(3*u):void 0;let y=0,C=scratchNormal$5,T=scratchTangent$4,S=scratchBitangent$4;const A=new GeographicProjection(a),v=A.project(a.cartesianToCartographic(i,scratchCartographic$f),projectedCenterScratch),E=a.scaleToGeodeticSurface(i,scratchCartesian1$5);a.geodeticSurfaceNormal(E,E);const b=Quaternion.fromAxisAngle(E,l,quaternionScratch$3),x=Matrix3.fromQuaternion(b,textureMatrixScratch$1),P=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),D=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord);let w=e.length;const M=w/3*2;for(let t=0;t<w;t+=3){const i=t+1,l=t+2;let u,E=Cartesian3.fromArray(e,t,scratchCartesian1$5);if(n.st){const e=Matrix3.multiplyByVector(x,E,scratchCartesian2$7),t=A.project(a.cartesianToCartographic(e,scratchCartographic$f),scratchCartesian3$8);Cartesian3.subtract(t,v,t),texCoordScratch.x=(t.x+r)/(2*r),texCoordScratch.y=(t.y+o)/(2*o),P.x=Math.min(texCoordScratch.x,P.x),P.y=Math.min(texCoordScratch.y,P.y),D.x=Math.max(texCoordScratch.x,D.x),D.y=Math.max(texCoordScratch.y,D.y),h[y+M]=texCoordScratch.x,h[y+1+M]=texCoordScratch.y,h[y++]=texCoordScratch.x,h[y++]=texCoordScratch.y}E=a.scaleToGeodeticSurface(E,E),u=Cartesian3.clone(E,scratchCartesian2$7),C=a.geodeticSurfaceNormal(E,C),g&&(_[t+w]=-C.x,_[i+w]=-C.y,_[l+w]=-C.z);let b=Cartesian3.multiplyByScalar(C,s,scratchCartesian4$5);if(E=Cartesian3.add(E,b,E),b=Cartesian3.multiplyByScalar(C,c,b),u=Cartesian3.add(u,b,u),n.position&&(d[t+w]=u.x,d[i+w]=u.y,d[l+w]=u.z,d[t]=E.x,d[i]=E.y,d[l]=E.z),n.normal||n.tangent||n.bitangent){S=Cartesian3.clone(C,S);const r=Cartesian3.fromArray(e,(t+3)%w,scratchCartesian4$5);Cartesian3.subtract(r,E,r);const o=Cartesian3.subtract(u,E,scratchCartesian3$8);C=Cartesian3.normalize(Cartesian3.cross(o,r,C),C),n.normal&&(p[t]=C.x,p[i]=C.y,p[l]=C.z,p[t+w]=C.x,p[i+w]=C.y,p[l+w]=C.z),n.tangent&&(T=Cartesian3.normalize(Cartesian3.cross(S,C,T),T),f[t]=T.x,f[i]=T.y,f[l]=T.z,f[t+w]=T.x,f[t+1+w]=T.y,f[t+2+w]=T.z),n.bitangent&&(m[t]=S.x,m[i]=S.y,m[l]=S.z,m[t+w]=S.x,m[i+w]=S.y,m[l+w]=S.z)}}if(n.st){w=h.length;for(let e=0;e<w;e+=2)h[e]=(h[e]-P.x)/(D.x-P.x),h[e+1]=(h[e+1]-P.y)/(D.y-P.y)}const I=new GeometryAttributes;if(n.position&&(I.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d})),n.st&&(I.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:h})),n.normal&&(I.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),n.tangent&&(I.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),n.bitangent&&(I.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),g&&(I.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),defined(t.offsetAttribute)){let e=new Uint8Array(u);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)e=arrayFill(e,1,0,u/2);else{e=arrayFill(e,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}I.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return I}function computeWallIndices(e){const t=e.length/3,n=IndexDatatype$1.createTypedArray(t,6*t);let i=0;for(let e=0;e<t;e++){const r=e,o=e+t,a=(r+1)%t,s=a+t;n[i++]=r,n[i++]=o,n[i++]=a,n[i++]=a,n[i++]=o,n[i++]=s}return n}const topBoundingSphere$3=new BoundingSphere,bottomBoundingSphere$3=new BoundingSphere;function computeExtrudedEllipse$1(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let r=Cartesian3.multiplyByScalar(n.geodeticSurfaceNormal(t,scratchCartesian1$5),e.height,scratchCartesian1$5);topBoundingSphere$3.center=Cartesian3.add(t,r,topBoundingSphere$3.center),topBoundingSphere$3.radius=i,r=Cartesian3.multiplyByScalar(n.geodeticSurfaceNormal(t,r),e.extrudedHeight,r),bottomBoundingSphere$3.center=Cartesian3.add(t,r,bottomBoundingSphere$3.center),bottomBoundingSphere$3.radius=i;const o=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!0),a=o.positions,s=o.numPts,c=o.outerPositions,l=BoundingSphere.union(topBoundingSphere$3,bottomBoundingSphere$3),u=computeTopBottomAttributes(a,e,!0);let d=topIndices(s);const h=d.length;d.length=2*h;const p=a.length/3;for(let e=0;e<h;e+=3)d[e+h]=d[e+2]+p,d[e+1+h]=d[e+1]+p,d[e+2+h]=d[e]+p;const f=new Geometry({attributes:u,indices:IndexDatatype$1.createTypedArray(2*p/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),m=computeWallAttributes(c,e);d=computeWallIndices(c);const g=new Geometry({attributes:m,indices:IndexDatatype$1.createTypedArray(2*c.length/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),_=GeometryPipeline.combineInstances([new GeometryInstance({geometry:f}),new GeometryInstance({geometry:g})]);return{boundingSphere:l,attributes:_[0].attributes,indices:_[0].indices}}function computeRectangle$3(e,t,n,i,r,o,a){const s=EllipseGeometryLibrary.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:r},!1,!0).outerPositions,c=s.length/3,l=new Array(c);for(let e=0;e<c;++e)l[e]=Cartesian3.fromArray(s,3*e);const u=Rectangle.fromCartesianArray(l,o,a);return u.width>CesiumMath.PI&&(u.north=u.north>0?CesiumMath.PI_OVER_TWO-CesiumMath.EPSILON7:u.north,u.south=u.south<0?CesiumMath.EPSILON7-CesiumMath.PI_OVER_TWO:u.south,u.east=CesiumMath.PI,u.west=-CesiumMath.PI),u}function EllipseGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,n=defaultValue(e.ellipsoid,Ellipsoid.WGS84),i=e.semiMajorAxis,r=e.semiMinorAxis,o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),s=defaultValue(e.height,0),c=defaultValue(e.extrudedHeight,s);this._center=Cartesian3.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=r,this._ellipsoid=Ellipsoid.clone(n),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._height=Math.max(c,s),this._granularity=o,this._vertexFormat=VertexFormat.clone(a),this._extrudedHeight=Math.min(c,s),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}EllipseGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+9,EllipseGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._center,t,n),n+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchCenter$7=new Cartesian3,scratchEllipsoid$e=new Ellipsoid,scratchVertexFormat$b=new VertexFormat,scratchOptions$l={center:scratchCenter$7,ellipsoid:scratchEllipsoid$e,vertexFormat:scratchVertexFormat$b,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};function textureCoordinateRotationPoints$2(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const n=EllipseGeometryLibrary.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,i=n.length/3,r=new Array(i);for(let e=0;e<i;++e)r[e]=Cartesian3.fromArray(n,3*e);const o=e._ellipsoid,a=e.rectangle;return Geometry._textureCoordinateRotationPoints(r,t,o,a)}function CircleGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,n={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation,shadowVolume:e.shadowVolume};this._ellipseGeometry=new EllipseGeometry(n),this._workerName="createCircleGeometry"}EllipseGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchCenter$7);t+=Cartesian3.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$e);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$b);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],f=e[t];return defined(n)?(n._center=Cartesian3.clone(i,n._center),n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._semiMajorAxis=a,n._semiMinorAxis=s,n._rotation=c,n._stRotation=l,n._height=u,n._granularity=d,n._extrudedHeight=h,n._shadowVolume=p,n._offsetAttribute=-1===f?void 0:f,n):(scratchOptions$l.height=u,scratchOptions$l.extrudedHeight=h,scratchOptions$l.granularity=d,scratchOptions$l.stRotation=l,scratchOptions$l.rotation=c,scratchOptions$l.semiMajorAxis=a,scratchOptions$l.semiMinorAxis=s,scratchOptions$l.shadowVolume=p,scratchOptions$l.offsetAttribute=-1===f?void 0:f,new EllipseGeometry(scratchOptions$l))},EllipseGeometry.computeRectangle=function(e,t){const n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=e.semiMajorAxis,o=e.semiMinorAxis,a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);return computeRectangle$3(n,r,o,defaultValue(e.rotation,0),a,i,t)},EllipseGeometry.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!CesiumMath.equalsEpsilon(t,n,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const r={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};let o;if(i)r.extrudedHeight=n,r.shadowVolume=e._shadowVolume,r.offsetAttribute=e._offsetAttribute,o=computeExtrudedEllipse$1(r);else if(o=computeEllipse$1(r),defined(e._offsetAttribute)){const t=o.attributes.position.values.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),o.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:o.attributes,indices:o.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:o.boundingSphere,offsetAttribute:e._offsetAttribute})},EllipseGeometry.createShadowVolume=function(e,t,n){const i=e._granularity,r=e._ellipsoid,o=t(i,r),a=n(i,r);return new EllipseGeometry({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:r,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(EllipseGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle$3(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$2(this)),this._textureCoordinateRotationPoints}}}),CircleGeometry.packedLength=EllipseGeometry.packedLength,CircleGeometry.pack=function(e,t,n){return EllipseGeometry.pack(e._ellipseGeometry,t,n)};const scratchEllipseGeometry$1=new EllipseGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$k={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new VertexFormat,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0,shadowVolume:void 0};CircleGeometry.unpack=function(e,t,n){const i=EllipseGeometry.unpack(e,t,scratchEllipseGeometry$1);return scratchOptions$k.center=Cartesian3.clone(i._center,scratchOptions$k.center),scratchOptions$k.ellipsoid=Ellipsoid.clone(i._ellipsoid,scratchOptions$k.ellipsoid),scratchOptions$k.height=i._height,scratchOptions$k.extrudedHeight=i._extrudedHeight,scratchOptions$k.granularity=i._granularity,scratchOptions$k.vertexFormat=VertexFormat.clone(i._vertexFormat,scratchOptions$k.vertexFormat),scratchOptions$k.stRotation=i._stRotation,scratchOptions$k.shadowVolume=i._shadowVolume,defined(n)?(scratchOptions$k.semiMajorAxis=i._semiMajorAxis,scratchOptions$k.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new EllipseGeometry(scratchOptions$k),n):(scratchOptions$k.radius=i._semiMajorAxis,new CircleGeometry(scratchOptions$k))},CircleGeometry.createGeometry=function(e){return EllipseGeometry.createGeometry(e._ellipseGeometry)},CircleGeometry.createShadowVolume=function(e,t,n){const i=e._ellipseGeometry._granularity,r=e._ellipseGeometry._ellipsoid,o=t(i,r),a=n(i,r);return new CircleGeometry({center:e._ellipseGeometry._center,radius:e._ellipseGeometry._semiMajorAxis,ellipsoid:r,stRotation:e._ellipseGeometry._stRotation,granularity:i,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(CircleGeometry.prototype,{rectangle:{get:function(){return this._ellipseGeometry.rectangle}},textureCoordinateRotationPoints:{get:function(){return this._ellipseGeometry.textureCoordinateRotationPoints}}});const scratchCartesian1$4=new Cartesian3;let boundingSphereCenter=new Cartesian3;function computeEllipse(e){const t=e.center;boundingSphereCenter=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter),e.height,boundingSphereCenter),boundingSphereCenter=Cartesian3.add(t,boundingSphereCenter,boundingSphereCenter);const n=new BoundingSphere(boundingSphereCenter,e.semiMajorAxis),i=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,r=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(i,e,!1)})}),o=i.length/3,a=IndexDatatype$1.createTypedArray(o,2*o);let s=0;for(let e=0;e<o;++e)a[s++]=e,a[s++]=(e+1)%o;return{boundingSphere:n,attributes:r,indices:a}}const topBoundingSphere$2=new BoundingSphere,bottomBoundingSphere$2=new BoundingSphere;function computeExtrudedEllipse(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let r=Cartesian3.multiplyByScalar(n.geodeticSurfaceNormal(t,scratchCartesian1$4),e.height,scratchCartesian1$4);topBoundingSphere$2.center=Cartesian3.add(t,r,topBoundingSphere$2.center),topBoundingSphere$2.radius=i,r=Cartesian3.multiplyByScalar(n.geodeticSurfaceNormal(t,r),e.extrudedHeight,r),bottomBoundingSphere$2.center=Cartesian3.add(t,r,bottomBoundingSphere$2.center),bottomBoundingSphere$2.radius=i;let o=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions;const a=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(o,e,!0)})});o=a.position.values;const s=BoundingSphere.union(topBoundingSphere$2,bottomBoundingSphere$2);let c=o.length/3;if(defined(e.offsetAttribute)){let t=new Uint8Array(c);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)t=arrayFill(t,1,0,c/2);else{t=arrayFill(t,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}a.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}let l=defaultValue(e.numberOfVerticalLines,16);l=CesiumMath.clamp(l,0,c/2);const u=IndexDatatype$1.createTypedArray(c,2*c+2*l);c/=2;let d,h,p=0;for(d=0;d<c;++d)u[p++]=d,u[p++]=(d+1)%c,u[p++]=d+c,u[p++]=(d+1)%c+c;if(l>0){const e=Math.min(l,c);h=Math.round(c/e);const t=Math.min(h*l,c);for(d=0;d<t;d+=h)u[p++]=d,u[p++]=d+c}return{boundingSphere:s,attributes:a,indices:u}}function EllipseOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,n=defaultValue(e.ellipsoid,Ellipsoid.WGS84),i=e.semiMajorAxis,r=e.semiMinorAxis,o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.height,0),s=defaultValue(e.extrudedHeight,a);this._center=Cartesian3.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=r,this._ellipsoid=Ellipsoid.clone(n),this._rotation=defaultValue(e.rotation,0),this._height=Math.max(s,a),this._granularity=o,this._extrudedHeight=Math.min(s,a),this._numberOfVerticalLines=Math.max(defaultValue(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}EllipseOutlineGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+8,EllipseOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._center,t,n),n+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._numberOfVerticalLines,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchCenter$6=new Cartesian3,scratchEllipsoid$d=new Ellipsoid,scratchOptions$j={center:scratchCenter$6,ellipsoid:scratchEllipsoid$d,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};function CircleOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,n={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new EllipseOutlineGeometry(n),this._workerName="createCircleOutlineGeometry"}EllipseOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchCenter$6);t+=Cartesian3.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$d);t+=Ellipsoid.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(n)?(n._center=Cartesian3.clone(i,n._center),n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._semiMajorAxis=o,n._semiMinorAxis=a,n._rotation=s,n._height=c,n._granularity=l,n._extrudedHeight=u,n._numberOfVerticalLines=d,n._offsetAttribute=-1===h?void 0:h,n):(scratchOptions$j.height=c,scratchOptions$j.extrudedHeight=u,scratchOptions$j.granularity=l,scratchOptions$j.rotation=s,scratchOptions$j.semiMajorAxis=o,scratchOptions$j.semiMinorAxis=a,scratchOptions$j.numberOfVerticalLines=d,scratchOptions$j.offsetAttribute=-1===h?void 0:h,new EllipseOutlineGeometry(scratchOptions$j))},EllipseOutlineGeometry.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!CesiumMath.equalsEpsilon(t,n,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const r={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let o;if(i)r.extrudedHeight=n,r.offsetAttribute=e._offsetAttribute,o=computeExtrudedEllipse(r);else if(o=computeEllipse(r),defined(e._offsetAttribute)){const t=o.attributes.position.values.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),o.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:o.attributes,indices:o.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:o.boundingSphere,offsetAttribute:e._offsetAttribute})},CircleOutlineGeometry.packedLength=EllipseOutlineGeometry.packedLength,CircleOutlineGeometry.pack=function(e,t,n){return EllipseOutlineGeometry.pack(e._ellipseGeometry,t,n)};const scratchEllipseGeometry=new EllipseOutlineGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$i={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};CircleOutlineGeometry.unpack=function(e,t,n){const i=EllipseOutlineGeometry.unpack(e,t,scratchEllipseGeometry);return scratchOptions$i.center=Cartesian3.clone(i._center,scratchOptions$i.center),scratchOptions$i.ellipsoid=Ellipsoid.clone(i._ellipsoid,scratchOptions$i.ellipsoid),scratchOptions$i.height=i._height,scratchOptions$i.extrudedHeight=i._extrudedHeight,scratchOptions$i.granularity=i._granularity,scratchOptions$i.numberOfVerticalLines=i._numberOfVerticalLines,defined(n)?(scratchOptions$i.semiMajorAxis=i._semiMajorAxis,scratchOptions$i.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new EllipseOutlineGeometry(scratchOptions$i),n):(scratchOptions$i.radius=i._semiMajorAxis,new CircleOutlineGeometry(scratchOptions$i))},CircleOutlineGeometry.createGeometry=function(e){return EllipseOutlineGeometry.createGeometry(e._ellipseGeometry)};const ClockRange={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2};var ClockRange$1=Object.freeze(ClockRange);const ClockStep={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2};var ClockStep$1=Object.freeze(ClockStep);let getTimestamp;getTimestamp="undefined"!=typeof performance&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};var getTimestamp$1=getTimestamp;function Clock(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).currentTime,n=e.startTime,i=e.stopTime;t=defined(t)?JulianDate.clone(t):defined(n)?JulianDate.clone(n):defined(i)?JulianDate.addDays(i,-1,new JulianDate):JulianDate.now(),n=defined(n)?JulianDate.clone(n):JulianDate.clone(t),i=defined(i)?JulianDate.clone(i):JulianDate.addDays(n,1,new JulianDate),this.startTime=n,this.stopTime=i,this.clockRange=defaultValue(e.clockRange,ClockRange$1.UNBOUNDED),this.canAnimate=defaultValue(e.canAnimate,!0),this.onTick=new Event,this.onStop=new Event,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=getTimestamp$1(),this.currentTime=t,this.multiplier=defaultValue(e.multiplier,1),this.shouldAnimate=defaultValue(e.shouldAnimate,!1),this.clockStep=defaultValue(e.clockStep,ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)}function hue2rgb(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),6*n<1?e+6*(t-e)*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function Color(e,t,n,i){this.red=defaultValue(e,1),this.green=defaultValue(t,1),this.blue=defaultValue(n,1),this.alpha=defaultValue(i,1)}let scratchArrayBuffer,scratchUint32Array,scratchUint8Array;Object.defineProperties(Clock.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){JulianDate.equals(this._currentTime,e)||(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===ClockStep$1.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=JulianDate.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}}),Clock.prototype.tick=function(){const e=getTimestamp$1();let t=JulianDate.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===ClockStep$1.SYSTEM_CLOCK)t=JulianDate.now(t);else{const i=this._multiplier;if(n===ClockStep$1.TICK_DEPENDENT)t=JulianDate.addSeconds(t,i,t);else{const n=e-this._lastSystemTime;t=JulianDate.addSeconds(t,i*(n/1e3),t)}const r=this.clockRange,o=this.startTime,a=this.stopTime;if(r===ClockRange$1.CLAMPED)JulianDate.lessThan(t,o)?t=JulianDate.clone(o,t):JulianDate.greaterThan(t,a)&&(t=JulianDate.clone(a,t),this.onStop.raiseEvent(this));else if(r===ClockRange$1.LOOP_STOP)for(JulianDate.lessThan(t,o)&&(t=JulianDate.clone(o,t));JulianDate.greaterThan(t,a);)t=JulianDate.addSeconds(o,JulianDate.secondsDifference(t,a),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t},Color.fromCartesian4=function(e,t){return defined(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new Color(e.x,e.y,e.z,e.w)},Color.fromBytes=function(e,t,n,i,r){return e=Color.byteToFloat(defaultValue(e,255)),t=Color.byteToFloat(defaultValue(t,255)),n=Color.byteToFloat(defaultValue(n,255)),i=Color.byteToFloat(defaultValue(i,255)),defined(r)?(r.red=e,r.green=t,r.blue=n,r.alpha=i,r):new Color(e,t,n,i)},Color.fromAlpha=function(e,t,n){return defined(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new Color(e.red,e.green,e.blue,t)},FeatureDetection.supportsTypedArrays()&&(scratchArrayBuffer=new ArrayBuffer(4),scratchUint32Array=new Uint32Array(scratchArrayBuffer),scratchUint8Array=new Uint8Array(scratchArrayBuffer)),Color.fromRgba=function(e,t){return scratchUint32Array[0]=e,Color.fromBytes(scratchUint8Array[0],scratchUint8Array[1],scratchUint8Array[2],scratchUint8Array[3],t)},Color.fromHsl=function(e,t,n,i,r){e=defaultValue(e,0)%1,t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,1);let o=n,a=n,s=n;if(0!==t){let i;i=n<.5?n*(1+t):n+t-n*t;const r=2*n-i;o=hue2rgb(r,i,e+1/3),a=hue2rgb(r,i,e),s=hue2rgb(r,i,e-1/3)}return defined(r)?(r.red=o,r.green=a,r.blue=s,r.alpha=i,r):new Color(o,a,s,i)},Color.fromRandom=function(e,t){let n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).red;if(!defined(n)){const t=defaultValue(e.minimumRed,0),i=defaultValue(e.maximumRed,1);n=t+CesiumMath.nextRandomNumber()*(i-t)}let i=e.green;if(!defined(i)){const t=defaultValue(e.minimumGreen,0),n=defaultValue(e.maximumGreen,1);i=t+CesiumMath.nextRandomNumber()*(n-t)}let r=e.blue;if(!defined(r)){const t=defaultValue(e.minimumBlue,0),n=defaultValue(e.maximumBlue,1);r=t+CesiumMath.nextRandomNumber()*(n-t)}let o=e.alpha;if(!defined(o)){const t=defaultValue(e.minimumAlpha,0),n=defaultValue(e.maximumAlpha,1);o=t+CesiumMath.nextRandomNumber()*(n-t)}return defined(t)?(t.red=n,t.green=i,t.blue=r,t.alpha=o,t):new Color(n,i,r,o)};const rgbaMatcher=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,rrggbbaaMatcher=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,rgbParenthesesMatcher=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,hslParenthesesMatcher=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;function ColorGeometryInstanceAttribute(e,t,n,i){e=defaultValue(e,1),t=defaultValue(t,1),n=defaultValue(n,1),i=defaultValue(i,1),this.value=new Uint8Array([Color.floatToByte(e),Color.floatToByte(t),Color.floatToByte(n),Color.floatToByte(i)])}function CompressedTextureBuffer(e,t,n,i,r){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=r}Color.fromCssColorString=function(e,t){defined(t)||(t=new Color);const n=Color[(e=e.replace(/\s/g,"")).toUpperCase()];if(defined(n))return Color.clone(n,t),t;let i=rgbaMatcher.exec(e);return null!==i?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(defaultValue(i[4],"f"),16)/15,t):(i=rrggbbaaMatcher.exec(e),null!==i?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(defaultValue(i[4],"ff"),16)/255,t):(i=rgbParenthesesMatcher.exec(e),null!==i?(t.red=parseFloat(i[1])/("%"===i[1].substr(-1)?100:255),t.green=parseFloat(i[2])/("%"===i[2].substr(-1)?100:255),t.blue=parseFloat(i[3])/("%"===i[3].substr(-1)?100:255),t.alpha=parseFloat(defaultValue(i[4],"1.0")),t):(i=hslParenthesesMatcher.exec(e),null!==i?Color.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(defaultValue(i[4],"1.0")),t):t=void 0)))},Color.packedLength=4,Color.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t},Color.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Color),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n},Color.byteToFloat=function(e){return e/255},Color.floatToByte=function(e){return 1===e?255:256*e|0},Color.clone=function(e,t){if(defined(e))return defined(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new Color(e.red,e.green,e.blue,e.alpha)},Color.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha},Color.equalsArray=function(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]},Color.prototype.clone=function(e){return Color.clone(this,e)},Color.prototype.equals=function(e){return Color.equals(this,e)},Color.prototype.equalsEpsilon=function(e,t){return this===e||defined(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t},Color.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},Color.prototype.toCssColorString=function(){const e=Color.floatToByte(this.red),t=Color.floatToByte(this.green),n=Color.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+n+")":"rgba("+e+","+t+","+n+","+this.alpha+")"},Color.prototype.toCssHexString=function(){let e=Color.floatToByte(this.red).toString(16);e.length<2&&(e="0"+e);let t=Color.floatToByte(this.green).toString(16);t.length<2&&(t="0"+t);let n=Color.floatToByte(this.blue).toString(16);if(n.length<2&&(n="0"+n),this.alpha<1){let i=Color.floatToByte(this.alpha).toString(16);return i.length<2&&(i="0"+i),"#"+e+t+n+i}return"#"+e+t+n},Color.prototype.toBytes=function(e){const t=Color.floatToByte(this.red),n=Color.floatToByte(this.green),i=Color.floatToByte(this.blue),r=Color.floatToByte(this.alpha);return defined(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=r,e):[t,n,i,r]},Color.prototype.toRgba=function(){return scratchUint8Array[0]=Color.floatToByte(this.red),scratchUint8Array[1]=Color.floatToByte(this.green),scratchUint8Array[2]=Color.floatToByte(this.blue),scratchUint8Array[3]=Color.floatToByte(this.alpha),scratchUint32Array[0]},Color.prototype.brighten=function(e,t){return e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},Color.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},Color.prototype.withAlpha=function(e,t){return Color.fromAlpha(this,e,t)},Color.add=function(e,t,n){return n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n},Color.subtract=function(e,t,n){return n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n},Color.multiply=function(e,t,n){return n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n},Color.divide=function(e,t,n){return n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n},Color.mod=function(e,t,n){return n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n},Color.lerp=function(e,t,n,i){return i.red=CesiumMath.lerp(e.red,t.red,n),i.green=CesiumMath.lerp(e.green,t.green,n),i.blue=CesiumMath.lerp(e.blue,t.blue,n),i.alpha=CesiumMath.lerp(e.alpha,t.alpha,n),i},Color.multiplyByScalar=function(e,t,n){return n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n},Color.divideByScalar=function(e,t,n){return n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n},Color.ALICEBLUE=Object.freeze(Color.fromCssColorString("#F0F8FF")),Color.ANTIQUEWHITE=Object.freeze(Color.fromCssColorString("#FAEBD7")),Color.AQUA=Object.freeze(Color.fromCssColorString("#00FFFF")),Color.AQUAMARINE=Object.freeze(Color.fromCssColorString("#7FFFD4")),Color.AZURE=Object.freeze(Color.fromCssColorString("#F0FFFF")),Color.BEIGE=Object.freeze(Color.fromCssColorString("#F5F5DC")),Color.BISQUE=Object.freeze(Color.fromCssColorString("#FFE4C4")),Color.BLACK=Object.freeze(Color.fromCssColorString("#000000")),Color.BLANCHEDALMOND=Object.freeze(Color.fromCssColorString("#FFEBCD")),Color.BLUE=Object.freeze(Color.fromCssColorString("#0000FF")),Color.BLUEVIOLET=Object.freeze(Color.fromCssColorString("#8A2BE2")),Color.BROWN=Object.freeze(Color.fromCssColorString("#A52A2A")),Color.BURLYWOOD=Object.freeze(Color.fromCssColorString("#DEB887")),Color.CADETBLUE=Object.freeze(Color.fromCssColorString("#5F9EA0")),Color.CHARTREUSE=Object.freeze(Color.fromCssColorString("#7FFF00")),Color.CHOCOLATE=Object.freeze(Color.fromCssColorString("#D2691E")),Color.CORAL=Object.freeze(Color.fromCssColorString("#FF7F50")),Color.CORNFLOWERBLUE=Object.freeze(Color.fromCssColorString("#6495ED")),Color.CORNSILK=Object.freeze(Color.fromCssColorString("#FFF8DC")),Color.CRIMSON=Object.freeze(Color.fromCssColorString("#DC143C")),Color.CYAN=Object.freeze(Color.fromCssColorString("#00FFFF")),Color.DARKBLUE=Object.freeze(Color.fromCssColorString("#00008B")),Color.DARKCYAN=Object.freeze(Color.fromCssColorString("#008B8B")),Color.DARKGOLDENROD=Object.freeze(Color.fromCssColorString("#B8860B")),Color.DARKGRAY=Object.freeze(Color.fromCssColorString("#A9A9A9")),Color.DARKGREEN=Object.freeze(Color.fromCssColorString("#006400")),Color.DARKGREY=Color.DARKGRAY,Color.DARKKHAKI=Object.freeze(Color.fromCssColorString("#BDB76B")),Color.DARKMAGENTA=Object.freeze(Color.fromCssColorString("#8B008B")),Color.DARKOLIVEGREEN=Object.freeze(Color.fromCssColorString("#556B2F")),Color.DARKORANGE=Object.freeze(Color.fromCssColorString("#FF8C00")),Color.DARKORCHID=Object.freeze(Color.fromCssColorString("#9932CC")),Color.DARKRED=Object.freeze(Color.fromCssColorString("#8B0000")),Color.DARKSALMON=Object.freeze(Color.fromCssColorString("#E9967A")),Color.DARKSEAGREEN=Object.freeze(Color.fromCssColorString("#8FBC8F")),Color.DARKSLATEBLUE=Object.freeze(Color.fromCssColorString("#483D8B")),Color.DARKSLATEGRAY=Object.freeze(Color.fromCssColorString("#2F4F4F")),Color.DARKSLATEGREY=Color.DARKSLATEGRAY,Color.DARKTURQUOISE=Object.freeze(Color.fromCssColorString("#00CED1")),Color.DARKVIOLET=Object.freeze(Color.fromCssColorString("#9400D3")),Color.DEEPPINK=Object.freeze(Color.fromCssColorString("#FF1493")),Color.DEEPSKYBLUE=Object.freeze(Color.fromCssColorString("#00BFFF")),Color.DIMGRAY=Object.freeze(Color.fromCssColorString("#696969")),Color.DIMGREY=Color.DIMGRAY,Color.DODGERBLUE=Object.freeze(Color.fromCssColorString("#1E90FF")),Color.FIREBRICK=Object.freeze(Color.fromCssColorString("#B22222")),Color.FLORALWHITE=Object.freeze(Color.fromCssColorString("#FFFAF0")),Color.FORESTGREEN=Object.freeze(Color.fromCssColorString("#228B22")),Color.FUCHSIA=Object.freeze(Color.fromCssColorString("#FF00FF")),Color.GAINSBORO=Object.freeze(Color.fromCssColorString("#DCDCDC")),Color.GHOSTWHITE=Object.freeze(Color.fromCssColorString("#F8F8FF")),Color.GOLD=Object.freeze(Color.fromCssColorString("#FFD700")),Color.GOLDENROD=Object.freeze(Color.fromCssColorString("#DAA520")),Color.GRAY=Object.freeze(Color.fromCssColorString("#808080")),Color.GREEN=Object.freeze(Color.fromCssColorString("#008000")),Color.GREENYELLOW=Object.freeze(Color.fromCssColorString("#ADFF2F")),Color.GREY=Color.GRAY,Color.HONEYDEW=Object.freeze(Color.fromCssColorString("#F0FFF0")),Color.HOTPINK=Object.freeze(Color.fromCssColorString("#FF69B4")),Color.INDIANRED=Object.freeze(Color.fromCssColorString("#CD5C5C")),Color.INDIGO=Object.freeze(Color.fromCssColorString("#4B0082")),Color.IVORY=Object.freeze(Color.fromCssColorString("#FFFFF0")),Color.KHAKI=Object.freeze(Color.fromCssColorString("#F0E68C")),Color.LAVENDER=Object.freeze(Color.fromCssColorString("#E6E6FA")),Color.LAVENDAR_BLUSH=Object.freeze(Color.fromCssColorString("#FFF0F5")),Color.LAWNGREEN=Object.freeze(Color.fromCssColorString("#7CFC00")),Color.LEMONCHIFFON=Object.freeze(Color.fromCssColorString("#FFFACD")),Color.LIGHTBLUE=Object.freeze(Color.fromCssColorString("#ADD8E6")),Color.LIGHTCORAL=Object.freeze(Color.fromCssColorString("#F08080")),Color.LIGHTCYAN=Object.freeze(Color.fromCssColorString("#E0FFFF")),Color.LIGHTGOLDENRODYELLOW=Object.freeze(Color.fromCssColorString("#FAFAD2")),Color.LIGHTGRAY=Object.freeze(Color.fromCssColorString("#D3D3D3")),Color.LIGHTGREEN=Object.freeze(Color.fromCssColorString("#90EE90")),Color.LIGHTGREY=Color.LIGHTGRAY,Color.LIGHTPINK=Object.freeze(Color.fromCssColorString("#FFB6C1")),Color.LIGHTSEAGREEN=Object.freeze(Color.fromCssColorString("#20B2AA")),Color.LIGHTSKYBLUE=Object.freeze(Color.fromCssColorString("#87CEFA")),Color.LIGHTSLATEGRAY=Object.freeze(Color.fromCssColorString("#778899")),Color.LIGHTSLATEGREY=Color.LIGHTSLATEGRAY,Color.LIGHTSTEELBLUE=Object.freeze(Color.fromCssColorString("#B0C4DE")),Color.LIGHTYELLOW=Object.freeze(Color.fromCssColorString("#FFFFE0")),Color.LIME=Object.freeze(Color.fromCssColorString("#00FF00")),Color.LIMEGREEN=Object.freeze(Color.fromCssColorString("#32CD32")),Color.LINEN=Object.freeze(Color.fromCssColorString("#FAF0E6")),Color.MAGENTA=Object.freeze(Color.fromCssColorString("#FF00FF")),Color.MAROON=Object.freeze(Color.fromCssColorString("#800000")),Color.MEDIUMAQUAMARINE=Object.freeze(Color.fromCssColorString("#66CDAA")),Color.MEDIUMBLUE=Object.freeze(Color.fromCssColorString("#0000CD")),Color.MEDIUMORCHID=Object.freeze(Color.fromCssColorString("#BA55D3")),Color.MEDIUMPURPLE=Object.freeze(Color.fromCssColorString("#9370DB")),Color.MEDIUMSEAGREEN=Object.freeze(Color.fromCssColorString("#3CB371")),Color.MEDIUMSLATEBLUE=Object.freeze(Color.fromCssColorString("#7B68EE")),Color.MEDIUMSPRINGGREEN=Object.freeze(Color.fromCssColorString("#00FA9A")),Color.MEDIUMTURQUOISE=Object.freeze(Color.fromCssColorString("#48D1CC")),Color.MEDIUMVIOLETRED=Object.freeze(Color.fromCssColorString("#C71585")),Color.MIDNIGHTBLUE=Object.freeze(Color.fromCssColorString("#191970")),Color.MINTCREAM=Object.freeze(Color.fromCssColorString("#F5FFFA")),Color.MISTYROSE=Object.freeze(Color.fromCssColorString("#FFE4E1")),Color.MOCCASIN=Object.freeze(Color.fromCssColorString("#FFE4B5")),Color.NAVAJOWHITE=Object.freeze(Color.fromCssColorString("#FFDEAD")),Color.NAVY=Object.freeze(Color.fromCssColorString("#000080")),Color.OLDLACE=Object.freeze(Color.fromCssColorString("#FDF5E6")),Color.OLIVE=Object.freeze(Color.fromCssColorString("#808000")),Color.OLIVEDRAB=Object.freeze(Color.fromCssColorString("#6B8E23")),Color.ORANGE=Object.freeze(Color.fromCssColorString("#FFA500")),Color.ORANGERED=Object.freeze(Color.fromCssColorString("#FF4500")),Color.ORCHID=Object.freeze(Color.fromCssColorString("#DA70D6")),Color.PALEGOLDENROD=Object.freeze(Color.fromCssColorString("#EEE8AA")),Color.PALEGREEN=Object.freeze(Color.fromCssColorString("#98FB98")),Color.PALETURQUOISE=Object.freeze(Color.fromCssColorString("#AFEEEE")),Color.PALEVIOLETRED=Object.freeze(Color.fromCssColorString("#DB7093")),Color.PAPAYAWHIP=Object.freeze(Color.fromCssColorString("#FFEFD5")),Color.PEACHPUFF=Object.freeze(Color.fromCssColorString("#FFDAB9")),Color.PERU=Object.freeze(Color.fromCssColorString("#CD853F")),Color.PINK=Object.freeze(Color.fromCssColorString("#FFC0CB")),Color.PLUM=Object.freeze(Color.fromCssColorString("#DDA0DD")),Color.POWDERBLUE=Object.freeze(Color.fromCssColorString("#B0E0E6")),Color.PURPLE=Object.freeze(Color.fromCssColorString("#800080")),Color.RED=Object.freeze(Color.fromCssColorString("#FF0000")),Color.ROSYBROWN=Object.freeze(Color.fromCssColorString("#BC8F8F")),Color.ROYALBLUE=Object.freeze(Color.fromCssColorString("#4169E1")),Color.SADDLEBROWN=Object.freeze(Color.fromCssColorString("#8B4513")),Color.SALMON=Object.freeze(Color.fromCssColorString("#FA8072")),Color.SANDYBROWN=Object.freeze(Color.fromCssColorString("#F4A460")),Color.SEAGREEN=Object.freeze(Color.fromCssColorString("#2E8B57")),Color.SEASHELL=Object.freeze(Color.fromCssColorString("#FFF5EE")),Color.SIENNA=Object.freeze(Color.fromCssColorString("#A0522D")),Color.SILVER=Object.freeze(Color.fromCssColorString("#C0C0C0")),Color.SKYBLUE=Object.freeze(Color.fromCssColorString("#87CEEB")),Color.SLATEBLUE=Object.freeze(Color.fromCssColorString("#6A5ACD")),Color.SLATEGRAY=Object.freeze(Color.fromCssColorString("#708090")),Color.SLATEGREY=Color.SLATEGRAY,Color.SNOW=Object.freeze(Color.fromCssColorString("#FFFAFA")),Color.SPRINGGREEN=Object.freeze(Color.fromCssColorString("#00FF7F")),Color.STEELBLUE=Object.freeze(Color.fromCssColorString("#4682B4")),Color.TAN=Object.freeze(Color.fromCssColorString("#D2B48C")),Color.TEAL=Object.freeze(Color.fromCssColorString("#008080")),Color.THISTLE=Object.freeze(Color.fromCssColorString("#D8BFD8")),Color.TOMATO=Object.freeze(Color.fromCssColorString("#FF6347")),Color.TURQUOISE=Object.freeze(Color.fromCssColorString("#40E0D0")),Color.VIOLET=Object.freeze(Color.fromCssColorString("#EE82EE")),Color.WHEAT=Object.freeze(Color.fromCssColorString("#F5DEB3")),Color.WHITE=Object.freeze(Color.fromCssColorString("#FFFFFF")),Color.WHITESMOKE=Object.freeze(Color.fromCssColorString("#F5F5F5")),Color.YELLOW=Object.freeze(Color.fromCssColorString("#FFFF00")),Color.YELLOWGREEN=Object.freeze(Color.fromCssColorString("#9ACD32")),Color.TRANSPARENT=Object.freeze(new Color(0,0,0,0)),Object.defineProperties(ColorGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),ColorGeometryInstanceAttribute.fromColor=function(e){return new ColorGeometryInstanceAttribute(e.red,e.green,e.blue,e.alpha)},ColorGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?e.toBytes(t):new Uint8Array(e.toBytes())},ColorGeometryInstanceAttribute.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]},Object.defineProperties(CompressedTextureBuffer.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),CompressedTextureBuffer.clone=function(e){if(defined(e))return new CompressedTextureBuffer(e._format,e._datatype,e._width,e._height,e._buffer)},CompressedTextureBuffer.prototype.clone=function(){return CompressedTextureBuffer.clone(this)};const CoplanarPolygonGeometryLibrary={},scratchIntersectionPoint=new Cartesian3,scratchXAxis=new Cartesian3,scratchYAxis=new Cartesian3,scratchZAxis=new Cartesian3,obbScratch=new OrientedBoundingBox;function projectTo2D(e,t,n,i,r){const o=Cartesian3.subtract(e,t,scratchIntersectionPoint),a=Cartesian3.dot(n,o),s=Cartesian3.dot(i,o);return Cartesian2.fromElements(a,s,r)}function calculateM(e,t,n){if(0===e)return t*n;const i=e*e,r=i*i,o=r*i,a=o*i,s=a*i,c=s*i,l=n;return t*((1-i/4-3*r/64-5*o/256-175*a/16384-441*s/65536-4851*c/1048576)*l-(3*i/8+3*r/32+45*o/1024+105*a/4096+2205*s/131072+6237*c/524288)*Math.sin(2*l)+(15*r/256+45*o/1024+525*a/16384+1575*s/65536+155925*c/8388608)*Math.sin(4*l)-(35*o/3072+175*a/12288+3675*s/262144+13475*c/1048576)*Math.sin(6*l)+(315*a/131072+2205*s/524288+43659*c/8388608)*Math.sin(8*l)-(693*s/1310720+6237*c/5242880)*Math.sin(10*l)+1001*c/8388608*Math.sin(12*l))}function calculateInverseM(e,t,n){const i=e/n;if(0===t)return i;const r=i*i,o=r*i,a=o*i,s=t*t,c=s*s,l=c*s,u=l*s,d=u*s,h=d*s,p=Math.sin(2*i),f=Math.cos(2*i),m=Math.sin(4*i),g=Math.cos(4*i),_=Math.sin(6*i),y=Math.cos(6*i),C=Math.sin(8*i),T=Math.cos(8*i),S=Math.sin(10*i);return i+i*s/4+7*i*c/64+15*i*l/256+579*i*u/16384+1515*i*d/65536+16837*i*h/1048576+(3*i*c/16+45*i*l/256-i*(32*r-561)*u/4096-i*(232*r-1677)*d/16384+i*(399985-90560*r+512*a)*h/5242880)*f+(21*i*l/256+483*i*u/4096-i*(224*r-1969)*d/16384-i*(33152*r-112599)*h/1048576)*g+(151*i*u/4096+4681*i*d/65536+1479*i*h/16384-453*o*h/32768)*y+(1097*i*d/65536+42783*i*h/1048576)*T+8011*i*h/1048576*Math.cos(10*i)+(3*s/8+3*c/16+213*l/2048-3*r*l/64+255*u/4096-33*r*u/512+20861*d/524288-33*r*d/512+a*d/1024+28273*h/1048576-471*r*h/8192+9*a*h/4096)*p+(21*c/256+21*l/256+533*u/8192-21*r*u/512+197*d/4096-315*r*d/4096+584039*h/16777216-12517*r*h/131072+7*a*h/2048)*m+(151*l/6144+151*u/4096+5019*d/131072-453*r*d/16384+26965*h/786432-8607*r*h/131072)*_+(1097*u/131072+1097*d/65536+225797*h/10485760-1097*r*h/65536)*C+(8011*d/2621440+8011*h/1048576)*S+293393*h/251658240*Math.sin(12*i)}function calculateSigma(e,t){if(0===e)return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function calculateHeading(e,t,n,i,r){const o=calculateSigma(e._ellipticity,n),a=calculateSigma(e._ellipticity,r);return Math.atan2(CesiumMath.negativePiToPi(i-t),a-o)}function calculateArcLength(e,t,n,i,r,o,a){const s=e._heading,c=o-i;let l=0;if(CesiumMath.equalsEpsilon(Math.abs(s),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8))if(t===n)l=t*Math.cos(r)*CesiumMath.negativePiToPi(c);else{const n=Math.sin(r);l=t*Math.cos(r)*CesiumMath.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*n*n)}else{const n=calculateM(e._ellipticity,t,r);l=(calculateM(e._ellipticity,t,a)-n)/Math.cos(s)}return Math.abs(l)}CoplanarPolygonGeometryLibrary.validOutline=function(e){const t=OrientedBoundingBox.fromPoints(e,obbScratch).halfAxes,n=Matrix3.getColumn(t,0,scratchXAxis),i=Matrix3.getColumn(t,1,scratchYAxis),r=Matrix3.getColumn(t,2,scratchZAxis),o=Cartesian3.magnitude(n),a=Cartesian3.magnitude(i),s=Cartesian3.magnitude(r);return!(0===o&&(0===a||0===s)||0===a&&0===s)},CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments=function(e,t,n,i){const r=OrientedBoundingBox.fromPoints(e,obbScratch),o=r.halfAxes,a=Matrix3.getColumn(o,0,scratchXAxis),s=Matrix3.getColumn(o,1,scratchYAxis),c=Matrix3.getColumn(o,2,scratchZAxis),l=Cartesian3.magnitude(a),u=Cartesian3.magnitude(s),d=Cartesian3.magnitude(c),h=Math.min(l,u,d);if(0===l&&(0===u||0===d)||0===u&&0===d)return!1;let p,f;return h!==u&&h!==d||(p=a),h===l?p=s:h===d&&(f=s),h!==l&&h!==u||(f=c),Cartesian3.normalize(p,n),Cartesian3.normalize(f,i),Cartesian3.clone(r.center,t),!0},CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const r=new Array(i.length);for(let o=0;o<i.length;o++)r[o]=projectTo2D(i[o],e,t,n);return r}},CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction=function(e,t,n){return function(i,r){return projectTo2D(i,e,t,n,r)}};const scratchCart1$1=new Cartesian3,scratchCart2$2=new Cartesian3;function computeProperties$1(e,t,n,i){Cartesian3.normalize(i.cartographicToCartesian(t,scratchCart2$2),scratchCart1$1),Cartesian3.normalize(i.cartographicToCartesian(n,scratchCart2$2),scratchCart2$2);const r=i.maximumRadius,o=i.minimumRadius,a=r*r,s=o*o;e._ellipticitySquared=(a-s)/a,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=Cartographic.clone(t,e._start),e._start.height=0,e._end=Cartographic.clone(n,e._end),e._end.height=0,e._heading=calculateHeading(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=calculateArcLength(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function interpolateUsingSurfaceDistance(e,t,n,i,r,o){if(0===n)return Cartographic.clone(e,o);const a=r*r;let s,c,l;if(Math.abs(CesiumMath.PI_OVER_TWO-Math.abs(t))>CesiumMath.EPSILON8){c=calculateInverseM(calculateM(r,i,e.latitude)+n*Math.cos(t),r,i);const o=calculateSigma(r,e.latitude),a=calculateSigma(r,c);l=Math.tan(t)*(a-o),s=CesiumMath.negativePiToPi(e.longitude+l)}else{let o;if(c=e.latitude,0===r)o=i*Math.cos(e.latitude);else{const t=Math.sin(e.latitude);o=i*Math.cos(e.latitude)/Math.sqrt(1-a*t*t)}l=n/o,s=t>0?CesiumMath.negativePiToPi(e.longitude+l):CesiumMath.negativePiToPi(e.longitude-l)}return defined(o)?(o.longitude=s,o.latitude=c,o.height=0,o):new Cartographic(s,c,0)}function EllipsoidRhumbLine(e,t,n){const i=defaultValue(n,Ellipsoid.WGS84);this._ellipsoid=i,this._start=new Cartographic,this._end=new Cartographic,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,defined(e)&&defined(t)&&computeProperties$1(this,e,t,i)}Object.defineProperties(EllipsoidRhumbLine.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return this._heading}}}),EllipsoidRhumbLine.fromStartHeadingDistance=function(e,t,n,i,r){const o=defaultValue(i,Ellipsoid.WGS84),a=o.maximumRadius,s=o.minimumRadius,c=a*a,l=s*s,u=Math.sqrt((c-l)/c),d=interpolateUsingSurfaceDistance(e,t=CesiumMath.negativePiToPi(t),n,o.maximumRadius,u);return!defined(r)||defined(i)&&!i.equals(r.ellipsoid)?new EllipsoidRhumbLine(e,d,o):(r.setEndPoints(e,d),r)},EllipsoidRhumbLine.prototype.setEndPoints=function(e,t){computeProperties$1(this,e,t,this._ellipsoid)},EllipsoidRhumbLine.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)},EllipsoidRhumbLine.prototype.interpolateUsingSurfaceDistance=function(e,t){return interpolateUsingSurfaceDistance(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)},EllipsoidRhumbLine.prototype.findIntersectionWithLongitude=function(e,t){const n=this._ellipticity,i=this._heading,r=Math.abs(i),o=this._start;if(e=CesiumMath.negativePiToPi(e),CesiumMath.equalsEpsilon(Math.abs(e),Math.PI,CesiumMath.EPSILON14)&&(e=CesiumMath.sign(o.longitude)*Math.PI),defined(t)||(t=new Cartographic),Math.abs(CesiumMath.PI_OVER_TWO-r)<=CesiumMath.EPSILON8)return t.longitude=e,t.latitude=o.latitude,t.height=0,t;if(CesiumMath.equalsEpsilon(Math.abs(CesiumMath.PI_OVER_TWO-r),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8)){if(CesiumMath.equalsEpsilon(e,o.longitude,CesiumMath.EPSILON12))return;return t.longitude=e,t.latitude=CesiumMath.PI_OVER_TWO*CesiumMath.sign(CesiumMath.PI_OVER_TWO-i),t.height=0,t}const a=o.latitude,s=n*Math.sin(a),c=Math.tan(.5*(CesiumMath.PI_OVER_TWO+a))*Math.exp((e-o.longitude)/Math.tan(i)),l=(1+s)/(1-s);let u,d=o.latitude;do{u=d;const e=n*Math.sin(u),t=(1+e)/(1-e);d=2*Math.atan(c*Math.pow(t/l,n/2))-CesiumMath.PI_OVER_TWO}while(!CesiumMath.equalsEpsilon(d,u,CesiumMath.EPSILON12));return t.longitude=e,t.latitude=d,t.height=0,t},EllipsoidRhumbLine.prototype.findIntersectionWithLatitude=function(e,t){const n=this._ellipticity,i=this._heading,r=this._start;if(CesiumMath.equalsEpsilon(Math.abs(i),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8))return;const o=calculateSigma(n,r.latitude),a=calculateSigma(n,e),s=Math.tan(i)*(a-o),c=CesiumMath.negativePiToPi(r.longitude+s);return defined(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new Cartographic(c,e,0)};var earcut_1=earcut,_default=earcut;function earcut(e,t,n){n=n||2;var i,r,o,a,s,c,l,u=t&&t.length,d=u?t[0]*n:e.length,h=linkedList(e,0,d,n,!0),p=[];if(!h||h.next===h.prev)return p;if(u&&(h=eliminateHoles(e,t,h,n)),e.length>80*n){i=o=e[0],r=a=e[1];for(var f=n;f<d;f+=n)(s=e[f])<i&&(i=s),(c=e[f+1])<r&&(r=c),s>o&&(o=s),c>a&&(a=c);l=0!==(l=Math.max(o-i,a-r))?1/l:0}return earcutLinked(h,p,n,i,r,l),p}function linkedList(e,t,n,i,r){var o,a;if(r===signedArea(e,t,n,i)>0)for(o=t;o<n;o+=i)a=insertNode(o,e[o],e[o+1],a);else for(o=n-i;o>=t;o-=i)a=insertNode(o,e[o],e[o+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!equals(i,i.next)&&0!==area(i.prev,i,i.next))i=i.next;else{if(removeNode(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function earcutLinked(e,t,n,i,r,o,a){if(e){!a&&o&&indexCurve(e,i,r,o);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?isEarHashed(e,i,r,o):isEar(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),removeNode(e),e=c.next,l=c.next;else if((e=c)===l){a?1===a?earcutLinked(e=cureLocalIntersections(filterPoints(e),t,n),t,n,i,r,o,2):2===a&&splitEarcut(e,t,n,i,r,o):earcutLinked(filterPoints(e),t,n,i,r,o,1);break}}}function isEar(e){var t=e.prev,n=e,i=e.next;if(area(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(pointInTriangle(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&area(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function isEarHashed(e,t,n,i){var r=e.prev,o=e,a=e.next;if(area(r,o,a)>=0)return!1;for(var s=r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,c=r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,l=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,u=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,d=zOrder(s,c,t,n,i),h=zOrder(l,u,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=d&&f&&f.z<=h;){if(p!==e.prev&&p!==e.next&&pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function cureLocalIntersections(e,t,n){var i=e;do{var r=i.prev,o=i.next.next;!equals(r,o)&&intersects$1(r,i,i.next,o)&&locallyInside(r,o)&&locallyInside(o,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(o.i/n),removeNode(i),removeNode(i.next),i=e=o),i=i.next}while(i!==e);return filterPoints(i)}function splitEarcut(e,t,n,i,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&isValidDiagonal(a,s)){var c=splitPolygon(a,s);return a=filterPoints(a,a.next),c=filterPoints(c,c.next),earcutLinked(a,t,n,i,r,o),void earcutLinked(c,t,n,i,r,o)}s=s.next}a=a.next}while(a!==e)}function eliminateHoles(e,t,n,i){var r,o,a,s=[];for(r=0,o=t.length;r<o;r++)(a=linkedList(e,t[r]*i,r<o-1?t[r+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(getLeftmost(a));for(s.sort(compareX),r=0;r<s.length;r++)n=filterPoints(n=eliminateHole(s[r],n),n.next);return n}function compareX(e,t){return e.x-t.x}function eliminateHole(e,t){var n=findHoleBridge(e,t);if(!n)return t;var i=splitPolygon(n,e),r=filterPoints(n,n.next);return filterPoints(i,i.next),t===n?r:t}function findHoleBridge(e,t){var n,i=t,r=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===a)return n;var c,l=n,u=n.x,d=n.y,h=1/0;i=n;do{r>=i.x&&i.x>=u&&r!==i.x&&pointInTriangle(o<d?r:a,o,u,d,o<d?a:r,o,i.x,i.y)&&(c=Math.abs(o-i.y)/(r-i.x),locallyInside(i,e)&&(c<h||c===h&&(i.x>n.x||i.x===n.x&&sectorContainsSector(n,i)))&&(n=i,h=c)),i=i.next}while(i!==l);return n}function sectorContainsSector(e,t){return area(e.prev,e,t.prev)<0&&area(t.next,e,e.next)<0}function indexCurve(e,t,n,i){var r=e;do{null===r.z&&(r.z=zOrder(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,sortLinked(r)}function sortLinked(e){var t,n,i,r,o,a,s,c,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,i=n,s=0,t=0;t<l&&(s++,i=i.nextZ);t++);for(c=l;s>0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1);return e}function zOrder(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function getLeftmost(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function pointInTriangle(e,t,n,i,r,o,a,s){return(r-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(i-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function isValidDiagonal(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!intersectsPolygon(e,t)&&(locallyInside(e,t)&&locallyInside(t,e)&&middleInside(e,t)&&(area(e.prev,e,t.prev)||area(e,t.prev,t))||equals(e,t)&&area(e.prev,e,e.next)>0&&area(t.prev,t,t.next)>0)}function area(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects$1(e,t,n,i){var r=sign(area(e,t,n)),o=sign(area(e,t,i)),a=sign(area(n,i,e)),s=sign(area(n,i,t));return r!==o&&a!==s||(!(0!==r||!onSegment(e,n,t))||(!(0!==o||!onSegment(e,i,t))||(!(0!==a||!onSegment(n,e,i))||!(0!==s||!onSegment(n,t,i)))))}function onSegment(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function sign(e){return e>0?1:e<0?-1:0}function intersectsPolygon(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&intersects$1(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function locallyInside(e,t){return area(e.prev,e,e.next)<0?area(e,t,e.next)>=0&&area(e,e.prev,t)>=0:area(e,t,e.prev)<0||area(e,e.next,t)<0}function middleInside(e,t){var n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}function splitPolygon(e,t){var n=new Node$5(e.i,e.x,e.y),i=new Node$5(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function insertNode(e,t,n,i){var r=new Node$5(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node$5(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,t,n,i){for(var r=0,o=t,a=n-i;o<n;o+=i)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}earcut.deviation=function(e,t,n,i){var r=t&&t.length,o=r?t[0]*n:e.length,a=Math.abs(signedArea(e,0,o,n));if(r)for(var s=0,c=t.length;s<c;s++){var l=t[s]*n,u=s<c-1?t[s+1]*n:e.length;a-=Math.abs(signedArea(e,l,u,n))}var d=0;for(s=0;s<i.length;s+=3){var h=i[s]*n,p=i[s+1]*n,f=i[s+2]*n;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===a&&0===d?0:Math.abs((d-a)/a)},earcut.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,r=0;r<e.length;r++){for(var o=0;o<e[r].length;o++)for(var a=0;a<t;a++)n.vertices.push(e[r][o][a]);r>0&&(i+=e[r-1].length,n.holes.push(i))}return n},earcut_1.default=_default;const WindingOrder={CLOCKWISE:WebGLConstants$1.CW,COUNTER_CLOCKWISE:WebGLConstants$1.CCW,validate:function(e){return e===WindingOrder.CLOCKWISE||e===WindingOrder.COUNTER_CLOCKWISE}};var WindingOrder$1=Object.freeze(WindingOrder);const scaleToGeodeticHeightN=new Cartesian3,scaleToGeodeticHeightP=new Cartesian3,PolygonPipeline={computeArea2D:function(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++){const t=e[i],o=e[r];n+=t.x*o.y-o.x*t.y}return.5*n},computeWindingOrder2D:function(e){return PolygonPipeline.computeArea2D(e)>0?WindingOrder$1.COUNTER_CLOCKWISE:WindingOrder$1.CLOCKWISE},triangulate:function(e,t){const n=Cartesian2.packArray(e);return earcut_1(n,t,2)}},subdivisionV0Scratch=new Cartesian3,subdivisionV1Scratch=new Cartesian3,subdivisionV2Scratch=new Cartesian3,subdivisionS0Scratch=new Cartesian3,subdivisionS1Scratch=new Cartesian3,subdivisionS2Scratch=new Cartesian3,subdivisionMidScratch=new Cartesian3;PolygonPipeline.computeSubdivision=function(e,t,n,i){i=defaultValue(i,CesiumMath.RADIANS_PER_DEGREE);const r=n.slice(0);let o;const a=t.length,s=new Array(3*a);let c=0;for(o=0;o<a;o++){const e=t[o];s[c++]=e.x,s[c++]=e.y,s[c++]=e.z}const l=[],u={},d=e.maximumRadius,h=CesiumMath.chordLength(i,d),p=h*h;for(;r.length>0;){const e=r.pop(),t=r.pop(),n=r.pop(),i=Cartesian3.fromArray(s,3*n,subdivisionV0Scratch),a=Cartesian3.fromArray(s,3*t,subdivisionV1Scratch),c=Cartesian3.fromArray(s,3*e,subdivisionV2Scratch),h=Cartesian3.multiplyByScalar(Cartesian3.normalize(i,subdivisionS0Scratch),d,subdivisionS0Scratch),f=Cartesian3.multiplyByScalar(Cartesian3.normalize(a,subdivisionS1Scratch),d,subdivisionS1Scratch),m=Cartesian3.multiplyByScalar(Cartesian3.normalize(c,subdivisionS2Scratch),d,subdivisionS2Scratch),g=Cartesian3.magnitudeSquared(Cartesian3.subtract(h,f,subdivisionMidScratch)),_=Cartesian3.magnitudeSquared(Cartesian3.subtract(f,m,subdivisionMidScratch)),y=Cartesian3.magnitudeSquared(Cartesian3.subtract(m,h,subdivisionMidScratch)),C=Math.max(g,_,y);let T,S;C>p?g===C?(T=Math.min(n,t)+" "+Math.max(n,t),o=u[T],defined(o)||(S=Cartesian3.add(i,a,subdivisionMidScratch),Cartesian3.multiplyByScalar(S,.5,S),s.push(S.x,S.y,S.z),o=s.length/3-1,u[T]=o),r.push(n,o,e),r.push(o,t,e)):_===C?(T=Math.min(t,e)+" "+Math.max(t,e),o=u[T],defined(o)||(S=Cartesian3.add(a,c,subdivisionMidScratch),Cartesian3.multiplyByScalar(S,.5,S),s.push(S.x,S.y,S.z),o=s.length/3-1,u[T]=o),r.push(t,o,n),r.push(o,e,n)):y===C&&(T=Math.min(e,n)+" "+Math.max(e,n),o=u[T],defined(o)||(S=Cartesian3.add(c,i,subdivisionMidScratch),Cartesian3.multiplyByScalar(S,.5,S),s.push(S.x,S.y,S.z),o=s.length/3-1,u[T]=o),r.push(e,o,t),r.push(o,n,t)):(l.push(n),l.push(t),l.push(e))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:l,primitiveType:PrimitiveType$1.TRIANGLES})};const subdivisionC0Scratch=new Cartographic,subdivisionC1Scratch=new Cartographic,subdivisionC2Scratch=new Cartographic,subdivisionCartographicScratch=new Cartographic;function Queue(){this._array=[],this._offset=0,this._length=0}PolygonPipeline.computeRhumbLineSubdivision=function(e,t,n,i){i=defaultValue(i,CesiumMath.RADIANS_PER_DEGREE);const r=n.slice(0);let o;const a=t.length,s=new Array(3*a);let c=0;for(o=0;o<a;o++){const e=t[o];s[c++]=e.x,s[c++]=e.y,s[c++]=e.z}const l=[],u={},d=e.maximumRadius,h=CesiumMath.chordLength(i,d),p=new EllipsoidRhumbLine(void 0,void 0,e),f=new EllipsoidRhumbLine(void 0,void 0,e),m=new EllipsoidRhumbLine(void 0,void 0,e);for(;r.length>0;){const t=r.pop(),n=r.pop(),i=r.pop(),a=Cartesian3.fromArray(s,3*i,subdivisionV0Scratch),c=Cartesian3.fromArray(s,3*n,subdivisionV1Scratch),d=Cartesian3.fromArray(s,3*t,subdivisionV2Scratch),g=e.cartesianToCartographic(a,subdivisionC0Scratch),_=e.cartesianToCartographic(c,subdivisionC1Scratch),y=e.cartesianToCartographic(d,subdivisionC2Scratch);p.setEndPoints(g,_);const C=p.surfaceDistance;f.setEndPoints(_,y);const T=f.surfaceDistance;m.setEndPoints(y,g);const S=m.surfaceDistance,A=Math.max(C,T,S);let v,E,b,x;A>h?C===A?(v=Math.min(i,n)+" "+Math.max(i,n),o=u[v],defined(o)||(E=p.interpolateUsingFraction(.5,subdivisionCartographicScratch),b=.5*(g.height+_.height),x=Cartesian3.fromRadians(E.longitude,E.latitude,b,e,subdivisionMidScratch),s.push(x.x,x.y,x.z),o=s.length/3-1,u[v]=o),r.push(i,o,t),r.push(o,n,t)):T===A?(v=Math.min(n,t)+" "+Math.max(n,t),o=u[v],defined(o)||(E=f.interpolateUsingFraction(.5,subdivisionCartographicScratch),b=.5*(_.height+y.height),x=Cartesian3.fromRadians(E.longitude,E.latitude,b,e,subdivisionMidScratch),s.push(x.x,x.y,x.z),o=s.length/3-1,u[v]=o),r.push(n,o,i),r.push(o,t,i)):S===A&&(v=Math.min(t,i)+" "+Math.max(t,i),o=u[v],defined(o)||(E=m.interpolateUsingFraction(.5,subdivisionCartographicScratch),b=.5*(y.height+g.height),x=Cartesian3.fromRadians(E.longitude,E.latitude,b,e,subdivisionMidScratch),s.push(x.x,x.y,x.z),o=s.length/3-1,u[v]=o),r.push(t,o,n),r.push(o,i,n)):(l.push(i),l.push(n),l.push(t))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:l,primitiveType:PrimitiveType$1.TRIANGLES})},PolygonPipeline.scaleToGeodeticHeight=function(e,t,n,i){n=defaultValue(n,Ellipsoid.WGS84);let r=scaleToGeodeticHeightN,o=scaleToGeodeticHeightP;if(t=defaultValue(t,0),i=defaultValue(i,!0),defined(e)){const a=e.length;for(let s=0;s<a;s+=3)Cartesian3.fromArray(e,s,o),i&&(o=n.scaleToGeodeticSurface(o,o)),0!==t&&(r=n.geodeticSurfaceNormal(o,r),Cartesian3.multiplyByScalar(r,t,r),Cartesian3.add(o,r,o)),e[s]=o.x,e[s+1]=o.y,e[s+2]=o.z}return e},Object.defineProperties(Queue.prototype,{length:{get:function(){return this._length}}}),Queue.prototype.enqueue=function(e){this._array.push(e),this._length++},Queue.prototype.dequeue=function(){if(0===this._length)return;const e=this._array;let t=this._offset;const n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n},Queue.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},Queue.prototype.contains=function(e){return-1!==this._array.indexOf(e)},Queue.prototype.clear=function(){this._array.length=this._offset=this._length=0},Queue.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const PolygonGeometryLibrary={computeHierarchyPackedLength:function(e){let t=0;const n=[e];for(;n.length>0;){const e=n.pop();if(!defined(e))continue;t+=2;const i=e.positions,r=e.holes;if(defined(i)&&(t+=i.length*Cartesian3.packedLength),defined(r)){const e=r.length;for(let t=0;t<e;++t)n.push(r[t])}}return t},packPolygonHierarchy:function(e,t,n){const i=[e];for(;i.length>0;){const e=i.pop();if(!defined(e))continue;const r=e.positions,o=e.holes;if(t[n++]=defined(r)?r.length:0,t[n++]=defined(o)?o.length:0,defined(r)){const e=r.length;for(let i=0;i<e;++i,n+=3)Cartesian3.pack(r[i],t,n)}if(defined(o)){const e=o.length;for(let t=0;t<e;++t)i.push(o[t])}}return n},unpackPolygonHierarchy:function(e,t){const n=e[t++],i=e[t++],r=new Array(n),o=i>0?new Array(i):void 0;for(let i=0;i<n;++i,t+=Cartesian3.packedLength)r[i]=Cartesian3.unpack(e,t);for(let n=0;n<i;++n)o[n]=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t),t=o[n].startingIndex,delete o[n].startingIndex;return{positions:r,holes:o,startingIndex:t}}},distanceScratch=new Cartesian3;function getPointAtDistance(e,t,n,i){return Cartesian3.subtract(t,e,distanceScratch),Cartesian3.multiplyByScalar(distanceScratch,n/i,distanceScratch),Cartesian3.add(e,distanceScratch,distanceScratch),[distanceScratch.x,distanceScratch.y,distanceScratch.z]}PolygonGeometryLibrary.subdivideLineCount=function(e,t,n){const i=Cartesian3.distance(e,t)/n,r=Math.max(0,Math.ceil(CesiumMath.log2(i)));return Math.pow(2,r)};const scratchCartographic0$1=new Cartographic,scratchCartographic1$2=new Cartographic,scratchCartographic2$1=new Cartographic,scratchCartesian0=new Cartesian3;PolygonGeometryLibrary.subdivideRhumbLineCount=function(e,t,n,i){const r=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0$1),e.cartesianToCartographic(n,scratchCartographic1$2),e).surfaceDistance/i,o=Math.max(0,Math.ceil(CesiumMath.log2(r)));return Math.pow(2,o)},PolygonGeometryLibrary.subdivideLine=function(e,t,n,i){const r=PolygonGeometryLibrary.subdivideLineCount(e,t,n),o=Cartesian3.distance(e,t),a=o/r;defined(i)||(i=[]);const s=i;s.length=3*r;let c=0;for(let n=0;n<r;n++){const i=getPointAtDistance(e,t,n*a,o);s[c++]=i[0],s[c++]=i[1],s[c++]=i[2]}return s},PolygonGeometryLibrary.subdivideRhumbLine=function(e,t,n,i,r){const o=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0$1),e.cartesianToCartographic(n,scratchCartographic1$2),e),a=o.surfaceDistance/i,s=Math.max(0,Math.ceil(CesiumMath.log2(a))),c=Math.pow(2,s),l=o.surfaceDistance/c;defined(r)||(r=[]);const u=r;u.length=3*c;let d=0;for(let t=0;t<c;t++){const n=o.interpolateUsingSurfaceDistance(t*l,scratchCartographic2$1),i=e.cartographicToCartesian(n,scratchCartesian0);u[d++]=i.x,u[d++]=i.y,u[d++]=i.z}return u};const scaleToGeodeticHeightN1=new Cartesian3,scaleToGeodeticHeightN2=new Cartesian3,scaleToGeodeticHeightP1=new Cartesian3,scaleToGeodeticHeightP2=new Cartesian3;PolygonGeometryLibrary.scaleToGeodeticHeightExtruded=function(e,t,n,i,r){i=defaultValue(i,Ellipsoid.WGS84);const o=scaleToGeodeticHeightN1;let a=scaleToGeodeticHeightN2;const s=scaleToGeodeticHeightP1;let c=scaleToGeodeticHeightP2;if(defined(e)&&defined(e.attributes)&&defined(e.attributes.position)){const l=e.attributes.position.values,u=l.length/2;for(let e=0;e<u;e+=3)Cartesian3.fromArray(l,e,s),i.geodeticSurfaceNormal(s,o),c=i.scaleToGeodeticSurface(s,c),a=Cartesian3.multiplyByScalar(o,n,a),a=Cartesian3.add(c,a,a),l[e+u]=a.x,l[e+1+u]=a.y,l[e+2+u]=a.z,r&&(c=Cartesian3.clone(s,c)),a=Cartesian3.multiplyByScalar(o,t,a),a=Cartesian3.add(c,a,a),l[e]=a.x,l[e+1]=a.y,l[e+2]=a.z}return e},PolygonGeometryLibrary.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],r=new Queue;let o,a,s;for(r.enqueue(e);0!==r.length;){const e=r.dequeue();let c=e.positions;if(t)for(s=c.length,o=0;o<s;o++)n.scaleToGeodeticSurface(c[o],c[o]);if(c=arrayRemoveDuplicates(c,Cartesian3.equalsEpsilon,!0),c.length<3)continue;const l=e.holes?e.holes.length:0;for(o=0;o<l;o++){const c=e.holes[o];let l=c.positions;if(t)for(s=l.length,a=0;a<s;++a)n.scaleToGeodeticSurface(l[a],l[a]);if(l=arrayRemoveDuplicates(l,Cartesian3.equalsEpsilon,!0),l.length<3)continue;i.push(l);let u=0;for(defined(c.holes)&&(u=c.holes.length),a=0;a<u;a++)r.enqueue(c.holes[a])}i.push(c)}return i},PolygonGeometryLibrary.polygonsFromHierarchy=function(e,t,n,i){const r=[],o=[],a=new Queue;for(a.enqueue(e);0!==a.length;){const e=a.dequeue();let s=e.positions;const c=e.holes;let l,u;if(n)for(u=s.length,l=0;l<u;l++)i.scaleToGeodeticSurface(s[l],s[l]);if(s=arrayRemoveDuplicates(s,Cartesian3.equalsEpsilon,!0),s.length<3)continue;let d=t(s);if(!defined(d))continue;const h=[];let p=PolygonPipeline.computeWindingOrder2D(d);p===WindingOrder$1.CLOCKWISE&&(d.reverse(),s=s.slice().reverse());let f=s.slice();const m=defined(c)?c.length:0,g=[];let _;for(l=0;l<m;l++){const e=c[l];let r=e.positions;if(n)for(u=r.length,_=0;_<u;++_)i.scaleToGeodeticSurface(r[_],r[_]);if(r=arrayRemoveDuplicates(r,Cartesian3.equalsEpsilon,!0),r.length<3)continue;const o=t(r);if(!defined(o))continue;p=PolygonPipeline.computeWindingOrder2D(o),p===WindingOrder$1.CLOCKWISE&&(o.reverse(),r=r.slice().reverse()),g.push(r),h.push(f.length),f=f.concat(r),d=d.concat(o);let s=0;for(defined(e.holes)&&(s=e.holes.length),_=0;_<s;_++)a.enqueue(e.holes[_])}r.push({outerRing:s,holes:g}),o.push({positions:f,positions2D:d,holes:h})}return{hierarchy:r,polygons:o}};const computeBoundingRectangleCartesian2=new Cartesian2,computeBoundingRectangleCartesian3=new Cartesian3,computeBoundingRectangleQuaternion=new Quaternion,computeBoundingRectangleMatrix3=new Matrix3;PolygonGeometryLibrary.computeBoundingRectangle=function(e,t,n,i,r){const o=Quaternion.fromAxisAngle(e,i,computeBoundingRectangleQuaternion),a=Matrix3.fromQuaternion(o,computeBoundingRectangleMatrix3);let s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;const d=n.length;for(let e=0;e<d;++e){const i=Cartesian3.clone(n[e],computeBoundingRectangleCartesian3);Matrix3.multiplyByVector(a,i,i);const r=t(i,computeBoundingRectangleCartesian2);defined(r)&&(s=Math.min(s,r.x),c=Math.max(c,r.x),l=Math.min(l,r.y),u=Math.max(u,r.y))}return r.x=s,r.y=l,r.width=c-s,r.height=u-l,r},PolygonGeometryLibrary.createGeometryFromPositions=function(e,t,n,i,r,o){let a=PolygonPipeline.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const s=t.positions;if(i){const e=s.length,t=new Array(3*e);let n=0;for(let i=0;i<e;i++){const e=s[i];t[n++]=e.x,t[n++]=e.y,t[n++]=e.z}const i=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:t})},indices:a,primitiveType:PrimitiveType$1.TRIANGLES});return r.normal?GeometryPipeline.computeNormal(i):i}return o===ArcType$1.GEODESIC?PolygonPipeline.computeSubdivision(e,s,a,n):o===ArcType$1.RHUMB?PolygonPipeline.computeRhumbLineSubdivision(e,s,a,n):void 0};const computeWallIndicesSubdivided=[],p1Scratch$1=new Cartesian3,p2Scratch$1=new Cartesian3;PolygonGeometryLibrary.computeWallGeometry=function(e,t,n,i,r){let o,a,s,c,l,u=e.length,d=0;if(i)for(a=3*u*2,o=new Array(2*a),s=0;s<u;s++)c=e[s],l=e[(s+1)%u],o[d]=o[d+a]=c.x,++d,o[d]=o[d+a]=c.y,++d,o[d]=o[d+a]=c.z,++d,o[d]=o[d+a]=l.x,++d,o[d]=o[d+a]=l.y,++d,o[d]=o[d+a]=l.z,++d;else{const i=CesiumMath.chordLength(n,t.maximumRadius);let h=0;if(r===ArcType$1.GEODESIC)for(s=0;s<u;s++)h+=PolygonGeometryLibrary.subdivideLineCount(e[s],e[(s+1)%u],i);else if(r===ArcType$1.RHUMB)for(s=0;s<u;s++)h+=PolygonGeometryLibrary.subdivideRhumbLineCount(t,e[s],e[(s+1)%u],i);for(a=3*(h+u),o=new Array(2*a),s=0;s<u;s++){let n;c=e[s],l=e[(s+1)%u],r===ArcType$1.GEODESIC?n=PolygonGeometryLibrary.subdivideLine(c,l,i,computeWallIndicesSubdivided):r===ArcType$1.RHUMB&&(n=PolygonGeometryLibrary.subdivideRhumbLine(t,c,l,i,computeWallIndicesSubdivided));const h=n.length;for(let e=0;e<h;++e,++d)o[d]=n[e],o[d+a]=n[e];o[d]=l.x,o[d+a]=l.x,++d,o[d]=l.y,o[d+a]=l.y,++d,o[d]=l.z,o[d+a]=l.z,++d}}u=o.length;const h=IndexDatatype$1.createTypedArray(u/3,u-6*e.length);let p=0;for(u/=6,s=0;s<u;s++){const e=s,t=e+1,n=e+u,i=n+1;c=Cartesian3.fromArray(o,3*e,p1Scratch$1),l=Cartesian3.fromArray(o,3*t,p2Scratch$1),Cartesian3.equalsEpsilon(c,l,CesiumMath.EPSILON10,CesiumMath.EPSILON10)||(h[p++]=e,h[p++]=n,h[p++]=t,h[p++]=t,h[p++]=n,h[p++]=i)}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:o})}),indices:h,primitiveType:PrimitiveType$1.TRIANGLES})};const scratchPosition$c=new Cartesian3,scratchBR=new BoundingRectangle,stScratch$1=new Cartesian2,textureCoordinatesOrigin=new Cartesian2,scratchNormal$4=new Cartesian3,scratchTangent$3=new Cartesian3,scratchBitangent$3=new Cartesian3,centerScratch$5=new Cartesian3,axis1Scratch=new Cartesian3,axis2Scratch=new Cartesian3,quaternionScratch$2=new Quaternion,textureMatrixScratch=new Matrix3,tangentRotationScratch=new Matrix3,surfaceNormalScratch=new Cartesian3;function createGeometryFromPolygon(e,t,n,i,r,o,a,s){const c=e.positions;let l=PolygonPipeline.triangulate(e.positions2D,e.holes);l.length<3&&(l=[0,1,2]);const u=IndexDatatype$1.createTypedArray(c.length,l.length);u.set(l);let d=textureMatrixScratch;if(0!==i){let e=Quaternion.fromAxisAngle(o,i,quaternionScratch$2);if(d=Matrix3.fromQuaternion(e,d),t.tangent||t.bitangent){e=Quaternion.fromAxisAngle(o,-i,quaternionScratch$2);const n=Matrix3.fromQuaternion(e,tangentRotationScratch);a=Cartesian3.normalize(Matrix3.multiplyByVector(n,a,a),a),t.bitangent&&(s=Cartesian3.normalize(Cartesian3.cross(o,a,s),s))}}else d=Matrix3.clone(Matrix3.IDENTITY,d);const h=textureCoordinatesOrigin;t.st&&(h.x=n.x,h.y=n.y);const p=c.length,f=3*p,m=new Float64Array(f),g=t.normal?new Float32Array(f):void 0,_=t.tangent?new Float32Array(f):void 0,y=t.bitangent?new Float32Array(f):void 0,C=t.st?new Float32Array(2*p):void 0;let T=0,S=0,A=0,v=0,E=0;for(let e=0;e<p;e++){const i=c[e];if(m[T++]=i.x,m[T++]=i.y,m[T++]=i.z,t.st){const e=r(Matrix3.multiplyByVector(d,i,scratchPosition$c),stScratch$1);Cartesian2.subtract(e,h,e);const t=CesiumMath.clamp(e.x/n.width,0,1),o=CesiumMath.clamp(e.y/n.height,0,1);C[E++]=t,C[E++]=o}t.normal&&(g[S++]=o.x,g[S++]=o.y,g[S++]=o.z),t.tangent&&(_[v++]=a.x,_[v++]=a.y,_[v++]=a.z),t.bitangent&&(y[A++]=s.x,y[A++]=s.y,y[A++]=s.z)}const b=new GeometryAttributes;return t.position&&(b.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:m})),t.normal&&(b.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),t.tangent&&(b.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),t.bitangent&&(b.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),t.st&&(b.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:C})),new Geometry({attributes:b,indices:u,primitiveType:PrimitiveType$1.TRIANGLES})}function CoplanarPolygonGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=VertexFormat.clone(n),this._polygonHierarchy=t,this._stRotation=defaultValue(e.stRotation,0),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+VertexFormat.packedLength+Ellipsoid.packedLength+2}CoplanarPolygonGeometry.fromPositions=function(e){return new CoplanarPolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},CoplanarPolygonGeometry.pack=function(e,t,n){return n=defaultValue(n,0),n=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n),Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._stRotation,t[n]=e.packedLength,t};const scratchEllipsoid$c=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$a=new VertexFormat,scratchOptions$h={polygonHierarchy:{}};function createGeometryFromPositions$1(e){const t=e.length,n=new Float64Array(3*t),i=IndexDatatype$1.createTypedArray(t,2*t);let r=0,o=0;for(let a=0;a<t;a++){const s=e[a];n[r++]=s.x,n[r++]=s.y,n[r++]=s.z,i[o++]=a,i[o++]=(a+1)%t}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:n})}),indices:i,primitiveType:PrimitiveType$1.LINES})}function CoplanarPolygonOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}CoplanarPolygonGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=i.startingIndex,delete i.startingIndex;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$c);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$a);t+=VertexFormat.packedLength;const a=e[t++],s=e[t];return defined(n)||(n=new CoplanarPolygonGeometry(scratchOptions$h)),n._polygonHierarchy=i,n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._stRotation=a,n.packedLength=s,n},CoplanarPolygonGeometry.createGeometry=function(e){const t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation;let r=n.positions;if(r=arrayRemoveDuplicates(r,Cartesian3.equalsEpsilon,!0),r.length<3)return;let o=scratchNormal$4,a=scratchTangent$3,s=scratchBitangent$3,c=axis1Scratch;const l=axis2Scratch;if(!CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments(r,centerScratch$5,c,l))return;if(o=Cartesian3.cross(c,l,o),o=Cartesian3.normalize(o,o),!Cartesian3.equalsEpsilon(centerScratch$5,Cartesian3.ZERO,CesiumMath.EPSILON6)){const t=e._ellipsoid.geodeticSurfaceNormal(centerScratch$5,surfaceNormalScratch);Cartesian3.dot(o,t)<0&&(o=Cartesian3.negate(o,o),c=Cartesian3.negate(c,c))}const u=CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(centerScratch$5,c,l),d=CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(centerScratch$5,c,l);t.tangent&&(a=Cartesian3.clone(c,a)),t.bitangent&&(s=Cartesian3.clone(l,s));const h=PolygonGeometryLibrary.polygonsFromHierarchy(n,u,!1),p=h.hierarchy,f=h.polygons;if(0===p.length)return;r=p[0].outerRing;const m=BoundingSphere.fromPoints(r),g=PolygonGeometryLibrary.computeBoundingRectangle(o,d,r,i,scratchBR),_=[];for(let e=0;e<f.length;e++){const n=new GeometryInstance({geometry:createGeometryFromPolygon(f[e],t,g,i,d,o,a,s)});_.push(n)}const y=GeometryPipeline.combineInstances(_)[0];y.attributes.position.values=new Float64Array(y.attributes.position.values),y.indices=IndexDatatype$1.createTypedArray(y.attributes.position.values.length/3,y.indices);const C=y.attributes;return t.position||delete C.position,new Geometry({attributes:C,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:m})},CoplanarPolygonOutlineGeometry.fromPositions=function(e){return new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions}})},CoplanarPolygonOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),t[n=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n)]=e.packedLength,t};const scratchOptions$g={polygonHierarchy:{}};CoplanarPolygonOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=i.startingIndex,delete i.startingIndex;const r=e[t];return defined(n)||(n=new CoplanarPolygonOutlineGeometry(scratchOptions$g)),n._polygonHierarchy=i,n.packedLength=r,n},CoplanarPolygonOutlineGeometry.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=arrayRemoveDuplicates(n,Cartesian3.equalsEpsilon,!0),n.length<3)return;if(!CoplanarPolygonGeometryLibrary.validOutline(n))return;const i=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(t,!1);if(0===i.length)return;const r=[];for(let e=0;e<i.length;e++){const t=new GeometryInstance({geometry:createGeometryFromPositions$1(i[e])});r.push(t)}const o=GeometryPipeline.combineInstances(r)[0],a=BoundingSphere.fromPoints(t.positions);return new Geometry({attributes:o.attributes,indices:o.indices,primitiveType:o.primitiveType,boundingSphere:a})};const CornerType={ROUNDED:0,MITERED:1,BEVELED:2};var CornerType$1=Object.freeze(CornerType);function setConstants(e){const t=e._uSquared,n=e._ellipsoid.maximumRadius,i=e._ellipsoid.minimumRadius,r=(n-i)/n,o=Math.cos(e._startHeading),a=Math.sin(e._startHeading),s=(1-r)*Math.tan(e._start.latitude),c=1/Math.sqrt(1+s*s),l=c*s,u=Math.atan2(s,o),d=c*a,h=d*d,p=1-h,f=Math.sqrt(p),m=t/4,g=m*m,_=g*m,y=g*g,C=1+m-3*g/4+5*_/4-175*y/64,T=1-m+15*g/8-35*_/8,S=1-3*m+35*g/4,A=1-5*m,v=C*u-T*Math.sin(2*u)*m/2-S*Math.sin(4*u)*g/16-A*Math.sin(6*u)*_/48-5*Math.sin(8*u)*y/512,E=e._constants;E.a=n,E.b=i,E.f=r,E.cosineHeading=o,E.sineHeading=a,E.tanU=s,E.cosineU=c,E.sineU=l,E.sigma=u,E.sineAlpha=d,E.sineSquaredAlpha=h,E.cosineSquaredAlpha=p,E.cosineAlpha=f,E.u2Over4=m,E.u4Over16=g,E.u6Over64=_,E.u8Over256=y,E.a0=C,E.a1=T,E.a2=S,E.a3=A,E.distanceRatio=v}function computeC(e,t){return e*t*(4+e*(4-3*t))/16}function computeDeltaLambda(e,t,n,i,r,o,a){const s=computeC(e,n);return(1-s)*e*t*(i+s*r*(a+s*o*(2*a*a-1)))}function vincentyInverseFormula(e,t,n,i,r,o,a){const s=(t-n)/t,c=o-i,l=Math.atan((1-s)*Math.tan(r)),u=Math.atan((1-s)*Math.tan(a)),d=Math.cos(l),h=Math.sin(l),p=Math.cos(u),f=Math.sin(u),m=d*p,g=d*f,_=h*f,y=h*p;let C,T,S,A,v,E=c,b=CesiumMath.TWO_PI,x=Math.cos(E),P=Math.sin(E);do{x=Math.cos(E),P=Math.sin(E);const e=g-y*x;let t;S=Math.sqrt(p*p*P*P+e*e),T=_+m*x,C=Math.atan2(S,T),0===S?(t=0,A=1):(t=m*P/S,A=1-t*t),b=E,v=T-2*_/A,isFinite(v)||(v=0),E=c+computeDeltaLambda(s,t,A,C,S,T,v)}while(Math.abs(E-b)>CesiumMath.EPSILON12);const D=A*(t*t-n*n)/(n*n),w=D*(256+D*(D*(74-47*D)-128))/1024,M=v*v,I=n*(1+D*(4096+D*(D*(320-175*D)-768))/16384)*(C-w*S*(v+w*(T*(2*M-1)-w*v*(4*S*S-3)*(4*M-3)/6)/4)),R=Math.atan2(p*P,g-y*x),O=Math.atan2(d*P,g*x-y);e._distance=I,e._startHeading=R,e._endHeading=O,e._uSquared=D}const scratchCart1=new Cartesian3,scratchCart2$1=new Cartesian3;function computeProperties(e,t,n,i){Cartesian3.normalize(i.cartographicToCartesian(t,scratchCart2$1),scratchCart1),Cartesian3.normalize(i.cartographicToCartesian(n,scratchCart2$1),scratchCart2$1),vincentyInverseFormula(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=Cartographic.clone(t,e._start),e._end=Cartographic.clone(n,e._end),e._start.height=0,e._end.height=0,setConstants(e)}function EllipsoidGeodesic(e,t,n){const i=defaultValue(n,Ellipsoid.WGS84);this._ellipsoid=i,this._start=new Cartographic,this._end=new Cartographic,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,defined(e)&&defined(t)&&computeProperties(this,e,t,i)}Object.defineProperties(EllipsoidGeodesic.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),EllipsoidGeodesic.prototype.setEndPoints=function(e,t){computeProperties(this,e,t,this._ellipsoid)},EllipsoidGeodesic.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance=function(e,t){const n=this._constants,i=n.distanceRatio+e/n.b,r=Math.cos(2*i),o=Math.cos(4*i),a=Math.cos(6*i),s=Math.sin(2*i),c=Math.sin(4*i),l=Math.sin(6*i),u=Math.sin(8*i),d=i*i,h=i*d,p=n.u8Over256,f=n.u2Over4,m=n.u6Over64,g=n.u4Over16;let _=2*h*p*r/3+i*(1-f+7*g/4-15*m/4+579*p/64-(g-15*m/4+187*p/16)*r-(5*m/4-115*p/16)*o-29*p*a/16)+(f/2-g+71*m/32-85*p/16)*s+(5*g/16-5*m/4+383*p/96)*c-d*((m-11*p/2)*s+5*p*c/2)+(29*m/96-29*p/16)*l+539*p*u/1536;const y=Math.asin(Math.sin(_)*n.cosineAlpha),C=Math.atan(n.a/n.b*Math.tan(y));_-=n.sigma;const T=Math.cos(2*n.sigma+_),S=Math.sin(_),A=Math.cos(_),v=n.cosineU*A,E=n.sineU*S,b=Math.atan2(S*n.sineHeading,v-E*n.cosineHeading)-computeDeltaLambda(n.f,n.sineAlpha,n.cosineSquaredAlpha,_,S,A,T);return defined(t)?(t.longitude=this._start.longitude+b,t.latitude=C,t.height=0,t):new Cartographic(this._start.longitude+b,C,0)};const PolylinePipeline={numberOfPoints:function(e,t,n){const i=Cartesian3.distance(e,t);return Math.ceil(i/n)},numberOfPointsRhumbLine:function(e,t,n){const i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))}},cartoScratch$2=new Cartographic;PolylinePipeline.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let r=0;r<n;r++){const n=e[r];i[r]=t.cartesianToCartographic(n,cartoScratch$2).height}return i};const wrapLongitudeInversMatrix=new Matrix4,wrapLongitudeOrigin=new Cartesian3,wrapLongitudeXZNormal=new Cartesian3,wrapLongitudeXZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeYZNormal=new Cartesian3,wrapLongitudeYZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeIntersection=new Cartesian3,wrapLongitudeOffset=new Cartesian3,subdivideHeightsScratchArray=[];function subdivideHeights$1(e,t,n){const i=subdivideHeightsScratchArray;let r;if(i.length=e,t===n){for(r=0;r<e;r++)i[r]=t;return i}const o=(n-t)/e;for(r=0;r<e;r++){const e=t+r*o;i[r]=e}return i}const carto1=new Cartographic,carto2=new Cartographic,cartesian=new Cartesian3,scaleFirst=new Cartesian3,scaleLast=new Cartesian3,ellipsoidGeodesic$1=new EllipsoidGeodesic;let ellipsoidRhumb=new EllipsoidRhumbLine;function generateCartesianArc(e,t,n,i,r,o,a,s){const c=i.scaleToGeodeticSurface(e,scaleFirst),l=i.scaleToGeodeticSurface(t,scaleLast),u=PolylinePipeline.numberOfPoints(e,t,n),d=i.cartesianToCartographic(c,carto1),h=i.cartesianToCartographic(l,carto2),p=subdivideHeights$1(u,r,o);ellipsoidGeodesic$1.setEndPoints(d,h);const f=ellipsoidGeodesic$1.surfaceDistance/u;let m=s;d.height=r;let g=i.cartographicToCartesian(d,cartesian);Cartesian3.pack(g,a,m),m+=3;for(let e=1;e<u;e++){const t=ellipsoidGeodesic$1.interpolateUsingSurfaceDistance(e*f,carto2);t.height=p[e],g=i.cartographicToCartesian(t,cartesian),Cartesian3.pack(g,a,m),m+=3}return m}function generateCartesianRhumbArc(e,t,n,i,r,o,a,s){const c=i.cartesianToCartographic(e,carto1),l=i.cartesianToCartographic(t,carto2),u=PolylinePipeline.numberOfPointsRhumbLine(c,l,n);c.height=0,l.height=0;const d=subdivideHeights$1(u,r,o);ellipsoidRhumb.ellipsoid.equals(i)||(ellipsoidRhumb=new EllipsoidRhumbLine(void 0,void 0,i)),ellipsoidRhumb.setEndPoints(c,l);const h=ellipsoidRhumb.surfaceDistance/u;let p=s;c.height=r;let f=i.cartographicToCartesian(c,cartesian);Cartesian3.pack(f,a,p),p+=3;for(let e=1;e<u;e++){const t=ellipsoidRhumb.interpolateUsingSurfaceDistance(e*h,carto2);t.height=d[e],f=i.cartographicToCartesian(t,cartesian),Cartesian3.pack(f,a,p),p+=3}return p}PolylinePipeline.wrapLongitude=function(e,t){const n=[],i=[];if(defined(e)&&e.length>0){t=defaultValue(t,Matrix4.IDENTITY);const r=Matrix4.inverseTransformation(t,wrapLongitudeInversMatrix),o=Matrix4.multiplyByPoint(r,Cartesian3.ZERO,wrapLongitudeOrigin),a=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(r,Cartesian3.UNIT_Y,wrapLongitudeXZNormal),wrapLongitudeXZNormal),s=Plane.fromPointNormal(o,a,wrapLongitudeXZPlane),c=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(r,Cartesian3.UNIT_X,wrapLongitudeYZNormal),wrapLongitudeYZNormal),l=Plane.fromPointNormal(o,c,wrapLongitudeYZPlane);let u=1;n.push(Cartesian3.clone(e[0]));let d=n[0];const h=e.length;for(let t=1;t<h;++t){const r=e[t];if(Plane.getPointDistance(l,d)<0||Plane.getPointDistance(l,r)<0){const e=IntersectionTests.lineSegmentPlane(d,r,s,wrapLongitudeIntersection);if(defined(e)){const t=Cartesian3.multiplyByScalar(a,5e-9,wrapLongitudeOffset);Plane.getPointDistance(s,d)<0&&Cartesian3.negate(t,t),n.push(Cartesian3.add(e,t,new Cartesian3)),i.push(u+1),Cartesian3.negate(t,t),n.push(Cartesian3.add(e,t,new Cartesian3)),u=1}}n.push(Cartesian3.clone(e[t])),u++,d=r}i.push(u)}return{positions:n,lengths:i}},PolylinePipeline.generateArc=function(e){defined(e)||(e={});const t=e.positions,n=t.length,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84);let r=defaultValue(e.height,0);const o=Array.isArray(r);if(n<1)return[];if(1===n){const e=i.scaleToGeodeticSurface(t[0],scaleFirst);if(r=o?r[0]:r,0!==r){const t=i.geodeticSurfaceNormal(e,cartesian);Cartesian3.multiplyByScalar(t,r,t),Cartesian3.add(e,t,e)}return[e.x,e.y,e.z]}let a=e.minDistance;if(!defined(a)){const t=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);a=CesiumMath.chordLength(t,i.maximumRadius)}let s,c=0;for(s=0;s<n-1;s++)c+=PolylinePipeline.numberOfPoints(t[s],t[s+1],a);const l=3*(c+1),u=new Array(l);let d=0;for(s=0;s<n-1;s++){d=generateCartesianArc(t[s],t[s+1],a,i,o?r[s]:r,o?r[s+1]:r,u,d)}subdivideHeightsScratchArray.length=0;const h=t[n-1],p=i.cartesianToCartographic(h,carto1);p.height=o?r[n-1]:r;const f=i.cartographicToCartesian(p,cartesian);return Cartesian3.pack(f,u,l-3),u};const scratchCartographic0=new Cartographic,scratchCartographic1$1=new Cartographic;PolylinePipeline.generateRhumbArc=function(e){defined(e)||(e={});const t=e.positions,n=t.length,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84);let r=defaultValue(e.height,0);const o=Array.isArray(r);if(n<1)return[];if(1===n){const e=i.scaleToGeodeticSurface(t[0],scaleFirst);if(r=o?r[0]:r,0!==r){const t=i.geodeticSurfaceNormal(e,cartesian);Cartesian3.multiplyByScalar(t,r,t),Cartesian3.add(e,t,e)}return[e.x,e.y,e.z]}const a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);let s,c,l=0,u=i.cartesianToCartographic(t[0],scratchCartographic0);for(s=0;s<n-1;s++)c=i.cartesianToCartographic(t[s+1],scratchCartographic1$1),l+=PolylinePipeline.numberOfPointsRhumbLine(u,c,a),u=Cartographic.clone(c,scratchCartographic0);const d=3*(l+1),h=new Array(d);let p=0;for(s=0;s<n-1;s++){p=generateCartesianRhumbArc(t[s],t[s+1],a,i,o?r[s]:r,o?r[s+1]:r,h,p)}subdivideHeightsScratchArray.length=0;const f=t[n-1],m=i.cartesianToCartographic(f,carto1);m.height=o?r[n-1]:r;const g=i.cartographicToCartesian(m,cartesian);return Cartesian3.pack(g,h,d-3),h},PolylinePipeline.generateCartesianArc=function(e){const t=PolylinePipeline.generateArc(e),n=t.length/3,i=new Array(n);for(let e=0;e<n;e++)i[e]=Cartesian3.unpack(t,3*e);return i},PolylinePipeline.generateCartesianRhumbArc=function(e){const t=PolylinePipeline.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let e=0;e<n;e++)i[e]=Cartesian3.unpack(t,3*e);return i};const warnings={};function oneTimeWarning(e,t){defined(warnings[e])||(warnings[e]=!0,console.warn(defaultValue(t,e)))}oneTimeWarning.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",oneTimeWarning.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",oneTimeWarning.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",oneTimeWarning.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";const scratch2Array=[new Cartesian3,new Cartesian3],scratchCartesian1$3=new Cartesian3,scratchCartesian2$6=new Cartesian3,scratchCartesian3$7=new Cartesian3,scratchCartesian4$4=new Cartesian3,scratchCartesian5$1=new Cartesian3,scratchCartesian6=new Cartesian3,scratchCartesian7=new Cartesian3,scratchCartesian8=new Cartesian3,scratchCartesian9=new Cartesian3,scratch1$2=new Cartesian3,scratch2$2=new Cartesian3,PolylineVolumeGeometryLibrary={};let cartographic=new Cartographic;function scaleToSurface$2(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const r=e[i];cartographic=t.cartesianToCartographic(r,cartographic),n[i]=cartographic.height,e[i]=t.scaleToGeodeticSurface(r,r)}return n}function subdivideHeights(e,t,n,i){const r=e[0],o=e[1],a=Cartesian3.angleBetween(r,o),s=Math.ceil(a/i),c=new Array(s);let l;if(t===n){for(l=0;l<s;l++)c[l]=t;return c.push(n),c}const u=(n-t)/s;for(l=1;l<s;l++){const e=t+l*u;c[l]=e}return c[0]=t,c.push(n),c}const nextScratch=new Cartesian3,prevScratch=new Cartesian3;function computeRotationAngle(e,t,n,i){const r=new EllipsoidTangentPlane(n,i),o=r.projectPointOntoPlane(Cartesian3.add(n,e,nextScratch),nextScratch),a=r.projectPointOntoPlane(Cartesian3.add(n,t,prevScratch),prevScratch),s=Cartesian2.angleBetween(o,a);return a.x*o.y-a.y*o.x>=0?-s:s}const negativeX=new Cartesian3(-1,0,0);let transform$2=new Matrix4;const translation$1=new Matrix4;let rotationZ=new Matrix3;const scaleMatrix=Matrix3.IDENTITY.clone(),westScratch=new Cartesian3,finalPosScratch=new Cartesian4,heightCartesian=new Cartesian3;function addPosition(e,t,n,i,r,o,a,s){let c=westScratch,l=finalPosScratch;transform$2=Transforms.eastNorthUpToFixedFrame(e,r,transform$2),c=Matrix4.multiplyByPointAsVector(transform$2,negativeX,c),c=Cartesian3.normalize(c,c);const u=computeRotationAngle(c,t,e,r);rotationZ=Matrix3.fromRotationZ(u,rotationZ),heightCartesian.z=o,transform$2=Matrix4.multiplyTransformation(transform$2,Matrix4.fromRotationTranslation(rotationZ,heightCartesian,translation$1),transform$2);const d=scaleMatrix;d[0]=a;for(let e=0;e<s;e++)for(let e=0;e<n.length;e+=3)l=Cartesian3.fromArray(n,e,l),l=Matrix3.multiplyByVector(d,l,l),l=Matrix4.multiplyByPoint(transform$2,l,l),i.push(l.x,l.y,l.z);return i}const centerScratch$4=new Cartesian3;function addPositions(e,t,n,i,r,o,a){for(let s=0;s<e.length;s+=3){i=addPosition(Cartesian3.fromArray(e,s,centerScratch$4),t,n,i,r,o[s/3],a,1)}return i}function convertShapeTo3DDuplicate(e,t){const n=e.length,i=new Array(6*n);let r=0;const o=t.x+t.width/2,a=t.y+t.height/2;let s=e[0];i[r++]=s.x-o,i[r++]=0,i[r++]=s.y-a;for(let t=1;t<n;t++){s=e[t];const n=s.x-o,c=s.y-a;i[r++]=n,i[r++]=0,i[r++]=c,i[r++]=n,i[r++]=0,i[r++]=c}return s=e[0],i[r++]=s.x-o,i[r++]=0,i[r++]=s.y-a,i}function convertShapeTo3D(e,t){const n=e.length,i=new Array(3*n);let r=0;const o=t.x+t.width/2,a=t.y+t.height/2;for(let t=0;t<n;t++)i[r++]=e[t].x-o,i[r++]=0,i[r++]=e[t].y-a;return i}const quaterion$1=new Quaternion,startPointScratch=new Cartesian3,rotMatrix$1=new Matrix3;function computeRoundCorner$1(e,t,n,i,r,o,a,s,c,l){const u=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1$2),Cartesian3.subtract(n,e,scratch2$2)),d=i===CornerType$1.BEVELED?0:Math.ceil(u/CesiumMath.toRadians(5));let h,p,f;if(h=r?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1$2),u/(d+1),quaterion$1),rotMatrix$1):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,u/(d+1),quaterion$1),rotMatrix$1),t=Cartesian3.clone(t,startPointScratch),d>0){const n=l?2:1;for(let i=0;i<d;i++)t=Matrix3.multiplyByVector(h,t,t),p=Cartesian3.subtract(t,e,scratch1$2),p=Cartesian3.normalize(p,p),r||(p=Cartesian3.negate(p,p)),f=o.scaleToGeodeticSurface(t,scratch2$2),a=addPosition(f,p,s,a,o,c,1,n)}else p=Cartesian3.subtract(t,e,scratch1$2),p=Cartesian3.normalize(p,p),r||(p=Cartesian3.negate(p,p)),f=o.scaleToGeodeticSurface(t,scratch2$2),a=addPosition(f,p,s,a,o,c,1,1),n=Cartesian3.clone(n,startPointScratch),p=Cartesian3.subtract(n,e,scratch1$2),p=Cartesian3.normalize(p,p),r||(p=Cartesian3.negate(p,p)),f=o.scaleToGeodeticSurface(n,scratch2$2),a=addPosition(f,p,s,a,o,c,1,1);return a}PolylineVolumeGeometryLibrary.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let i=t-1,r=0;r<t;i=r++){const t=e[i],o=e[r];Cartesian2.equals(t,o)||n.push(o)}return n},PolylineVolumeGeometryLibrary.angleIsGreaterThanPi=function(e,t,n,i){const r=new EllipsoidTangentPlane(n,i),o=r.projectPointOntoPlane(Cartesian3.add(n,e,nextScratch),nextScratch),a=r.projectPointOntoPlane(Cartesian3.add(n,t,prevScratch),prevScratch);return a.x*o.y-a.y*o.x>=0};const scratchForwardProjection$1=new Cartesian3,scratchBackwardProjection$1=new Cartesian3;PolylineVolumeGeometryLibrary.computePositions=function(e,t,n,i,r){const o=i._ellipsoid,a=scaleToSurface$2(e,o),s=i._granularity,c=i._cornerType,l=r?convertShapeTo3DDuplicate(t,n):convertShapeTo3D(t,n),u=r?convertShapeTo3D(t,n):void 0,d=n.height/2,h=n.width/2;let p=e.length,f=[],m=r?[]:void 0,g=scratchCartesian1$3,_=scratchCartesian2$6,y=scratchCartesian3$7,C=scratchCartesian4$4,T=scratchCartesian5$1,S=scratchCartesian6,A=scratchCartesian7,v=scratchCartesian8,E=scratchCartesian9,b=e[0],x=e[1];C=o.geodeticSurfaceNormal(b,C),g=Cartesian3.subtract(x,b,g),g=Cartesian3.normalize(g,g),v=Cartesian3.cross(C,g,v),v=Cartesian3.normalize(v,v);let P,D,w=a[0],M=a[1];r&&(m=addPosition(b,v,u,m,o,w+d,1,1)),E=Cartesian3.clone(b,E),b=x,_=Cartesian3.negate(g,_);for(let t=1;t<p-1;t++){const n=r?2:1;if(x=e[t+1],b.equals(x)){oneTimeWarning("Positions are too close and are considered equivalent with rounding error.");continue}g=Cartesian3.subtract(x,b,g),g=Cartesian3.normalize(g,g),y=Cartesian3.add(g,_,y),y=Cartesian3.normalize(y,y),C=o.geodeticSurfaceNormal(b,C);const i=Cartesian3.multiplyByScalar(C,Cartesian3.dot(g,C),scratchForwardProjection$1);Cartesian3.subtract(g,i,i),Cartesian3.normalize(i,i);const u=Cartesian3.multiplyByScalar(C,Cartesian3.dot(_,C),scratchBackwardProjection$1);Cartesian3.subtract(_,u,u),Cartesian3.normalize(u,u);if(!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(i,u)),1,CesiumMath.EPSILON7)){y=Cartesian3.cross(y,C,y),y=Cartesian3.cross(C,y,y),y=Cartesian3.normalize(y,y);const e=1/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(y,_,scratch1$2))),t=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(g,_,b,o);t?(T=Cartesian3.add(b,Cartesian3.multiplyByScalar(y,e*h,y),T),S=Cartesian3.add(T,Cartesian3.multiplyByScalar(v,h,S),S),scratch2Array[0]=Cartesian3.clone(E,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(S,scratch2Array[1]),P=subdivideHeights(scratch2Array,w+d,M+d,s),D=PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:o}),f=addPositions(D,v,l,f,o,P,1),v=Cartesian3.cross(C,g,v),v=Cartesian3.normalize(v,v),A=Cartesian3.add(T,Cartesian3.multiplyByScalar(v,h,A),A),c===CornerType$1.ROUNDED||c===CornerType$1.BEVELED?computeRoundCorner$1(T,S,A,c,t,o,f,l,M+d,r):(y=Cartesian3.negate(y,y),f=addPosition(b,y,l,f,o,M+d,e,n)),E=Cartesian3.clone(A,E)):(T=Cartesian3.add(b,Cartesian3.multiplyByScalar(y,e*h,y),T),S=Cartesian3.add(T,Cartesian3.multiplyByScalar(v,-h,S),S),scratch2Array[0]=Cartesian3.clone(E,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(S,scratch2Array[1]),P=subdivideHeights(scratch2Array,w+d,M+d,s),D=PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:o}),f=addPositions(D,v,l,f,o,P,1),v=Cartesian3.cross(C,g,v),v=Cartesian3.normalize(v,v),A=Cartesian3.add(T,Cartesian3.multiplyByScalar(v,-h,A),A),c===CornerType$1.ROUNDED||c===CornerType$1.BEVELED?computeRoundCorner$1(T,S,A,c,t,o,f,l,M+d,r):f=addPosition(b,y,l,f,o,M+d,e,n),E=Cartesian3.clone(A,E)),_=Cartesian3.negate(g,_)}else f=addPosition(E,v,l,f,o,w+d,1,1),E=b;w=M,M=a[t+1],b=x}scratch2Array[0]=Cartesian3.clone(E,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(b,scratch2Array[1]),P=subdivideHeights(scratch2Array,w+d,M+d,s),D=PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:o}),f=addPositions(D,v,l,f,o,P,1),r&&(m=addPosition(b,v,u,m,o,M+d,1,1)),p=f.length;const I=r?p+m.length:p,R=new Float64Array(I);return R.set(f),r&&R.set(m,p),R};const CorridorGeometryLibrary={},scratch1$1=new Cartesian3,scratch2$1=new Cartesian3,scratch3=new Cartesian3,scratch4=new Cartesian3,scaleArray2=[new Cartesian3,new Cartesian3],cartesian1$2=new Cartesian3,cartesian2$2=new Cartesian3,cartesian3$2=new Cartesian3,cartesian4$1=new Cartesian3,cartesian5$1=new Cartesian3,cartesian6$1=new Cartesian3,cartesian7=new Cartesian3,cartesian8=new Cartesian3,cartesian9=new Cartesian3,cartesian10=new Cartesian3,quaterion=new Quaternion,rotMatrix=new Matrix3;function computeRoundCorner(e,t,n,i,r){const o=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1$1),Cartesian3.subtract(n,e,scratch2$1)),a=i===CornerType$1.BEVELED?1:Math.ceil(o/CesiumMath.toRadians(5))+1,s=3*a,c=new Array(s);let l;c[s-3]=n.x,c[s-2]=n.y,c[s-1]=n.z,l=r?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1$1),o/a,quaterion),rotMatrix):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,o/a,quaterion),rotMatrix);let u=0;t=Cartesian3.clone(t,scratch1$1);for(let e=0;e<a;e++)t=Matrix3.multiplyByVector(l,t,t),c[u++]=t.x,c[u++]=t.y,c[u++]=t.z;return c}function addEndCaps(e){let t=cartesian1$2,n=cartesian2$2,i=cartesian3$2,r=e[1];n=Cartesian3.fromArray(e[1],r.length-3,n),i=Cartesian3.fromArray(e[0],0,i),t=Cartesian3.midpoint(n,i,t);const o=computeRoundCorner(t,n,i,CornerType$1.ROUNDED,!1),a=e.length-1,s=e[a-1];r=e[a],n=Cartesian3.fromArray(s,s.length-3,n),i=Cartesian3.fromArray(r,0,i),t=Cartesian3.midpoint(n,i,t);return[o,computeRoundCorner(t,n,i,CornerType$1.ROUNDED,!1)]}function computeMiteredCorner(e,t,n,i){let r=scratch1$1;return i||(t=Cartesian3.negate(t,t)),r=Cartesian3.add(e,t,r),[r.x,r.y,r.z,n.x,n.y,n.z]}function addShiftedPositions(e,t,n,i){const r=new Array(e.length),o=new Array(e.length),a=Cartesian3.multiplyByScalar(t,n,scratch1$1),s=Cartesian3.negate(a,scratch2$1);let c=0,l=e.length-1;for(let t=0;t<e.length;t+=3){const n=Cartesian3.fromArray(e,t,scratch3),i=Cartesian3.add(n,s,scratch4);r[c++]=i.x,r[c++]=i.y,r[c++]=i.z;const u=Cartesian3.add(n,a,scratch4);o[l--]=u.z,o[l--]=u.y,o[l--]=u.x}return i.push(r,o),i}CorridorGeometryLibrary.addAttribute=function(e,t,n,i){const r=t.x,o=t.y,a=t.z;defined(n)&&(e[n]=r,e[n+1]=o,e[n+2]=a),defined(i)&&(e[i]=a,e[i-1]=o,e[i-2]=r)};const scratchForwardProjection=new Cartesian3,scratchBackwardProjection=new Cartesian3;CorridorGeometryLibrary.computePositions=function(e){const t=e.granularity,n=e.positions,i=e.ellipsoid,r=e.width/2,o=e.cornerType,a=e.saveAttributes;let s=cartesian1$2,c=cartesian2$2,l=cartesian3$2,u=cartesian4$1,d=cartesian5$1,h=cartesian6$1,p=cartesian7,f=cartesian8,m=cartesian9,g=cartesian10,_=[];const y=a?[]:void 0,C=a?[]:void 0;let T,S=n[0],A=n[1];c=Cartesian3.normalize(Cartesian3.subtract(A,S,c),c),s=i.geodeticSurfaceNormal(S,s),u=Cartesian3.normalize(Cartesian3.cross(s,c,u),u),a&&(y.push(u.x,u.y,u.z),C.push(s.x,s.y,s.z)),p=Cartesian3.clone(S,p),S=A,l=Cartesian3.negate(c,l);const v=[];let E;const b=n.length;for(E=1;E<b-1;E++){s=i.geodeticSurfaceNormal(S,s),A=n[E+1],c=Cartesian3.normalize(Cartesian3.subtract(A,S,c),c),d=Cartesian3.normalize(Cartesian3.add(c,l,d),d);const e=Cartesian3.multiplyByScalar(s,Cartesian3.dot(c,s),scratchForwardProjection);Cartesian3.subtract(c,e,e),Cartesian3.normalize(e,e);const b=Cartesian3.multiplyByScalar(s,Cartesian3.dot(l,s),scratchBackwardProjection);Cartesian3.subtract(l,b,b),Cartesian3.normalize(b,b);if(!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(e,b)),1,CesiumMath.EPSILON7)){d=Cartesian3.cross(d,s,d),d=Cartesian3.cross(s,d,d),d=Cartesian3.normalize(d,d);const e=r/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(d,l,scratch1$1))),n=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(c,l,S,i);d=Cartesian3.multiplyByScalar(d,e,d),n?(f=Cartesian3.add(S,d,f),g=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,r,g),g),m=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,2*r,m),m),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),T=PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:i}),_=addShiftedPositions(T,u,r,_),a&&(y.push(u.x,u.y,u.z),C.push(s.x,s.y,s.z)),h=Cartesian3.clone(m,h),u=Cartesian3.normalize(Cartesian3.cross(s,c,u),u),m=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,2*r,m),m),p=Cartesian3.add(f,Cartesian3.multiplyByScalar(u,r,p),p),o===CornerType$1.ROUNDED||o===CornerType$1.BEVELED?v.push({leftPositions:computeRoundCorner(f,h,m,o,n)}):v.push({leftPositions:computeMiteredCorner(S,Cartesian3.negate(d,d),m,n)})):(m=Cartesian3.add(S,d,m),g=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,r,g),g),g),f=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*r,f),f),f),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),T=PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:i}),_=addShiftedPositions(T,u,r,_),a&&(y.push(u.x,u.y,u.z),C.push(s.x,s.y,s.z)),h=Cartesian3.clone(f,h),u=Cartesian3.normalize(Cartesian3.cross(s,c,u),u),f=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*r,f),f),f),p=Cartesian3.add(m,Cartesian3.negate(Cartesian3.multiplyByScalar(u,r,p),p),p),o===CornerType$1.ROUNDED||o===CornerType$1.BEVELED?v.push({rightPositions:computeRoundCorner(m,h,f,o,n)}):v.push({rightPositions:computeMiteredCorner(S,d,f,n)})),l=Cartesian3.negate(c,l)}S=A}let x;return s=i.geodeticSurfaceNormal(S,s),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(S,scaleArray2[1]),T=PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:i}),_=addShiftedPositions(T,u,r,_),a&&(y.push(u.x,u.y,u.z),C.push(s.x,s.y,s.z)),o===CornerType$1.ROUNDED&&(x=addEndCaps(_)),{positions:_,corners:v,lefts:y,normals:C,endPositions:x}};const cartesian1$1=new Cartesian3,cartesian2$1=new Cartesian3,cartesian3$1=new Cartesian3,cartesian4=new Cartesian3,cartesian5=new Cartesian3,cartesian6=new Cartesian3,scratch1=new Cartesian3,scratch2=new Cartesian3;function scaleToSurface$1(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function addNormals(e,t,n,i,r,o){const a=e.normals,s=e.tangents,c=e.bitangents,l=Cartesian3.normalize(Cartesian3.cross(n,t,scratch1),scratch1);o.normal&&CorridorGeometryLibrary.addAttribute(a,t,i,r),o.tangent&&CorridorGeometryLibrary.addAttribute(s,l,i,r),o.bitangent&&CorridorGeometryLibrary.addAttribute(c,n,i,r)}function combine$1(e,t,n){const i=e.positions,r=e.corners,o=e.endPositions,a=e.lefts,s=e.normals,c=new GeometryAttributes;let l,u,d,h=0,p=0,f=0;for(u=0;u<i.length;u+=2)d=i[u].length-3,h+=d,f+=2*d,p+=i[u+1].length-3;for(h+=3,p+=3,u=0;u<r.length;u++){l=r[u];const e=r[u].leftPositions;defined(e)?(d=e.length,h+=d,f+=d):(d=r[u].rightPositions.length,p+=d,f+=d)}const m=defined(o);let g;m&&(g=o[0].length-3,h+=g,p+=g,g/=3,f+=6*g);const _=h+p,y=new Float64Array(_),C={normals:t.normal?new Float32Array(_):void 0,tangents:t.tangent?new Float32Array(_):void 0,bitangents:t.bitangent?new Float32Array(_):void 0};let T,S,A,v,E,b,x=0,P=_-1,D=cartesian1$1,w=cartesian2$1;const M=g/2,I=IndexDatatype$1.createTypedArray(_/3,f);let R=0;if(m){b=cartesian3$1,E=cartesian4;const e=o[0];for(D=Cartesian3.fromArray(s,0,D),w=Cartesian3.fromArray(a,0,w),u=0;u<M;u++)b=Cartesian3.fromArray(e,3*(M-1-u),b),E=Cartesian3.fromArray(e,3*(M+u),E),CorridorGeometryLibrary.addAttribute(y,E,x),CorridorGeometryLibrary.addAttribute(y,b,void 0,P),addNormals(C,D,w,x,P,t),S=x/3,v=S+1,T=(P-2)/3,A=T-1,I[R++]=T,I[R++]=S,I[R++]=A,I[R++]=A,I[R++]=S,I[R++]=v,x+=3,P-=3}let O,B,L=0,F=0,N=i[L++],V=i[L++];for(y.set(N,x),y.set(V,P-V.length+1),w=Cartesian3.fromArray(a,F,w),d=V.length-3,u=0;u<d;u+=3)O=n.geodeticSurfaceNormal(Cartesian3.fromArray(N,u,scratch1),scratch1),B=n.geodeticSurfaceNormal(Cartesian3.fromArray(V,d-u,scratch2),scratch2),D=Cartesian3.normalize(Cartesian3.add(O,B,D),D),addNormals(C,D,w,x,P,t),S=x/3,v=S+1,T=(P-2)/3,A=T-1,I[R++]=T,I[R++]=S,I[R++]=A,I[R++]=A,I[R++]=S,I[R++]=v,x+=3,P-=3;for(O=n.geodeticSurfaceNormal(Cartesian3.fromArray(N,d,scratch1),scratch1),B=n.geodeticSurfaceNormal(Cartesian3.fromArray(V,d,scratch2),scratch2),D=Cartesian3.normalize(Cartesian3.add(O,B,D),D),F+=3,u=0;u<r.length;u++){let e;l=r[u];const o=l.leftPositions,c=l.rightPositions;let h,p,f=cartesian6,m=cartesian3$1,g=cartesian4;if(D=Cartesian3.fromArray(s,F,D),defined(o)){for(addNormals(C,D,w,void 0,P,t),P-=3,h=v,p=A,e=0;e<o.length/3;e++)f=Cartesian3.fromArray(o,3*e,f),I[R++]=h,I[R++]=p-e-1,I[R++]=p-e,CorridorGeometryLibrary.addAttribute(y,f,void 0,P),m=Cartesian3.fromArray(y,3*(p-e-1),m),g=Cartesian3.fromArray(y,3*h,g),w=Cartesian3.normalize(Cartesian3.subtract(m,g,w),w),addNormals(C,D,w,void 0,P,t),P-=3;f=Cartesian3.fromArray(y,3*h,f),m=Cartesian3.subtract(Cartesian3.fromArray(y,3*p,m),f,m),g=Cartesian3.subtract(Cartesian3.fromArray(y,3*(p-e),g),f,g),w=Cartesian3.normalize(Cartesian3.add(m,g,w),w),addNormals(C,D,w,x,void 0,t),x+=3}else{for(addNormals(C,D,w,x,void 0,t),x+=3,h=A,p=v,e=0;e<c.length/3;e++)f=Cartesian3.fromArray(c,3*e,f),I[R++]=h,I[R++]=p+e,I[R++]=p+e+1,CorridorGeometryLibrary.addAttribute(y,f,x),m=Cartesian3.fromArray(y,3*h,m),g=Cartesian3.fromArray(y,3*(p+e),g),w=Cartesian3.normalize(Cartesian3.subtract(m,g,w),w),addNormals(C,D,w,x,void 0,t),x+=3;f=Cartesian3.fromArray(y,3*h,f),m=Cartesian3.subtract(Cartesian3.fromArray(y,3*(p+e),m),f,m),g=Cartesian3.subtract(Cartesian3.fromArray(y,3*p,g),f,g),w=Cartesian3.normalize(Cartesian3.negate(Cartesian3.add(g,m,w),w),w),addNormals(C,D,w,void 0,P,t),P-=3}for(N=i[L++],V=i[L++],N.splice(0,3),V.splice(V.length-3,3),y.set(N,x),y.set(V,P-V.length+1),d=V.length-3,F+=3,w=Cartesian3.fromArray(a,F,w),e=0;e<V.length;e+=3)O=n.geodeticSurfaceNormal(Cartesian3.fromArray(N,e,scratch1),scratch1),B=n.geodeticSurfaceNormal(Cartesian3.fromArray(V,d-e,scratch2),scratch2),D=Cartesian3.normalize(Cartesian3.add(O,B,D),D),addNormals(C,D,w,x,P,t),v=x/3,S=v-1,A=(P-2)/3,T=A+1,I[R++]=T,I[R++]=S,I[R++]=A,I[R++]=A,I[R++]=S,I[R++]=v,x+=3,P-=3;x-=3,P+=3}if(D=Cartesian3.fromArray(s,s.length-3,D),addNormals(C,D,w,x,P,t),m){x+=3,P-=3,b=cartesian3$1,E=cartesian4;const e=o[1];for(u=0;u<M;u++)b=Cartesian3.fromArray(e,3*(g-u-1),b),E=Cartesian3.fromArray(e,3*u,E),CorridorGeometryLibrary.addAttribute(y,b,void 0,P),CorridorGeometryLibrary.addAttribute(y,E,x),addNormals(C,D,w,x,P,t),v=x/3,S=v-1,A=(P-2)/3,T=A+1,I[R++]=T,I[R++]=S,I[R++]=A,I[R++]=A,I[R++]=S,I[R++]=v,x+=3,P-=3}if(c.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:y}),t.st){const e=new Float32Array(_/3*2);let t,n,i=0;if(m){h/=3,p/=3;const r=Math.PI/(g+1);let o;n=1/(h-g+1),t=1/(p-g+1);const a=g/2;for(u=a+1;u<g+1;u++)o=CesiumMath.PI_OVER_TWO+r*u,e[i++]=t*(1+Math.cos(o)),e[i++]=.5*(1+Math.sin(o));for(u=1;u<p-g+1;u++)e[i++]=u*t,e[i++]=0;for(u=g;u>a;u--)o=CesiumMath.PI_OVER_TWO-u*r,e[i++]=1-t*(1+Math.cos(o)),e[i++]=.5*(1+Math.sin(o));for(u=a;u>0;u--)o=CesiumMath.PI_OVER_TWO-r*u,e[i++]=1-n*(1+Math.cos(o)),e[i++]=.5*(1+Math.sin(o));for(u=h-g;u>0;u--)e[i++]=u*n,e[i++]=1;for(u=1;u<a+1;u++)o=CesiumMath.PI_OVER_TWO+r*u,e[i++]=n*(1+Math.cos(o)),e[i++]=.5*(1+Math.sin(o))}else{for(h/=3,p/=3,n=1/(h-1),t=1/(p-1),u=0;u<p;u++)e[i++]=u*t,e[i++]=0;for(u=h;u>0;u--)e[i++]=(u-1)*n,e[i++]=1}c.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:e})}return t.normal&&(c.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C.normals})),t.tangent&&(c.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C.tangents})),t.bitangent&&(c.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C.bitangents})),{attributes:c,indices:I}}function extrudedAttributes(e,t){if(!(t.normal||t.tangent||t.bitangent||t.st))return e;const n=e.position.values;let i,r;(t.normal||t.bitangent)&&(i=e.normal.values,r=e.bitangent.values);const o=e.position.values.length/18,a=3*o,s=2*o,c=2*a;let l;if(t.normal||t.bitangent||t.tangent){const o=t.normal?new Float32Array(6*a):void 0,s=t.tangent?new Float32Array(6*a):void 0,u=t.bitangent?new Float32Array(6*a):void 0;let d=cartesian1$1,h=cartesian2$1,p=cartesian3$1,f=cartesian4,m=cartesian5,g=cartesian6,_=c;for(l=0;l<a;l+=3){const e=_+c;d=Cartesian3.fromArray(n,l,d),h=Cartesian3.fromArray(n,l+a,h),p=Cartesian3.fromArray(n,(l+3)%a,p),h=Cartesian3.subtract(h,d,h),p=Cartesian3.subtract(p,d,p),f=Cartesian3.normalize(Cartesian3.cross(h,p,f),f),t.normal&&(CorridorGeometryLibrary.addAttribute(o,f,e),CorridorGeometryLibrary.addAttribute(o,f,e+3),CorridorGeometryLibrary.addAttribute(o,f,_),CorridorGeometryLibrary.addAttribute(o,f,_+3)),(t.tangent||t.bitangent)&&(g=Cartesian3.fromArray(i,l,g),t.bitangent&&(CorridorGeometryLibrary.addAttribute(u,g,e),CorridorGeometryLibrary.addAttribute(u,g,e+3),CorridorGeometryLibrary.addAttribute(u,g,_),CorridorGeometryLibrary.addAttribute(u,g,_+3)),t.tangent&&(m=Cartesian3.normalize(Cartesian3.cross(g,f,m),m),CorridorGeometryLibrary.addAttribute(s,m,e),CorridorGeometryLibrary.addAttribute(s,m,e+3),CorridorGeometryLibrary.addAttribute(s,m,_),CorridorGeometryLibrary.addAttribute(s,m,_+3))),_+=6}if(t.normal){for(o.set(i),l=0;l<a;l+=3)o[l+a]=-i[l],o[l+a+1]=-i[l+1],o[l+a+2]=-i[l+2];e.normal.values=o}else e.normal=void 0;if(t.bitangent?(u.set(r),u.set(r,a),e.bitangent.values=u):e.bitangent=void 0,t.tangent){const t=e.tangent.values;s.set(t),s.set(t,a),e.tangent.values=s}}if(t.st){const t=e.st.values,n=new Float32Array(6*s);n.set(t),n.set(t,s);let i=2*s;for(let e=0;e<2;e++){for(n[i++]=t[0],n[i++]=t[1],l=2;l<s;l+=2){const e=t[l],r=t[l+1];n[i++]=e,n[i++]=r,n[i++]=e,n[i++]=r}n[i++]=t[0],n[i++]=t[1]}e.st.values=n}return e}function addWallPositions$1(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){const r=e[i],o=e[i+1],a=e[i+2];n[t++]=r,n[t++]=o,n[t++]=a,n[t++]=r,n[t++]=o,n[t++]=a}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function computePositionsExtruded$1(e,t){const n=new VertexFormat({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,r=combine$1(CorridorGeometryLibrary.computePositions(e),n,i),o=e.height,a=e.extrudedHeight;let s=r.attributes;const c=r.indices;let l=s.position.values,u=l.length;const d=new Float64Array(6*u);let h=new Float64Array(u);h.set(l);let p,f=new Float64Array(4*u);l=PolygonPipeline.scaleToGeodeticHeight(l,o,i),f=addWallPositions$1(l,0,f),h=PolygonPipeline.scaleToGeodeticHeight(h,a,i),f=addWallPositions$1(h,2*u,f),d.set(l),d.set(h,u),d.set(f,2*u),s.position.values=d,s=extrudedAttributes(s,t);const m=u/3;if(e.shadowVolume){const e=s.normal.values;u=e.length;let n=new Float32Array(6*u);for(p=0;p<u;p++)e[p]=-e[p];n.set(e,u),n=addWallPositions$1(e,4*u,n),s.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:n}),t.normal||(s.normal=void 0)}if(defined(e.offsetAttribute)){let t=new Uint8Array(6*m);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)t=arrayFill(t,1,0,m),t=arrayFill(t,1,2*m,4*m);else{t=arrayFill(t,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}s.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}const g=c.length,_=m+m,y=IndexDatatype$1.createTypedArray(d.length/3,2*g+3*_);y.set(c);let C,T,S,A,v=g;for(p=0;p<g;p+=3){const e=c[p],t=c[p+1],n=c[p+2];y[v++]=n+m,y[v++]=t+m,y[v++]=e+m}for(p=0;p<_;p+=2)C=p+_,T=C+_,S=C+1,A=T+1,y[v++]=C,y[v++]=T,y[v++]=S,y[v++]=S,y[v++]=T,y[v++]=A;return{attributes:s,indices:y}}const scratchCartesian1$2=new Cartesian3,scratchCartesian2$5=new Cartesian3,scratchCartographic$e=new Cartographic;function computeOffsetPoints(e,t,n,i,r,o){const a=Cartesian3.subtract(t,e,scratchCartesian1$2);Cartesian3.normalize(a,a);const s=n.geodeticSurfaceNormal(e,scratchCartesian2$5),c=Cartesian3.cross(a,s,scratchCartesian1$2);Cartesian3.multiplyByScalar(c,i,c);let l=r.latitude,u=r.longitude,d=o.latitude,h=o.longitude;Cartesian3.add(e,c,scratchCartesian2$5),n.cartesianToCartographic(scratchCartesian2$5,scratchCartographic$e);let p=scratchCartographic$e.latitude,f=scratchCartographic$e.longitude;l=Math.min(l,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),Cartesian3.subtract(e,c,scratchCartesian2$5),n.cartesianToCartographic(scratchCartesian2$5,scratchCartographic$e),p=scratchCartographic$e.latitude,f=scratchCartographic$e.longitude,l=Math.min(l,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),r.latitude=l,r.longitude=u,o.latitude=d,o.longitude=h}const scratchCartesianOffset=new Cartesian3,scratchCartesianEnds=new Cartesian3,scratchCartographicMin=new Cartographic,scratchCartographicMax=new Cartographic;function computeRectangle$2(e,t,n,i,r){const o=arrayRemoveDuplicates(e=scaleToSurface$1(e,t),Cartesian3.equalsEpsilon),a=o.length;if(a<2||n<=0)return new Rectangle;const s=.5*n;let c,l;if(scratchCartographicMin.latitude=Number.POSITIVE_INFINITY,scratchCartographicMin.longitude=Number.POSITIVE_INFINITY,scratchCartographicMax.latitude=Number.NEGATIVE_INFINITY,scratchCartographicMax.longitude=Number.NEGATIVE_INFINITY,i===CornerType$1.ROUNDED){const e=o[0];Cartesian3.subtract(e,o[1],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,s,scratchCartesianOffset),Cartesian3.add(e,scratchCartesianOffset,scratchCartesianEnds),t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$e),c=scratchCartographic$e.latitude,l=scratchCartographic$e.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,c),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,c),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l)}for(let e=0;e<a-1;++e)computeOffsetPoints(o[e],o[e+1],t,s,scratchCartographicMin,scratchCartographicMax);const u=o[a-1];Cartesian3.subtract(u,o[a-2],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,s,scratchCartesianOffset),Cartesian3.add(u,scratchCartesianOffset,scratchCartesianEnds),computeOffsetPoints(u,scratchCartesianEnds,t,s,scratchCartographicMin,scratchCartographicMax),i===CornerType$1.ROUNDED&&(t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$e),c=scratchCartographic$e.latitude,l=scratchCartographic$e.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,c),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,c),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l));const d=defined(r)?r:new Rectangle;return d.north=scratchCartographicMax.latitude,d.south=scratchCartographicMin.latitude,d.east=scratchCartographicMax.longitude,d.west=scratchCartographicMin.longitude,d}function CorridorGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.width,i=defaultValue(e.height,0),r=defaultValue(e.extrudedHeight,i);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._width=n,this._height=Math.max(i,r),this._extrudedHeight=Math.min(i,r),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7}CorridorGeometry.pack=function(e,t,n){n=defaultValue(n,0);const i=e._positions,r=i.length;t[n++]=r;for(let e=0;e<r;++e,n+=Cartesian3.packedLength)Cartesian3.pack(i[e],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n++]=e._shadowVolume?1:0,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchEllipsoid$b=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$9=new VertexFormat,scratchOptions$f={positions:void 0,ellipsoid:scratchEllipsoid$b,vertexFormat:scratchVertexFormat$9,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};CorridorGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=e[t++],r=new Array(i);for(let n=0;n<i;++n,t+=Cartesian3.packedLength)r[n]=Cartesian3.unpack(e,t);const o=Ellipsoid.unpack(e,t,scratchEllipsoid$b);t+=Ellipsoid.packedLength;const a=VertexFormat.unpack(e,t,scratchVertexFormat$9);t+=VertexFormat.packedLength;const s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=1===e[t++],p=e[t];return defined(n)?(n._positions=r,n._ellipsoid=Ellipsoid.clone(o,n._ellipsoid),n._vertexFormat=VertexFormat.clone(a,n._vertexFormat),n._width=s,n._height=c,n._extrudedHeight=l,n._cornerType=u,n._granularity=d,n._shadowVolume=h,n._offsetAttribute=-1===p?void 0:p,n):(scratchOptions$f.positions=r,scratchOptions$f.width=s,scratchOptions$f.height=c,scratchOptions$f.extrudedHeight=l,scratchOptions$f.cornerType=u,scratchOptions$f.granularity=d,scratchOptions$f.shadowVolume=h,scratchOptions$f.offsetAttribute=-1===p?void 0:p,new CorridorGeometry(scratchOptions$f))},CorridorGeometry.computeRectangle=function(e,t){const n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.width;return computeRectangle$2(n,defaultValue(e.ellipsoid,Ellipsoid.WGS84),i,defaultValue(e.cornerType,CornerType$1.ROUNDED),t)},CorridorGeometry.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=scaleToSurface$1(t,i);const r=arrayRemoveDuplicates(t,Cartesian3.equalsEpsilon);if(r.length<2||n<=0)return;const o=e._height,a=e._extrudedHeight,s=!CesiumMath.equalsEpsilon(o,a,0,CesiumMath.EPSILON2),c=e._vertexFormat,l={ellipsoid:i,positions:r,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let u;if(s)l.height=o,l.extrudedHeight=a,l.shadowVolume=e._shadowVolume,l.offsetAttribute=e._offsetAttribute,u=computePositionsExtruded$1(l,c);else{if(u=combine$1(CorridorGeometryLibrary.computePositions(l),c,i),u.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(u.attributes.position.values,o,i),defined(e._offsetAttribute)){const t=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,n=u.attributes.position.values.length,i=new Uint8Array(n/3);arrayFill(i,t),u.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}}const d=u.attributes,h=BoundingSphere.fromVertices(d.position.values,void 0,3);return c.position||(u.attributes.position.values=void 0),new Geometry({attributes:d,indices:u.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:h,offsetAttribute:e._offsetAttribute})},CorridorGeometry.createShadowVolume=function(e,t,n){const i=e._granularity,r=e._ellipsoid,o=t(i,r),a=n(i,r);return new CorridorGeometry({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:r,granularity:i,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(CorridorGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle$2(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const cartesian1=new Cartesian3,cartesian2=new Cartesian3,cartesian3=new Cartesian3;function scaleToSurface(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function combine(e,t){const n=[],i=e.positions,r=e.corners,o=e.endPositions,a=new GeometryAttributes;let s,c,l,u=0,d=0,h=0;for(c=0;c<i.length;c+=2)l=i[c].length-3,u+=l,h+=l/3*4,d+=i[c+1].length-3;for(u+=3,d+=3,c=0;c<r.length;c++){s=r[c];const e=r[c].leftPositions;defined(e)?(l=e.length,u+=l,h+=l/3*2):(l=r[c].rightPositions.length,d+=l,h+=l/3*2)}const p=defined(o);let f;p&&(f=o[0].length-3,u+=f,d+=f,f/=3,h+=4*f);const m=u+d,g=new Float64Array(m);let _,y,C,T,S,A,v=0,E=m-1;const b=f/2,x=IndexDatatype$1.createTypedArray(m/3,h+4);let P=0;if(x[P++]=v/3,x[P++]=(E-2)/3,p){n.push(v/3),A=cartesian1,S=cartesian2;const e=o[0];for(c=0;c<b;c++)A=Cartesian3.fromArray(e,3*(b-1-c),A),S=Cartesian3.fromArray(e,3*(b+c),S),CorridorGeometryLibrary.addAttribute(g,S,v),CorridorGeometryLibrary.addAttribute(g,A,void 0,E),y=v/3,T=y+1,_=(E-2)/3,C=_-1,x[P++]=_,x[P++]=C,x[P++]=y,x[P++]=T,v+=3,E-=3}let D=0,w=i[D++],M=i[D++];for(g.set(w,v),g.set(M,E-M.length+1),l=M.length-3,n.push(v/3,(E-2)/3),c=0;c<l;c+=3)y=v/3,T=y+1,_=(E-2)/3,C=_-1,x[P++]=_,x[P++]=C,x[P++]=y,x[P++]=T,v+=3,E-=3;for(c=0;c<r.length;c++){let e;s=r[c];const o=s.leftPositions,a=s.rightPositions;let u,d=cartesian3;if(defined(o)){for(E-=3,u=C,n.push(T),e=0;e<o.length/3;e++)d=Cartesian3.fromArray(o,3*e,d),x[P++]=u-e-1,x[P++]=u-e,CorridorGeometryLibrary.addAttribute(g,d,void 0,E),E-=3;n.push(u-Math.floor(o.length/6)),t===CornerType$1.BEVELED&&n.push((E-2)/3+1),v+=3}else{for(v+=3,u=T,n.push(C),e=0;e<a.length/3;e++)d=Cartesian3.fromArray(a,3*e,d),x[P++]=u+e,x[P++]=u+e+1,CorridorGeometryLibrary.addAttribute(g,d,v),v+=3;n.push(u+Math.floor(a.length/6)),t===CornerType$1.BEVELED&&n.push(v/3-1),E-=3}for(w=i[D++],M=i[D++],w.splice(0,3),M.splice(M.length-3,3),g.set(w,v),g.set(M,E-M.length+1),l=M.length-3,e=0;e<M.length;e+=3)T=v/3,y=T-1,C=(E-2)/3,_=C+1,x[P++]=_,x[P++]=C,x[P++]=y,x[P++]=T,v+=3,E-=3;v-=3,E+=3,n.push(v/3,(E-2)/3)}if(p){v+=3,E-=3,A=cartesian1,S=cartesian2;const e=o[1];for(c=0;c<b;c++)A=Cartesian3.fromArray(e,3*(f-c-1),A),S=Cartesian3.fromArray(e,3*c,S),CorridorGeometryLibrary.addAttribute(g,A,void 0,E),CorridorGeometryLibrary.addAttribute(g,S,v),T=v/3,y=T-1,C=(E-2)/3,_=C+1,x[P++]=_,x[P++]=C,x[P++]=y,x[P++]=T,v+=3,E-=3;n.push(v/3)}else n.push(v/3,(E-2)/3);return x[P++]=v/3,x[P++]=(E-2)/3,a.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:g}),{attributes:a,indices:x,wallIndices:n}}function computePositionsExtruded(e){const t=e.ellipsoid,n=combine(CorridorGeometryLibrary.computePositions(e),e.cornerType),i=n.wallIndices,r=e.height,o=e.extrudedHeight,a=n.attributes,s=n.indices;let c=a.position.values,l=c.length,u=new Float64Array(l);u.set(c);const d=new Float64Array(2*l);if(c=PolygonPipeline.scaleToGeodeticHeight(c,r,t),u=PolygonPipeline.scaleToGeodeticHeight(u,o,t),d.set(c),d.set(u,l),a.position.values=d,l/=3,defined(e.offsetAttribute)){let t=new Uint8Array(2*l);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)t=arrayFill(t,1,0,l);else{t=arrayFill(t,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}a.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}let h;const p=s.length,f=IndexDatatype$1.createTypedArray(d.length/3,2*(p+i.length));f.set(s);let m,g,_=p;for(h=0;h<p;h+=2){const e=s[h],t=s[h+1];f[_++]=e+l,f[_++]=t+l}for(h=0;h<i.length;h++)m=i[h],g=m+l,f[_++]=m,f[_++]=g;return{attributes:a,indices:f}}function CorridorOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.width,i=defaultValue(e.height,0),r=defaultValue(e.extrudedHeight,i);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._width=n,this._height=Math.max(i,r),this._extrudedHeight=Math.min(i,r),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+6}CorridorOutlineGeometry.pack=function(e,t,n){n=defaultValue(n,0);const i=e._positions,r=i.length;t[n++]=r;for(let e=0;e<r;++e,n+=Cartesian3.packedLength)Cartesian3.pack(i[e],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchEllipsoid$a=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$e={positions:void 0,ellipsoid:scratchEllipsoid$a,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};function createGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}let defaultTokenCredit;CorridorOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=e[t++],r=new Array(i);for(let n=0;n<i;++n,t+=Cartesian3.packedLength)r[n]=Cartesian3.unpack(e,t);const o=Ellipsoid.unpack(e,t,scratchEllipsoid$a);t+=Ellipsoid.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t];return defined(n)?(n._positions=r,n._ellipsoid=Ellipsoid.clone(o,n._ellipsoid),n._width=a,n._height=s,n._extrudedHeight=c,n._cornerType=l,n._granularity=u,n._offsetAttribute=-1===d?void 0:d,n):(scratchOptions$e.positions=r,scratchOptions$e.width=a,scratchOptions$e.height=s,scratchOptions$e.extrudedHeight=c,scratchOptions$e.cornerType=l,scratchOptions$e.granularity=u,scratchOptions$e.offsetAttribute=-1===d?void 0:d,new CorridorOutlineGeometry(scratchOptions$e))},CorridorOutlineGeometry.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=scaleToSurface(t,i);const r=arrayRemoveDuplicates(t,Cartesian3.equalsEpsilon);if(r.length<2||n<=0)return;const o=e._height,a=e._extrudedHeight,s=!CesiumMath.equalsEpsilon(o,a,0,CesiumMath.EPSILON2),c={ellipsoid:i,positions:r,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};let l;if(s)c.height=o,c.extrudedHeight=a,c.offsetAttribute=e._offsetAttribute,l=computePositionsExtruded(c);else{if(l=combine(CorridorGeometryLibrary.computePositions(c),c.cornerType),l.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,o,i),defined(e._offsetAttribute)){const t=l.attributes.position.values.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),l.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}}const u=l.attributes,d=BoundingSphere.fromVertices(u.position.values,void 0,3);return new Geometry({attributes:u,indices:l.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:d,offsetAttribute:e._offsetAttribute})};const defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1ZWY2YjM5NS1iYzkyLTQ3NmQtOTA0ZS05ZTJlZjlhNDI3YTMiLCJpZCI6MjU5LCJpYXQiOjE2NDEyMjU1OTV9.RZTTORPxWMVhucx0WEImnp40sUIpGelWkqL29UtbfwU",Ion={};function IonResource(e,t){let n;const i=e.externalType,r=defined(i);if(r){if("3DTILES"!==i&&"STK_TERRAIN_SERVER"!==i)throw new RuntimeError("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");n={url:e.options.url}}else n={url:e.url,retryAttempts:1,retryCallback:retryCallback};Resource.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=r?void 0:new URI(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=r}function retryCallback(e,t){const n=defaultValue(e._ionRoot,e),i=n._ionEndpointResource,r="undefined"!=typeof Image;return defined(t)&&(401===t.statusCode||r&&t.target instanceof Image)?(defined(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then((function(e){return n._ionEndpoint=e,e})).always((function(e){return n._pendingPromise=void 0,e}))),n._pendingPromise.then((function(t){return e._ionEndpoint=t,!0}))):when.resolve(!1)}function createWorldTerrain(e){return e=defaultValue(e,defaultValue.EMPTY_OBJECT),new CesiumTerrainProvider({url:IonResource.fromAssetId(1),requestVertexNormals:defaultValue(e.requestVertexNormals,!1),requestWaterMask:defaultValue(e.requestWaterMask,!1)})}function CullingVolume(e){this.planes=defaultValue(e,[])}Ion.defaultAccessToken=defaultAccessToken,Ion.defaultServer=new Resource({url:"https://api.cesium.com/"}),Ion.getDefaultTokenCredit=function(e){if(e===defaultAccessToken){if(!defined(defaultTokenCredit)){defaultTokenCredit=new Credit('<b> This application is using Cesium\'s default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i> with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>',!0)}return defaultTokenCredit}},defined(Object.create)&&(IonResource.prototype=Object.create(Resource.prototype),IonResource.prototype.constructor=IonResource),IonResource.fromAssetId=function(e,t){const n=IonResource._createEndpointResource(e,t);return n.fetchJson().then((function(e){return new IonResource(e,n)}))},Object.defineProperties(IonResource.prototype,{credits:{get:function(){return defined(this._ionRoot)?this._ionRoot.credits:(defined(this._credits)||(this._credits=IonResource.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource)),this._credits)}}}),IonResource.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(Credit.getIonCredit),i=Ion.getDefaultTokenCredit(t.queryParameters.access_token);return defined(i)&&n.push(Credit.clone(i)),n},IonResource.prototype.clone=function(e){const t=defaultValue(this._ionRoot,this);return defined(e)||(e=new IonResource(t._ionEndpoint,t._ionEndpointResource)),(e=Resource.prototype.clone.call(this,e))._ionRoot=t,e._isExternal=this._isExternal,e},IonResource.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},defined(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Resource.prototype.fetchImage.call(this,e)},IonResource.prototype._makeRequest=function(e){return this._isExternal||new URI(this.url).authority()!==this._ionEndpointDomain||(defined(e.headers)||(e.headers={}),e.headers.Authorization="Bearer "+this._ionEndpoint.accessToken),Resource.prototype._makeRequest.call(this,e)},IonResource._createEndpointResource=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);let n=defaultValue(t.server,Ion.defaultServer);const i=defaultValue(t.accessToken,Ion.defaultAccessToken);n=Resource.createIfNeeded(n);const r={url:"v1/assets/"+e+"/endpoint"};return defined(i)&&(r.queryParameters={access_token:i}),n.getDerivedResource(r)};const faces=[new Cartesian3,new Cartesian3,new Cartesian3];Cartesian3.clone(Cartesian3.UNIT_X,faces[0]),Cartesian3.clone(Cartesian3.UNIT_Y,faces[1]),Cartesian3.clone(Cartesian3.UNIT_Z,faces[2]);const scratchPlaneCenter=new Cartesian3,scratchPlaneNormal=new Cartesian3,scratchPlane$1=new Plane(new Cartesian3(1,0,0),0);function CustomHeightmapTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._callback=e.callback,this._tilingScheme=e.tilingScheme,defined(this._tilingScheme)||(this._tilingScheme=new GeographicTilingScheme({ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84)})),this._width=e.width,this._height=e.height;const t=Math.max(this._width,this._height);this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,t,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Event;let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this._readyPromise=when.resolve(!0)}CullingVolume.fromBoundingSphere=function(e,t){defined(t)||(t=new CullingVolume);const n=faces.length,i=t.planes;i.length=2*n;const r=e.center,o=e.radius;let a=0;for(let e=0;e<n;++e){const t=faces[e];let n=i[a],s=i[a+1];defined(n)||(n=i[a]=new Cartesian4),defined(s)||(s=i[a+1]=new Cartesian4),Cartesian3.multiplyByScalar(t,-o,scratchPlaneCenter),Cartesian3.add(r,scratchPlaneCenter,scratchPlaneCenter),n.x=t.x,n.y=t.y,n.z=t.z,n.w=-Cartesian3.dot(t,scratchPlaneCenter),Cartesian3.multiplyByScalar(t,o,scratchPlaneCenter),Cartesian3.add(r,scratchPlaneCenter,scratchPlaneCenter),s.x=-t.x,s.y=-t.y,s.z=-t.z,s.w=-Cartesian3.dot(Cartesian3.negate(t,scratchPlaneNormal),scratchPlaneCenter),a+=2}return t},CullingVolume.prototype.computeVisibility=function(e){const t=this.planes;let n=!1;for(let i=0,r=t.length;i<r;++i){const r=e.intersectPlane(Plane.fromCartesian4(t[i],scratchPlane$1));if(r===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE;r===Intersect$1.INTERSECTING&&(n=!0)}return n?Intersect$1.INTERSECTING:Intersect$1.INSIDE},CullingVolume.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===CullingVolume.MASK_OUTSIDE||t===CullingVolume.MASK_INSIDE)return t;let n=CullingVolume.MASK_INSIDE;const i=this.planes;for(let r=0,o=i.length;r<o;++r){const o=r<31?1<<r:0;if(r<31&&0==(t&o))continue;const a=e.intersectPlane(Plane.fromCartesian4(i[r],scratchPlane$1));if(a===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE;a===Intersect$1.INTERSECTING&&(n|=o)}return n},CullingVolume.MASK_OUTSIDE=4294967295,CullingVolume.MASK_INSIDE=0,CullingVolume.MASK_INDETERMINATE=2147483647,Object.defineProperties(CustomHeightmapTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),CustomHeightmapTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){const r=this._callback(e,t,n);if(!defined(r))return;const o=this._width,a=this._height;return when(r).then((function(e){let t=e;return Array.isArray(t)&&(t=new Float64Array(t)),new HeightmapTerrainData({buffer:t,width:o,height:a})}))},CustomHeightmapTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},CustomHeightmapTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){},CustomHeightmapTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){};const CylinderGeometryLibrary={computePositions:function(e,t,n,i,r){const o=.5*e,a=-o,s=i+i,c=new Float64Array(3*(r?2*s:s));let l,u=0,d=0;const h=r?3*s:0,p=r?3*(s+i):3*i;for(l=0;l<i;l++){const e=l/i*CesiumMath.TWO_PI,s=Math.cos(e),f=Math.sin(e),m=s*n,g=f*n,_=s*t,y=f*t;c[d+h]=m,c[d+h+1]=g,c[d+h+2]=a,c[d+p]=_,c[d+p+1]=y,c[d+p+2]=o,d+=3,r&&(c[u++]=m,c[u++]=g,c[u++]=a,c[u++]=_,c[u++]=y,c[u++]=o)}return c}},radiusScratch$1=new Cartesian2,normalScratch$3=new Cartesian3,bitangentScratch$1=new Cartesian3,tangentScratch$1=new Cartesian3,positionScratch$b=new Cartesian3;function CylinderGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,n=e.topRadius,i=e.bottomRadius,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),o=defaultValue(e.slices,128);this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=VertexFormat.clone(r),this._slices=o,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}CylinderGeometry.packedLength=VertexFormat.packedLength+5,CylinderGeometry.pack=function(e,t,n){return n=defaultValue(n,0),VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchVertexFormat$8=new VertexFormat,scratchOptions$d={vertexFormat:scratchVertexFormat$8,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};let unitCylinderGeometry;CylinderGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=VertexFormat.unpack(e,t,scratchVertexFormat$8);t+=VertexFormat.packedLength;const r=e[t++],o=e[t++],a=e[t++],s=e[t++],c=e[t];return defined(n)?(n._vertexFormat=VertexFormat.clone(i,n._vertexFormat),n._length=r,n._topRadius=o,n._bottomRadius=a,n._slices=s,n._offsetAttribute=-1===c?void 0:c,n):(scratchOptions$d.length=r,scratchOptions$d.topRadius=o,scratchOptions$d.bottomRadius=a,scratchOptions$d.slices=s,scratchOptions$d.offsetAttribute=-1===c?void 0:c,new CylinderGeometry(scratchOptions$d))},CylinderGeometry.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,r=e._vertexFormat,o=e._slices;if(t<=0||n<0||i<0||0===n&&0===i)return;const a=o+o,s=o+a,c=a+a,l=CylinderGeometryLibrary.computePositions(t,n,i,o,!0),u=r.st?new Float32Array(2*c):void 0,d=r.normal?new Float32Array(3*c):void 0,h=r.tangent?new Float32Array(3*c):void 0,p=r.bitangent?new Float32Array(3*c):void 0;let f;const m=r.normal||r.tangent||r.bitangent;if(m){const e=r.tangent||r.bitangent;let a=0,s=0,c=0;const l=Math.atan2(i-n,t),u=normalScratch$3;u.z=Math.sin(l);const g=Math.cos(l);let _=tangentScratch$1,y=bitangentScratch$1;for(f=0;f<o;f++){const t=f/o*CesiumMath.TWO_PI,n=g*Math.cos(t),i=g*Math.sin(t);m&&(u.x=n,u.y=i,e&&(_=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,u,_),_)),r.normal&&(d[a++]=u.x,d[a++]=u.y,d[a++]=u.z,d[a++]=u.x,d[a++]=u.y,d[a++]=u.z),r.tangent&&(h[s++]=_.x,h[s++]=_.y,h[s++]=_.z,h[s++]=_.x,h[s++]=_.y,h[s++]=_.z),r.bitangent&&(y=Cartesian3.normalize(Cartesian3.cross(u,_,y),y),p[c++]=y.x,p[c++]=y.y,p[c++]=y.z,p[c++]=y.x,p[c++]=y.y,p[c++]=y.z))}for(f=0;f<o;f++)r.normal&&(d[a++]=0,d[a++]=0,d[a++]=-1),r.tangent&&(h[s++]=1,h[s++]=0,h[s++]=0),r.bitangent&&(p[c++]=0,p[c++]=-1,p[c++]=0);for(f=0;f<o;f++)r.normal&&(d[a++]=0,d[a++]=0,d[a++]=1),r.tangent&&(h[s++]=1,h[s++]=0,h[s++]=0),r.bitangent&&(p[c++]=0,p[c++]=1,p[c++]=0)}const g=12*o-12,_=IndexDatatype$1.createTypedArray(c,g);let y=0,C=0;for(f=0;f<o-1;f++)_[y++]=C,_[y++]=C+2,_[y++]=C+3,_[y++]=C,_[y++]=C+3,_[y++]=C+1,C+=2;for(_[y++]=a-2,_[y++]=0,_[y++]=1,_[y++]=a-2,_[y++]=1,_[y++]=a-1,f=1;f<o-1;f++)_[y++]=a+f+1,_[y++]=a+f,_[y++]=a;for(f=1;f<o-1;f++)_[y++]=s,_[y++]=s+f,_[y++]=s+f+1;let T=0;if(r.st){const e=Math.max(n,i);for(f=0;f<c;f++){const t=Cartesian3.fromArray(l,3*f,positionScratch$b);u[T++]=(t.x+e)/(2*e),u[T++]=(t.y+e)/(2*e)}}const S=new GeometryAttributes;r.position&&(S.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l})),r.normal&&(S.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:d})),r.tangent&&(S.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),r.bitangent&&(S.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),r.st&&(S.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:u})),radiusScratch$1.x=.5*t,radiusScratch$1.y=Math.max(i,n);const A=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch$1));if(defined(e._offsetAttribute)){t=l.length;const n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),S.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:S,indices:_,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:A,offsetAttribute:e._offsetAttribute})},CylinderGeometry.getUnitCylinder=function(){return defined(unitCylinderGeometry)||(unitCylinderGeometry=CylinderGeometry.createGeometry(new CylinderGeometry({topRadius:1,bottomRadius:1,length:1,vertexFormat:VertexFormat.POSITION_ONLY}))),unitCylinderGeometry};const radiusScratch=new Cartesian2;function CylinderOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,n=e.topRadius,i=e.bottomRadius,r=defaultValue(e.slices,128),o=Math.max(defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=r,this._numberOfVerticalLines=o,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}CylinderOutlineGeometry.packedLength=6,CylinderOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchOptions$c={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};CylinderOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=e[t++],r=e[t++],o=e[t++],a=e[t++],s=e[t++],c=e[t];return defined(n)?(n._length=i,n._topRadius=r,n._bottomRadius=o,n._slices=a,n._numberOfVerticalLines=s,n._offsetAttribute=-1===c?void 0:c,n):(scratchOptions$c.length=i,scratchOptions$c.topRadius=r,scratchOptions$c.bottomRadius=o,scratchOptions$c.slices=a,scratchOptions$c.numberOfVerticalLines=s,scratchOptions$c.offsetAttribute=-1===c?void 0:c,new CylinderOutlineGeometry(scratchOptions$c))},CylinderOutlineGeometry.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,r=e._slices,o=e._numberOfVerticalLines;if(t<=0||n<0||i<0||0===n&&0===i)return;const a=2*r,s=CylinderGeometryLibrary.computePositions(t,n,i,r,!1);let c,l=2*r;if(o>0){const e=Math.min(o,r);c=Math.round(r/e),l+=e}const u=IndexDatatype$1.createTypedArray(a,2*l);let d,h=0;for(d=0;d<r-1;d++)u[h++]=d,u[h++]=d+1,u[h++]=d+r,u[h++]=d+1+r;if(u[h++]=r-1,u[h++]=0,u[h++]=r+r-1,u[h++]=r,o>0)for(d=0;d<r;d+=c)u[h++]=d,u[h++]=d+r;const p=new GeometryAttributes;p.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s}),radiusScratch.x=.5*t,radiusScratch.y=Math.max(i,n);const f=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch));if(defined(e._offsetAttribute)){t=s.length;const n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),p.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:p,indices:u,primitiveType:PrimitiveType$1.LINES,boundingSphere:f,offsetAttribute:e._offsetAttribute})};const compressedMagic=1953029805,compressedMagicSwap=2917034100;function decodeGoogleEarthEnterpriseData(e,t){if(decodeGoogleEarthEnterpriseData.passThroughDataForTesting)return t;const n=e.byteLength;if(0===n||n%4!=0)throw new RuntimeError("The length of key must be greater than 0 and a multiple of 4.");const i=new DataView(t),r=i.getUint32(0,!0);if(r===compressedMagic||r===compressedMagicSwap)return t;const o=new DataView(e);let a=0;const s=t.byteLength,c=s-s%8,l=n;let u,d=8;for(;a<c;)for(d=(d+8)%24,u=d;a<c&&u<l;)i.setUint32(a,i.getUint32(a,!0)^o.getUint32(u,!0),!0),i.setUint32(a+4,i.getUint32(a+4,!0)^o.getUint32(u+4,!0),!0),a+=8,u+=24;if(a<s)for(u>=l&&(d=(d+8)%24,u=d);a<s;)i.setUint8(a,i.getUint8(a)^o.getUint8(u)),a++,u++}decodeGoogleEarthEnterpriseData.passThroughDataForTesting=!1;const maxShort=32767,scratchBVCartographic$1=new Cartographic,scratchEncodedPosition=new Cartesian3;function decodeVectorPolylinePositions(e,t,n,i,r){const o=e.length/3,a=e.subarray(0,o),s=e.subarray(o,2*o),c=e.subarray(2*o,3*o);AttributeCompression.zigZagDeltaDecode(a,s,c);const l=new Float64Array(e.length);for(let e=0;e<o;++e){const o=a[e],u=s[e],d=c[e],h=CesiumMath.lerp(t.west,t.east,o/maxShort),p=CesiumMath.lerp(t.south,t.north,u/maxShort),f=CesiumMath.lerp(n,i,d/maxShort),m=Cartographic.fromRadians(h,p,f,scratchBVCartographic$1),g=r.cartographicToCartesian(m,scratchEncodedPosition);Cartesian3.pack(g,l,3*e)}return l}function DefaultProxy(e){this.proxy=e}function deprecationWarning(e,t){oneTimeWarning(e,t)}function DistanceDisplayCondition(e,t){e=defaultValue(e,0),this._near=e,t=defaultValue(t,Number.MAX_VALUE),this._far=t}function DistanceDisplayConditionGeometryInstanceAttribute(e,t){e=defaultValue(e,0),t=defaultValue(t,Number.MAX_VALUE),this.value=new Float32Array([e,t])}function DoubleEndedPriorityQueue(e){this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=defined(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}function swap$2(e,t,n){const i=e._array,r=i[t];i[t]=i[n],i[n]=r}function lessThan(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function greaterThan(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function pushUp(e,t){if(0===t)return;const n=Math.floor(CesiumMath.log2(t+1))%2==0,i=Math.floor((t-1)/2),r=lessThan(e,t,i);for(r!==n&&(swap$2(e,t,i),t=i);t>=3;){const n=Math.floor((t-3)/4);if(lessThan(e,t,n)!==r)break;swap$2(e,t,n),t=n}}function pushDown(e,t){const n=e._length,i=Math.floor(CesiumMath.log2(t+1))%2==0;let r;for(;(r=2*t+1)<n;){let o=r;const a=r+1;if(a<n){lessThan(e,a,o)===i&&(o=a);const t=2*r+1,s=Math.max(Math.min(n-t,4),0);for(let n=0;n<s;n++){const r=t+n;lessThan(e,r,o)===i&&(o=r)}}if(lessThan(e,o,t)===i&&(swap$2(e,o,t),o!==r&&o!==a)){const t=Math.floor((o-1)/2);greaterThan(e,o,t)===i&&swap$2(e,o,t)}t=o}}function DoublyLinkedList(){this.head=void 0,this.tail=void 0,this._length=0}function DoublyLinkedListNode(e,t,n){this.item=e,this.previous=t,this.next=n}function remove$2(e,t){defined(t.previous)&&defined(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):defined(t.previous)?(t.previous.next=void 0,e.tail=t.previous):defined(t.next)?(t.next.previous=void 0,e.head=t.next):(e.head=void 0,e.tail=void 0),t.next=void 0,t.previous=void 0}DefaultProxy.prototype.getURL=function(e){const t=-1===this.proxy.indexOf("?")?"?":"";return this.proxy+t+encodeURIComponent(e)},Object.defineProperties(DistanceDisplayCondition.prototype,{near:{get:function(){return this._near},set:function(e){this._near=e}},far:{get:function(){return this._far},set:function(e){this._far=e}}}),DistanceDisplayCondition.packedLength=2,DistanceDisplayCondition.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.near,t[n]=e.far,t},DistanceDisplayCondition.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new DistanceDisplayCondition),n.near=e[t++],n.far=e[t],n},DistanceDisplayCondition.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.far===t.far},DistanceDisplayCondition.clone=function(e,t){if(defined(e))return defined(t)||(t=new DistanceDisplayCondition),t.near=e.near,t.far=e.far,t},DistanceDisplayCondition.prototype.clone=function(e){return DistanceDisplayCondition.clone(this,e)},DistanceDisplayCondition.prototype.equals=function(e){return DistanceDisplayCondition.equals(this,e)},Object.defineProperties(DistanceDisplayConditionGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}}),DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition=function(e){return new DistanceDisplayConditionGeometryInstanceAttribute(e.near,e.far)},DistanceDisplayConditionGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])},Object.defineProperties(DoubleEndedPriorityQueue.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(defined(e)){for(;this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}}),DoubleEndedPriorityQueue.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,r=new DoubleEndedPriorityQueue({comparator:t,maximumLength:e});r._length=i;for(let e=0;e<i;e++)r._array[e]=n[e];return r},DoubleEndedPriorityQueue.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(defined(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0},DoubleEndedPriorityQueue.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)pushUp(this,t)},DoubleEndedPriorityQueue.prototype.insert=function(e){let t;const n=this._maximumLength;if(defined(n)){if(0===n)return;if(this._length===n){const n=this._array[0];if(this._comparator(e,n)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,pushUp(this,i),t},DoubleEndedPriorityQueue.prototype.removeMinimum=function(){const e=this._length;if(0===e)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],pushDown(this,0)),this._array[e-1]=void 0,t},DoubleEndedPriorityQueue.prototype.removeMaximum=function(){const e=this._length;if(0===e)return;let t;if(this._length--,e<=2)t=this._array[e-1];else{const n=greaterThan(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&pushDown(this,n)}return this._array[e-1]=void 0,t},DoubleEndedPriorityQueue.prototype.getMinimum=function(){if(0!==this._length)return this._array[0]},DoubleEndedPriorityQueue.prototype.getMaximum=function(){const e=this._length;if(0!==e)return e<=2?this._array[e-1]:this._array[greaterThan(this,1,2)?1:2]},Object.defineProperties(DoublyLinkedList.prototype,{length:{get:function(){return this._length}}}),DoublyLinkedList.prototype.add=function(e){const t=new DoublyLinkedListNode(e,this.tail,void 0);return defined(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t},DoublyLinkedList.prototype.remove=function(e){defined(e)&&(remove$2(this,e),--this._length)},DoublyLinkedList.prototype.splice=function(e,t){if(e===t)return;remove$2(this,t);const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e};var Tween$1=createCommonjsModule((function(e,t){var n,i=i||(n=[],{getAll:function(){return n},removeAll:function(){n=[]},add:function(e){n.push(e)},remove:function(e){var t=n.indexOf(e);-1!==t&&n.splice(t,1)},update:function(e,t){if(0===n.length)return!1;var r=0;for(e=void 0!==e?e:i.now();r<n.length;)n[r].update(e)||t?r++:n.splice(r,1);return!0}});"undefined"==typeof window&&"undefined"!=typeof process?i.now=function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?i.now=window.performance.now.bind(window.performance):void 0!==Date.now?i.now=Date.now:i.now=function(){return(new Date).getTime()},i.Tween=function(e){var t,n=e,r={},o={},a={},s=1e3,c=0,l=!1,u=!1,d=0,h=null,p=i.Easing.Linear.None,f=i.Interpolation.Linear,m=[],g=null,_=!1,y=null,C=null,T=null;this.to=function(e,t){return o=e,void 0!==t&&(s=t),this},this.start=function(e){for(var t in i.add(this),u=!0,_=!1,h=void 0!==e?e:i.now(),h+=d,o){if(o[t]instanceof Array){if(0===o[t].length)continue;o[t]=[n[t]].concat(o[t])}void 0!==n[t]&&(r[t]=n[t],r[t]instanceof Array==!1&&(r[t]*=1),a[t]=r[t]||0)}return this},this.stop=function(){return u?(i.remove(this),u=!1,null!==T&&T.call(n,n),this.stopChainedTweens(),this):this},this.end=function(){return this.update(h+s),this},this.stopChainedTweens=function(){for(var e=0,t=m.length;e<t;e++)m[e].stop()},this.delay=function(e){return d=e,this},this.repeat=function(e){return c=e,this},this.repeatDelay=function(e){return t=e,this},this.yoyo=function(e){return l=e,this},this.easing=function(e){return p=e,this},this.interpolation=function(e){return f=e,this},this.chain=function(){return m=arguments,this},this.onStart=function(e){return g=e,this},this.onUpdate=function(e){return y=e,this},this.onComplete=function(e){return C=e,this},this.onStop=function(e){return T=e,this},this.update=function(e){var i,u,T;if(e<h)return!0;for(i in!1===_&&(null!==g&&g.call(n,n),_=!0),T=p(u=(u=(e-h)/s)>1?1:u),o)if(void 0!==r[i]){var S=r[i]||0,A=o[i];A instanceof Array?n[i]=f(A,T):("string"==typeof A&&(A="+"===A.charAt(0)||"-"===A.charAt(0)?S+parseFloat(A):parseFloat(A)),"number"==typeof A&&(n[i]=S+(A-S)*T))}if(null!==y&&y.call(n,T),1===u){if(c>0){for(i in isFinite(c)&&c--,a){if("string"==typeof o[i]&&(a[i]=a[i]+parseFloat(o[i])),l){var v=a[i];a[i]=o[i],o[i]=v}r[i]=a[i]}return h=void 0!==t?e+t:e+d,!0}null!==C&&C.call(n,n);for(var E=0,b=m.length;E<b;E++)m[E].start(h+s);return!1}return!0}},i.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-i.Easing.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*i.Easing.Bounce.In(2*e):.5*i.Easing.Bounce.Out(2*e-1)+.5}}},i.Interpolation={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),a=i.Interpolation.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[n],e[n-1],n-r):a(e[o],e[o+1>n?n:o+1],r-o)},Bezier:function(e,t){for(var n=0,r=e.length-1,o=Math.pow,a=i.Interpolation.Utils.Bernstein,s=0;s<=r;s++)n+=o(1-t,r-s)*o(t,s)*e[s]*a(r,s);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),a=i.Interpolation.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(r=n*(1+t))),a(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],r-o)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[o?o-1:0],e[o],e[n<o+1?n:o+1],e[n<o+2?n:o+2],r-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=i.Interpolation.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var i=t;i>1;i--)n*=i;return e[t]=n,n}}(),CatmullRom:function(e,t,n,i,r){var o=.5*(n-e),a=.5*(i-t),s=r*r;return(2*t-2*n+o+a)*(r*s)+(-3*t+3*n-2*o-a)*s+o*r+t}}},e.exports=i}));const EasingFunction={LINEAR_NONE:Tween$1.Easing.Linear.None,QUADRATIC_IN:Tween$1.Easing.Quadratic.In,QUADRATIC_OUT:Tween$1.Easing.Quadratic.Out,QUADRATIC_IN_OUT:Tween$1.Easing.Quadratic.InOut,CUBIC_IN:Tween$1.Easing.Cubic.In,CUBIC_OUT:Tween$1.Easing.Cubic.Out,CUBIC_IN_OUT:Tween$1.Easing.Cubic.InOut,QUARTIC_IN:Tween$1.Easing.Quartic.In,QUARTIC_OUT:Tween$1.Easing.Quartic.Out,QUARTIC_IN_OUT:Tween$1.Easing.Quartic.InOut,QUINTIC_IN:Tween$1.Easing.Quintic.In,QUINTIC_OUT:Tween$1.Easing.Quintic.Out,QUINTIC_IN_OUT:Tween$1.Easing.Quintic.InOut,SINUSOIDAL_IN:Tween$1.Easing.Sinusoidal.In,SINUSOIDAL_OUT:Tween$1.Easing.Sinusoidal.Out,SINUSOIDAL_IN_OUT:Tween$1.Easing.Sinusoidal.InOut,EXPONENTIAL_IN:Tween$1.Easing.Exponential.In,EXPONENTIAL_OUT:Tween$1.Easing.Exponential.Out,EXPONENTIAL_IN_OUT:Tween$1.Easing.Exponential.InOut,CIRCULAR_IN:Tween$1.Easing.Circular.In,CIRCULAR_OUT:Tween$1.Easing.Circular.Out,CIRCULAR_IN_OUT:Tween$1.Easing.Circular.InOut,ELASTIC_IN:Tween$1.Easing.Elastic.In,ELASTIC_OUT:Tween$1.Easing.Elastic.Out,ELASTIC_IN_OUT:Tween$1.Easing.Elastic.InOut,BACK_IN:Tween$1.Easing.Back.In,BACK_OUT:Tween$1.Easing.Back.Out,BACK_IN_OUT:Tween$1.Easing.Back.InOut,BOUNCE_IN:Tween$1.Easing.Bounce.In,BOUNCE_OUT:Tween$1.Easing.Bounce.Out,BOUNCE_IN_OUT:Tween$1.Easing.Bounce.InOut};var EasingFunction$1=Object.freeze(EasingFunction);const scratchPosition$b=new Cartesian3,scratchNormal$3=new Cartesian3,scratchTangent$2=new Cartesian3,scratchBitangent$2=new Cartesian3,scratchNormalST=new Cartesian3,defaultRadii$1=new Cartesian3(1,1,1),cos$2=Math.cos,sin$2=Math.sin;function EllipsoidGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.radii,defaultRadii$1),n=defaultValue(e.innerRadii,t),i=defaultValue(e.minimumClock,0),r=defaultValue(e.maximumClock,CesiumMath.TWO_PI),o=defaultValue(e.minimumCone,0),a=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,64)),c=Math.round(defaultValue(e.slicePartitions,64)),l=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(n),this._minimumClock=i,this._maximumClock=r,this._minimumCone=o,this._maximumCone=a,this._stackPartitions=s,this._slicePartitions=c,this._vertexFormat=VertexFormat.clone(l),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}EllipsoidGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+7,EllipsoidGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._radii,t,n),n+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,n),n+=Cartesian3.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchRadii$2=new Cartesian3,scratchInnerRadii$1=new Cartesian3,scratchVertexFormat$7=new VertexFormat,scratchOptions$b={radii:scratchRadii$2,innerRadii:scratchInnerRadii$1,vertexFormat:scratchVertexFormat$7,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};let unitEllipsoidGeometry;EllipsoidGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchRadii$2);t+=Cartesian3.packedLength;const r=Cartesian3.unpack(e,t,scratchInnerRadii$1);t+=Cartesian3.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$7);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(n)?(n._radii=Cartesian3.clone(i,n._radii),n._innerRadii=Cartesian3.clone(r,n._innerRadii),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._minimumClock=a,n._maximumClock=s,n._minimumCone=c,n._maximumCone=l,n._stackPartitions=u,n._slicePartitions=d,n._offsetAttribute=-1===h?void 0:h,n):(scratchOptions$b.minimumClock=a,scratchOptions$b.maximumClock=s,scratchOptions$b.minimumCone=c,scratchOptions$b.maximumCone=l,scratchOptions$b.stackPartitions=u,scratchOptions$b.slicePartitions=d,scratchOptions$b.offsetAttribute=-1===h?void 0:h,new EllipsoidGeometry(scratchOptions$b))},EllipsoidGeometry.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,r=e._maximumClock,o=e._minimumCone,a=e._maximumCone,s=e._vertexFormat;let c,l,u=e._slicePartitions+1,d=e._stackPartitions+1;u=Math.round(u*Math.abs(r-i)/CesiumMath.TWO_PI),d=Math.round(d*Math.abs(a-o)/CesiumMath.PI),u<2&&(u=2),d<2&&(d=2);let h=0;const p=[o],f=[i];for(c=0;c<d;c++)p.push(o+c*(a-o)/(d-1));for(p.push(a),l=0;l<u;l++)f.push(i+l*(r-i)/(u-1));f.push(r);const m=p.length,g=f.length;let _=0,y=1;const C=n.x!==t.x||n.y!==t.y||n.z!==t.z;let T=!1,S=!1,A=!1;C&&(y=2,o>0&&(T=!0,_+=u-1),a<Math.PI&&(S=!0,_+=u-1),(r-i)%CesiumMath.TWO_PI?(A=!0,_+=2*(d-1)+1):_+=1);const v=g*m*y,E=new Float64Array(3*v),b=arrayFill(new Array(v),!1),x=arrayFill(new Array(v),!1),P=u*d*y,D=6*(P+_+1-(u+d)*y),w=IndexDatatype$1.createTypedArray(P,D),M=s.normal?new Float32Array(3*v):void 0,I=s.tangent?new Float32Array(3*v):void 0,R=s.bitangent?new Float32Array(3*v):void 0,O=s.st?new Float32Array(2*v):void 0,B=new Array(m),L=new Array(m);for(c=0;c<m;c++)B[c]=sin$2(p[c]),L[c]=cos$2(p[c]);const F=new Array(g),N=new Array(g);for(l=0;l<g;l++)N[l]=cos$2(f[l]),F[l]=sin$2(f[l]);for(c=0;c<m;c++)for(l=0;l<g;l++)E[h++]=t.x*B[c]*N[l],E[h++]=t.y*B[c]*F[l],E[h++]=t.z*L[c];let V,k,U,G,$=v/2;if(C)for(c=0;c<m;c++)for(l=0;l<g;l++)E[h++]=n.x*B[c]*N[l],E[h++]=n.y*B[c]*F[l],E[h++]=n.z*L[c],b[$]=!0,c>0&&c!==m-1&&0!==l&&l!==g-1&&(x[$]=!0),$++;for(h=0,c=1;c<m-2;c++)for(V=c*g,k=(c+1)*g,l=1;l<g-2;l++)w[h++]=k+l,w[h++]=k+l+1,w[h++]=V+l+1,w[h++]=k+l,w[h++]=V+l+1,w[h++]=V+l;if(C){const e=m*g;for(c=1;c<m-2;c++)for(V=e+c*g,k=e+(c+1)*g,l=1;l<g-2;l++)w[h++]=k+l,w[h++]=V+l,w[h++]=V+l+1,w[h++]=k+l,w[h++]=V+l+1,w[h++]=k+l+1}if(C){if(T)for(G=m*g,c=1;c<g-2;c++)w[h++]=c,w[h++]=c+1,w[h++]=G+c+1,w[h++]=c,w[h++]=G+c+1,w[h++]=G+c;if(S)for(U=m*g-g,G=m*g*y-g,c=1;c<g-2;c++)w[h++]=U+c+1,w[h++]=U+c,w[h++]=G+c,w[h++]=U+c+1,w[h++]=G+c,w[h++]=G+c+1}if(A){for(c=1;c<m-2;c++)G=g*m+g*c,U=g*c,w[h++]=G,w[h++]=U+g,w[h++]=U,w[h++]=G,w[h++]=G+g,w[h++]=U+g;for(c=1;c<m-2;c++)G=g*m+g*(c+1)-1,U=g*(c+1)-1,w[h++]=U+g,w[h++]=G,w[h++]=U,w[h++]=U+g,w[h++]=G+g,w[h++]=G}const z=new GeometryAttributes;s.position&&(z.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:E}));let H=0,W=0,q=0,j=0;const X=v/2;let Y;const K=Ellipsoid.fromCartesian3(t),J=Ellipsoid.fromCartesian3(n);if(s.st||s.normal||s.tangent||s.bitangent){for(c=0;c<v;c++){Y=b[c]?J:K;const e=Cartesian3.fromArray(E,3*c,scratchPosition$b),t=Y.geodeticSurfaceNormal(e,scratchNormal$3);if(x[c]&&Cartesian3.negate(t,t),s.st){const e=Cartesian2.negate(t,scratchNormalST);O[H++]=Math.atan2(e.y,e.x)/CesiumMath.TWO_PI+.5,O[H++]=Math.asin(t.z)/Math.PI+.5}if(s.normal&&(M[W++]=t.x,M[W++]=t.y,M[W++]=t.z),s.tangent||s.bitangent){const e=scratchTangent$2;let n,i=0;if(b[c]&&(i=X),n=!T&&c>=i&&c<i+2*g?Cartesian3.UNIT_X:Cartesian3.UNIT_Z,Cartesian3.cross(n,t,e),Cartesian3.normalize(e,e),s.tangent&&(I[q++]=e.x,I[q++]=e.y,I[q++]=e.z),s.bitangent){const n=Cartesian3.cross(t,e,scratchBitangent$2);Cartesian3.normalize(n,n),R[j++]=n.x,R[j++]=n.y,R[j++]=n.z}}}s.st&&(z.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:O})),s.normal&&(z.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:M})),s.tangent&&(z.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:I})),s.bitangent&&(z.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:R}))}if(defined(e._offsetAttribute)){const t=E.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),z.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:z,indices:w,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromEllipsoid(K),offsetAttribute:e._offsetAttribute})},EllipsoidGeometry.getUnitEllipsoid=function(){return defined(unitEllipsoidGeometry)||(unitEllipsoidGeometry=EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitEllipsoidGeometry};const defaultRadii=new Cartesian3(1,1,1),cos$1=Math.cos,sin$1=Math.sin;function EllipsoidOutlineGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.radii,defaultRadii),n=defaultValue(e.innerRadii,t),i=defaultValue(e.minimumClock,0),r=defaultValue(e.maximumClock,CesiumMath.TWO_PI),o=defaultValue(e.minimumCone,0),a=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,10)),c=Math.round(defaultValue(e.slicePartitions,8)),l=Math.round(defaultValue(e.subdivisions,128));this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(n),this._minimumClock=i,this._maximumClock=r,this._minimumCone=o,this._maximumCone=a,this._stackPartitions=s,this._slicePartitions=c,this._subdivisions=l,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}EllipsoidOutlineGeometry.packedLength=2*Cartesian3.packedLength+8,EllipsoidOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._radii,t,n),n+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,n),n+=Cartesian3.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchRadii$1=new Cartesian3,scratchInnerRadii=new Cartesian3,scratchOptions$a={radii:scratchRadii$1,innerRadii:scratchInnerRadii,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};function EllipsoidTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,defined(this._tilingScheme)||(this._tilingScheme=new GeographicTilingScheme({ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84)})),this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Event,this._readyPromise=when.resolve(!0)}function EventHelper(){this._removalFunctions=[]}EllipsoidOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t,scratchRadii$1);t+=Cartesian3.packedLength;const r=Cartesian3.unpack(e,t,scratchInnerRadii);t+=Cartesian3.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(n)?(n._radii=Cartesian3.clone(i,n._radii),n._innerRadii=Cartesian3.clone(r,n._innerRadii),n._minimumClock=o,n._maximumClock=a,n._minimumCone=s,n._maximumCone=c,n._stackPartitions=l,n._slicePartitions=u,n._subdivisions=d,n._offsetAttribute=-1===h?void 0:h,n):(scratchOptions$a.minimumClock=o,scratchOptions$a.maximumClock=a,scratchOptions$a.minimumCone=s,scratchOptions$a.maximumCone=c,scratchOptions$a.stackPartitions=l,scratchOptions$a.slicePartitions=u,scratchOptions$a.subdivisions=d,scratchOptions$a.offsetAttribute=-1===h?void 0:h,new EllipsoidOutlineGeometry(scratchOptions$a))},EllipsoidOutlineGeometry.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,r=e._maximumClock,o=e._minimumCone,a=e._maximumCone,s=e._subdivisions,c=Ellipsoid.fromCartesian3(t);let l=e._slicePartitions+1,u=e._stackPartitions+1;l=Math.round(l*Math.abs(r-i)/CesiumMath.TWO_PI),u=Math.round(u*Math.abs(a-o)/CesiumMath.PI),l<2&&(l=2),u<2&&(u=2);let d=0,h=1;const p=n.x!==t.x||n.y!==t.y||n.z!==t.z;let f=!1,m=!1;p&&(h=2,o>0&&(f=!0,d+=l),a<Math.PI&&(m=!0,d+=l));const g=s*h*(u+l),_=new Float64Array(3*g),y=2*(g+d-(l+u)*h),C=IndexDatatype$1.createTypedArray(g,y);let T,S,A,v,E=0;const b=new Array(u),x=new Array(u);for(T=0;T<u;T++)v=o+T*(a-o)/(u-1),b[T]=sin$1(v),x[T]=cos$1(v);const P=new Array(s),D=new Array(s);for(T=0;T<s;T++)A=i+T*(r-i)/(s-1),P[T]=sin$1(A),D[T]=cos$1(A);for(T=0;T<u;T++)for(S=0;S<s;S++)_[E++]=t.x*b[T]*D[S],_[E++]=t.y*b[T]*P[S],_[E++]=t.z*x[T];if(p)for(T=0;T<u;T++)for(S=0;S<s;S++)_[E++]=n.x*b[T]*D[S],_[E++]=n.y*b[T]*P[S],_[E++]=n.z*x[T];for(b.length=s,x.length=s,T=0;T<s;T++)v=o+T*(a-o)/(s-1),b[T]=sin$1(v),x[T]=cos$1(v);for(P.length=l,D.length=l,T=0;T<l;T++)A=i+T*(r-i)/(l-1),P[T]=sin$1(A),D[T]=cos$1(A);for(T=0;T<s;T++)for(S=0;S<l;S++)_[E++]=t.x*b[T]*D[S],_[E++]=t.y*b[T]*P[S],_[E++]=t.z*x[T];if(p)for(T=0;T<s;T++)for(S=0;S<l;S++)_[E++]=n.x*b[T]*D[S],_[E++]=n.y*b[T]*P[S],_[E++]=n.z*x[T];for(E=0,T=0;T<u*h;T++){const e=T*s;for(S=0;S<s-1;S++)C[E++]=e+S,C[E++]=e+S+1}let w=u*s*h;for(T=0;T<l;T++)for(S=0;S<s-1;S++)C[E++]=w+T+S*l,C[E++]=w+T+(S+1)*l;if(p)for(w=u*s*h+l*s,T=0;T<l;T++)for(S=0;S<s-1;S++)C[E++]=w+T+S*l,C[E++]=w+T+(S+1)*l;if(p){let e=u*s*h,t=e+s*l;if(f)for(T=0;T<l;T++)C[E++]=e+T,C[E++]=t+T;if(m)for(e+=s*l-l,t+=s*l-l,T=0;T<l;T++)C[E++]=e+T,C[E++]=t+T}const M=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:_})});if(defined(e._offsetAttribute)){const t=_.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),M.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new Geometry({attributes:M,indices:C,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})},Object.defineProperties(EllipsoidTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),EllipsoidTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}))},EllipsoidTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},EllipsoidTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){},EllipsoidTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){},EventHelper.prototype.add=function(e,t,n){const i=e.addEventListener(t,n);this._removalFunctions.push(i);const r=this;return function(){i();const e=r._removalFunctions;e.splice(e.indexOf(i),1)}},EventHelper.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};const ExperimentalFeatures={enableModelExperimental:!1},ExtrapolationType={NONE:0,HOLD:1,EXTRAPOLATE:2};var ExtrapolationType$1=Object.freeze(ExtrapolationType);function OrthographicOffCenterFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._orthographicMatrix=new Matrix4}function update$5(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=Matrix4.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}Object.defineProperties(OrthographicOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update$5(this),this._orthographicMatrix}}});const getPlanesRight$1=new Cartesian3,getPlanesNearCenter$1=new Cartesian3,getPlanesPoint=new Cartesian3,negateScratch=new Cartesian3;function OrthographicFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new OrthographicOffCenterFrustum,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far}function update$4(e){const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const n=1/e.aspectRatio;t.right=.5*e.width,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}function PerspectiveOffCenterFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._perspectiveMatrix=new Matrix4,this._infinitePerspective=new Matrix4}function update$3(e){const t=e.top,n=e.bottom,i=e.right,r=e.left,o=e.near,a=e.far;t===e._top&&n===e._bottom&&r===e._left&&i===e._right&&o===e._near&&a===e._far||(e._left=r,e._right=i,e._top=t,e._bottom=n,e._near=o,e._far=a,e._perspectiveMatrix=Matrix4.computePerspectiveOffCenter(r,i,n,t,o,a,e._perspectiveMatrix),e._infinitePerspective=Matrix4.computeInfinitePerspectiveOffCenter(r,i,n,t,o,e._infinitePerspective))}OrthographicOffCenterFrustum.prototype.computeCullingVolume=function(e,t,n){const i=this._cullingVolume.planes,r=this.top,o=this.bottom,a=this.right,s=this.left,c=this.near,l=this.far,u=Cartesian3.cross(t,n,getPlanesRight$1);Cartesian3.normalize(u,u);const d=getPlanesNearCenter$1;Cartesian3.multiplyByScalar(t,c,d),Cartesian3.add(e,d,d);const h=getPlanesPoint;Cartesian3.multiplyByScalar(u,s,h),Cartesian3.add(d,h,h);let p=i[0];return defined(p)||(p=i[0]=new Cartesian4),p.x=u.x,p.y=u.y,p.z=u.z,p.w=-Cartesian3.dot(u,h),Cartesian3.multiplyByScalar(u,a,h),Cartesian3.add(d,h,h),p=i[1],defined(p)||(p=i[1]=new Cartesian4),p.x=-u.x,p.y=-u.y,p.z=-u.z,p.w=-Cartesian3.dot(Cartesian3.negate(u,negateScratch),h),Cartesian3.multiplyByScalar(n,o,h),Cartesian3.add(d,h,h),p=i[2],defined(p)||(p=i[2]=new Cartesian4),p.x=n.x,p.y=n.y,p.z=n.z,p.w=-Cartesian3.dot(n,h),Cartesian3.multiplyByScalar(n,r,h),Cartesian3.add(d,h,h),p=i[3],defined(p)||(p=i[3]=new Cartesian4),p.x=-n.x,p.y=-n.y,p.z=-n.z,p.w=-Cartesian3.dot(Cartesian3.negate(n,negateScratch),h),p=i[4],defined(p)||(p=i[4]=new Cartesian4),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-Cartesian3.dot(t,d),Cartesian3.multiplyByScalar(t,l,h),Cartesian3.add(e,h,h),p=i[5],defined(p)||(p=i[5]=new Cartesian4),p.x=-t.x,p.y=-t.y,p.z=-t.z,p.w=-Cartesian3.dot(Cartesian3.negate(t,negateScratch),h),this._cullingVolume},OrthographicOffCenterFrustum.prototype.getPixelDimensions=function(e,t,n,i,r){update$5(this);const o=i*(this.right-this.left)/e,a=i*(this.top-this.bottom)/t;return r.x=o,r.y=a,r},OrthographicOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicOffCenterFrustum),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},OrthographicOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof OrthographicOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},OrthographicOffCenterFrustum.prototype.equalsEpsilon=function(e,t,n){return e===this||defined(e)&&e instanceof OrthographicOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,n)&&CesiumMath.equalsEpsilon(this.left,e.left,t,n)&&CesiumMath.equalsEpsilon(this.top,e.top,t,n)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,n)&&CesiumMath.equalsEpsilon(this.near,e.near,t,n)&&CesiumMath.equalsEpsilon(this.far,e.far,t,n)},OrthographicFrustum.packedLength=4,OrthographicFrustum.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t},OrthographicFrustum.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new OrthographicFrustum),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n},Object.defineProperties(OrthographicFrustum.prototype,{projectionMatrix:{get:function(){return update$4(this),this._offCenterFrustum.projectionMatrix}}}),OrthographicFrustum.prototype.computeCullingVolume=function(e,t,n){return update$4(this),this._offCenterFrustum.computeCullingVolume(e,t,n)},OrthographicFrustum.prototype.getPixelDimensions=function(e,t,n,i,r){return update$4(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,r)},OrthographicFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicFrustum),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e},OrthographicFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$4(this),update$4(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},OrthographicFrustum.prototype.equalsEpsilon=function(e,t,n){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$4(this),update$4(e),CesiumMath.equalsEpsilon(this.width,e.width,t,n)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))},Object.defineProperties(PerspectiveOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update$3(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return update$3(this),this._infinitePerspective}}});const getPlanesRight=new Cartesian3,getPlanesNearCenter=new Cartesian3,getPlanesFarCenter=new Cartesian3,getPlanesNormal=new Cartesian3;function PerspectiveFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new PerspectiveOffCenterFrustum,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this.xOffset=defaultValue(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=defaultValue(e.yOffset,0),this._yOffset=this.yOffset}function update$2(e){const 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)}PerspectiveOffCenterFrustum.prototype.computeCullingVolume=function(e,t,n){const i=this._cullingVolume.planes,r=this.top,o=this.bottom,a=this.right,s=this.left,c=this.near,l=this.far,u=Cartesian3.cross(t,n,getPlanesRight),d=getPlanesNearCenter;Cartesian3.multiplyByScalar(t,c,d),Cartesian3.add(e,d,d);const h=getPlanesFarCenter;Cartesian3.multiplyByScalar(t,l,h),Cartesian3.add(e,h,h);const p=getPlanesNormal;Cartesian3.multiplyByScalar(u,s,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.normalize(p,p),Cartesian3.cross(p,n,p),Cartesian3.normalize(p,p);let f=i[0];return defined(f)||(f=i[0]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(u,a,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(n,p,p),Cartesian3.normalize(p,p),f=i[1],defined(f)||(f=i[1]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(n,o,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(u,p,p),Cartesian3.normalize(p,p),f=i[2],defined(f)||(f=i[2]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(n,r,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(p,u,p),Cartesian3.normalize(p,p),f=i[3],defined(f)||(f=i[3]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,e),f=i[4],defined(f)||(f=i[4]=new Cartesian4),f.x=t.x,f.y=t.y,f.z=t.z,f.w=-Cartesian3.dot(t,d),Cartesian3.negate(t,p),f=i[5],defined(f)||(f=i[5]=new Cartesian4),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-Cartesian3.dot(p,h),this._cullingVolume},PerspectiveOffCenterFrustum.prototype.getPixelDimensions=function(e,t,n,i,r){update$3(this);const o=1/this.near;let a=this.top*o;const s=2*i*n*a/t;a=this.right*o;const c=2*i*n*a/e;return r.x=c,r.y=s,r},PerspectiveOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveOffCenterFrustum),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},PerspectiveOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof PerspectiveOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},PerspectiveOffCenterFrustum.prototype.equalsEpsilon=function(e,t,n){return e===this||defined(e)&&e instanceof PerspectiveOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,n)&&CesiumMath.equalsEpsilon(this.left,e.left,t,n)&&CesiumMath.equalsEpsilon(this.top,e.top,t,n)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,n)&&CesiumMath.equalsEpsilon(this.near,e.near,t,n)&&CesiumMath.equalsEpsilon(this.far,e.far,t,n)},PerspectiveFrustum.packedLength=6,PerspectiveFrustum.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.fov,t[n++]=e.aspectRatio,t[n++]=e.near,t[n++]=e.far,t[n++]=e.xOffset,t[n]=e.yOffset,t},PerspectiveFrustum.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new PerspectiveFrustum),n.fov=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t++],n.xOffset=e[t++],n.yOffset=e[t],n},Object.defineProperties(PerspectiveFrustum.prototype,{projectionMatrix:{get:function(){return update$2(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return update$2(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return update$2(this),this._fovy}},sseDenominator:{get:function(){return update$2(this),this._sseDenominator}}}),PerspectiveFrustum.prototype.computeCullingVolume=function(e,t,n){return update$2(this),this._offCenterFrustum.computeCullingVolume(e,t,n)},PerspectiveFrustum.prototype.getPixelDimensions=function(e,t,n,i,r){return update$2(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,r)},PerspectiveFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveFrustum),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e},PerspectiveFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$2(this),update$2(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},PerspectiveFrustum.prototype.equalsEpsilon=function(e,t,n){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$2(this),update$2(e),CesiumMath.equalsEpsilon(this.fov,e.fov,t,n)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const PERSPECTIVE$1=0,ORTHOGRAPHIC$1=1;function FrustumGeometry(e){const t=e.frustum,n=e.orientation,i=e.origin,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),o=defaultValue(e._drawNearPlane,!0);let a,s;t instanceof PerspectiveFrustum?(a=PERSPECTIVE$1,s=PerspectiveFrustum.packedLength):t instanceof OrthographicFrustum&&(a=ORTHOGRAPHIC$1,s=OrthographicFrustum.packedLength),this._frustumType=a,this._frustum=t.clone(),this._origin=Cartesian3.clone(i),this._orientation=Quaternion.clone(n),this._drawNearPlane=o,this._vertexFormat=r,this._workerName="createFrustumGeometry",this.packedLength=2+s+Cartesian3.packedLength+Quaternion.packedLength+VertexFormat.packedLength}FrustumGeometry.pack=function(e,t,n){n=defaultValue(n,0);const i=e._frustumType,r=e._frustum;return t[n++]=i,i===PERSPECTIVE$1?(PerspectiveFrustum.pack(r,t,n),n+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(r,t,n),n+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,n),n+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,n),n+=Quaternion.packedLength,VertexFormat.pack(e._vertexFormat,t,n),t[n+=VertexFormat.packedLength]=e._drawNearPlane?1:0,t};const scratchPackPerspective$1=new PerspectiveFrustum,scratchPackOrthographic$1=new OrthographicFrustum,scratchPackQuaternion$1=new Quaternion,scratchPackorigin$1=new Cartesian3,scratchVertexFormat$6=new VertexFormat;function getAttributes(e,t,n,i,r,o,a,s){const c=e/3*2;for(let r=0;r<4;++r)defined(t)&&(t[e]=o.x,t[e+1]=o.y,t[e+2]=o.z),defined(n)&&(n[e]=a.x,n[e+1]=a.y,n[e+2]=a.z),defined(i)&&(i[e]=s.x,i[e+1]=s.y,i[e+2]=s.z),e+=3;r[c]=0,r[c+1]=0,r[c+2]=1,r[c+3]=0,r[c+4]=1,r[c+5]=1,r[c+6]=0,r[c+7]=1}FrustumGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=e[t++];let r;i===PERSPECTIVE$1?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective$1),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic$1),t+=OrthographicFrustum.packedLength);const o=Cartesian3.unpack(e,t,scratchPackorigin$1);t+=Cartesian3.packedLength;const a=Quaternion.unpack(e,t,scratchPackQuaternion$1);t+=Quaternion.packedLength;const s=VertexFormat.unpack(e,t,scratchVertexFormat$6),c=1===e[t+=VertexFormat.packedLength];if(!defined(n))return new FrustumGeometry({frustum:r,origin:o,orientation:a,vertexFormat:s,_drawNearPlane:c});const l=i===n._frustumType?n._frustum:void 0;return n._frustum=r.clone(l),n._frustumType=i,n._origin=Cartesian3.clone(o,n._origin),n._orientation=Quaternion.clone(a,n._orientation),n._vertexFormat=VertexFormat.clone(s,n._vertexFormat),n._drawNearPlane=c,n};const scratchRotationMatrix=new Matrix3,scratchViewMatrix=new Matrix4,scratchInverseMatrix=new Matrix4,scratchXDirection=new Cartesian3,scratchYDirection=new Cartesian3,scratchZDirection=new Cartesian3,scratchNegativeX=new Cartesian3,scratchNegativeY=new Cartesian3,scratchNegativeZ=new Cartesian3,frustumSplits=new Array(3),frustumCornersNDC$1=new Array(4);frustumCornersNDC$1[0]=new Cartesian4(-1,-1,1,1),frustumCornersNDC$1[1]=new Cartesian4(1,-1,1,1),frustumCornersNDC$1[2]=new Cartesian4(1,1,1,1),frustumCornersNDC$1[3]=new Cartesian4(-1,1,1,1);const scratchFrustumCorners$1=new Array(4);for(let e=0;e<4;++e)scratchFrustumCorners$1[e]=new Cartesian4;FrustumGeometry._computeNearFarPlanes=function(e,t,n,i,r,o,a,s){const c=Matrix3.fromQuaternion(t,scratchRotationMatrix);let l=defaultValue(o,scratchXDirection),u=defaultValue(a,scratchYDirection),d=defaultValue(s,scratchZDirection);l=Matrix3.getColumn(c,0,l),u=Matrix3.getColumn(c,1,u),d=Matrix3.getColumn(c,2,d),Cartesian3.normalize(l,l),Cartesian3.normalize(u,u),Cartesian3.normalize(d,d),Cartesian3.negate(l,l);const h=Matrix4.computeView(e,d,u,l,scratchViewMatrix);let p,f;if(n===PERSPECTIVE$1){const e=i.projectionMatrix,t=Matrix4.multiply(e,h,scratchInverseMatrix);f=Matrix4.inverse(t,scratchInverseMatrix)}else p=Matrix4.inverseTransformation(h,scratchInverseMatrix);defined(f)?(frustumSplits[0]=i.near,frustumSplits[1]=i.far):(frustumSplits[0]=0,frustumSplits[1]=i.near,frustumSplits[2]=i.far);for(let t=0;t<2;++t)for(let n=0;n<4;++n){let o=Cartesian4.clone(frustumCornersNDC$1[n],scratchFrustumCorners$1[n]);if(defined(f)){o=Matrix4.multiplyByVector(f,o,o);const n=1/o.w;Cartesian3.multiplyByScalar(o,n,o),Cartesian3.subtract(o,e,o),Cartesian3.normalize(o,o);const i=Cartesian3.dot(d,o);Cartesian3.multiplyByScalar(o,frustumSplits[t]/i,o),Cartesian3.add(o,e,o)}else{defined(i._offCenterFrustum)&&(i=i._offCenterFrustum);const e=frustumSplits[t],n=frustumSplits[t+1];o.x=.5*(o.x*(i.right-i.left)+i.left+i.right),o.y=.5*(o.y*(i.top-i.bottom)+i.bottom+i.top),o.z=.5*(o.z*(e-n)-e-n),o.w=1,Matrix4.multiplyByVector(p,o,o)}r[12*t+3*n]=o.x,r[12*t+3*n+1]=o.y,r[12*t+3*n+2]=o.z}},FrustumGeometry.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,r=e._orientation,o=e._drawNearPlane,a=e._vertexFormat,s=o?6:5;let c=new Float64Array(72);FrustumGeometry._computeNearFarPlanes(i,r,t,n,c);let l=24;c[l]=c[12],c[l+1]=c[13],c[l+2]=c[14],c[l+3]=c[0],c[l+4]=c[1],c[l+5]=c[2],c[l+6]=c[9],c[l+7]=c[10],c[l+8]=c[11],c[l+9]=c[21],c[l+10]=c[22],c[l+11]=c[23],l+=12,c[l]=c[15],c[l+1]=c[16],c[l+2]=c[17],c[l+3]=c[3],c[l+4]=c[4],c[l+5]=c[5],c[l+6]=c[0],c[l+7]=c[1],c[l+8]=c[2],c[l+9]=c[12],c[l+10]=c[13],c[l+11]=c[14],l+=12,c[l]=c[3],c[l+1]=c[4],c[l+2]=c[5],c[l+3]=c[15],c[l+4]=c[16],c[l+5]=c[17],c[l+6]=c[18],c[l+7]=c[19],c[l+8]=c[20],c[l+9]=c[6],c[l+10]=c[7],c[l+11]=c[8],l+=12,c[l]=c[6],c[l+1]=c[7],c[l+2]=c[8],c[l+3]=c[18],c[l+4]=c[19],c[l+5]=c[20],c[l+6]=c[21],c[l+7]=c[22],c[l+8]=c[23],c[l+9]=c[9],c[l+10]=c[10],c[l+11]=c[11],o||(c=c.subarray(12));const u=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:c})});if(defined(a.normal)||defined(a.tangent)||defined(a.bitangent)||defined(a.st)){const e=defined(a.normal)?new Float32Array(12*s):void 0,t=defined(a.tangent)?new Float32Array(12*s):void 0,n=defined(a.bitangent)?new Float32Array(12*s):void 0,i=defined(a.st)?new Float32Array(8*s):void 0,r=scratchXDirection,c=scratchYDirection,d=scratchZDirection,h=Cartesian3.negate(r,scratchNegativeX),p=Cartesian3.negate(c,scratchNegativeY),f=Cartesian3.negate(d,scratchNegativeZ);l=0,o&&(getAttributes(l,e,t,n,i,f,r,c),l+=12),getAttributes(l,e,t,n,i,d,h,c),l+=12,getAttributes(l,e,t,n,i,h,f,c),l+=12,getAttributes(l,e,t,n,i,p,f,h),l+=12,getAttributes(l,e,t,n,i,r,d,c),l+=12,getAttributes(l,e,t,n,i,c,d,h),defined(e)&&(u.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})),defined(t)&&(u.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t})),defined(n)&&(u.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:n})),defined(i)&&(u.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:i}))}const d=new Uint16Array(6*s);for(let e=0;e<s;++e){const t=6*e,n=4*e;d[t]=n,d[t+1]=n+1,d[t+2]=n+2,d[t+3]=n,d[t+4]=n+2,d[t+5]=n+3}return new Geometry({attributes:u,indices:d,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromVertices(c)})};const PERSPECTIVE=0,ORTHOGRAPHIC=1;function FrustumOutlineGeometry(e){const t=e.frustum,n=e.orientation,i=e.origin,r=defaultValue(e._drawNearPlane,!0);let o,a;t instanceof PerspectiveFrustum?(o=PERSPECTIVE,a=PerspectiveFrustum.packedLength):t instanceof OrthographicFrustum&&(o=ORTHOGRAPHIC,a=OrthographicFrustum.packedLength),this._frustumType=o,this._frustum=t.clone(),this._origin=Cartesian3.clone(i),this._orientation=Quaternion.clone(n),this._drawNearPlane=r,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+a+Cartesian3.packedLength+Quaternion.packedLength}FrustumOutlineGeometry.pack=function(e,t,n){n=defaultValue(n,0);const i=e._frustumType,r=e._frustum;return t[n++]=i,i===PERSPECTIVE?(PerspectiveFrustum.pack(r,t,n),n+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(r,t,n),n+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,n),n+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,n),t[n+=Quaternion.packedLength]=e._drawNearPlane?1:0,t};const scratchPackPerspective=new PerspectiveFrustum,scratchPackOrthographic=new OrthographicFrustum,scratchPackQuaternion=new Quaternion,scratchPackorigin=new Cartesian3;function GeocoderService(){}FrustumOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=e[t++];let r;i===PERSPECTIVE?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic),t+=OrthographicFrustum.packedLength);const o=Cartesian3.unpack(e,t,scratchPackorigin);t+=Cartesian3.packedLength;const a=Quaternion.unpack(e,t,scratchPackQuaternion),s=1===e[t+=Quaternion.packedLength];if(!defined(n))return new FrustumOutlineGeometry({frustum:r,origin:o,orientation:a,_drawNearPlane:s});const c=i===n._frustumType?n._frustum:void 0;return n._frustum=r.clone(c),n._frustumType=i,n._origin=Cartesian3.clone(o,n._origin),n._orientation=Quaternion.clone(a,n._orientation),n._drawNearPlane=s,n},FrustumOutlineGeometry.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,r=e._orientation,o=e._drawNearPlane,a=new Float64Array(24);FrustumGeometry._computeNearFarPlanes(i,r,t,n,a);const s=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})});let c,l;const u=o?2:1,d=new Uint16Array(8*(u+1));let h=o?0:1;for(;h<2;++h)c=o?8*h:0,l=4*h,d[c]=l,d[c+1]=l+1,d[c+2]=l+1,d[c+3]=l+2,d[c+4]=l+2,d[c+5]=l+3,d[c+6]=l+3,d[c+7]=l;for(h=0;h<2;++h)c=8*(u+h),l=4*h,d[c]=l,d[c+1]=l+4,d[c+2]=l+1,d[c+3]=l+5,d[c+4]=l+2,d[c+5]=l+6,d[c+6]=l+3,d[c+7]=l+7;return new Geometry({attributes:s,indices:d,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromVertices(a)})},GeocoderService.prototype.geocode=DeveloperError.throwInstantiationError;const GeocodeType={SEARCH:0,AUTOCOMPLETE:1};var GeocodeType$1=Object.freeze(GeocodeType);function GeometryFactory(){DeveloperError.throwInstantiationError()}function GeometryInstanceAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.value=e.value}function getFilenameFromUri(e){const t=new URI(e);t.normalize();let n=t.path();const i=n.lastIndexOf("/");return-1!==i&&(n=n.substr(i+1)),n}GeometryFactory.createGeometry=function(e){DeveloperError.throwInstantiationError()};const context2DsByWidthAndHeight={};function getImagePixels(e,t,n){defined(t)||(t=e.width),defined(n)||(n=e.height);let i=context2DsByWidthAndHeight[t];defined(i)||(i={},context2DsByWidthAndHeight[t]=i);let r=i[n];if(!defined(r)){const e=document.createElement("canvas");e.width=t,e.height=n,r=e.getContext("2d"),r.globalCompositeOperation="copy",i[n]=r}return r.drawImage(e,0,0,t,n),r.getImageData(0,0,t,n).data}function getMagic(e,t){return getStringFromTypedArray(e,t=defaultValue(t,0),Math.min(4,e.length))}function _mergeNamespaces$1(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var protobuf=createCommonjsModule((function(module){
/*!
* protobuf.js v6.7.0 (c) 2016, Daniel Wirtz
* Compiled Sun, 02 Apr 2017 11:28:29 UTC
* Licensed under the BSD-3-Clause License
* see: https://github.com/dcodeIO/protobuf.js for details
*/
(function(global,undefined$1){!function(e,t,n){var i=global.protobuf=function n(i){var r=t[i];return r||e[i][0].call(r=t[i]={exports:{}},n,r,r.exports),r.exports}(n[0]);"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(i.util.Long=e,i.configure()),i})),module&&module.exports&&(module.exports=i)}({1:[function(e,t,n){t.exports=function(e,t){for(var n=[],i=2;i<arguments.length;)n.push(arguments[i++]);var r=!0;return new Promise((function(i,o){n.push((function(e){if(r)if(r=!1,e)o(e);else{for(var t=[],n=1;n<arguments.length;)t.push(arguments[n++]);i.apply(null,t)}}));try{e.apply(t||this,n)}catch(e){r&&(r=!1,o(e))}}))}},{}],2:[function(e,t,n){var i=n;i.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),o=new Array(123),a=0;a<64;)o[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(e,t,n){for(var i,o=[],a=0,s=0;t<n;){var c=e[t++];switch(s){case 0:o[a++]=r[c>>2],i=(3&c)<<4,s=1;break;case 1:o[a++]=r[i|c>>4],i=(15&c)<<2,s=2;break;case 2:o[a++]=r[i|c>>6],o[a++]=r[63&c],s=0}}return s&&(o[a++]=r[i],o[a]=61,1===s&&(o[a+1]=61)),String.fromCharCode.apply(String,o)};var s="invalid encoding";i.decode=function(e,t,n){for(var i,r=n,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if((l=o[l])===undefined$1)throw Error(s);switch(a){case 0:i=l,a=1;break;case 1:t[n++]=i<<2|(48&l)>>4,i=l,a=2;break;case 2:t[n++]=(15&i)<<4|(60&l)>>2,i=l,a=3;break;case 3:t[n++]=(3&i)<<6|l,a=0}}if(1===a)throw Error(s);return n-r},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,n){function i(){this._listeners={}}t.exports=i,i.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},i.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this},i.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}},{}],4:[function(e,t,n){function i(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),i=128===n[3];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3]}function o(e,i,r){t[0]=e,i[r]=n[3],i[r+1]=n[2],i[r+2]=n[1],i[r+3]=n[0]}function a(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],t[0]}function s(e,i){return n[3]=e[i],n[2]=e[i+1],n[1]=e[i+2],n[0]=e[i+3],t[0]}e.writeFloatLE=i?r:o,e.writeFloatBE=i?o:r,e.readFloatLE=i?a:s,e.readFloatBE=i?s:a}():function(){function t(e,t,n,i){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,n,i);else if(isNaN(t))e(2143289344,n,i);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,n,i);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,n,i);else{var o=Math.floor(Math.log(t)/Math.LN2);e((r<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,i)}}function n(e,t,n){var i=e(t,n),r=2*(i>>31)+1,o=i>>>23&255,a=8388607&i;return 255===o?a?NaN:r*(1/0):0===o?1401298464324817e-60*r*a:r*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,o),e.readFloatLE=n.bind(null,a),e.readFloatBE=n.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),i=128===n[7];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3],i[r+4]=n[4],i[r+5]=n[5],i[r+6]=n[6],i[r+7]=n[7]}function o(e,i,r){t[0]=e,i[r]=n[7],i[r+1]=n[6],i[r+2]=n[5],i[r+3]=n[4],i[r+4]=n[3],i[r+5]=n[2],i[r+6]=n[1],i[r+7]=n[0]}function a(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],n[4]=e[i+4],n[5]=e[i+5],n[6]=e[i+6],n[7]=e[i+7],t[0]}function s(e,i){return n[7]=e[i],n[6]=e[i+1],n[5]=e[i+2],n[4]=e[i+3],n[3]=e[i+4],n[2]=e[i+5],n[1]=e[i+6],n[0]=e[i+7],t[0]}e.writeDoubleLE=i?r:o,e.writeDoubleBE=i?o:r,e.readDoubleLE=i?a:s,e.readDoubleBE=i?s:a}():function(){function t(e,t,n,i,r,o){var a=i<0?1:0;if(a&&(i=-i),0===i)e(0,r,o+t),e(1/i>0?0:2147483648,r,o+n);else if(isNaN(i))e(0,r,o+t),e(2146959360,r,o+n);else if(i>17976931348623157e292)e(0,r,o+t),e((a<<31|2146435072)>>>0,r,o+n);else{var s;if(i<22250738585072014e-324)e((s=i/5e-324)>>>0,r,o+t),e((a<<31|s/4294967296)>>>0,r,o+n);else{var c=Math.floor(Math.log(i)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=i*Math.pow(2,-c))>>>0,r,o+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,r,o+n)}}}function n(e,t,n,i,r){var o=e(i,r+t),a=e(i,r+n),s=2*(a>>31)+1,c=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===c?l?NaN:s*(1/0):0===c?5e-324*s*l:s*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=n.bind(null,a,0,4),e.readDoubleBE=n.bind(null,s,4,0)}(),e}function r(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function o(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function a(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=i(i)},{}],5:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],6:[function(e,t,n){t.exports=function(e,t,n){var i=n||8192,r=i>>>1,o=null,a=i;return function(n){if(n<1||n>r)return e(n);a+n>i&&(o=e(i),a=0);var s=t.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}},{}],7:[function(e,t,n){var i=n;i.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},i.read=function(e,t,n){if(n-t<1)return"";for(var i,r=null,o=[],a=0;t<n;)(i=e[t++])<128?o[a++]=i:i>191&&i<224?o[a++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(i>>10),o[a++]=56320+(1023&i)):o[a++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))},i.write=function(e,t,n){for(var i,r,o=n,a=0;a<e.length;++a)(i=e.charCodeAt(a))<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&56320==(64512&(r=e.charCodeAt(a+1)))?(i=65536+((1023&i)<<10)+(1023&r),++a,t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128);return n-o}},{}],8:[function(e,t,n){var i=n;function r(){i.Reader._configure(i.BufferReader),i.util._configure()}i.build="minimal",i.roots={},i.Writer=e(15),i.BufferWriter=e(16),i.Reader=e(9),i.BufferReader=e(10),i.util=e(14),i.rpc=e(11),i.configure=r,i.Writer._configure(i.BufferWriter),r()},{10:10,11:11,14:14,15:15,16:16,9:9}],9:[function(e,t,n){t.exports=c;var i,r=e(14),o=r.LongBits,a=r.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")};function d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new o(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}c.create=r.Buffer?function(e){return(c.create=function(e){return r.Buffer.isBuffer(e)?new i(e):u(e)})(e)}:u,c.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw s(this,e);return this.pos+=e,t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},c.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){i=e;var t=r.Long?"toLong":"toNumber";r.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},{14:14}],10:[function(e,t,n){t.exports=o;var i=e(9);(o.prototype=Object.create(i.prototype)).constructor=o;var r=e(14);function o(e){i.call(this,e)}r.Buffer&&(o.prototype._slice=r.Buffer.prototype.slice),o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{14:14,9:9}],11:[function(e,t,n){n.Service=e(12)},{12:12}],12:[function(e,t,n){t.exports=r;var i=e(14);function r(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(r.prototype=Object.create(i.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,n,r,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return i.asPromise(e,s,t,n,r,o);if(!s.rpcImpl)return setTimeout((function(){a(Error("already ended"))}),0),undefined$1;try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return s.emit("error",e,t),a(e);if(null===n)return s.end(!0),undefined$1;if(!(n instanceof r))try{n=r[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return s.emit("error",e,t),a(e)}return s.emit("data",n,t),a(null,n)}))}catch(e){return s.emit("error",e,t),setTimeout((function(){a(e)}),0),undefined$1}},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{14:14}],13:[function(e,t,n){t.exports=r;var i=e(14);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=r.zero=new r(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(i.isString(e)){if(!i.Long)return r.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):o},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;r.fromHash=function(e){return e===a?o:new r((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},{14:14}],14:[function(e,t,n){var i=n;function r(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;++r)e[i[r]]!==undefined$1&&n||(e[i[r]]=t[i[r]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=e(1),i.base64=e(2),i.EventEmitter=e(3),i.float=e(4),i.inquire=e(5),i.utf8=e(7),i.pool=e(6),i.LongBits=e(13),i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=global.dcodeIO&&global.dcodeIO.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var n=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},i.merge=r,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&this[e[n]]!==undefined$1&&null!==this[e[n]])return e[n]}},i.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},i.lazyResolve=function(e,t){for(var n=0;n<t.length;++n)for(var i=Object.keys(t[n]),r=0;r<i.length;++r){for(var o=t[n][i[r]].split("."),a=e;o.length;)a=a[o.shift()];t[n][i[r]]=a}},i.toJSONOptions={longs:String,enums:String,bytes:String},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},{1:1,13:13,2:2,3:3,4:4,5:5,6:6,7:7}],15:[function(e,t,n){t.exports=d;var i,r=e(14),o=r.LongBits,a=r.base64,s=r.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=undefined$1,this.val=n}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}function h(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=undefined$1,this.val=t}function f(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function m(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}d.create=r.Buffer?function(){return(d.create=function(){return new i})()}:function(){return new d},d.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(d.alloc=r.pool(d.alloc,r.Array.prototype.subarray)),d.prototype.push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this.push(f,10,o.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=o.from(e);return this.push(f,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this.push(f,t.length(),t)},d.prototype.bool=function(e){return this.push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this.push(m,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=o.from(e);return this.push(m,4,t.lo).push(m,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this.push(r.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this.push(r.float.writeDoubleLE,8,e)};var g=r.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this.push(h,1,0);if(r.isString(e)){var n=d.alloc(t=a.length(e));a.decode(e,n,0),e=n}return this.uint32(t).push(g,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t).push(s.write,t,e):this.push(h,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},d._configure=function(e){i=e}},{14:14}],16:[function(e,t,n){t.exports=a;var i=e(15);(a.prototype=Object.create(i.prototype)).constructor=a;var r=e(14),o=r.Buffer;function a(){i.call(this)}a.alloc=function(e){return(a.alloc=r._Buffer_allocUnsafe)(e)};var s=o&&o.prototype instanceof Uint8Array&&"set"===o.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var i=0;i<e.length;)t[n++]=e[i++]};function c(e,t,n){e.length<40?r.utf8.write(e,t,n):t.utf8Write(e,n)}a.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(s,t,e),this},a.prototype.string=function(e){var t=o.byteLength(e);return this.uint32(t),t&&this.push(c,t,e),this}},{14:14,15:15}]},{},[8])})("object"==typeof window&&window||"object"==typeof self&&self||commonjsGlobal)})),protobuf$1=Object.freeze(_mergeNamespaces$1({__proto__:null,default:protobuf},[protobuf]));function isBitSet(e,t){return 0!=(e&t)}const childrenBitmasks=[1,2,4,8],anyChildBitmask=15,cacheFlagBitmask=16,imageBitmask=64,terrainBitmask=128;function GoogleEarthEnterpriseTileInformation(e,t,n,i,r,o){this._bits=e,this.cnodeVersion=t,this.imageryVersion=n,this.terrainVersion=i,this.imageryProvider=r,this.terrainProvider=o,this.ancestorHasTerrain=!1,this.terrainState=void 0}function stringToBuffer(e){const t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n);for(let n=0;n<t;++n)i[n]=e.charCodeAt(n);return n}GoogleEarthEnterpriseTileInformation.clone=function(e,t){return defined(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new GoogleEarthEnterpriseTileInformation(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t},GoogleEarthEnterpriseTileInformation.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},GoogleEarthEnterpriseTileInformation.prototype.hasSubtree=function(){return isBitSet(this._bits,cacheFlagBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasImagery=function(){return isBitSet(this._bits,imageBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasTerrain=function(){return isBitSet(this._bits,terrainBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChildren=function(){return isBitSet(this._bits,anyChildBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChild=function(e){return isBitSet(this._bits,childrenBitmasks[e])},GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask=function(){return this._bits&anyChildBitmask};const defaultKey=stringToBuffer('Eô½\vyâjE"’,ÍqøIFgQ\0B%Æèa,f)\bÆ4Üjb%y\nwmiÖðœk“¡½NuàA[ß@V\fÙ»r›|3SîOlÔq°{ÀEVZ­wUe\v3’l5Å0sø3>mF8J´Ýð.ÝuڌDt"úa"\f3"So¯9D\vŒ9Ù9L¹¿«\\ŒP_Ÿ"uxéq‘h;Áěð<VqH‚\'UfYNe˜u£aF}a?A\0Ÿ×´4M·ոŠ\'{‹Ü+»Mg0ÈÑö\\Pú[/F›n5/\'C.ë\n\f^¥se4ål.jC\'c#U©?q{gC}:¯ÍâTUœýKÆâŸ/(íË\\Æ-fˆ§;/*"N°k.Ý\r•}}GºC²²+>Mª>}æÎI‰Ææx\fa1-¤O¥~q ˆì\r1èN\v\0nPh}=\b\r•¦n£h—$[kó#ó¶s³\r\v@ÀŸØQ]ú".jßI\0¹ wUÆïj¿{GLƒîÜÜF…©­S+S4ÿ”Yä8è1ƒN¹XFkË-#†’p\x005ˆ"Ï1²&/çÃu-6,rt°#G·ÓÑ&…7râ\0ŒÚ3-Þ`†i#i*|ÍKQ\r•T9w.)ê¦P¢joP™\\>TûïP[\vE‰m(w7ێJfJo™ åpâ¹q~\fmI-zþrÇòY0»]såÉ êxì ðŠB|G½&·q¶ÇŸÑ3‚=Ó«îc™È+S D\\qÆÌD2O<ÊÀ)=RÓaX©}e´ÜÏ\rô=ñ\b©BÚ#\tØ¿^PIøMÀËGLO÷{+ØÅ1’;µoÜl\r’ˆўÛ?âéÚ_ԄâFaZÞUϤ\0¾ýÎgñJi—æ HØ]~®q N®ÀV©‘<‚rçvì)IÖ]-ƒãÛ6©;f—‡jÕ¶=P^R¹KÇsWxÉô.Y•“oÐKW>\'\'Ç`Û;íšSD>?’mw¢\në?R¨ÆU^1I7…ôÅ&-©¿‹\'TÚÃj å*x°Öprª‹ˆ÷_H±~ÀXL?fù>áeÀp§Ï8i¯ðVldIœ\'­xtO‡ÞV9\0Úw\vË-‰û5Oõ\bQ`Á\nZGM&30xÚÀœFGâ[y`In7gS\n>éìF9²ñ4\rƄSuná\fYÙÞ)…{II¥wy¾IV.6ç\v:»Ob{ÒM1•/½8{¨O!áìFpv•})"xˆ\nÝ\\ÚÞQÏðüYRe|3ßóHÚ»*uÛ`²Ôüíì5¨ÿ(1-È܈F|Š["');function GoogleEarthEnterpriseMetadata(e){let t=e;"string"==typeof t||t instanceof Resource||(t=e.url);const n=Resource.createIfNeeded(t);n.appendForwardSlash(),this._resource=n,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=CesiumMath.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};const i=this;this._readyPromise=requestDbRoot(this).then((function(){return i.getQuadTreePacket("",i._quadPacketVersion)})).then((function(){return!0})).otherwise((function(e){const t="An error occurred while accessing "+getMetadataResource(i,"",1).url+".";return when.reject(new RuntimeError(t))}))}Object.defineProperties(GoogleEarthEnterpriseMetadata.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}}),GoogleEarthEnterpriseMetadata.tileXYToQuadKey=function(e,t,n){let i="";for(let r=n;r>=0;--r){const n=1<<r;let o=0;isBitSet(t,n)?isBitSet(e,n)&&(o|=1):(o|=2,isBitSet(e,n)||(o|=1)),i+=o}return i},GoogleEarthEnterpriseMetadata.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let r=i;r>=0;--r){const o=1<<r,a=+e[i-r];isBitSet(a,2)?isBitSet(a,1)||(t|=o):(n|=o,isBitSet(a,1)&&(t|=o))}return{x:t,y:n,level:i}},GoogleEarthEnterpriseMetadata.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(defined(t))return null!==t;let n,i=!0,r=e;for(;r.length>1;){if(n=r.substring(r.length-1),r=r.substring(0,r.length-1),t=this.getTileInformationFromQuadKey(r),defined(t)){t.hasSubtree()||t.hasChild(parseInt(n))||(i=!1);break}if(null===t){i=!1;break}}return i};const taskProcessor$1=new TaskProcessor("decodeGoogleEarthEnterprisePacket");function populateSubtree(e,t,n){const i=e._tileInfo;let r,o=t,a=i[o];if(defined(a)&&(!a.hasSubtree()||a.hasChildren()))return a;for(;void 0===a&&o.length>1;)o=o.substring(0,o.length-1),a=i[o];const s=e._subtreePromises;let c=s[o];return defined(c)?c.then((function(){return r=new Request({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),populateSubtree(e,t,r)})):defined(a)&&a.hasSubtree()?(c=e.getQuadTreePacket(o,a.cnodeVersion,n),defined(c)?(s[o]=c,c.then((function(){return r=new Request({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),populateSubtree(e,t,r)})).always((function(){delete s[o]}))):void 0):when.reject(new RuntimeError("Couldn't load metadata for tile "+t))}function getMetadataResource(e,t,n,i){return e._resource.getDerivedResource({url:"flatfile?q2-0"+t+"-q."+n.toString(),request:i})}let dbrootParser,dbrootParserPromise;function requestDbRoot(e){const t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!defined(dbrootParserPromise)){const e=buildModuleUrl("ThirdParty/google-earth-dbroot-parser.js"),t=window.cesiumGoogleEarthDbRootParser;dbrootParserPromise=loadAndExecuteScript(e).then((function(){dbrootParser=window.cesiumGoogleEarthDbRootParser(protobuf$1),defined(t)?window.cesiumGoogleEarthDbRootParser=t:delete window.cesiumGoogleEarthDbRootParser}))}return dbrootParserPromise.then((function(){return t.fetchArrayBuffer()})).then((function(t){const n=dbrootParser.EncryptedDbRootProto.decode(new Uint8Array(t));let i=n.encryptionData,r=i.byteOffset,o=r+i.byteLength;const a=e.key=i.buffer.slice(r,o);i=n.dbrootData,r=i.byteOffset,o=r+i.byteLength;const s=i.buffer.slice(r,o);return taskProcessor$1.scheduleTask({buffer:s,type:"DbRoot",key:a},[s])})).then((function(t){const n=dbrootParser.DbRootProto.decode(new Uint8Array(t.buffer));if(e.imageryPresent=defaultValue(n.imageryPresent,e.imageryPresent),e.protoImagery=n.protoImagery,e.terrainPresent=defaultValue(n.terrainPresent,e.terrainPresent),defined(n.endSnippet)&&defined(n.endSnippet.model)){const t=n.endSnippet.model;e.negativeAltitudeExponentBias=defaultValue(t.negativeAltitudeExponentBias,e.negativeAltitudeExponentBias),e.negativeAltitudeThreshold=defaultValue(t.compressedNegativeAltitudeThreshold,e.negativeAltitudeThreshold)}defined(n.databaseVersion)&&(e._quadPacketVersion=defaultValue(n.databaseVersion.quadtreeVersion,e._quadPacketVersion));const i=e.providers,r=defaultValue(n.providerInfo,[]),o=r.length;for(let e=0;e<o;++e){const t=r[e],n=t.copyrightString;defined(n)&&(i[t.providerId]=new Credit(n.value))}})).otherwise((function(){console.log("Failed to retrieve "+t.url+". Using defaults."),e.key=defaultKey}))}function GoogleEarthEnterpriseTerrainData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;const t=defaultValue(e.childTileMask,15);let n=3&t;n|=4&t?8:0,n|=8&t?4:0,this._childTileMask=n,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._skirtHeight=void 0,this._bufferType=this._buffer.constructor,this._mesh=void 0,this._minimumHeight=void 0,this._maximumHeight=void 0}GoogleEarthEnterpriseMetadata.prototype.getQuadTreePacket=function(e,t,n){t=defaultValue(t,1);const i=getMetadataResource(this,e=defaultValue(e,""),t,n).fetchArrayBuffer();if(!defined(i))return;const r=this._tileInfo,o=this.key;return i.then((function(t){return taskProcessor$1.scheduleTask({buffer:t,quadKey:e,type:"Metadata",key:o},[t]).then((function(t){let n,i=-1;if(""!==e){i=e.length+1;const o=t[e];n=r[e],n._bits|=o._bits,delete t[e]}const o=Object.keys(t);o.sort((function(e,t){return e.length-t.length}));const a=o.length;for(let e=0;e<a;++e){const a=o[e];if(null!==t[a]){const e=GoogleEarthEnterpriseTileInformation.clone(t[a]),o=a.length;if(o===i)e.setParent(n);else if(o>1){const t=r[a.substring(0,a.length-1)];e.setParent(t)}r[a]=e}else r[a]=null}}))}))},GoogleEarthEnterpriseMetadata.prototype.populateSubtree=function(e,t,n,i){return populateSubtree(this,GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,n),i)},GoogleEarthEnterpriseMetadata.prototype.getTileInformation=function(e,t,n){const i=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,n);return this._tileInfo[i]},GoogleEarthEnterpriseMetadata.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]},Object.defineProperties(GoogleEarthEnterpriseTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});const createMeshTaskName="createVerticesFromGoogleEarthEnterpriseBuffer",createMeshTaskProcessorNoThrottle=new TaskProcessor(createMeshTaskName),createMeshTaskProcessorThrottle=new TaskProcessor(createMeshTaskName,TerrainData.maximumAsynchronousTasks),nativeRectangleScratch=new Rectangle,rectangleScratch$5=new Rectangle;GoogleEarthEnterpriseTerrainData.prototype.createMesh=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tilingScheme,n=e.x,i=e.y,r=e.level,o=defaultValue(e.exaggeration,1),a=defaultValue(e.exaggerationRelativeHeight,0),s=defaultValue(e.throttle,!0),c=t.ellipsoid;t.tileXYToNativeRectangle(n,i,r,nativeRectangleScratch),t.tileXYToRectangle(n,i,r,rectangleScratch$5);const l=c.cartographicToCartesian(Rectangle.center(rectangleScratch$5)),u=40075.16/(1<<r);this._skirtHeight=Math.min(8*u,1e3);const d=(s?createMeshTaskProcessorThrottle:createMeshTaskProcessorNoThrottle).scheduleTask({buffer:this._buffer,nativeRectangle:nativeRectangleScratch,rectangle:rectangleScratch$5,relativeToCenter:l,ellipsoid:c,skirtHeight:this._skirtHeight,exaggeration:o,exaggerationRelativeHeight:a,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(!defined(d))return;const h=this;return d.then((function(e){return h._mesh=new TerrainMesh(l,new Float32Array(e.vertices),new Uint16Array(e.indices),e.indexCountWithoutSkirts,e.vertexCountWithoutSkirts,e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),h._minimumHeight=e.minimumHeight,h._maximumHeight=e.maximumHeight,h._buffer=void 0,h._mesh}))},GoogleEarthEnterpriseTerrainData.prototype.interpolateHeight=function(e,t,n){const i=CesiumMath.clamp((t-e.west)/e.width,0,1),r=CesiumMath.clamp((n-e.south)/e.height,0,1);return defined(this._mesh)?interpolateMeshHeight(this,i,r):interpolateHeight(this,i,r,e)};const upsampleTaskProcessor=new TaskProcessor("upsampleQuantizedTerrainMesh",TerrainData.maximumAsynchronousTasks);GoogleEarthEnterpriseTerrainData.prototype.upsample=function(e,t,n,i,r,o,a){const s=this._mesh;if(!defined(this._mesh))return;const c=2*t!==r,l=2*n===o,u=e.ellipsoid,d=e.tileXYToRectangle(r,o,a),h=upsampleTaskProcessor.scheduleTask({vertices:s.vertices,indices:s.indices,indexCountWithoutSkirts:s.indexCountWithoutSkirts,vertexCountWithoutSkirts:s.vertexCountWithoutSkirts,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:u});if(!defined(h))return;const p=this;return h.then((function(e){const t=new Uint16Array(e.vertices),n=IndexDatatype$1.createTypedArray(t.length/3,e.indices),i=p._skirtHeight;return new QuantizedMeshTerrainData({quantizedVertices:t,indices:n,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:i,southSkirtHeight:i,eastSkirtHeight:i,northSkirtHeight:i,childTileMask:0,createdByUpsampling:!0,credits:p._credits})}))},GoogleEarthEnterpriseTerrainData.prototype.isChildAvailable=function(e,t,n,i){let r=2;return n!==2*e&&++r,i!==2*t&&(r-=2),0!=(this._childTileMask&1<<r)},GoogleEarthEnterpriseTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};const texCoordScratch0=new Cartesian2,texCoordScratch1=new Cartesian2,texCoordScratch2=new Cartesian2,barycentricCoordinateScratch=new Cartesian3;function interpolateMeshHeight(e,t,n){const i=e._mesh,r=i.vertices,o=i.encoding,a=i.indices;for(let e=0,i=a.length;e<i;e+=3){const i=a[e],s=a[e+1],c=a[e+2],l=o.decodeTextureCoordinates(r,i,texCoordScratch0),u=o.decodeTextureCoordinates(r,s,texCoordScratch1),d=o.decodeTextureCoordinates(r,c,texCoordScratch2),h=Intersections2D.computeBarycentricCoordinates(t,n,l.x,l.y,u.x,u.y,d.x,d.y,barycentricCoordinateScratch);if(h.x>=-1e-15&&h.y>=-1e-15&&h.z>=-1e-15){const e=o.decodeHeight(r,i),t=o.decodeHeight(r,s),n=o.decodeHeight(r,c);return h.x*e+h.y*t+h.z*n}}}const sizeOfUint16=Uint16Array.BYTES_PER_ELEMENT,sizeOfUint32$7=Uint32Array.BYTES_PER_ELEMENT,sizeOfInt32=Int32Array.BYTES_PER_ELEMENT,sizeOfFloat=Float32Array.BYTES_PER_ELEMENT,sizeOfDouble=Float64Array.BYTES_PER_ELEMENT;function interpolateHeight(e,t,n,i){const r=e._buffer;let o=0,a=0,s=0;n>.5?(t>.5?(o=2,a=.5):o=3,s=.5):t>.5&&(o=1,a=.5);const c=new DataView(r);let l=0;for(let e=0;e<o;++e)l+=c.getUint32(l,!0),l+=sizeOfUint32$7;l+=sizeOfUint32$7,l+=2*sizeOfDouble;const u=CesiumMath.toRadians(180*c.getFloat64(l,!0));l+=sizeOfDouble;const d=CesiumMath.toRadians(180*c.getFloat64(l,!0));l+=sizeOfDouble;const h=i.width/u/2,p=i.height/d/2,f=c.getInt32(l,!0);l+=sizeOfInt32;const m=3*c.getInt32(l,!0);l+=sizeOfInt32,l+=sizeOfInt32;const g=new Array(f),_=new Array(f),y=new Array(f);let C;for(C=0;C<f;++C)g[C]=a+c.getUint8(l++)*h,_[C]=s+c.getUint8(l++)*p,y[C]=6371010*c.getFloat32(l,!0),l+=sizeOfFloat;const T=new Array(m);for(C=0;C<m;++C)T[C]=c.getUint16(l,!0),l+=sizeOfUint16;for(C=0;C<m;C+=3){const e=T[C],i=T[C+1],r=T[C+2],o=g[e],a=g[i],s=g[r],c=_[e],l=_[i],u=_[r],d=Intersections2D.computeBarycentricCoordinates(t,n,o,c,a,l,s,u,barycentricCoordinateScratch);if(d.x>=-1e-15&&d.y>=-1e-15&&d.z>=-1e-15)return d.x*y[e]+d.y*y[i]+d.z*y[r]}}const TerrainState$2={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},julianDateScratch=new JulianDate;function TerrainCache(){this._terrainCache={},this._lastTidy=JulianDate.now()}function GoogleEarthEnterpriseTerrainProvider(e){let t;if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadata))t=e.metadata;else{const n=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(n)}this._metadata=t,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new TerrainCache,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new Event,this._ready=!1;const i=this;let r;this._readyPromise=t.readyPromise.then((function(e){if(!t.terrainPresent){const e=new RuntimeError("The server "+t.url+" doesn't have terrain");return r=TileProviderError.handleError(r,i,i._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}return TileProviderError.handleSuccess(r),i._ready=e,e})).otherwise((function(e){return r=TileProviderError.handleError(r,i,i._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}))}TerrainCache.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:JulianDate.now()}},TerrainCache.prototype.get=function(e){const t=this._terrainCache[e];if(defined(t))return delete this._terrainCache[e],t.buffer},TerrainCache.prototype.tidy=function(){if(JulianDate.now(julianDateScratch),JulianDate.secondsDifference(julianDateScratch,this._lastTidy)>10){const e=this._terrainCache,t=Object.keys(e),n=t.length;for(let i=0;i<n;++i){const n=t[i],r=e[n];JulianDate.secondsDifference(julianDateScratch,r.timestamp)>10&&delete e[n]}JulianDate.clone(julianDateScratch,this._lastTidy)}},Object.defineProperties(GoogleEarthEnterpriseTerrainProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tilingScheme:{get:function(){return this._tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});const taskProcessor=new TaskProcessor("decodeGoogleEarthEnterprisePacket");function computeChildMask(e,t,n){let i=t.getChildBitmask();if(t.terrainState===TerrainState$2.PARENT){i=0;for(let t=0;t<4;++t){const r=n.getTileInformationFromQuadKey(e+t.toString());defined(r)&&r.hasTerrain()&&(i|=1<<t)}}return i}function buildTerrainResource(e,t,n,i){return n=defined(n)&&n>0?n:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1c-0"+t+"-t."+n.toString(),request:i})}GoogleEarthEnterpriseTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){const r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,n),o=this._terrainCache,a=this._metadata,s=a.getTileInformationFromQuadKey(r);if(!defined(s))return when.reject(new RuntimeError("Terrain tile doesn't exist"));let c=s.terrainState;defined(c)||(c=s.terrainState=TerrainState$2.UNKNOWN);const l=o.get(r);if(defined(l)){const e=a.providers[s.terrainProvider];return when.resolve(new GoogleEarthEnterpriseTerrainData({buffer:l,childTileMask:computeChildMask(r,s,a),credits:defined(e)?[e]:void 0,negativeAltitudeExponentBias:a.negativeAltitudeExponentBias,negativeElevationThreshold:a.negativeAltitudeThreshold}))}if(o.tidy(),!s.ancestorHasTerrain)return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}));if(c===TerrainState$2.NONE)return when.reject(new RuntimeError("Terrain tile doesn't exist"));let u,d=r,h=-1;switch(c){case TerrainState$2.SELF:h=s.terrainVersion;break;case TerrainState$2.PARENT:d=d.substring(0,d.length-1),u=a.getTileInformationFromQuadKey(d),h=u.terrainVersion;break;case TerrainState$2.UNKNOWN:s.hasTerrain()?h=s.terrainVersion:(d=d.substring(0,d.length-1),u=a.getTileInformationFromQuadKey(d),defined(u)&&u.hasTerrain()&&(h=u.terrainVersion))}if(h<0)return when.reject(new RuntimeError("Terrain tile doesn't exist"));const p=this._terrainPromises,f=this._terrainRequests;let m,g;if(defined(p[d]))m=p[d],g=f[d];else{g=i;const e=buildTerrainResource(this,d,h,g).fetchArrayBuffer();if(!defined(e))return;m=e.then((function(e){return defined(e)?taskProcessor.scheduleTask({buffer:e,type:"Terrain",key:a.key},[e]).then((function(e){const t=a.getTileInformationFromQuadKey(d);t.terrainState=TerrainState$2.SELF,o.add(d,e[0]);const n=t.terrainProvider,i=e.length-1;for(let t=0;t<i;++t){const i=d+t.toString(),r=a.getTileInformationFromQuadKey(i);defined(r)&&(o.add(i,e[t+1]),r.terrainState=TerrainState$2.PARENT,0===r.terrainProvider&&(r.terrainProvider=n))}})):when.reject(new RuntimeError("Failed to load terrain."))})),p[d]=m,f[d]=g,m=m.always((function(){delete p[d],delete f[d]}))}return m.then((function(){const e=o.get(r);if(defined(e)){const t=a.providers[s.terrainProvider];return new GoogleEarthEnterpriseTerrainData({buffer:e,childTileMask:computeChildMask(r,s,a),credits:defined(t)?[t]:void 0,negativeAltitudeExponentBias:a.negativeAltitudeExponentBias,negativeElevationThreshold:a.negativeAltitudeThreshold})}return when.reject(new RuntimeError("Failed to load terrain."))})).otherwise((function(e){return g.state===RequestState$1.CANCELLED?(i.state=g.state,when.reject(e)):(s.terrainState=TerrainState$2.NONE,when.reject(e))}))},GoogleEarthEnterpriseTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){const i=this._metadata;let r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,n);const o=i.getTileInformation(e,t,n);if(null===o)return!1;if(defined(o)){if(!o.ancestorHasTerrain)return!0;const e=o.terrainState;if(e===TerrainState$2.NONE)return!1;if(!(defined(e)&&e!==TerrainState$2.UNKNOWN||(o.terrainState=TerrainState$2.UNKNOWN,o.hasTerrain()))){r=r.substring(0,r.length-1);const e=i.getTileInformationFromQuadKey(r);if(!defined(e)||!e.hasTerrain())return!1}return!0}if(i.isValid(r)){const r=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});i.populateSubtree(e,t,n,r)}return!1},GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){};const PROJECTIONS=[GeographicProjection,WebMercatorProjection],PROJECTION_COUNT=PROJECTIONS.length,MITER_BREAK_SMALL=Math.cos(CesiumMath.toRadians(30)),MITER_BREAK_LARGE=Math.cos(CesiumMath.toRadians(150)),WALL_INITIAL_MIN_HEIGHT=0,WALL_INITIAL_MAX_HEIGHT=1e3;function GroundPolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;this.width=defaultValue(e.width,1),this._positions=t,this.granularity=defaultValue(e.granularity,9999),this.loop=defaultValue(e.loop,!1),this.arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._ellipsoid=Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(GroundPolylineGeometry.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+Ellipsoid.packedLength+1+1}}}),GroundPolylineGeometry.setProjectionAndEllipsoid=function(e,t){let n=0;for(let e=0;e<PROJECTION_COUNT;e++)if(t instanceof PROJECTIONS[e]){n=e;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const cart3Scratch1=new Cartesian3,cart3Scratch2=new Cartesian3,cart3Scratch3=new Cartesian3;function computeRightNormal(e,t,n,i,r){const o=getPosition$2(i,e,0,cart3Scratch1),a=getPosition$2(i,e,n,cart3Scratch2),s=getPosition$2(i,t,0,cart3Scratch3),c=direction(a,o,cart3Scratch2),l=direction(s,o,cart3Scratch3);return Cartesian3.cross(l,c,r),Cartesian3.normalize(r,r)}const interpolatedCartographicScratch$1=new Cartographic,interpolatedBottomScratch=new Cartesian3,interpolatedTopScratch=new Cartesian3,interpolatedNormalScratch=new Cartesian3;function interpolateSegment(e,t,n,i,r,o,a,s,c,l,u){if(0===r)return;let d;o===ArcType$1.GEODESIC?d=new EllipsoidGeodesic(e,t,a):o===ArcType$1.RHUMB&&(d=new EllipsoidRhumbLine(e,t,a));const h=d.surfaceDistance;if(h<r)return;const p=computeRightNormal(e,t,i,a,interpolatedNormalScratch),f=Math.ceil(h/r),m=h/f;let g=m;const _=f-1;let y=s.length;for(let e=0;e<_;e++){const e=d.interpolateUsingSurfaceDistance(g,interpolatedCartographicScratch$1),t=getPosition$2(a,e,n,interpolatedBottomScratch),r=getPosition$2(a,e,i,interpolatedTopScratch);Cartesian3.pack(p,s,y),Cartesian3.pack(t,c,y),Cartesian3.pack(r,l,y),u.push(e.latitude),u.push(e.longitude),y+=3,g+=m}}const heightlessCartographicScratch=new Cartographic;function getPosition$2(e,t,n,i){return Cartographic.clone(t,heightlessCartographicScratch),heightlessCartographicScratch.height=n,Cartographic.toCartesian(heightlessCartographicScratch,e,i)}function direction(e,t,n){return Cartesian3.subtract(e,t,n),Cartesian3.normalize(n,n),n}function tangentDirection(e,t,n,i){return i=direction(e,t,i),i=Cartesian3.cross(i,n,i),i=Cartesian3.normalize(i,i),i=Cartesian3.cross(n,i,i)}GroundPolylineGeometry.pack=function(e,t,n){let i=defaultValue(n,0);const r=e._positions,o=r.length;t[i++]=o;for(let e=0;e<o;++e){const n=r[e];Cartesian3.pack(n,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t},GroundPolylineGeometry.unpack=function(e,t,n){let i=defaultValue(t,0);const r=e[i++],o=new Array(r);for(let t=0;t<r;t++)o[t]=Cartesian3.unpack(e,i),i+=3;const a=e[i++],s=1===e[i++],c=e[i++],l=Ellipsoid.unpack(e,i);i+=Ellipsoid.packedLength;const u=e[i++],d=1===e[i++];return defined(n)||(n=new GroundPolylineGeometry({positions:o})),n._positions=o,n.granularity=a,n.loop=s,n.arcType=c,n._ellipsoid=l,n._projectionIndex=u,n._scene3DOnly=d,n};const toPreviousScratch=new Cartesian3,toNextScratch=new Cartesian3,forwardScratch=new Cartesian3,vertexUpScratch=new Cartesian3,cosine90=0,cosine180=-1;function computeVertexMiterNormal(e,t,n,i,r){const o=direction(n,t,vertexUpScratch),a=tangentDirection(e,t,o,toPreviousScratch),s=tangentDirection(i,t,o,toNextScratch);if(CesiumMath.equalsEpsilon(Cartesian3.dot(a,s),cosine180,CesiumMath.EPSILON5))return r=Cartesian3.cross(o,a,r),r=Cartesian3.normalize(r,r);r=Cartesian3.add(s,a,r),r=Cartesian3.normalize(r,r);const c=Cartesian3.cross(o,r,forwardScratch);return Cartesian3.dot(s,c)<cosine90&&(r=Cartesian3.negate(r,r)),r}const XZ_PLANE=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),previousBottomScratch=new Cartesian3,vertexBottomScratch=new Cartesian3,vertexTopScratch=new Cartesian3,nextBottomScratch=new Cartesian3,vertexNormalScratch=new Cartesian3,intersectionScratch$1=new Cartesian3,cartographicScratch0=new Cartographic,cartographicScratch1=new Cartographic,cartographicIntersectionScratch=new Cartographic;GroundPolylineGeometry.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,r=e.granularity,o=e.arcType,a=new PROJECTIONS[e._projectionIndex](i),s=WALL_INITIAL_MIN_HEIGHT,c=WALL_INITIAL_MAX_HEIGHT;let l,u;const d=e._positions,h=d.length;let p,f,m,g;2===h&&(n=!1);const _=new EllipsoidRhumbLine(void 0,void 0,i);let y,C,T;const S=[d[0]];for(u=0;u<h-1;u++)p=d[u],f=d[u+1],y=IntersectionTests.lineSegmentPlane(p,f,XZ_PLANE,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(y)):e.arcType===ArcType$1.RHUMB&&(T=i.cartesianToCartographic(y,cartographicScratch0).longitude,m=i.cartesianToCartographic(p,cartographicScratch0),g=i.cartesianToCartographic(f,cartographicScratch1),_.setEndPoints(m,g),C=_.findIntersectionWithLongitude(T,cartographicIntersectionScratch),y=i.cartographicToCartesian(C,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(y)))),S.push(f);n&&(p=d[h-1],f=d[0],y=IntersectionTests.lineSegmentPlane(p,f,XZ_PLANE,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(y)):e.arcType===ArcType$1.RHUMB&&(T=i.cartesianToCartographic(y,cartographicScratch0).longitude,m=i.cartesianToCartographic(p,cartographicScratch0),g=i.cartesianToCartographic(f,cartographicScratch1),_.setEndPoints(m,g),C=_.findIntersectionWithLongitude(T,cartographicIntersectionScratch),y=i.cartographicToCartesian(C,intersectionScratch$1),!defined(y)||Cartesian3.equalsEpsilon(y,p,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(y,f,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(y)))));let A=S.length,v=new Array(A);for(u=0;u<A;u++){const e=Cartographic.fromCartesian(S[u],i);e.height=0,v[u]=e}if(v=arrayRemoveDuplicates(v,Cartographic.equalsEpsilon),A=v.length,A<2)return;const E=[],b=[],x=[],P=[];let D=previousBottomScratch,w=vertexBottomScratch,M=vertexTopScratch,I=nextBottomScratch,R=vertexNormalScratch;const O=v[0],B=v[1];for(D=getPosition$2(i,v[A-1],s,D),I=getPosition$2(i,B,s,I),w=getPosition$2(i,O,s,w),M=getPosition$2(i,O,c,M),R=n?computeVertexMiterNormal(D,w,M,I,R):computeRightNormal(O,B,c,i,R),Cartesian3.pack(R,b,0),Cartesian3.pack(w,x,0),Cartesian3.pack(M,P,0),E.push(O.latitude),E.push(O.longitude),interpolateSegment(O,B,s,c,r,o,i,b,x,P,E),u=1;u<A-1;++u){D=Cartesian3.clone(w,D),w=Cartesian3.clone(I,w);const e=v[u];getPosition$2(i,e,c,M),getPosition$2(i,v[u+1],s,I),computeVertexMiterNormal(D,w,M,I,R),l=b.length,Cartesian3.pack(R,b,l),Cartesian3.pack(w,x,l),Cartesian3.pack(M,P,l),E.push(e.latitude),E.push(e.longitude),interpolateSegment(v[u],v[u+1],s,c,r,o,i,b,x,P,E)}const L=v[A-1],F=v[A-2];if(w=getPosition$2(i,L,s,w),M=getPosition$2(i,L,c,M),n){const e=v[0];D=getPosition$2(i,F,s,D),I=getPosition$2(i,e,s,I),R=computeVertexMiterNormal(D,w,M,I,R)}else R=computeRightNormal(F,L,c,i,R);if(l=b.length,Cartesian3.pack(R,b,l),Cartesian3.pack(w,x,l),Cartesian3.pack(M,P,l),E.push(L.latitude),E.push(L.longitude),n){for(interpolateSegment(L,O,s,c,r,o,i,b,x,P,E),l=b.length,u=0;u<3;++u)b[l+u]=b[u],x[l+u]=x[u],P[l+u]=P[u];E.push(O.latitude),E.push(O.longitude)}return generateGeometryAttributes(n,a,x,P,b,E,t)};const lineDirectionScratch=new Cartesian3,matrix3Scratch$1=new Matrix3,quaternionScratch$1=new Quaternion;function breakMiter(e,t,n,i){const r=direction(n,t,lineDirectionScratch),o=Cartesian3.dot(r,e);if(o>MITER_BREAK_SMALL||o<MITER_BREAK_LARGE){const t=direction(i,n,vertexUpScratch),r=o<MITER_BREAK_LARGE?CesiumMath.PI_OVER_TWO:-CesiumMath.PI_OVER_TWO,a=Quaternion.fromAxisAngle(t,r,quaternionScratch$1),s=Matrix3.fromQuaternion(a,matrix3Scratch$1);return Matrix3.multiplyByVector(s,e,e),!0}return!1}const endPosCartographicScratch=new Cartographic,normalStartpointScratch=new Cartesian3,normalEndpointScratch=new Cartesian3;function projectNormal(e,t,n,i,r){const o=Cartographic.toCartesian(t,e._ellipsoid,normalStartpointScratch);let a=Cartesian3.add(o,n,normalEndpointScratch),s=!1;const c=e._ellipsoid;let l=c.cartesianToCartographic(a,endPosCartographicScratch);Math.abs(t.longitude-l.longitude)>CesiumMath.PI_OVER_TWO&&(s=!0,a=Cartesian3.subtract(o,n,normalEndpointScratch),l=c.cartesianToCartographic(a,endPosCartographicScratch)),l.height=0;const u=e.project(l,r);return(r=Cartesian3.subtract(u,i,r)).z=0,r=Cartesian3.normalize(r,r),s&&Cartesian3.negate(r,r),r}const adjustHeightNormalScratch=new Cartesian3,adjustHeightOffsetScratch=new Cartesian3;function adjustHeights(e,t,n,i,r,o){const a=Cartesian3.subtract(t,e,adjustHeightNormalScratch);Cartesian3.normalize(a,a);const s=n-WALL_INITIAL_MIN_HEIGHT;let c=Cartesian3.multiplyByScalar(a,s,adjustHeightOffsetScratch);Cartesian3.add(e,c,r);const l=i-WALL_INITIAL_MAX_HEIGHT;c=Cartesian3.multiplyByScalar(a,l,adjustHeightOffsetScratch),Cartesian3.add(t,c,o)}const nudgeDirectionScratch=new Cartesian3;function nudgeXZ(e,t){const n=Plane.getPointDistance(XZ_PLANE,e),i=Plane.getPointDistance(XZ_PLANE,t);let r=nudgeDirectionScratch;CesiumMath.equalsEpsilon(n,0,CesiumMath.EPSILON2)?(r=direction(t,e,r),Cartesian3.multiplyByScalar(r,CesiumMath.EPSILON2,r),Cartesian3.add(e,r,e)):CesiumMath.equalsEpsilon(i,0,CesiumMath.EPSILON2)&&(r=direction(e,t,r),Cartesian3.multiplyByScalar(r,CesiumMath.EPSILON2,r),Cartesian3.add(t,r,t))}function nudgeCartographic(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(CesiumMath.equalsEpsilon(n,CesiumMath.PI,CesiumMath.EPSILON11)){const i=CesiumMath.sign(t.longitude);return e.longitude=i*(n-CesiumMath.EPSILON11),1}if(CesiumMath.equalsEpsilon(i,CesiumMath.PI,CesiumMath.EPSILON11)){const n=CesiumMath.sign(e.longitude);return t.longitude=n*(i-CesiumMath.EPSILON11),2}return 0}const startCartographicScratch$1=new Cartographic,endCartographicScratch$1=new Cartographic,segmentStartTopScratch=new Cartesian3,segmentEndTopScratch=new Cartesian3,segmentStartBottomScratch=new Cartesian3,segmentEndBottomScratch=new Cartesian3,segmentStartNormalScratch=new Cartesian3,segmentEndNormalScratch=new Cartesian3,getHeightCartographics=[startCartographicScratch$1,endCartographicScratch$1],getHeightRectangleScratch=new Rectangle,adjustHeightStartTopScratch=new Cartesian3,adjustHeightEndTopScratch=new Cartesian3,adjustHeightStartBottomScratch=new Cartesian3,adjustHeightEndBottomScratch=new Cartesian3,segmentStart2DScratch=new Cartesian3,segmentEnd2DScratch=new Cartesian3,segmentStartNormal2DScratch=new Cartesian3,segmentEndNormal2DScratch=new Cartesian3,offsetScratch$b=new Cartesian3,startUpScratch=new Cartesian3,endUpScratch=new Cartesian3,rightScratch=new Cartesian3,startPlaneNormalScratch=new Cartesian3,endPlaneNormalScratch=new Cartesian3,encodeScratch$1=new EncodedCartesian3,encodeScratch2D=new EncodedCartesian3,forwardOffset2DScratch=new Cartesian3,right2DScratch=new Cartesian3,normalNudgeScratch=new Cartesian3,scratchBoundingSpheres=[new BoundingSphere,new BoundingSphere],REFERENCE_INDICES=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],REFERENCE_INDICES_LENGTH=REFERENCE_INDICES.length;function generateGeometryAttributes(e,t,n,i,r,o,a){let s,c;const l=t._ellipsoid,u=n.length/3-1,d=8*u,h=4*d,p=36*u,f=d>65535?new Uint32Array(p):new Uint16Array(p),m=new Float64Array(3*d),g=new Float32Array(h),_=new Float32Array(h),y=new Float32Array(h),C=new Float32Array(h),T=new Float32Array(h);let S,A,v,E;a&&(S=new Float32Array(h),A=new Float32Array(h),v=new Float32Array(h),E=new Float32Array(2*d));const b=o.length/2;let x=0;const P=startCartographicScratch$1;P.height=0;const D=endCartographicScratch$1;D.height=0;let w=segmentStartTopScratch,M=segmentEndTopScratch;if(a)for(c=0,s=1;s<b;s++)P.latitude=o[c],P.longitude=o[c+1],D.latitude=o[c+2],D.longitude=o[c+3],w=t.project(P,w),M=t.project(D,M),x+=Cartesian3.distance(w,M),c+=2;const I=i.length/3;M=Cartesian3.unpack(i,0,M);let R,O=0;for(c=3,s=1;s<I;s++)w=Cartesian3.clone(M,w),M=Cartesian3.unpack(i,c,M),O+=Cartesian3.distance(w,M),c+=3;c=3;let B=0,L=0,F=0,N=0,V=!1,k=Cartesian3.unpack(n,0,segmentEndBottomScratch),U=Cartesian3.unpack(i,0,segmentEndTopScratch),G=Cartesian3.unpack(r,0,segmentEndNormalScratch);if(e){breakMiter(G,Cartesian3.unpack(n,n.length-6,segmentStartBottomScratch),k,U)&&(G=Cartesian3.negate(G,G))}let $=0,z=0,H=0;for(s=0;s<u;s++){const e=Cartesian3.clone(k,segmentStartBottomScratch),s=Cartesian3.clone(U,segmentStartTopScratch);let u,d,h,p,f=Cartesian3.clone(G,segmentStartNormalScratch);if(V&&(f=Cartesian3.negate(f,f)),k=Cartesian3.unpack(n,c,segmentEndBottomScratch),U=Cartesian3.unpack(i,c,segmentEndTopScratch),G=Cartesian3.unpack(r,c,segmentEndNormalScratch),V=breakMiter(G,e,k,U),P.latitude=o[B],P.longitude=o[B+1],D.latitude=o[B+2],D.longitude=o[B+3],a){const e=nudgeCartographic(P,D);u=t.project(P,segmentStart2DScratch),d=t.project(D,segmentEnd2DScratch);const n=direction(d,u,forwardOffset2DScratch);n.y=Math.abs(n.y),h=segmentStartNormal2DScratch,p=segmentEndNormal2DScratch,0===e||Cartesian3.dot(n,Cartesian3.UNIT_Y)>MITER_BREAK_SMALL?(h=projectNormal(t,P,f,u,segmentStartNormal2DScratch),p=projectNormal(t,D,G,d,segmentEndNormal2DScratch)):1===e?(p=projectNormal(t,D,G,d,segmentEndNormal2DScratch),h.x=0,h.y=CesiumMath.sign(P.longitude-Math.abs(D.longitude)),h.z=0):(h=projectNormal(t,P,f,u,segmentStartNormal2DScratch),p.x=0,p.y=CesiumMath.sign(P.longitude-D.longitude),p.z=0)}const b=Cartesian3.distance(s,U),w=EncodedCartesian3.fromCartesian(e,encodeScratch$1),M=Cartesian3.subtract(k,e,offsetScratch$b),I=Cartesian3.normalize(M,rightScratch);let W=Cartesian3.subtract(s,e,startUpScratch);W=Cartesian3.normalize(W,W);let q=Cartesian3.cross(I,W,rightScratch);q=Cartesian3.normalize(q,q);let j=Cartesian3.cross(W,f,startPlaneNormalScratch);j=Cartesian3.normalize(j,j);let X=Cartesian3.subtract(U,k,endUpScratch);X=Cartesian3.normalize(X,X);let Y=Cartesian3.cross(G,X,endPlaneNormalScratch);Y=Cartesian3.normalize(Y,Y);const K=b/O,J=$/O;let Q,Z,ee,te=0,ne=0,ie=0;if(a){te=Cartesian3.distance(u,d),Q=EncodedCartesian3.fromCartesian(u,encodeScratch2D),Z=Cartesian3.subtract(d,u,forwardOffset2DScratch),ee=Cartesian3.normalize(Z,right2DScratch);const e=ee.x;ee.x=ee.y,ee.y=-e,ne=te/x,ie=z/x}for(R=0;R<8;R++){const e=N+4*R,t=L+2*R,n=e+3,i=R<4?1:-1,r=2===R||3===R||6===R||7===R?1:-1;Cartesian3.pack(w.high,g,e),g[n]=M.x,Cartesian3.pack(w.low,_,e),_[n]=M.y,Cartesian3.pack(j,y,e),y[n]=M.z,Cartesian3.pack(Y,C,e),C[n]=K*i,Cartesian3.pack(q,T,e);let o=J*r;0===o&&r<0&&(o=9),T[n]=o,a&&(S[e]=Q.high.x,S[e+1]=Q.high.y,S[e+2]=Q.low.x,S[e+3]=Q.low.y,v[e]=-h.y,v[e+1]=h.x,v[e+2]=p.y,v[e+3]=-p.x,A[e]=Z.x,A[e+1]=Z.y,A[e+2]=ee.x,A[e+3]=ee.y,E[t]=ne*i,o=ie*r,0===o&&r<0&&(o=9),E[t+1]=o)}const re=adjustHeightStartBottomScratch,oe=adjustHeightEndBottomScratch,ae=adjustHeightStartTopScratch,se=adjustHeightEndTopScratch,ce=Rectangle.fromCartographicArray(getHeightCartographics,getHeightRectangleScratch),le=ApproximateTerrainHeights.getMinimumMaximumHeights(ce,l),ue=le.minimumTerrainHeight,de=le.maximumTerrainHeight;H+=ue,H+=de,adjustHeights(e,s,ue,de,re,ae),adjustHeights(k,U,ue,de,oe,se);let he=Cartesian3.multiplyByScalar(q,CesiumMath.EPSILON5,normalNudgeScratch);Cartesian3.add(re,he,re),Cartesian3.add(oe,he,oe),Cartesian3.add(ae,he,ae),Cartesian3.add(se,he,se),nudgeXZ(re,oe),nudgeXZ(ae,se),Cartesian3.pack(re,m,F),Cartesian3.pack(oe,m,F+3),Cartesian3.pack(se,m,F+6),Cartesian3.pack(ae,m,F+9),he=Cartesian3.multiplyByScalar(q,-2*CesiumMath.EPSILON5,normalNudgeScratch),Cartesian3.add(re,he,re),Cartesian3.add(oe,he,oe),Cartesian3.add(ae,he,ae),Cartesian3.add(se,he,se),nudgeXZ(re,oe),nudgeXZ(ae,se),Cartesian3.pack(re,m,F+12),Cartesian3.pack(oe,m,F+15),Cartesian3.pack(se,m,F+18),Cartesian3.pack(ae,m,F+21),B+=2,c+=3,L+=16,F+=24,N+=32,$+=b,z+=te}c=0;let W=0;for(s=0;s<u;s++){for(R=0;R<REFERENCE_INDICES_LENGTH;R++)f[c+R]=REFERENCE_INDICES[R]+W;W+=8,c+=REFERENCE_INDICES_LENGTH}const q=scratchBoundingSpheres;BoundingSphere.fromVertices(n,Cartesian3.ZERO,3,q[0]),BoundingSphere.fromVertices(i,Cartesian3.ZERO,3,q[1]);const j=BoundingSphere.fromBoundingSpheres(q);j.radius+=H/(2*u);const X={position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,normalize:!1,values:m}),startHiAndForwardOffsetX:getVec4GeometryAttribute(g),startLoAndForwardOffsetY:getVec4GeometryAttribute(_),startNormalAndForwardOffsetZ:getVec4GeometryAttribute(y),endNormalAndTextureCoordinateNormalizationX:getVec4GeometryAttribute(C),rightNormalAndTextureCoordinateNormalizationY:getVec4GeometryAttribute(T)};return a&&(X.startHiLo2D=getVec4GeometryAttribute(S),X.offsetAndRight2D=getVec4GeometryAttribute(A),X.startEndNormals2D=getVec4GeometryAttribute(v),X.texcoordNormalization2D=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,normalize:!1,values:E})),new Geometry({attributes:X,indices:f,boundingSphere:j})}function getVec4GeometryAttribute(e){return new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}function HeadingPitchRange(e,t,n){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.range=defaultValue(n,0)}GroundPolylineGeometry._projectNormal=projectNormal,HeadingPitchRange.clone=function(e,t){if(defined(e))return defined(t)||(t=new HeadingPitchRange),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const factorial=CesiumMath.factorial;function calculateCoefficientTerm(e,t,n,i,r,o){let a,s,c,l=0;if(i>0){for(s=0;s<r;s++){for(a=!1,c=0;c<o.length&&!a;c++)s===o[c]&&(a=!0);a||(o.push(s),l+=calculateCoefficientTerm(e,t,n,i-1,r,o),o.splice(o.length-1,1))}return l}for(l=1,s=0;s<r;s++){for(a=!1,c=0;c<o.length&&!a;c++)s===o[c]&&(a=!0);a||(l*=e-n[t[s]])}return l}const HermitePolynomialApproximation={type:"Hermite",getRequiredDataPoints:function(e,t){return t=defaultValue(t,0),Math.max(Math.floor((e+1)/(t+1)),2)},interpolateOrderZero:function(e,t,n,i,r){let o,a,s,c,l,u;defined(r)||(r=new Array(i));const d=t.length,h=new Array(i);for(o=0;o<i;o++){r[o]=0;const e=new Array(d);for(h[o]=e,a=0;a<d;a++)e[a]=[]}const p=d,f=new Array(p);for(o=0;o<p;o++)f[o]=o;let m=d-1;for(c=0;c<i;c++){for(a=0;a<p;a++)u=f[a]*i+c,h[c][0].push(n[u]);for(o=1;o<p;o++){let e=!1;for(a=0;a<p-o;a++){const r=t[f[a]],s=t[f[a+o]];let l;s-r<=0?(u=f[a]*i+i*o+c,l=n[u],h[c][o].push(l/factorial(o))):(l=h[c][o-1][a+1]-h[c][o-1][a],h[c][o].push(l/(s-r))),e=e||0!==l}e||(m=o-1)}}for(s=0,l=0;s<=0;s++)for(o=s;o<=m;o++){const n=calculateCoefficientTerm(e,f,t,s,o,[]);for(c=0;c<i;c++){const e=h[c][o][0];r[c+s*i]+=e*n}}return r}},arrayScratch=[];function fillCoefficientList(e,t,n,i,r,o){let a,s,c=-1;const l=t.length,u=l*(l+1)/2;for(let d=0;d<r;d++){const h=Math.floor(d*u);for(a=0;a<l;a++)s=t[a]*r*(o+1)+d,e[h+a]=i[s];for(let u=1;u<l;u++){let p=0;const f=Math.floor(u*(1-u)/2)+l*u;let m=!1;for(a=0;a<l-u;a++){const c=n[t[a]],g=n[t[a+u]];let _,y;if(g-c<=0)s=t[a]*r*(o+1)+r*u+d,_=i[s],y=_/CesiumMath.factorial(u),e[h+f+p]=y,p++;else{const t=Math.floor((u-1)*(2-u)/2)+l*(u-1);_=e[h+t+a+1]-e[h+t+a],y=_/(g-c),e[h+f+p]=y,p++}m=m||0!==_}m&&(c=Math.max(c,u))}}return c}HermitePolynomialApproximation.interpolate=function(e,t,n,i,r,o,a){const s=i*(o+1);defined(a)||(a=new Array(s));for(let e=0;e<s;e++)a[e]=0;const c=t.length,l=new Array(c*(r+1));let u;for(u=0;u<c;u++)for(let e=0;e<r+1;e++)l[u*(r+1)+e]=u;const d=l.length,h=arrayScratch,p=fillCoefficientList(h,l,t,n,i,r),f=[],m=d*(d+1)/2,g=Math.min(p,o);for(let n=0;n<=g;n++)for(u=n;u<=p;u++){f.length=0;const r=calculateCoefficientTerm(e,l,t,n,u,f),o=Math.floor(u*(1-u)/2)+d*u;for(let e=0;e<i;e++){const t=h[Math.floor(e*m)+o];a[e+n*i]+=t*r}}return a};const HilbertOrder={};function rotate$1(e,t,n,i){if(0!==i)return;1===n&&(t.x=e-1-t.x,t.y=e-1-t.y);const r=t.x;t.x=t.y,t.y=r}function IauOrientationParameters(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}HilbertOrder.encode2D=function(e,t,n){const i=Math.pow(2,e),r={x:t,y:n};let o,a,s,c=BigInt(0);for(s=i/2;s>0;s/=2)o=(r.x&s)>0?1:0,a=(r.y&s)>0?1:0,c+=BigInt((3*o^a)*s*s),rotate$1(i,r,o,a);return c},HilbertOrder.decode2D=function(e,t){const n=Math.pow(2,e),i={x:0,y:0};let r,o,a,s;for(a=1,s=t;a<n;a*=2)r=1&Number(s/BigInt(2)),o=1&Number(s^BigInt(r)),rotate$1(a,i,r,o),i.x+=a*r,i.y+=a*o,s/=BigInt(4);return[i.x,i.y]};const Iau2000Orientation={},TdtMinusTai$1=32.184,J2000d$1=2451545,c1=-.0529921,c2=-.1059842,c3=13.0120009,c4=13.3407154,c5=.9856003,c6=26.4057084,c7=13.064993,c8=.3287146,c9=1.7484877,c10=-.1589763,c11=.0036096,c12=.1643573,c13=12.9590088;let dateTT=new JulianDate;function IauOrientationAxes(e){defined(e)&&"function"==typeof e||(e=Iau2000Orientation.ComputeMoon),this._computeFunction=e}Iau2000Orientation.ComputeMoon=function(e,t){defined(e)||(e=JulianDate.now()),dateTT=JulianDate.addSeconds(e,TdtMinusTai$1,dateTT);const n=JulianDate.totalDays(dateTT)-J2000d$1,i=n/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,r=(125.045+c1*n)*CesiumMath.RADIANS_PER_DEGREE,o=(250.089+c2*n)*CesiumMath.RADIANS_PER_DEGREE,a=(260.008+c3*n)*CesiumMath.RADIANS_PER_DEGREE,s=(176.625+c4*n)*CesiumMath.RADIANS_PER_DEGREE,c=(357.529+c5*n)*CesiumMath.RADIANS_PER_DEGREE,l=(311.589+c6*n)*CesiumMath.RADIANS_PER_DEGREE,u=(134.963+c7*n)*CesiumMath.RADIANS_PER_DEGREE,d=(276.617+c8*n)*CesiumMath.RADIANS_PER_DEGREE,h=(34.226+c9*n)*CesiumMath.RADIANS_PER_DEGREE,p=(15.134+c10*n)*CesiumMath.RADIANS_PER_DEGREE,f=(119.743+c11*n)*CesiumMath.RADIANS_PER_DEGREE,m=(239.961+c12*n)*CesiumMath.RADIANS_PER_DEGREE,g=(25.053+c13*n)*CesiumMath.RADIANS_PER_DEGREE,_=Math.sin(r),y=Math.sin(o),C=Math.sin(a),T=Math.sin(s),S=Math.sin(c),A=Math.sin(l),v=Math.sin(u),E=Math.sin(d),b=Math.sin(h),x=Math.sin(p),P=Math.sin(f),D=Math.sin(m),w=Math.sin(g),M=Math.cos(r),I=Math.cos(o),R=Math.cos(a),O=Math.cos(s),B=Math.cos(c),L=Math.cos(l),F=Math.cos(u),N=Math.cos(d),V=Math.cos(h),k=Math.cos(p),U=Math.cos(f),G=Math.cos(m),$=Math.cos(g),z=(269.9949+.0031*i-3.8787*_-.1204*y+.07*C-.0172*T+.0072*A-.0052*x+.0043*w)*CesiumMath.RADIANS_PER_DEGREE,H=(66.5392+.013*i+1.5419*M+.0239*I-.0278*R+.0068*O-.0029*L+9e-4*F+8e-4*k-9e-4*$)*CesiumMath.RADIANS_PER_DEGREE,W=(38.3213+13.17635815*n-14e-13*n*n+3.561*_+.1208*y-.0642*C+.0158*T+.0252*S-.0066*A-.0047*v-.0046*E+.0028*b+.0052*x+.004*P+.0019*D-.0044*w)*CesiumMath.RADIANS_PER_DEGREE,q=(13.17635815-2*n*14e-13+3.561*M*c1+.1208*I*c2-.0642*R*c3+.0158*O*c4+.0252*B*c5-.0066*L*c6-.0047*F*c7-.0046*N*c8+.0028*V*c9+.0052*k*c10+.004*U*c11+.0019*G*c12-.0044*$*c13)/86400*CesiumMath.RADIANS_PER_DEGREE;return defined(t)||(t=new IauOrientationParameters),t.rightAscension=z,t.declination=H,t.rotation=W,t.rotationRate=q,t};const xAxisScratch=new Cartesian3,yAxisScratch=new Cartesian3,zAxisScratch=new Cartesian3;function computeRotationMatrix(e,t,n){const i=xAxisScratch;i.x=Math.cos(e+CesiumMath.PI_OVER_TWO),i.y=Math.sin(e+CesiumMath.PI_OVER_TWO),i.z=0;const r=Math.cos(t),o=zAxisScratch;o.x=r*Math.cos(e),o.y=r*Math.sin(e),o.z=Math.sin(t);const a=Cartesian3.cross(o,i,yAxisScratch);return defined(n)||(n=new Matrix3),n[0]=i.x,n[1]=a.x,n[2]=o.x,n[3]=i.y,n[4]=a.y,n[5]=o.y,n[6]=i.z,n[7]=a.z,n[8]=o.z,n}const rotMtxScratch=new Matrix3,quatScratch=new Quaternion;IauOrientationAxes.prototype.evaluate=function(e,t){defined(e)||(e=JulianDate.now());const n=this._computeFunction(e),i=computeRotationMatrix(n.rightAscension,n.declination,t),r=CesiumMath.zeroToTwoPi(n.rotation),o=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,r,quatScratch),a=Matrix3.fromQuaternion(Quaternion.conjugate(o,o),rotMtxScratch);return Matrix3.multiply(a,i,i)};const InterpolationAlgorithm={};function PeliasGeocoderService(e){this._url=Resource.createIfNeeded(e),this._url.appendForwardSlash()}function IonGeocoderService(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.accessToken,Ion.defaultAccessToken),n=Resource.createIfNeeded(defaultValue(e.server,Ion.defaultServer));n.appendForwardSlash();const i=Ion.getDefaultTokenCredit(t);defined(i)&&e.scene.frameState.creditDisplay.addDefaultCredit(Credit.clone(i));const r=n.getDerivedResource({url:"v1/geocode"});defined(t)&&r.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new PeliasGeocoderService(r)}function TimeInterval(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.start=defined(e.start)?JulianDate.clone(e.start):new JulianDate,this.stop=defined(e.stop)?JulianDate.clone(e.stop):new JulianDate,this.data=e.data,this.isStartIncluded=defaultValue(e.isStartIncluded,!0),this.isStopIncluded=defaultValue(e.isStopIncluded,!0)}InterpolationAlgorithm.type=void 0,InterpolationAlgorithm.getRequiredDataPoints=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolateOrderZero=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolate=DeveloperError.throwInstantiationError,Object.defineProperties(PeliasGeocoderService.prototype,{url:{get:function(){return this._url}}}),PeliasGeocoderService.prototype.geocode=function(e,t){return this._url.getDerivedResource({url:t===GeocodeType$1.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then((function(e){return e.features.map((function(e){let t;const n=e.bbox;if(defined(n))t=Rectangle.fromDegrees(n[0],n[1],n[2],n[3]);else{const n=e.geometry.coordinates[0],i=e.geometry.coordinates[1];t=Cartesian3.fromDegrees(n,i)}return{displayName:e.properties.label,destination:t}}))}))},IonGeocoderService.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)},Object.defineProperties(TimeInterval.prototype,{isEmpty:{get:function(){const e=JulianDate.compare(this.stop,this.start);return e<0||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});const scratchInterval={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};TimeInterval.fromIso8601=function(e,t){const n=e.iso8601.split("/");if(2!==n.length)throw new DeveloperError("options.iso8601 is an invalid ISO 8601 interval.");const i=JulianDate.fromIso8601(n[0]),r=JulianDate.fromIso8601(n[1]),o=defaultValue(e.isStartIncluded,!0),a=defaultValue(e.isStopIncluded,!0),s=e.data;return defined(t)?(t.start=i,t.stop=r,t.isStartIncluded=o,t.isStopIncluded=a,t.data=s,t):(scratchInterval.start=i,scratchInterval.stop=r,scratchInterval.isStartIncluded=o,scratchInterval.isStopIncluded=a,scratchInterval.data=s,new TimeInterval(scratchInterval))},TimeInterval.toIso8601=function(e,t){return JulianDate.toIso8601(e.start,t)+"/"+JulianDate.toIso8601(e.stop,t)},TimeInterval.clone=function(e,t){if(defined(e))return defined(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new TimeInterval(e)},TimeInterval.equals=function(e,t,n){return e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equals(e.start,t.start)&&JulianDate.equals(e.stop,t.stop)&&(e.data===t.data||defined(n)&&n(e.data,t.data)))},TimeInterval.equalsEpsilon=function(e,t,n,i){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equalsEpsilon(e.start,t.start,n)&&JulianDate.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||defined(i)&&i(e.data,t.data)))},TimeInterval.intersect=function(e,t,n,i){if(!defined(t))return TimeInterval.clone(TimeInterval.EMPTY,n);const r=e.start,o=e.stop,a=t.start,s=t.stop,c=JulianDate.greaterThanOrEquals(a,r)&&JulianDate.greaterThanOrEquals(o,a),l=!c&&JulianDate.lessThanOrEquals(a,r)&&JulianDate.lessThanOrEquals(r,s);if(!c&&!l)return TimeInterval.clone(TimeInterval.EMPTY,n);const u=e.isStartIncluded,d=e.isStopIncluded,h=t.isStartIncluded,p=t.isStopIncluded,f=JulianDate.lessThan(o,s);return defined(n)||(n=new TimeInterval),n.start=c?a:r,n.isStartIncluded=u&&h||!JulianDate.equals(a,r)&&(c&&h||l&&u),n.stop=f?o:s,n.isStopIncluded=f?d:d&&p||!JulianDate.equals(s,o)&&p,n.data=defined(i)?i(e.data,t.data):e.data,n},TimeInterval.contains=function(e,t){if(e.isEmpty)return!1;const n=JulianDate.compare(e.start,t);if(0===n)return e.isStartIncluded;const i=JulianDate.compare(t,e.stop);return 0===i?e.isStopIncluded:n<0&&i<0},TimeInterval.prototype.clone=function(e){return TimeInterval.clone(this,e)},TimeInterval.prototype.equals=function(e,t){return TimeInterval.equals(this,e,t)},TimeInterval.prototype.equalsEpsilon=function(e,t,n){return TimeInterval.equalsEpsilon(this,e,t,n)},TimeInterval.prototype.toString=function(){return TimeInterval.toIso8601(this)},TimeInterval.EMPTY=Object.freeze(new TimeInterval({start:new JulianDate,stop:new JulianDate,isStartIncluded:!1,isStopIncluded:!1}));const MINIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("0000-01-01T00:00:00Z")),MAXIMUM_VALUE=Object.freeze(JulianDate.fromIso8601("9999-12-31T24:00:00Z")),MAXIMUM_INTERVAL=Object.freeze(new TimeInterval({start:MINIMUM_VALUE,stop:MAXIMUM_VALUE})),Iso8601={MINIMUM_VALUE:MINIMUM_VALUE,MAXIMUM_VALUE:MAXIMUM_VALUE,MAXIMUM_INTERVAL:MAXIMUM_INTERVAL},KeyboardEventModifier={SHIFT:0,CTRL:1,ALT:2};var KeyboardEventModifier$1=Object.freeze(KeyboardEventModifier);function KTX2Transcoder(){}function makeReadyPromise(){const e=KTX2Transcoder._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then((function(){return KTX2Transcoder._transcodeTaskProcessor}));KTX2Transcoder._readyPromise=e}KTX2Transcoder._transcodeTaskProcessor=new TaskProcessor("transcodeKTX2",Number.POSITIVE_INFINITY),KTX2Transcoder._readyPromise=void 0,KTX2Transcoder.transcode=function(e,t){return defined(KTX2Transcoder._readyPromise)||makeReadyPromise(),KTX2Transcoder._readyPromise.then((function(n){let i;if(e instanceof ArrayBuffer){const r=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:r},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])})).then((function(e){const t=e.length,n=Object.keys(e[0]),i=n.length;let r;for(r=0;r<t;r++){const t=e[r];for(let e=0;e<i;e++){const i=t[n[e]];t[n[e]]=new CompressedTextureBuffer(i.internalFormat,i.datatype,i.width,i.height,i.levelBuffer)}}if(1===i){for(r=0;r<t;++r)e[r]=e[r][n[0]];1===t&&(e=e[0])}return e})).otherwise((function(e){throw e}))};const LagrangePolynomialApproximation={type:"Lagrange",getRequiredDataPoints:function(e){return Math.max(e+1,2)},interpolateOrderZero:function(e,t,n,i,r){let o,a;defined(r)||(r=new Array(i));const s=t.length;for(o=0;o<i;o++)r[o]=0;for(o=0;o<s;o++){let c=1;for(a=0;a<s;a++)if(a!==o){const n=t[o]-t[a];c*=(e-t[a])/n}for(a=0;a<i;a++)r[a]+=c*n[o*i+a]}return r}},LinearApproximation={type:"Linear"};function loadImageFromTypedArray(e){const t=e.uint8Array,n=e.format,i=e.request,r=defaultValue(e.flipY,!1),o=defaultValue(e.skipColorSpaceConversion,!1),a=new Blob([t],{type:n});let s;return Resource.supportsImageBitmapOptions().then((function(e){if(e)return when(Resource.createImageBitmapFromBlob(a,{flipY:r,premultiplyAlpha:!1,skipColorSpaceConversion:o}));s=window.URL.createObjectURL(a);return new Resource({url:s,request:i}).fetchImage({flipY:r,skipColorSpaceConversion:o})})).then((function(e){return defined(s)&&window.URL.revokeObjectURL(s),e})).otherwise((function(e){return defined(s)&&window.URL.revokeObjectURL(s),when.reject(e)}))}let supportedTranscoderFormats;function loadKTX2(e){let t;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))t=when.resolve(e);else{t=Resource.createIfNeeded(e).fetchArrayBuffer()}return t.then((function(e){return KTX2Transcoder.transcode(e,supportedTranscoderFormats)}))}function ManagedArray(e){e=defaultValue(e,0),this._array=new Array(e),this._length=e}function MapProjection(){DeveloperError.throwInstantiationError()}LinearApproximation.getRequiredDataPoints=function(e){return 2},LinearApproximation.interpolateOrderZero=function(e,t,n,i,r){let o,a,s;defined(r)||(r=new Array(i));const c=t[0],l=t[1];for(o=0;o<i;o++)a=n[o],s=n[o+i],r[o]=((s-a)*e+l*a-c*s)/(l-c);return r},loadKTX2.setKTX2SupportedFormats=function(e,t,n,i,r,o){supportedTranscoderFormats={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:r,bc7:o}},Object.defineProperties(ManagedArray.prototype,{length:{get:function(){return this._length},set:function(e){const t=this._array,n=this._length;if(e<n)for(let i=e;i<n;++i)t[i]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}}),ManagedArray.prototype.get=function(e){return this._array[e]},ManagedArray.prototype.set=function(e,t){e>=this._length&&(this.length=e+1),this._array[e]=t},ManagedArray.prototype.peek=function(){return this._array[this._length-1]},ManagedArray.prototype.push=function(e){const t=this.length++;this._array[t]=e},ManagedArray.prototype.pop=function(){if(0===this._length)return;const e=this._array[this._length-1];return--this.length,e},ManagedArray.prototype.reserve=function(e){e>this._array.length&&(this._array.length=e)},ManagedArray.prototype.resize=function(e){this.length=e},ManagedArray.prototype.trim=function(e){e=defaultValue(e,this._length),this._array.length=e},Object.defineProperties(MapProjection.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError}}),MapProjection.prototype.project=DeveloperError.throwInstantiationError,MapProjection.prototype.unproject=DeveloperError.throwInstantiationError;const leftScratchArray=[],rightScratchArray=[];function merge$1(e,t,n,i,r,o){const a=r-i+1,s=o-r,c=leftScratchArray,l=rightScratchArray;let u,d;for(u=0;u<a;++u)c[u]=e[i+u];for(d=0;d<s;++d)l[d]=e[r+d+1];u=0,d=0;for(let r=i;r<=o;++r){const i=c[u],o=l[d];u<a&&(d>=s||t(i,o,n)<=0)?(e[r]=i,++u):d<s&&(e[r]=o,++d)}}function sort(e,t,n,i,r){if(i>=r)return;const o=Math.floor(.5*(i+r));sort(e,t,n,i,o),sort(e,t,n,o+1,r),merge$1(e,t,n,i,o,r)}function mergeSort(e,t,n){const i=e.length,r=Math.ceil(.5*i);leftScratchArray.length=r,rightScratchArray.length=r,sort(e,t,n,0,i-1),leftScratchArray.length=0,rightScratchArray.length=0}const MortonOrder={};function insertOneSpacing(e){return e=1431655765&((e=858993459&((e=252645135&((e=16711935&(e^e<<8))^e<<4))^e<<2))^e<<1)}function insertTwoSpacing(e){return e=153391689&((e=51130563&((e=50393103&((e=50331903&(e^e<<16))^e<<8))^e<<4))^e<<2)}function removeOneSpacing(e){return e=65535&((e=16711935&((e=252645135&((e=858993459&((e&=1431655765)^e>>1))^e>>2))^e>>4))^e>>8)}function removeTwoSpacing(e){return e=1023&((e=4278190335&((e=50393103&((e=51130563&((e&=153391689)^e>>2))^e>>4))^e>>8))^e>>16)}function NearFarScalar(e,t,n,i){this.near=defaultValue(e,0),this.nearValue=defaultValue(t,0),this.far=defaultValue(n,1),this.farValue=defaultValue(i,0)}MortonOrder.encode2D=function(e,t){return(insertOneSpacing(e)|insertOneSpacing(t)<<1)>>>0},MortonOrder.decode2D=function(e,t){return defined(t)||(t=new Array(2)),t[0]=removeOneSpacing(e),t[1]=removeOneSpacing(e>>1),t},MortonOrder.encode3D=function(e,t,n){return insertTwoSpacing(e)|insertTwoSpacing(t)<<1|insertTwoSpacing(n)<<2},MortonOrder.decode3D=function(e,t){return defined(t)||(t=new Array(3)),t[0]=removeTwoSpacing(e),t[1]=removeTwoSpacing(e>>1),t[2]=removeTwoSpacing(e>>2),t},NearFarScalar.clone=function(e,t){if(defined(e))return defined(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new NearFarScalar(e.near,e.nearValue,e.far,e.farValue)},NearFarScalar.packedLength=4,NearFarScalar.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t},NearFarScalar.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new NearFarScalar),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n},NearFarScalar.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue},NearFarScalar.prototype.clone=function(e){return NearFarScalar.clone(this,e)},NearFarScalar.prototype.equals=function(e){return NearFarScalar.equals(this,e)};const Visibility={NONE:-1,PARTIAL:0,FULL:1};var Visibility$1=Object.freeze(Visibility);function Occluder(e,t){this._occluderPosition=Cartesian3.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const scratchCartesian3$6=new Cartesian3;Object.defineProperties(Occluder.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=Cartesian3.clone(e,this._cameraPosition);const t=Cartesian3.subtract(this._occluderPosition,e,scratchCartesian3$6);let n=Cartesian3.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let r,o,a;if(n>i){r=Math.sqrt(n-i),n=1/Math.sqrt(n),o=Cartesian3.multiplyByScalar(t,n,scratchCartesian3$6);const s=r*r*n;a=Cartesian3.add(e,Cartesian3.multiplyByScalar(o,s,scratchCartesian3$6),scratchCartesian3$6)}else r=Number.MAX_VALUE;this._horizonDistance=r,this._horizonPlaneNormal=o,this._horizonPlanePosition=a,this._cameraPosition=e}}}),Occluder.fromBoundingSphere=function(e,t,n){return defined(n)?(Cartesian3.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new Occluder(e,t)};const tempVecScratch=new Cartesian3;Occluder.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=Cartesian3.subtract(e,this._occluderPosition,tempVecScratch),n=this._occluderRadius;if(n=Cartesian3.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=Cartesian3.subtract(e,this._cameraPosition,t),n*n>Cartesian3.magnitudeSquared(t)}return!1};const occludeePositionScratch=new Cartesian3;Occluder.prototype.isBoundingSphereVisible=function(e){const t=Cartesian3.clone(e.center,occludeePositionScratch),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let e=Cartesian3.subtract(t,this._occluderPosition,tempVecScratch),i=this._occluderRadius-n;if(i=Cartesian3.magnitudeSquared(e)-i*i,n<this._occluderRadius)return i>0&&(i=Math.sqrt(i)+this._horizonDistance,e=Cartesian3.subtract(t,this._cameraPosition,e),i*i+n*n>Cartesian3.magnitudeSquared(e));if(i>0){e=Cartesian3.subtract(t,this._cameraPosition,e);const r=Cartesian3.magnitudeSquared(e),o=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+o)*a>r*o||(i=Math.sqrt(i)+this._horizonDistance,i*i+a>r)}return!0}return!1};const tempScratch=new Cartesian3;Occluder.prototype.computeVisibility=function(e){const t=Cartesian3.clone(e.center),n=e.radius;if(n>this._occluderRadius)return Visibility$1.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let e=Cartesian3.subtract(t,this._occluderPosition,tempScratch),i=this._occluderRadius-n;const r=Cartesian3.magnitudeSquared(e);if(i=r-i*i,i>0){i=Math.sqrt(i)+this._horizonDistance,e=Cartesian3.subtract(t,this._cameraPosition,e);const o=Cartesian3.magnitudeSquared(e);return i*i+n*n<o?Visibility$1.NONE:(i=this._occluderRadius+n,i=r-i*i,i>0?(i=Math.sqrt(i)+this._horizonDistance,o<i*i+n*n?Visibility$1.FULL:Visibility$1.PARTIAL):(e=Cartesian3.subtract(t,this._horizonPlanePosition,e),Cartesian3.dot(e,this._horizonPlaneNormal)>-n?Visibility$1.PARTIAL:Visibility$1.FULL))}}return Visibility$1.NONE};const occludeePointScratch=new Cartesian3;Occluder.computeOccludeePoint=function(e,t,n){const i=Cartesian3.clone(t),r=Cartesian3.clone(e.center),o=e.radius,a=n.length,s=Cartesian3.normalize(Cartesian3.subtract(i,r,occludeePointScratch),occludeePointScratch),c=-Cartesian3.dot(s,r),l=Occluder._anyRotationVector(r,s,c);let u,d=Occluder._horizonToPlaneNormalDotProduct(e,s,c,l,n[0]);if(!d)return;for(let t=1;t<a;++t){if(u=Occluder._horizonToPlaneNormalDotProduct(e,s,c,l,n[t]),!u)return;u<d&&(d=u)}if(d<.0017453283658983088)return;const h=o/d;return Cartesian3.add(r,Cartesian3.multiplyByScalar(s,h,occludeePointScratch),occludeePointScratch)};const computeOccludeePointFromRectangleScratch=[];Occluder.computeOccludeePointFromRectangle=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const n=Rectangle.subsample(e,t,0,computeOccludeePointFromRectangleScratch),i=BoundingSphere.fromPoints(n),r=Cartesian3.ZERO;if(!Cartesian3.equals(r,i.center))return Occluder.computeOccludeePoint(new BoundingSphere(r,t.minimumRadius),i.center,n)};const tempVec0Scratch=new Cartesian3;Occluder._anyRotationVector=function(e,t,n){const i=Cartesian3.abs(t,tempVec0Scratch);let r=i.x>i.y?0:1;(0===r&&i.z>i.x||1===r&&i.z>i.y)&&(r=2);const o=new Cartesian3;let a;0===r?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,a=Cartesian3.UNIT_X):1===r?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,a=Cartesian3.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,a=Cartesian3.UNIT_Z);const s=(Cartesian3.dot(t,i)+n)/-Cartesian3.dot(t,a);return Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(i,Cartesian3.multiplyByScalar(a,s,o),i),e,i),i)};const posDirectionScratch=new Cartesian3;Occluder._rotationVector=function(e,t,n,i,r){let o=Cartesian3.subtract(i,e,posDirectionScratch);if(o=Cartesian3.normalize(o,o),Cartesian3.dot(t,o)<.9999999847691291){const e=Cartesian3.cross(t,o,o);if(Cartesian3.magnitude(e)>CesiumMath.EPSILON13)return Cartesian3.normalize(e,new Cartesian3)}return r};const posScratch1=new Cartesian3,occluerPosScratch=new Cartesian3,posScratch2=new Cartesian3,horizonPlanePosScratch=new Cartesian3;function OffsetGeometryInstanceAttribute(e,t,n){e=defaultValue(e,0),t=defaultValue(t,0),n=defaultValue(n,0),this.value=new Float32Array([e,t,n])}function OpenCageGeocoderService(e,t,n){(e=Resource.createIfNeeded(e)).appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=defaultValue(n,{})}Occluder._horizonToPlaneNormalDotProduct=function(e,t,n,i,r){const o=Cartesian3.clone(r,posScratch1),a=Cartesian3.clone(e.center,occluerPosScratch),s=e.radius;let c=Cartesian3.subtract(a,o,posScratch2);const l=Cartesian3.magnitudeSquared(c),u=s*s;if(l<u)return!1;const d=l-u,h=Math.sqrt(d),p=h*(1/Math.sqrt(l))*h;c=Cartesian3.normalize(c,c);const f=Cartesian3.add(o,Cartesian3.multiplyByScalar(c,p,horizonPlanePosScratch),horizonPlanePosScratch),m=Math.sqrt(d-p*p);let g=this._rotationVector(a,t,n,o,i),_=Cartesian3.fromElements(g.x*g.x*c.x+(g.x*g.y-g.z)*c.y+(g.x*g.z+g.y)*c.z,(g.x*g.y+g.z)*c.x+g.y*g.y*c.y+(g.y*g.z-g.x)*c.z,(g.x*g.z-g.y)*c.x+(g.y*g.z+g.x)*c.y+g.z*g.z*c.z,posScratch1);_=Cartesian3.normalize(_,_);const y=Cartesian3.multiplyByScalar(_,m,posScratch1);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(f,y,posScratch2),a,posScratch2),posScratch2);const C=Cartesian3.dot(t,g);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.subtract(f,y,g),a,g),g);const T=Cartesian3.dot(t,g);return C<T?C:T},Object.defineProperties(OffsetGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),OffsetGeometryInstanceAttribute.fromCartesian3=function(e){return new OffsetGeometryInstanceAttribute(e.x,e.y,e.z)},OffsetGeometryInstanceAttribute.toValue=function(e,t){return defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t},Object.defineProperties(OpenCageGeocoderService.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}}}),OpenCageGeocoderService.prototype.geocode=function(e){return this._url.getDerivedResource({url:"json",queryParameters:combine$2(this._params,{q:e})}).fetchJson().then((function(e){return e.results.map((function(e){let t;const n=e.bounds;if(defined(n))t=Rectangle.fromDegrees(n.southwest.lng,n.southwest.lat,n.northeast.lng,n.northeast.lat);else{const n=e.geometry.lat,i=e.geometry.lng;t=Cartesian3.fromDegrees(n,i)}return{displayName:e.formatted,destination:t}}))}))};const Packable={packedLength:void 0,pack:DeveloperError.throwInstantiationError,unpack:DeveloperError.throwInstantiationError},PackableForInterpolation={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:DeveloperError.throwInstantiationError,unpackInterpolationResult:DeveloperError.throwInstantiationError};function measureText(e,t,n,i,r){const o=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),s=document.createElement("canvas"),c=100,l=o.width+c|0,u=3*a,d=u/2;s.width=l,s.height=u;const h=s.getContext("2d");h.font=n,h.fillStyle="white",h.fillRect(0,0,s.width+1,s.height+1),i&&(h.strokeStyle="black",h.lineWidth=e.lineWidth,h.strokeText(t,c/2,d)),r&&(h.fillStyle="black",h.fillText(t,c/2,d));const p=h.getImageData(0,0,l,u).data,f=p.length,m=4*l;let g,_,y,C;for(g=0;g<f;++g)if(255!==p[g]){y=g/m|0;break}for(g=f-1;g>=0;--g)if(255!==p[g]){C=g/m|0;break}let T=-1;for(g=0;g<l&&-1===T;++g)for(_=0;_<u;++_){const e=4*g+_*m;if(255!==p[e]||255!==p[e+1]||255!==p[e+2]||255!==p[e+3]){T=g;break}}return{width:o.width,height:C-y,ascent:d-y,descent:C-d,minx:T-c/2}}return{width:o.width,height:0,ascent:0,descent:0,minx:0}}let imageSmoothingEnabledName;function writeTextToCanvas(e,t){if(""===e)return;t=defaultValue(t,defaultValue.EMPTY_OBJECT);const n=defaultValue(t.font,"10px sans-serif"),i=defaultValue(t.stroke,!1),r=defaultValue(t.fill,!0),o=defaultValue(t.strokeWidth,1),a=defaultValue(t.backgroundColor,Color.TRANSPARENT),s=defaultValue(t.padding,0),c=2*s,l=document.createElement("canvas");l.width=1,l.height=1,l.style.font=n;const u=l.getContext("2d");defined(imageSmoothingEnabledName)||(defined(u.imageSmoothingEnabled)?imageSmoothingEnabledName="imageSmoothingEnabled":defined(u.mozImageSmoothingEnabled)?imageSmoothingEnabledName="mozImageSmoothingEnabled":defined(u.webkitImageSmoothingEnabled)?imageSmoothingEnabledName="webkitImageSmoothingEnabled":defined(u.msImageSmoothingEnabled)&&(imageSmoothingEnabledName="msImageSmoothingEnabled")),u.font=n,u.lineJoin="round",u.lineWidth=o,u[imageSmoothingEnabledName]=!1,l.style.visibility="hidden",document.body.appendChild(l);const d=measureText(u,e,n,i,r);l.dimensions=d,document.body.removeChild(l),l.style.visibility="";const h=-d.minx,p=Math.ceil(d.width)+h+c,f=d.height+c,m=f-(f-d.ascent+s)+c;if(l.width=p,l.height=f,u.font=n,u.lineJoin="round",u.lineWidth=o,u[imageSmoothingEnabledName]=!1,a!==Color.TRANSPARENT&&(u.fillStyle=a.toCssColorString(),u.fillRect(0,0,l.width,l.height)),i){const n=defaultValue(t.strokeColor,Color.BLACK);u.strokeStyle=n.toCssColorString(),u.strokeText(e,h+s,m)}if(r){const n=defaultValue(t.fillColor,Color.WHITE);u.fillStyle=n.toCssColorString(),u.fillText(e,h+s,m)}return l}function PinBuilder(){this._cache={}}PinBuilder.prototype.fromColor=function(e,t){return createPin(void 0,void 0,e,t,this._cache)},PinBuilder.prototype.fromUrl=function(e,t,n){return createPin(e,void 0,t,n,this._cache)},PinBuilder.prototype.fromMakiIconId=function(e,t,n){return createPin(buildModuleUrl("Assets/Textures/maki/"+encodeURIComponent(e)+".png"),void 0,t,n,this._cache)},PinBuilder.prototype.fromText=function(e,t,n){return createPin(void 0,e,t,n,this._cache)};const colorScratch$7=new Color;function drawPin(e,t,n){e.save(),e.scale(n/24,n/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,colorScratch$7).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function drawIcon(e,t,n){const i=n/2.5;let r=i,o=i;t.width>t.height?o=i*(t.height/t.width):t.width<t.height&&(r=i*(t.width/t.height));const a=Math.round((n-r)/2),s=Math.round(7/24*n-o/2);e.globalCompositeOperation="destination-out",e.drawImage(t,a-1,s,r,o),e.drawImage(t,a,s-1,r,o),e.drawImage(t,a+1,s,r,o),e.drawImage(t,a,s+1,r,o),e.globalCompositeOperation="destination-over",e.fillStyle=Color.BLACK.toCssColorString(),e.fillRect(a-1,s-1,r+2,o+2),e.globalCompositeOperation="destination-out",e.drawImage(t,a,s,r,o),e.globalCompositeOperation="destination-over",e.fillStyle=Color.WHITE.toCssColorString(),e.fillRect(a-1,s-2,r+2,o+2)}const stringifyScratch=new Array(4);function createPin(e,t,n,i,r){stringifyScratch[0]=e,stringifyScratch[1]=t,stringifyScratch[2]=n,stringifyScratch[3]=i;const o=JSON.stringify(stringifyScratch),a=r[o];if(defined(a))return a;const s=document.createElement("canvas");s.width=i,s.height=i;const c=s.getContext("2d");if(drawPin(c,n,i),defined(e)){const t=Resource.createIfNeeded(e).fetchImage().then((function(e){return drawIcon(c,e,i),r[o]=s,s}));return r[o]=t,t}if(defined(t)){const e=writeTextToCanvas(t,{font:"bold "+i+"px sans-serif"});drawIcon(c,e,i)}return r[o]=s,s}const PixelDatatype={UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,FLOAT:WebGLConstants$1.FLOAT,HALF_FLOAT:WebGLConstants$1.HALF_FLOAT_OES,UNSIGNED_INT_24_8:WebGLConstants$1.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:WebGLConstants$1.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:WebGLConstants$1.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:WebGLConstants$1.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(e,t){switch(e){case PixelDatatype.UNSIGNED_BYTE:return WebGLConstants$1.UNSIGNED_BYTE;case PixelDatatype.UNSIGNED_SHORT:return WebGLConstants$1.UNSIGNED_SHORT;case PixelDatatype.UNSIGNED_INT:return WebGLConstants$1.UNSIGNED_INT;case PixelDatatype.FLOAT:return WebGLConstants$1.FLOAT;case PixelDatatype.HALF_FLOAT:return t.webgl2?WebGLConstants$1.HALF_FLOAT:WebGLConstants$1.HALF_FLOAT_OES;case PixelDatatype.UNSIGNED_INT_24_8:return WebGLConstants$1.UNSIGNED_INT_24_8;case PixelDatatype.UNSIGNED_SHORT_4_4_4_4:return WebGLConstants$1.UNSIGNED_SHORT_4_4_4_4;case PixelDatatype.UNSIGNED_SHORT_5_5_5_1:return WebGLConstants$1.UNSIGNED_SHORT_5_5_5_1;case PixelDatatype.UNSIGNED_SHORT_5_6_5:return PixelDatatype.UNSIGNED_SHORT_5_6_5}},isPacked:function(e){return e===PixelDatatype.UNSIGNED_INT_24_8||e===PixelDatatype.UNSIGNED_SHORT_4_4_4_4||e===PixelDatatype.UNSIGNED_SHORT_5_5_5_1||e===PixelDatatype.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(e){switch(e){case PixelDatatype.UNSIGNED_BYTE:return 1;case PixelDatatype.UNSIGNED_SHORT:case PixelDatatype.UNSIGNED_SHORT_4_4_4_4:case PixelDatatype.UNSIGNED_SHORT_5_5_5_1:case PixelDatatype.UNSIGNED_SHORT_5_6_5:case PixelDatatype.HALF_FLOAT:return 2;case PixelDatatype.UNSIGNED_INT:case PixelDatatype.FLOAT:case PixelDatatype.UNSIGNED_INT_24_8:return 4}},validate:function(e){return e===PixelDatatype.UNSIGNED_BYTE||e===PixelDatatype.UNSIGNED_SHORT||e===PixelDatatype.UNSIGNED_INT||e===PixelDatatype.FLOAT||e===PixelDatatype.HALF_FLOAT||e===PixelDatatype.UNSIGNED_INT_24_8||e===PixelDatatype.UNSIGNED_SHORT_4_4_4_4||e===PixelDatatype.UNSIGNED_SHORT_5_5_5_1||e===PixelDatatype.UNSIGNED_SHORT_5_6_5}};var PixelDatatype$1=Object.freeze(PixelDatatype);const PixelFormat={DEPTH_COMPONENT:WebGLConstants$1.DEPTH_COMPONENT,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,ALPHA:WebGLConstants$1.ALPHA,RGB:WebGLConstants$1.RGB,RGBA:WebGLConstants$1.RGBA,LUMINANCE:WebGLConstants$1.LUMINANCE,LUMINANCE_ALPHA:WebGLConstants$1.LUMINANCE_ALPHA,RGB_DXT1:WebGLConstants$1.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:WebGLConstants$1.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:WebGLConstants$1.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:WebGLConstants$1.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:WebGLConstants$1.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:WebGLConstants$1.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:WebGLConstants$1.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:WebGLConstants$1.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:WebGLConstants$1.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:WebGLConstants$1.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(e){switch(e){case PixelFormat.RGB:return 3;case PixelFormat.RGBA:return 4;case PixelFormat.LUMINANCE_ALPHA:return 2;case PixelFormat.ALPHA:case PixelFormat.LUMINANCE:default:return 1}},validate:function(e){return e===PixelFormat.DEPTH_COMPONENT||e===PixelFormat.DEPTH_STENCIL||e===PixelFormat.ALPHA||e===PixelFormat.RGB||e===PixelFormat.RGBA||e===PixelFormat.LUMINANCE||e===PixelFormat.LUMINANCE_ALPHA||e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5||e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1||e===PixelFormat.RGBA_ASTC||e===PixelFormat.RGB_ETC1||e===PixelFormat.RGB8_ETC2||e===PixelFormat.RGBA8_ETC2_EAC||e===PixelFormat.RGBA_BC7},isColorFormat:function(e){return e===PixelFormat.ALPHA||e===PixelFormat.RGB||e===PixelFormat.RGBA||e===PixelFormat.LUMINANCE||e===PixelFormat.LUMINANCE_ALPHA},isDepthFormat:function(e){return e===PixelFormat.DEPTH_COMPONENT||e===PixelFormat.DEPTH_STENCIL},isCompressedFormat:function(e){return e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5||e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1||e===PixelFormat.RGBA_ASTC||e===PixelFormat.RGB_ETC1||e===PixelFormat.RGB8_ETC2||e===PixelFormat.RGBA8_ETC2_EAC||e===PixelFormat.RGBA_BC7},isDXTFormat:function(e){return e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5},isPVRTCFormat:function(e){return e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1},isASTCFormat:function(e){return e===PixelFormat.RGBA_ASTC},isETC1Format:function(e){return e===PixelFormat.RGB_ETC1},isETC2Format:function(e){return e===PixelFormat.RGB8_ETC2||e===PixelFormat.RGBA8_ETC2_EAC},isBC7Format:function(e){return e===PixelFormat.RGBA_BC7},compressedTextureSizeInBytes:function(e,t,n){switch(e){case PixelFormat.RGB_DXT1:case PixelFormat.RGBA_DXT1:case PixelFormat.RGB_ETC1:case PixelFormat.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case PixelFormat.RGBA_DXT3:case PixelFormat.RGBA_DXT5:case PixelFormat.RGBA_ASTC:case PixelFormat.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case PixelFormat.RGB_PVRTC_4BPPV1:case PixelFormat.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case PixelFormat.RGB_PVRTC_2BPPV1:case PixelFormat.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case PixelFormat.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}},textureSizeInBytes:function(e,t,n,i){let r=PixelFormat.componentsLength(e);return PixelDatatype$1.isPacked(t)&&(r=1),r*PixelDatatype$1.sizeInBytes(t)*n*i},alignmentInBytes:function(e,t,n){const i=PixelFormat.textureSizeInBytes(e,t,n,1)%4;return 0===i?4:2===i?2:1},createTypedArray:function(e,t,n,i){let r;const o=PixelDatatype$1.sizeInBytes(t);r=o===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:o===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:o===Float32Array.BYTES_PER_ELEMENT&&t===PixelDatatype$1.FLOAT?Float32Array:Uint32Array;return new r(PixelFormat.componentsLength(e)*n*i)},flipY:function(e,t,n,i,r){if(1===r)return e;const o=PixelFormat.createTypedArray(t,n,i,r),a=PixelFormat.componentsLength(t),s=i*a;for(let t=0;t<r;++t){const n=t*i*a,c=(r-t-1)*i*a;for(let t=0;t<s;++t)o[c+t]=e[n+t]}return o},toInternalFormat:function(e,t,n){if(!n.webgl2)return e;if(e===PixelFormat.DEPTH_STENCIL)return WebGLConstants$1.DEPTH24_STENCIL8;if(e===PixelFormat.DEPTH_COMPONENT){if(t===PixelDatatype$1.UNSIGNED_SHORT)return WebGLConstants$1.DEPTH_COMPONENT16;if(t===PixelDatatype$1.UNSIGNED_INT)return WebGLConstants$1.DEPTH_COMPONENT24}if(t===PixelDatatype$1.FLOAT)switch(e){case PixelFormat.RGBA:return WebGLConstants$1.RGBA32F;case PixelFormat.RGB:return WebGLConstants$1.RGB32F;case PixelFormat.RG:return WebGLConstants$1.RG32F;case PixelFormat.R:return WebGLConstants$1.R32F}if(t===PixelDatatype$1.HALF_FLOAT)switch(e){case PixelFormat.RGBA:return WebGLConstants$1.RGBA16F;case PixelFormat.RGB:return WebGLConstants$1.RGB16F;case PixelFormat.RG:return WebGLConstants$1.RG16F;case PixelFormat.R:return WebGLConstants$1.R16F}return e}};var PixelFormat$1=Object.freeze(PixelFormat);function PlaneGeometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}PlaneGeometry.packedLength=VertexFormat.packedLength,PlaneGeometry.pack=function(e,t,n){return n=defaultValue(n,0),VertexFormat.pack(e._vertexFormat,t,n),t};const scratchVertexFormat$5=new VertexFormat,scratchOptions$9={vertexFormat:scratchVertexFormat$5};PlaneGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=VertexFormat.unpack(e,t,scratchVertexFormat$5);return defined(n)?(n._vertexFormat=VertexFormat.clone(i,n._vertexFormat),n):new PlaneGeometry(scratchOptions$9)};const min$1=new Cartesian3(-.5,-.5,0),max$1=new Cartesian3(.5,.5,0);function PlaneOutlineGeometry(){this._workerName="createPlaneOutlineGeometry"}PlaneGeometry.createGeometry=function(e){const t=e._vertexFormat,n=new GeometryAttributes;let i,r;if(t.position){if(r=new Float64Array(12),r[0]=min$1.x,r[1]=min$1.y,r[2]=0,r[3]=max$1.x,r[4]=min$1.y,r[5]=0,r[6]=max$1.x,r[7]=max$1.y,r[8]=0,r[9]=min$1.x,r[10]=max$1.y,r[11]=0,n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:r}),t.normal){const e=new Float32Array(12);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=1,e[9]=0,e[10]=0,e[11]=1,n.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(t.st){const e=new Float32Array(8);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=1,e[5]=1,e[6]=0,e[7]=1,n.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:e})}if(t.tangent){const e=new Float32Array(12);e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=1,e[7]=0,e[8]=0,e[9]=1,e[10]=0,e[11]=0,n.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}if(t.bitangent){const e=new Float32Array(12);e[0]=0,e[1]=1,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=1,e[8]=0,e[9]=0,e[10]=1,e[11]=0,n.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}i=new Uint16Array(6),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3}return new Geometry({attributes:n,indices:i,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})},PlaneOutlineGeometry.packedLength=0,PlaneOutlineGeometry.pack=function(e,t){return t},PlaneOutlineGeometry.unpack=function(e,t,n){return defined(n)?n:new PlaneOutlineGeometry};const min=new Cartesian3(-.5,-.5,0),max=new Cartesian3(.5,.5,0);PlaneOutlineGeometry.createGeometry=function(){const e=new GeometryAttributes,t=new Uint16Array(8),n=new Float64Array(12);return n[0]=min.x,n[1]=min.y,n[2]=min.z,n[3]=max.x,n[4]=min.y,n[5]=min.z,n[6]=max.x,n[7]=max.y,n[8]=min.z,n[9]=min.x,n[10]=max.y,n[11]=min.z,e.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:n}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new Geometry({attributes:e,indices:t,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})};const scratchBarycentricCoords=new Cartesian3;function pointInsideTriangle(e,t,n,i){const r=barycentricCoordinates(e,t,n,i,scratchBarycentricCoords);return!!defined(r)&&(r.x>0&&r.y>0&&r.z>0)}const scratchCarto1=new Cartographic,scratchCarto2=new Cartographic;function adjustPosHeightsForNormal(e,t,n,i){const r=i.cartesianToCartographic(e,scratchCarto1).height,o=i.cartesianToCartographic(t,scratchCarto2);o.height=r,i.cartographicToCartesian(o,t);const a=i.cartesianToCartographic(n,scratchCarto2);a.height=r-100,i.cartographicToCartesian(a,n)}const scratchBoundingRectangle=new BoundingRectangle,scratchPosition$a=new Cartesian3,scratchNormal$2=new Cartesian3,scratchTangent$1=new Cartesian3,scratchBitangent$1=new Cartesian3,p1Scratch=new Cartesian3,p2Scratch=new Cartesian3;let scratchPerPosNormal=new Cartesian3,scratchPerPosTangent=new Cartesian3,scratchPerPosBitangent=new Cartesian3;const appendTextureCoordinatesOrigin=new Cartesian2,appendTextureCoordinatesCartesian2=new Cartesian2,appendTextureCoordinatesCartesian3=new Cartesian3,appendTextureCoordinatesQuaternion=new Quaternion,appendTextureCoordinatesMatrix3=new Matrix3,tangentMatrixScratch=new Matrix3;function computeAttributes$2(e){const t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,r=n.attributes.position.values;let o=r.length;const a=e.wall,s=e.top||a,c=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){const l=e.boundingRectangle,u=e.tangentPlane,d=e.ellipsoid,h=e.stRotation,p=e.perPositionHeight,f=appendTextureCoordinatesOrigin;f.x=l.x,f.y=l.y;const m=t.st?new Float32Array(o/3*2):void 0;let g;t.normal&&(g=p&&s&&!a?n.attributes.normal.values:new Float32Array(o));const _=t.tangent?new Float32Array(o):void 0,y=t.bitangent?new Float32Array(o):void 0,C=i?new Float32Array(o):void 0;let T=0,S=0,A=scratchNormal$2,v=scratchTangent$1,E=scratchBitangent$1,b=!0,x=appendTextureCoordinatesMatrix3,P=tangentMatrixScratch;if(0!==h){let e=Quaternion.fromAxisAngle(u._plane.normal,h,appendTextureCoordinatesQuaternion);x=Matrix3.fromQuaternion(e,x),e=Quaternion.fromAxisAngle(u._plane.normal,-h,appendTextureCoordinatesQuaternion),P=Matrix3.fromQuaternion(e,P)}else x=Matrix3.clone(Matrix3.IDENTITY,x),P=Matrix3.clone(Matrix3.IDENTITY,P);let D=0,w=0;s&&c&&(D=o/2,w=o/3,o/=2);for(let n=0;n<o;n+=3){const h=Cartesian3.fromArray(r,n,appendTextureCoordinatesCartesian3);if(t.st){let e=Matrix3.multiplyByVector(x,h,scratchPosition$a);e=d.scaleToGeodeticSurface(e,e);const t=u.projectPointOntoPlane(e,appendTextureCoordinatesCartesian2);Cartesian2.subtract(t,f,t);const n=CesiumMath.clamp(t.x/l.width,0,1),i=CesiumMath.clamp(t.y/l.height,0,1);c&&(m[T+w]=n,m[T+1+w]=i),s&&(m[T]=n,m[T+1]=i),T+=2}if(t.normal||t.tangent||t.bitangent||i){const l=S+1,u=S+2;if(a){if(n+3<o){const e=Cartesian3.fromArray(r,n+3,p1Scratch);if(b){const t=Cartesian3.fromArray(r,n+o,p2Scratch);p&&adjustPosHeightsForNormal(h,e,t,d),Cartesian3.subtract(e,h,e),Cartesian3.subtract(t,h,t),A=Cartesian3.normalize(Cartesian3.cross(t,e,A),A),b=!1}Cartesian3.equalsEpsilon(e,h,CesiumMath.EPSILON10)&&(b=!0)}(t.tangent||t.bitangent)&&(E=d.geodeticSurfaceNormal(h,E),t.tangent&&(v=Cartesian3.normalize(Cartesian3.cross(E,A,v),v)))}else A=d.geodeticSurfaceNormal(h,A),(t.tangent||t.bitangent)&&(p&&(scratchPerPosNormal=Cartesian3.fromArray(g,S,scratchPerPosNormal),scratchPerPosTangent=Cartesian3.cross(Cartesian3.UNIT_Z,scratchPerPosNormal,scratchPerPosTangent),scratchPerPosTangent=Cartesian3.normalize(Matrix3.multiplyByVector(P,scratchPerPosTangent,scratchPerPosTangent),scratchPerPosTangent),t.bitangent&&(scratchPerPosBitangent=Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal,scratchPerPosTangent,scratchPerPosBitangent),scratchPerPosBitangent))),v=Cartesian3.cross(Cartesian3.UNIT_Z,A,v),v=Cartesian3.normalize(Matrix3.multiplyByVector(P,v,v),v),t.bitangent&&(E=Cartesian3.normalize(Cartesian3.cross(A,v,E),E)));t.normal&&(e.wall?(g[S+D]=A.x,g[l+D]=A.y,g[u+D]=A.z):c&&(g[S+D]=-A.x,g[l+D]=-A.y,g[u+D]=-A.z),(s&&!p||a)&&(g[S]=A.x,g[l]=A.y,g[u]=A.z)),i&&(a&&(A=d.geodeticSurfaceNormal(h,A)),C[S+D]=-A.x,C[l+D]=-A.y,C[u+D]=-A.z),t.tangent&&(e.wall?(_[S+D]=v.x,_[l+D]=v.y,_[u+D]=v.z):c&&(_[S+D]=-v.x,_[l+D]=-v.y,_[u+D]=-v.z),s&&(p?(_[S]=scratchPerPosTangent.x,_[l]=scratchPerPosTangent.y,_[u]=scratchPerPosTangent.z):(_[S]=v.x,_[l]=v.y,_[u]=v.z))),t.bitangent&&(c&&(y[S+D]=E.x,y[l+D]=E.y,y[u+D]=E.z),s&&(p?(y[S]=scratchPerPosBitangent.x,y[l]=scratchPerPosBitangent.y,y[u]=scratchPerPosBitangent.z):(y[S]=E.x,y[l]=E.y,y[u]=E.z))),S+=3}}t.st&&(n.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:m})),t.normal&&(n.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),t.tangent&&(n.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),t.bitangent&&(n.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),i&&(n.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C}))}if(e.extrude&&defined(e.offsetAttribute)){const t=r.length/3;let i=new Uint8Array(t);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)s&&c||a?i=arrayFill(i,1,0,t/2):s&&(i=arrayFill(i,1));else{i=arrayFill(i,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1)}n.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return n}const startCartographicScratch=new Cartographic,endCartographicScratch=new Cartographic,idlCross={westOverIDL:0,eastOverIDL:0};let ellipsoidGeodesic=new EllipsoidGeodesic;function computeRectangle$1(e,t,n,i,r){if(r=defaultValue(r,new Rectangle),!defined(e)||e.length<3)return r.west=0,r.north=0,r.south=0,r.east=0,r;if(n===ArcType$1.RHUMB)return Rectangle.fromCartesianArray(e,t,r);ellipsoidGeodesic.ellipsoid.equals(t)||(ellipsoidGeodesic=new EllipsoidGeodesic(void 0,void 0,t)),r.west=Number.POSITIVE_INFINITY,r.east=Number.NEGATIVE_INFINITY,r.south=Number.POSITIVE_INFINITY,r.north=Number.NEGATIVE_INFINITY,idlCross.westOverIDL=Number.POSITIVE_INFINITY,idlCross.eastOverIDL=Number.NEGATIVE_INFINITY;const o=1/CesiumMath.chordLength(i,t.maximumRadius),a=e.length;let s,c=t.cartesianToCartographic(e[0],endCartographicScratch),l=startCartographicScratch;for(let n=1;n<a;n++)s=l,l=c,c=t.cartesianToCartographic(e[n],s),ellipsoidGeodesic.setEndPoints(l,c),interpolateAndGrowRectangle(ellipsoidGeodesic,o,r,idlCross);return s=l,l=c,c=t.cartesianToCartographic(e[0],s),ellipsoidGeodesic.setEndPoints(l,c),interpolateAndGrowRectangle(ellipsoidGeodesic,o,r,idlCross),r.east-r.west>idlCross.eastOverIDL-idlCross.westOverIDL&&(r.west=idlCross.westOverIDL,r.east=idlCross.eastOverIDL,r.east>CesiumMath.PI&&(r.east=r.east-CesiumMath.TWO_PI),r.west>CesiumMath.PI&&(r.west=r.west-CesiumMath.TWO_PI)),r}const interpolatedCartographicScratch=new Cartographic;function interpolateAndGrowRectangle(e,t,n,i){const r=e.surfaceDistance,o=Math.ceil(r*t),a=o>0?r/(o-1):Number.POSITIVE_INFINITY;let s=0;for(let t=0;t<o;t++){const t=e.interpolateUsingSurfaceDistance(s,interpolatedCartographicScratch);s+=a;const r=t.longitude,o=t.latitude;n.west=Math.min(n.west,r),n.east=Math.max(n.east,r),n.south=Math.min(n.south,o),n.north=Math.max(n.north,o);const c=r>=0?r:r+CesiumMath.TWO_PI;i.westOverIDL=Math.min(i.westOverIDL,c),i.eastOverIDL=Math.max(i.eastOverIDL,c)}}const createGeometryFromPositionsExtrudedPositions=[];function createGeometryFromPositionsExtruded$1(e,t,n,i,r,o,a,s,c){const l={walls:[]};let u;if(o||a){const i=PolygonGeometryLibrary.createGeometryFromPositions(e,t,n,r,s,c),d=i.attributes.position.values,h=i.indices;let p,f;if(o&&a){const e=d.concat(d);p=e.length/3,f=IndexDatatype$1.createTypedArray(p,2*h.length),f.set(h);const t=h.length,n=p/2;for(u=0;u<t;u+=3){const e=f[u]+n,i=f[u+1]+n,r=f[u+2]+n;f[u+t]=r,f[u+1+t]=i,f[u+2+t]=e}if(i.attributes.position.values=e,r&&s.normal){const t=i.attributes.normal.values;i.attributes.normal.values=new Float32Array(e.length),i.attributes.normal.values.set(t)}i.indices=f}else if(a){for(p=d.length/3,f=IndexDatatype$1.createTypedArray(p,h.length),u=0;u<h.length;u+=3)f[u]=h[u+2],f[u+1]=h[u+1],f[u+2]=h[u];i.indices=f}l.topAndBottom=new GeometryInstance({geometry:i})}let d=i.outerRing,h=EllipsoidTangentPlane.fromPoints(d,e),p=h.projectPointsOntoPlane(d,createGeometryFromPositionsExtrudedPositions),f=PolygonPipeline.computeWindingOrder2D(p);f===WindingOrder$1.CLOCKWISE&&(d=d.slice().reverse());let m=PolygonGeometryLibrary.computeWallGeometry(d,e,n,r,c);l.walls.push(new GeometryInstance({geometry:m}));const g=i.holes;for(u=0;u<g.length;u++){let t=g[u];h=EllipsoidTangentPlane.fromPoints(t,e),p=h.projectPointsOntoPlane(t,createGeometryFromPositionsExtrudedPositions),f=PolygonPipeline.computeWindingOrder2D(p),f===WindingOrder$1.COUNTER_CLOCKWISE&&(t=t.slice().reverse()),m=PolygonGeometryLibrary.computeWallGeometry(t,e,n,r,c),l.walls.push(new GeometryInstance({geometry:m}))}return l}function PolygonGeometry(e){const t=e.polygonHierarchy,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.stRotation,0),a=defaultValue(e.perPositionHeight,!1),s=a&&defined(e.extrudedHeight);let c=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,c);if(!s){const e=Math.max(c,l);l=Math.min(c,l),c=e}this._vertexFormat=VertexFormat.clone(n),this._ellipsoid=Ellipsoid.clone(i),this._granularity=r,this._stRotation=o,this._height=c,this._extrudedHeight=l,this._closeTop=defaultValue(e.closeTop,!0),this._closeBottom=defaultValue(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=s,this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+VertexFormat.packedLength+12}PolygonGeometry.fromPositions=function(e){return new PolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType})},PolygonGeometry.pack=function(e,t,n){return n=defaultValue(n,0),n=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n),Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._stRotation,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._closeTop?1:0,t[n++]=e._closeBottom?1:0,t[n++]=e._shadowVolume?1:0,t[n++]=defaultValue(e._offsetAttribute,-1),t[n++]=e._arcType,t[n]=e.packedLength,t};const scratchEllipsoid$9=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$4=new VertexFormat,dummyOptions$1={polygonHierarchy:{}};function textureCoordinateRotationPoints$1(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const n=e._ellipsoid,i=e._polygonHierarchy.positions,r=e.rectangle;return Geometry._textureCoordinateRotationPoints(i,t,n,r)}function PolygonHierarchy(e,t){this.positions=defined(e)?e:[],this.holes=defined(t)?t:[]}PolygonGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=i.startingIndex,delete i.startingIndex;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$9);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$4);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=1===e[t++],d=1===e[t++],h=1===e[t++],p=1===e[t++],f=1===e[t++],m=e[t++],g=e[t++],_=e[t];return defined(n)||(n=new PolygonGeometry(dummyOptions$1)),n._polygonHierarchy=i,n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._height=a,n._extrudedHeight=s,n._granularity=c,n._stRotation=l,n._perPositionHeightExtrude=u,n._perPositionHeight=d,n._closeTop=h,n._closeBottom=p,n._shadowVolume=f,n._offsetAttribute=-1===m?void 0:m,n._arcType=g,n.packedLength=_,n},PolygonGeometry.computeRectangle=function(e,t){const n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),i=defaultValue(e.arcType,ArcType$1.GEODESIC),r=e.polygonHierarchy,o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle$1(r.positions,o,i,n,t)},PolygonGeometry.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,r=e._stRotation,o=e._polygonHierarchy,a=e._perPositionHeight,s=e._closeTop,c=e._closeBottom,l=e._arcType;let u=o.positions;if(u.length<3)return;const d=EllipsoidTangentPlane.fromPoints(u,n),h=PolygonGeometryLibrary.polygonsFromHierarchy(o,d.projectPointsOntoPlane.bind(d),!a,n),p=h.hierarchy,f=h.polygons;if(0===p.length)return;u=p[0].outerRing;const m=PolygonGeometryLibrary.computeBoundingRectangle(d.plane.normal,d.projectPointOntoPlane.bind(d),u,r,scratchBoundingRectangle),g=[],_=e._height,y=e._extrudedHeight,C={perPositionHeight:a,vertexFormat:t,geometry:void 0,tangentPlane:d,boundingRectangle:m,ellipsoid:n,stRotation:r,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:l};let T;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(_,y,0,CesiumMath.EPSILON2))for(C.extrude=!0,C.top=s,C.bottom=c,C.shadowVolume=e._shadowVolume,C.offsetAttribute=e._offsetAttribute,T=0;T<f.length;T++){const e=createGeometryFromPositionsExtruded$1(n,f[T],i,p[T],a,s,c,t,l);let r;s&&c?(r=e.topAndBottom,C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(r.geometry,_,y,n,a)):s?(r=e.topAndBottom,r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,_,n,!a),C.geometry=r.geometry):c&&(r=e.topAndBottom,r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,y,n,!0),C.geometry=r.geometry),(s||c)&&(C.wall=!1,r.geometry=computeAttributes$2(C),g.push(r));const o=e.walls;C.wall=!0;for(let e=0;e<o.length;e++){const t=o[e];C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(t.geometry,_,y,n,a),t.geometry=computeAttributes$2(C),g.push(t)}}else for(T=0;T<f.length;T++){const r=new GeometryInstance({geometry:PolygonGeometryLibrary.createGeometryFromPositions(n,f[T],i,a,t,l)});if(r.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.geometry.attributes.position.values,_,n,!a),C.geometry=r.geometry,r.geometry=computeAttributes$2(C),defined(e._offsetAttribute)){const t=r.geometry.attributes.position.values.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),r.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}g.push(r)}const S=GeometryPipeline.combineInstances(g)[0];S.attributes.position.values=new Float64Array(S.attributes.position.values),S.indices=IndexDatatype$1.createTypedArray(S.attributes.position.values.length/3,S.indices);const A=S.attributes,v=BoundingSphere.fromVertices(A.position.values);return t.position||delete A.position,new Geometry({attributes:A,indices:S.indices,primitiveType:S.primitiveType,boundingSphere:v,offsetAttribute:e._offsetAttribute})},PolygonGeometry.createShadowVolume=function(e,t,n){const i=e._granularity,r=e._ellipsoid,o=t(i,r),a=n(i,r);return new PolygonGeometry({polygonHierarchy:e._polygonHierarchy,ellipsoid:r,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},Object.defineProperties(PolygonGeometry.prototype,{rectangle:{get:function(){if(!defined(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=computeRectangle$1(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$1(this)),this._textureCoordinateRotationPoints}}});const createGeometryFromPositionsPositions=[],createGeometryFromPositionsSubdivided=[];function createGeometryFromPositions(e,t,n,i,r){const o=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);let a,s;PolygonPipeline.computeWindingOrder2D(o)===WindingOrder$1.CLOCKWISE&&(o.reverse(),t=t.slice().reverse());let c=t.length,l=0;if(i)for(a=new Float64Array(2*c*3),s=0;s<c;s++){const e=t[s],n=t[(s+1)%c];a[l++]=e.x,a[l++]=e.y,a[l++]=e.z,a[l++]=n.x,a[l++]=n.y,a[l++]=n.z}else{let i=0;if(r===ArcType$1.GEODESIC)for(s=0;s<c;s++)i+=PolygonGeometryLibrary.subdivideLineCount(t[s],t[(s+1)%c],n);else if(r===ArcType$1.RHUMB)for(s=0;s<c;s++)i+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[s],t[(s+1)%c],n);for(a=new Float64Array(3*i),s=0;s<c;s++){let i;r===ArcType$1.GEODESIC?i=PolygonGeometryLibrary.subdivideLine(t[s],t[(s+1)%c],n,createGeometryFromPositionsSubdivided):r===ArcType$1.RHUMB&&(i=PolygonGeometryLibrary.subdivideRhumbLine(e,t[s],t[(s+1)%c],n,createGeometryFromPositionsSubdivided));const o=i.length;for(let e=0;e<o;++e)a[l++]=i[e]}}c=a.length/3;const u=2*c,d=IndexDatatype$1.createTypedArray(c,u);for(l=0,s=0;s<c-1;s++)d[l++]=s,d[l++]=s+1;return d[l++]=c-1,d[l++]=0,new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:d,primitiveType:PrimitiveType$1.LINES})})}function createGeometryFromPositionsExtruded(e,t,n,i,r){const o=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);let a,s;PolygonPipeline.computeWindingOrder2D(o)===WindingOrder$1.CLOCKWISE&&(o.reverse(),t=t.slice().reverse());let c=t.length;const l=new Array(c);let u=0;if(i)for(a=new Float64Array(2*c*3*2),s=0;s<c;++s){l[s]=u/3;const e=t[s],n=t[(s+1)%c];a[u++]=e.x,a[u++]=e.y,a[u++]=e.z,a[u++]=n.x,a[u++]=n.y,a[u++]=n.z}else{let i=0;if(r===ArcType$1.GEODESIC)for(s=0;s<c;s++)i+=PolygonGeometryLibrary.subdivideLineCount(t[s],t[(s+1)%c],n);else if(r===ArcType$1.RHUMB)for(s=0;s<c;s++)i+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[s],t[(s+1)%c],n);for(a=new Float64Array(3*i*2),s=0;s<c;++s){let i;l[s]=u/3,r===ArcType$1.GEODESIC?i=PolygonGeometryLibrary.subdivideLine(t[s],t[(s+1)%c],n,createGeometryFromPositionsSubdivided):r===ArcType$1.RHUMB&&(i=PolygonGeometryLibrary.subdivideRhumbLine(e,t[s],t[(s+1)%c],n,createGeometryFromPositionsSubdivided));const o=i.length;for(let e=0;e<o;++e)a[u++]=i[e]}}c=a.length/6;const d=l.length,h=2*(2*c+d),p=IndexDatatype$1.createTypedArray(c+d,h);for(u=0,s=0;s<c;++s)p[u++]=s,p[u++]=(s+1)%c,p[u++]=s+c,p[u++]=(s+1)%c+c;for(s=0;s<d;s++){const e=l[s];p[u++]=e,p[u++]=e+c}return new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:p,primitiveType:PrimitiveType$1.LINES})})}function PolygonOutlineGeometry(e){const t=e.polygonHierarchy,n=defaultValue(e.ellipsoid,Ellipsoid.WGS84),i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.perPositionHeight,!1),o=r&&defined(e.extrudedHeight),a=defaultValue(e.arcType,ArcType$1.GEODESIC);let s=defaultValue(e.height,0),c=defaultValue(e.extrudedHeight,s);if(!o){const e=Math.max(s,c);c=Math.min(s,c),s=e}this._ellipsoid=Ellipsoid.clone(n),this._granularity=i,this._height=s,this._extrudedHeight=c,this._arcType=a,this._polygonHierarchy=t,this._perPositionHeight=r,this._perPositionHeightExtrude=o,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+8}PolygonOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),n=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n),Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._arcType,t[n++]=defaultValue(e._offsetAttribute,-1),t[n]=e.packedLength,t};const scratchEllipsoid$8=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),dummyOptions={polygonHierarchy:{}};PolygonOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=i.startingIndex,delete i.startingIndex;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$8);t+=Ellipsoid.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=1===e[t++],l=1===e[t++],u=e[t++],d=e[t++],h=e[t];return defined(n)||(n=new PolygonOutlineGeometry(dummyOptions)),n._polygonHierarchy=i,n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._height=o,n._extrudedHeight=a,n._granularity=s,n._perPositionHeight=l,n._perPositionHeightExtrude=c,n._arcType=u,n._offsetAttribute=-1===d?void 0:d,n.packedLength=h,n},PolygonOutlineGeometry.fromPositions=function(e){return new PolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},PolygonOutlineGeometry.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,r=e._perPositionHeight,o=e._arcType,a=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(i,!r,t);if(0===a.length)return;let s;const c=[],l=CesiumMath.chordLength(n,t.maximumRadius),u=e._height,d=e._extrudedHeight;let h,p;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(u,d,0,CesiumMath.EPSILON2))for(p=0;p<a.length;p++){if(s=createGeometryFromPositionsExtruded(t,a[p],l,r,o),s.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(s.geometry,u,d,t,r),defined(e._offsetAttribute)){const t=s.geometry.attributes.position.values.length/3;let n=new Uint8Array(t);e._offsetAttribute===GeometryOffsetAttribute$1.TOP?n=arrayFill(n,1,0,t/2):(h=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,n=arrayFill(n,h)),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}c.push(s)}else for(p=0;p<a.length;p++){if(s=createGeometryFromPositions(t,a[p],l,r,o),s.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(s.geometry.attributes.position.values,u,t,!r),defined(e._offsetAttribute)){const t=s.geometry.attributes.position.values.length,n=new Uint8Array(t/3);h=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,arrayFill(n,h),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}c.push(s)}const f=GeometryPipeline.combineInstances(c)[0],m=BoundingSphere.fromVertices(f.attributes.position.values);return new Geometry({attributes:f.attributes,indices:f.indices,primitiveType:f.primitiveType,boundingSphere:m,offsetAttribute:e._offsetAttribute})};const scratchInterpolateColorsArray=[];function interpolateColors$1(e,t,n,i,r){const o=scratchInterpolateColorsArray;let a;o.length=r;const s=n.red,c=n.green,l=n.blue,u=n.alpha,d=i.red,h=i.green,p=i.blue,f=i.alpha;if(Color.equals(n,i)){for(a=0;a<r;a++)o[a]=Color.clone(n);return o}const m=(d-s)/r,g=(h-c)/r,_=(p-l)/r,y=(f-u)/r;for(a=0;a<r;a++)o[a]=new Color(s+a*m,c+a*g,l+a*_,u+a*y);return o}function PolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.colors,i=defaultValue(e.width,1),r=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=r,this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";let o=1+t.length*Cartesian3.packedLength;o+=defined(n)?1+n.length*Color.packedLength:1,this.packedLength=o+Ellipsoid.packedLength+VertexFormat.packedLength+4}PolylineGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._colors;for(o=defined(a)?a.length:0,t[n++]=o,i=0;i<o;++i,n+=Color.packedLength)Color.pack(a[i],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const scratchEllipsoid$7=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$3=new VertexFormat,scratchOptions$8={positions:void 0,colors:void 0,ellipsoid:scratchEllipsoid$7,vertexFormat:scratchVertexFormat$3,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};PolylineGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);r=e[t++];const a=r>0?new Array(r):void 0;for(i=0;i<r;++i,t+=Color.packedLength)a[i]=Color.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$7);t+=Ellipsoid.packedLength;const c=VertexFormat.unpack(e,t,scratchVertexFormat$3);t+=VertexFormat.packedLength;const l=e[t++],u=1===e[t++],d=e[t++],h=e[t];return defined(n)?(n._positions=o,n._colors=a,n._ellipsoid=Ellipsoid.clone(s,n._ellipsoid),n._vertexFormat=VertexFormat.clone(c,n._vertexFormat),n._width=l,n._colorsPerVertex=u,n._arcType=d,n._granularity=h,n):(scratchOptions$8.positions=o,scratchOptions$8.colors=a,scratchOptions$8.width=l,scratchOptions$8.colorsPerVertex=u,scratchOptions$8.arcType=d,scratchOptions$8.granularity=h,new PolylineGeometry(scratchOptions$8))};const scratchCartesian3$5=new Cartesian3,scratchPosition$9=new Cartesian3,scratchPrevPosition=new Cartesian3,scratchNextPosition=new Cartesian3;function computeAttributes$1(e,t,n,i){const r=new GeometryAttributes;i.position&&(r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e}));const o=t.length,a=e.length/3,s=(a-2*o)/(2*o),c=PolygonPipeline.triangulate(t),l=(s-1)*o*6+2*c.length,u=IndexDatatype$1.createTypedArray(a,l);let d,h,p,f,m,g;const _=2*o;let y=0;for(d=0;d<s-1;d++){for(h=0;h<o-1;h++)p=2*h+d*o*2,g=p+_,f=p+1,m=f+_,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=g;p=2*o-2+d*o*2,f=p+1,m=f+_,g=p+_,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=g}if(i.st||i.tangent||i.bitangent){const e=new Float32Array(2*a),i=1/(s-1),c=1/n.height,l=n.height/2;let u,p,f=0;for(d=0;d<s;d++){for(u=d*i,p=c*(t[0].y+l),e[f++]=u,e[f++]=p,h=1;h<o;h++)p=c*(t[h].y+l),e[f++]=u,e[f++]=p,e[f++]=u,e[f++]=p;p=c*(t[0].y+l),e[f++]=u,e[f++]=p}for(h=0;h<o;h++)u=0,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;for(h=0;h<o;h++)u=(s-1)*i,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;r.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:new Float32Array(e)})}const C=a-2*o;for(d=0;d<c.length;d+=3){const e=c[d]+C,t=c[d+1]+C,n=c[d+2]+C;u[y++]=e,u[y++]=t,u[y++]=n,u[y++]=n+o,u[y++]=t+o,u[y++]=e+o}let T=new Geometry({attributes:r,indices:u,boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.TRIANGLES});if(i.normal&&(T=GeometryPipeline.computeNormal(T)),i.tangent||i.bitangent){try{T=GeometryPipeline.computeTangentAndBitangent(T)}catch(e){oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}i.tangent||(T.attributes.tangent=void 0),i.bitangent||(T.attributes.bitangent=void 0),i.st||(T.attributes.st=void 0)}return T}function PolylineVolumeGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*Cartesian3.packedLength;i+=1+n.length*Cartesian2.packedLength,this.packedLength=i+Ellipsoid.packedLength+VertexFormat.packedLength+2}PolylineGeometry.createGeometry=function(e){const t=e._width,n=e._vertexFormat;let i=e._colors;const r=e._colorsPerVertex,o=e._arcType,a=e._granularity,s=e._ellipsoid;let c,l,u;const d=[];let h=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon,!1,d);if(defined(i)&&d.length>0){let e=0,t=d[0];i=i.filter((function(n,i){let o=!1;return o=r?i===t||0===i&&1===t:i+1===t,!o||(e++,t=d[e],!1)}))}let p=h.length;if(p<2||t<=0)return;if(o===ArcType$1.GEODESIC||o===ArcType$1.RHUMB){let e,t;o===ArcType$1.GEODESIC?(e=CesiumMath.chordLength(a,s.maximumRadius),t=PolylinePipeline.numberOfPoints):(e=a,t=PolylinePipeline.numberOfPointsRhumbLine);const n=PolylinePipeline.extractHeights(h,s);if(defined(i)){let n=1;for(c=0;c<p-1;++c)n+=t(h[c],h[c+1],e);const o=new Array(n);let a=0;for(c=0;c<p-1;++c){const s=h[c],u=h[c+1],d=i[c],p=t(s,u,e);if(r&&c<n){const e=interpolateColors$1(s,u,d,i[c+1],p),t=e.length;for(l=0;l<t;++l)o[a++]=e[l]}else for(l=0;l<p;++l)o[a++]=Color.clone(d)}o[a]=Color.clone(i[i.length-1]),i=o,scratchInterpolateColorsArray.length=0}h=o===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc({positions:h,minDistance:e,ellipsoid:s,height:n}):PolylinePipeline.generateCartesianRhumbArc({positions:h,granularity:e,ellipsoid:s,height:n})}p=h.length;const f=4*p-4,m=new Float64Array(3*f),g=new Float64Array(3*f),_=new Float64Array(3*f),y=new Float32Array(2*f),C=n.st?new Float32Array(2*f):void 0,T=defined(i)?new Uint8Array(4*f):void 0;let S,A=0,v=0,E=0,b=0;for(l=0;l<p;++l){let e,o;0===l?(S=scratchCartesian3$5,Cartesian3.subtract(h[0],h[1],S),Cartesian3.add(h[0],S,S)):S=h[l-1],Cartesian3.clone(S,scratchPrevPosition),Cartesian3.clone(h[l],scratchPosition$9),l===p-1?(S=scratchCartesian3$5,Cartesian3.subtract(h[p-1],h[p-2],S),Cartesian3.add(h[p-1],S,S)):S=h[l+1],Cartesian3.clone(S,scratchNextPosition),defined(T)&&(e=0===l||r?i[l]:i[l-1],l!==p-1&&(o=i[l]));const a=l===p-1?2:4;for(u=0===l?2:0;u<a;++u){Cartesian3.pack(scratchPosition$9,m,A),Cartesian3.pack(scratchPrevPosition,g,A),Cartesian3.pack(scratchNextPosition,_,A),A+=3;const i=u-2<0?-1:1;if(y[v++]=u%2*2-1,y[v++]=i*t,n.st&&(C[E++]=l/(p-1),C[E++]=Math.max(y[v-2],0)),defined(T)){const t=u<2?e:o;T[b++]=Color.floatToByte(t.red),T[b++]=Color.floatToByte(t.green),T[b++]=Color.floatToByte(t.blue),T[b++]=Color.floatToByte(t.alpha)}}}const x=new GeometryAttributes;x.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:m}),x.prevPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:g}),x.nextPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:_}),x.expandAndWidth=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:y}),n.st&&(x.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:C})),defined(T)&&(x.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:T,normalize:!0}));const P=IndexDatatype$1.createTypedArray(f,6*p-6);let D=0,w=0;const M=p-1;for(l=0;l<M;++l)P[w++]=D,P[w++]=D+2,P[w++]=D+1,P[w++]=D+1,P[w++]=D+2,P[w++]=D+3,D+=4;return new Geometry({attributes:x,indices:P,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromPoints(h),geometryType:GeometryType$1.POLYLINES})},PolylineVolumeGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._shape;for(o=a.length,t[n++]=o,i=0;i<o;++i,n+=Cartesian2.packedLength)Cartesian2.pack(a[i],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const scratchEllipsoid$6=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$2=new VertexFormat,scratchOptions$7={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$6,vertexFormat:scratchVertexFormat$2,cornerType:void 0,granularity:void 0};PolylineVolumeGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);r=e[t++];const a=new Array(r);for(i=0;i<r;++i,t+=Cartesian2.packedLength)a[i]=Cartesian2.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$6);t+=Ellipsoid.packedLength;const c=VertexFormat.unpack(e,t,scratchVertexFormat$2);t+=VertexFormat.packedLength;const l=e[t++],u=e[t];return defined(n)?(n._positions=o,n._shape=a,n._ellipsoid=Ellipsoid.clone(s,n._ellipsoid),n._vertexFormat=VertexFormat.clone(c,n._vertexFormat),n._cornerType=l,n._granularity=u,n):(scratchOptions$7.polylinePositions=o,scratchOptions$7.shapePositions=a,scratchOptions$7.cornerType=l,scratchOptions$7.granularity=u,new PolylineVolumeGeometry(scratchOptions$7))};const brScratch$1=new BoundingRectangle;function computeAttributes(e,t){const n=new GeometryAttributes;n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,r=n.position.values.length/3,o=e.length/3/i,a=IndexDatatype$1.createTypedArray(r,2*i*(o+1));let s,c,l=0;s=0;let u=s*i;for(c=0;c<i-1;c++)a[l++]=c+u,a[l++]=c+u+1;for(a[l++]=i-1+u,a[l++]=u,s=o-1,u=s*i,c=0;c<i-1;c++)a[l++]=c+u,a[l++]=c+u+1;for(a[l++]=i-1+u,a[l++]=u,s=0;s<o-1;s++){const e=i*s,t=e+i;for(c=0;c<i;c++)a[l++]=c+e,a[l++]=c+t}return new Geometry({attributes:n,indices:IndexDatatype$1.createTypedArray(r,a),boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.LINES})}function PolylineVolumeOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*Cartesian3.packedLength;i+=1+n.length*Cartesian2.packedLength,this.packedLength=i+Ellipsoid.packedLength+2}PolylineVolumeGeometry.createGeometry=function(e){const t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon);let n=e._shape;if(n=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(n),t.length<2||n.length<3)return;PolygonPipeline.computeWindingOrder2D(n)===WindingOrder$1.CLOCKWISE&&n.reverse();const i=BoundingRectangle.fromPoints(n,brScratch$1);return computeAttributes$1(PolylineVolumeGeometryLibrary.computePositions(t,n,i,e,!0),n,i,e._vertexFormat)},PolylineVolumeOutlineGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._shape;for(o=a.length,t[n++]=o,i=0;i<o;++i,n+=Cartesian2.packedLength)Cartesian2.pack(a[i],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const scratchEllipsoid$5=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$6={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$5,height:void 0,cornerType:void 0,granularity:void 0};PolylineVolumeOutlineGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);r=e[t++];const a=new Array(r);for(i=0;i<r;++i,t+=Cartesian2.packedLength)a[i]=Cartesian2.unpack(e,t);const s=Ellipsoid.unpack(e,t,scratchEllipsoid$5);t+=Ellipsoid.packedLength;const c=e[t++],l=e[t];return defined(n)?(n._positions=o,n._shape=a,n._ellipsoid=Ellipsoid.clone(s,n._ellipsoid),n._cornerType=c,n._granularity=l,n):(scratchOptions$6.polylinePositions=o,scratchOptions$6.shapePositions=a,scratchOptions$6.cornerType=c,scratchOptions$6.granularity=l,new PolylineVolumeOutlineGeometry(scratchOptions$6))};const brScratch=new BoundingRectangle;function Proxy(){DeveloperError.throwInstantiationError()}function createEvaluateFunction(e){const t=e.points,n=e.times;return function(i,r){defined(r)||(r=new Quaternion);const o=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),a=(i-n[o])/(n[o+1]-n[o]),s=t[o],c=t[o+1];return Quaternion.fastSlerp(s,c,a,r)}}function QuaternionSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,n=e.times;this._times=n,this._points=t,this._evaluateFunction=createEvaluateFunction(this),this._lastTimeIndex=0}function quickselect(e,t,n,i,r){quickselectStep(e,t,n||0,i||e.length-1,r||defaultCompare)}function quickselectStep(e,t,n,i,r){for(;i>n;){if(i-n>600){var o=i-n+1,a=t-n+1,s=Math.log(o),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(o-c)/o)*(a-o/2<0?-1:1);quickselectStep(e,t,Math.max(n,Math.floor(t-a*c/o+l)),Math.min(i,Math.floor(t+(o-a)*c/o+l)),r)}var u=e[t],d=n,h=i;for(swap$1(e,n,t),r(e[i],u)>0&&swap$1(e,n,i);d<h;){for(swap$1(e,d,h),d++,h--;r(e[d],u)<0;)d++;for(;r(e[h],u)>0;)h--}0===r(e[n],u)?swap$1(e,n,h):swap$1(e,++h,i),h<=t&&(n=h+1),t<=h&&(i=h-1)}}function swap$1(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function defaultCompare(e,t){return e<t?-1:e>t?1:0}PolylineVolumeOutlineGeometry.createGeometry=function(e){const t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon);let n=e._shape;if(n=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(n),t.length<2||n.length<3)return;PolygonPipeline.computeWindingOrder2D(n)===WindingOrder$1.CLOCKWISE&&n.reverse();const i=BoundingRectangle.fromPoints(n,brScratch);return computeAttributes(PolylineVolumeGeometryLibrary.computePositions(t,n,i,e,!1),n)},Proxy.prototype.getURL=DeveloperError.throwInstantiationError,Object.defineProperties(QuaternionSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),QuaternionSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,QuaternionSpline.prototype.wrapTime=Spline.prototype.wrapTime,QuaternionSpline.prototype.clampTime=Spline.prototype.clampTime,QuaternionSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};class RBush{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!intersects(e,t))return n;const i=this.toBBox,r=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],s=t.leaf?i(a):a;intersects(e,s)&&(t.leaf?n.push(a):contains$1(e,s)?this._all(a,n):r.push(a))}t=r.pop()}return n}collides(e){let t=this.data;if(!intersects(e,t))return!1;const n=[];for(;t;){for(let i=0;i<t.children.length;i++){const r=t.children[i],o=t.leaf?this.toBBox(r):r;if(intersects(e,o)){if(t.leaf||contains$1(e,o))return!0;n.push(r)}}t=n.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(e,t){if(!e)return this;let n=this.data;const i=this.toBBox(e),r=[],o=[];let a,s,c;for(;n||r.length;){if(n||(n=r.pop(),s=r[r.length-1],a=o.pop(),c=!0),n.leaf){const i=findItem(e,n.children,t);if(-1!==i)return n.children.splice(i,1),r.push(n),this._condense(r),this}c||n.leaf||!contains$1(n,i)?s?(a++,n=s.children[a],c=!1):n=null:(r.push(n),o.push(a),a=0,s=n,n=n.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,i){const r=n-t+1;let o,a=this._maxEntries;if(r<=a)return o=createNode(e.slice(t,n+1)),calcBBox(o,this.toBBox),o;i||(i=Math.ceil(Math.log(r)/Math.log(a)),a=Math.ceil(r/Math.pow(a,i-1))),o=createNode([]),o.leaf=!1,o.height=i;const s=Math.ceil(r/a),c=s*Math.ceil(Math.sqrt(a));multiSelect(e,t,n,c,this.compareMinX);for(let r=t;r<=n;r+=c){const t=Math.min(r+c-1,n);multiSelect(e,r,t,s,this.compareMinY);for(let n=r;n<=t;n+=s){const r=Math.min(n+s-1,t);o.children.push(this._build(e,n,r,i-1))}}return calcBBox(o,this.toBBox),o}_chooseSubtree(e,t,n,i){for(;i.push(t),!t.leaf&&i.length-1!==n;){let n,i=1/0,r=1/0;for(let o=0;o<t.children.length;o++){const a=t.children[o],s=bboxArea(a),c=enlargedArea(e,a)-s;c<r?(r=c,i=s<i?s:i,n=a):c===r&&s<i&&(i=s,n=a)}t=n||t.children[0]}return t}_insert(e,t,n){const i=n?e:this.toBBox(e),r=[],o=this._chooseSubtree(i,this.data,t,r);for(o.children.push(e),extend(o,i);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(i,r,t)}_split(e,t){const n=e[t],i=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,i);const o=this._chooseSplitIndex(n,r,i),a=createNode(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,calcBBox(n,this.toBBox),calcBBox(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let i,r=1/0,o=1/0;for(let a=t;a<=n-t;a++){const t=distBBox(e,0,a,this.toBBox),s=distBBox(e,a,n,this.toBBox),c=intersectionArea(t,s),l=bboxArea(t)+bboxArea(s);c<r?(r=c,i=a,o=l<o?l:o):c===r&&l<o&&(o=l,i=a)}return i||n-t}_chooseSplitAxis(e,t,n){const i=e.leaf?this.compareMinX:compareNodeMinX,r=e.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(e,t,n,i)<this._allDistMargin(e,t,n,r)&&e.children.sort(i)}_allDistMargin(e,t,n,i){e.children.sort(i);const r=this.toBBox,o=distBBox(e,0,t,r),a=distBBox(e,n-t,n,r);let s=bboxMargin(o)+bboxMargin(a);for(let i=t;i<n-t;i++){const t=e.children[i];extend(o,e.leaf?r(t):t),s+=bboxMargin(o)}for(let i=n-t-1;i>=t;i--){const t=e.children[i];extend(a,e.leaf?r(t):t),s+=bboxMargin(a)}return s}_adjustParentBBoxes(e,t,n){for(let i=n;i>=0;i--)extend(t[i],e)}_condense(e){for(let t,n=e.length-1;n>=0;n--)0===e[n].children.length?n>0?(t=e[n-1].children,t.splice(t.indexOf(e[n]),1)):this.clear():calcBBox(e[n],this.toBBox)}}function findItem(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function calcBBox(e,t){distBBox(e,0,e.children.length,t,e)}function distBBox(e,t,n,i,r){r||(r=createNode(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<n;o++){const t=e.children[o];extend(r,e.leaf?i(t):t)}return r}function extend(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function compareNodeMinX(e,t){return e.minX-t.minX}function compareNodeMinY(e,t){return e.minY-t.minY}function bboxArea(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function bboxMargin(e){return e.maxX-e.minX+(e.maxY-e.minY)}function enlargedArea(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function intersectionArea(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-n)*Math.max(0,o-i)}function contains$1(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function intersects(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function createNode(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(e,t,n,i,r){const o=[t,n];for(;o.length;){if((n=o.pop())-(t=o.pop())<=i)continue;const a=t+Math.ceil((n-t)/i/2)*i;quickselect(e,a,t,n,r),o.push(t,a,a,n)}}function RectangleCollisionChecker(){this._tree=new RBush}function RectangleWithId(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}function idCompare(e,t){return e.id===t.id}RectangleWithId.fromRectangleAndId=function(e,t,n){return n.minX=t.west,n.minY=t.south,n.maxX=t.east,n.maxY=t.north,n.id=e,n},RectangleCollisionChecker.prototype.insert=function(e,t){const n=RectangleWithId.fromRectangleAndId(e,t,new RectangleWithId);this._tree.insert(n)};const removalScratch=new RectangleWithId;RectangleCollisionChecker.prototype.remove=function(e,t){const n=RectangleWithId.fromRectangleAndId(e,t,removalScratch);this._tree.remove(n,idCompare)};const collisionScratch=new RectangleWithId;RectangleCollisionChecker.prototype.collides=function(e){const t=RectangleWithId.fromRectangleAndId("",e,collisionScratch);return this._tree.collides(t)};const cos=Math.cos,sin=Math.sin,sqrt=Math.sqrt,RectangleGeometryLibrary={computePosition:function(e,t,n,i,r,o,a){const s=t.radiiSquared,c=e.nwCorner,l=e.boundingRectangle;let u=c.latitude-e.granYCos*i+r*e.granXSin;const d=cos(u),h=sin(u),p=s.z*h;let f=c.longitude+i*e.granYSin+r*e.granXCos;const m=d*cos(f),g=d*sin(f),_=s.x*m,y=s.y*g,C=sqrt(_*m+y*g+p*h);if(o.x=_/C,o.y=y/C,o.z=p/C,n){const t=e.stNwCorner;defined(t)?(u=t.latitude-e.stGranYCos*i+r*e.stGranXSin,f=t.longitude+i*e.stGranYSin+r*e.stGranXCos,a.x=(f-e.stWest)*e.lonScalar,a.y=(u-e.stSouth)*e.latScalar):(a.x=(f-l.west)*e.lonScalar,a.y=(u-l.south)*e.latScalar)}}},rotationMatrixScratch=new Matrix2;let nwCartesian=new Cartesian3;const centerScratch$3=new Cartographic;let centerCartesian=new Cartesian3;const proj=new GeographicProjection;function getRotationOptions(e,t,n,i,r,o,a){const s=Math.cos(t),c=i*s,l=n*s,u=Math.sin(t),d=i*u,h=n*u;nwCartesian=proj.project(e,nwCartesian),nwCartesian=Cartesian3.subtract(nwCartesian,centerCartesian,nwCartesian);const p=Matrix2.fromRotation(t,rotationMatrixScratch);nwCartesian=Matrix2.multiplyByVector(p,nwCartesian,nwCartesian),nwCartesian=Cartesian3.add(nwCartesian,centerCartesian,nwCartesian),o-=1,a-=1;const f=(e=proj.unproject(nwCartesian,e)).latitude,m=f+o*h,g=f-c*a,_=f-c*a+o*h,y=Math.max(f,m,g,_),C=Math.min(f,m,g,_),T=e.longitude,S=T+o*l,A=T+a*d,v=T+a*d+o*l;return{north:y,south:C,east:Math.max(T,S,A,v),west:Math.min(T,S,A,v),granYCos:c,granYSin:d,granXCos:l,granXSin:h,nwCorner:e}}RectangleGeometryLibrary.computeOptions=function(e,t,n,i,r,o,a){let s,c=e.east,l=e.west,u=e.north,d=e.south,h=!1,p=!1;u===CesiumMath.PI_OVER_TWO&&(h=!0),d===-CesiumMath.PI_OVER_TWO&&(p=!0);const f=u-d;s=l>c?CesiumMath.TWO_PI-l+c:c-l;const m=Math.ceil(s/t)+1,g=Math.ceil(f/t)+1,_=s/(m-1),y=f/(g-1),C=Rectangle.northwest(e,o),T=Rectangle.center(e,centerScratch$3);0===n&&0===i||(T.longitude<C.longitude&&(T.longitude+=CesiumMath.TWO_PI),centerCartesian=proj.project(T,centerCartesian));const S=y,A=_,v=Rectangle.clone(e,r),E={granYCos:S,granYSin:0,granXCos:A,granXSin:0,nwCorner:C,boundingRectangle:v,width:m,height:g,northCap:h,southCap:p};if(0!==n){const e=getRotationOptions(C,n,_,y,T,m,g);u=e.north,d=e.south,c=e.east,l=e.west,E.granYCos=e.granYCos,E.granYSin=e.granYSin,E.granXCos=e.granXCos,E.granXSin=e.granXSin,v.north=u,v.south=d,v.east=c,v.west=l}if(0!==i){n-=i;const e=Rectangle.northwest(v,a),t=getRotationOptions(e,n,_,y,T,m,g);E.stGranYCos=t.granYCos,E.stGranXCos=t.granXCos,E.stGranYSin=t.granYSin,E.stGranXSin=t.granXSin,E.stNwCorner=e,E.stWest=t.west,E.stSouth=t.south}return E};const positionScratch$a=new Cartesian3,normalScratch$2=new Cartesian3,tangentScratch=new Cartesian3,bitangentScratch=new Cartesian3,rectangleScratch$4=new Rectangle,stScratch=new Cartesian2,bottomBoundingSphere$1=new BoundingSphere,topBoundingSphere$1=new BoundingSphere;function createAttributes(e,t){const n=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.TRIANGLES});return n.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function calculateAttributes(e,t,n,i){const r=e.length,o=t.normal?new Float32Array(r):void 0,a=t.tangent?new Float32Array(r):void 0,s=t.bitangent?new Float32Array(r):void 0;let c=0;const l=bitangentScratch,u=tangentScratch;let d=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(let h=0;h<r;h+=3){const r=Cartesian3.fromArray(e,h,positionScratch$a),p=c+1,f=c+2;d=n.geodeticSurfaceNormal(r,d),(t.tangent||t.bitangent)&&(Cartesian3.cross(Cartesian3.UNIT_Z,d,u),Matrix3.multiplyByVector(i,u,u),Cartesian3.normalize(u,u),t.bitangent&&Cartesian3.normalize(Cartesian3.cross(d,u,l),l)),t.normal&&(o[c]=d.x,o[p]=d.y,o[f]=d.z),t.tangent&&(a[c]=u.x,a[p]=u.y,a[f]=u.z),t.bitangent&&(s[c]=l.x,s[p]=l.y,s[f]=l.z),c+=3}return createAttributes(t,{positions:e,normals:o,tangents:a,bitangents:s})}const v1Scratch=new Cartesian3,v2Scratch=new Cartesian3;function calculateAttributesWall(e,t,n){const i=e.length,r=t.normal?new Float32Array(i):void 0,o=t.tangent?new Float32Array(i):void 0,a=t.bitangent?new Float32Array(i):void 0;let s=0,c=0,l=0,u=!0,d=bitangentScratch,h=tangentScratch,p=normalScratch$2;if(t.normal||t.tangent||t.bitangent)for(let f=0;f<i;f+=6){const m=Cartesian3.fromArray(e,f,positionScratch$a),g=Cartesian3.fromArray(e,(f+6)%i,v1Scratch);if(u){const t=Cartesian3.fromArray(e,(f+3)%i,v2Scratch);Cartesian3.subtract(g,m,g),Cartesian3.subtract(t,m,t),p=Cartesian3.normalize(Cartesian3.cross(t,g,p),p),u=!1}Cartesian3.equalsEpsilon(g,m,CesiumMath.EPSILON10)&&(u=!0),(t.tangent||t.bitangent)&&(d=n.geodeticSurfaceNormal(m,d),t.tangent&&(h=Cartesian3.normalize(Cartesian3.cross(d,p,h),h))),t.normal&&(r[s++]=p.x,r[s++]=p.y,r[s++]=p.z,r[s++]=p.x,r[s++]=p.y,r[s++]=p.z),t.tangent&&(o[c++]=h.x,o[c++]=h.y,o[c++]=h.z,o[c++]=h.x,o[c++]=h.y,o[c++]=h.z),t.bitangent&&(a[l++]=d.x,a[l++]=d.y,a[l++]=d.z,a[l++]=d.x,a[l++]=d.y,a[l++]=d.z)}return createAttributes(t,{positions:e,normals:r,tangents:o,bitangents:a})}function constructRectangle$1(e,t){const n=e._vertexFormat,i=e._ellipsoid,r=t.height,o=t.width,a=t.northCap,s=t.southCap;let c=0,l=r,u=r,d=0;a&&(c=1,u-=1,d+=1),s&&(l-=1,u-=1,d+=1),d+=o*u;const h=n.position?new Float64Array(3*d):void 0,p=n.st?new Float32Array(2*d):void 0;let f=0,m=0;const g=positionScratch$a,_=stScratch;let y=Number.MAX_VALUE,C=Number.MAX_VALUE,T=-Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let e=c;e<l;++e)for(let r=0;r<o;++r)RectangleGeometryLibrary.computePosition(t,i,n.st,e,r,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,n.st&&(p[m++]=_.x,p[m++]=_.y,y=Math.min(y,_.x),C=Math.min(C,_.y),T=Math.max(T,_.x),S=Math.max(S,_.y));if(a&&(RectangleGeometryLibrary.computePosition(t,i,n.st,0,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f++]=g.z,n.st&&(p[m++]=_.x,p[m++]=_.y,y=_.x,C=_.y,T=_.x,S=_.y)),s&&(RectangleGeometryLibrary.computePosition(t,i,n.st,r-1,0,g,_),h[f++]=g.x,h[f++]=g.y,h[f]=g.z,n.st&&(p[m++]=_.x,p[m]=_.y,y=Math.min(y,_.x),C=Math.min(C,_.y),T=Math.max(T,_.x),S=Math.max(S,_.y))),n.st&&(y<0||C<0||T>1||S>1))for(let e=0;e<p.length;e+=2)p[e]=(p[e]-y)/(T-y),p[e+1]=(p[e+1]-C)/(S-C);const A=calculateAttributes(h,n,i,t.tangentRotationMatrix);let v=6*(o-1)*(u-1);a&&(v+=3*(o-1)),s&&(v+=3*(o-1));const E=IndexDatatype$1.createTypedArray(d,v);let b,x=0,P=0;for(b=0;b<u-1;++b){for(let e=0;e<o-1;++e){const e=x,t=e+o,n=t+1,i=e+1;E[P++]=e,E[P++]=t,E[P++]=i,E[P++]=i,E[P++]=t,E[P++]=n,++x}++x}if(a||s){let e=d-1;const t=d-1;let n,i;if(a&&s&&(e=d-2),x=0,a)for(b=0;b<o-1;b++)n=x,i=n+1,E[P++]=e,E[P++]=n,E[P++]=i,++x;if(s)for(x=(u-1)*o,b=0;b<o-1;b++)n=x,i=n+1,E[P++]=n,E[P++]=t,E[P++]=i,++x}return A.indices=E,n.st&&(A.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:p})),A}function addWallPositions(e,t,n,i,r){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n+2],e[t++]=r[n],e[t++]=r[n+1],e[t]=r[n+2],e}function addWallTextureCoordinates(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}const scratchVertexFormat$1=new VertexFormat;function constructExtrudedRectangle$1(e,t){const n=e._shadowVolume,i=e._offsetAttribute,r=e._vertexFormat,o=e._extrudedHeight,a=e._surfaceHeight,s=e._ellipsoid,c=t.height,l=t.width;let u;if(n){const t=VertexFormat.clone(r,scratchVertexFormat$1);t.normal=!0,e._vertexFormat=t}const d=constructRectangle$1(e,t);n&&(e._vertexFormat=r);let h=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,a,s,!1);h=new Float64Array(h);let p=h.length;const f=2*p,m=new Float64Array(f);m.set(h);const g=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,o,s);m.set(g,p),d.attributes.position.values=m;const _=r.normal?new Float32Array(f):void 0,y=r.tangent?new Float32Array(f):void 0,C=r.bitangent?new Float32Array(f):void 0,T=r.st?new Float32Array(f/3*2):void 0;let S,A,v;if(r.normal){for(A=d.attributes.normal.values,_.set(A),u=0;u<p;u++)A[u]=-A[u];_.set(A,p),d.attributes.normal.values=_}if(n){A=d.attributes.normal.values,r.normal||(d.attributes.normal=void 0);const e=new Float32Array(f);for(u=0;u<p;u++)A[u]=-A[u];e.set(A,p),d.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:e})}const E=defined(i);if(E){const e=p/3*2;let t=new Uint8Array(e);i===GeometryOffsetAttribute$1.TOP?t=arrayFill(t,1,0,e/2):(v=i===GeometryOffsetAttribute$1.NONE?0:1,t=arrayFill(t,v)),d.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}if(r.tangent){const e=d.attributes.tangent.values;for(y.set(e),u=0;u<p;u++)e[u]=-e[u];y.set(e,p),d.attributes.tangent.values=y}if(r.bitangent){const e=d.attributes.bitangent.values;C.set(e),C.set(e,p),d.attributes.bitangent.values=C}r.st&&(S=d.attributes.st.values,T.set(S),T.set(S,p/3*2),d.attributes.st.values=T);const b=d.indices,x=b.length,P=p/3,D=IndexDatatype$1.createTypedArray(f/3,2*x);for(D.set(b),u=0;u<x;u+=3)D[u+x]=b[u+2]+P,D[u+1+x]=b[u+1]+P,D[u+2+x]=b[u]+P;d.indices=D;const w=t.northCap,M=t.southCap;let I=c,R=2,O=0,B=4,L=4;w&&(R-=1,I-=1,O+=1,B-=2,L-=1),M&&(R-=1,I-=1,O+=1,B-=2,L-=1),O+=R*l+2*I-B;const F=2*(O+L);let N=new Float64Array(3*F);const V=n?new Float32Array(3*F):void 0;let k=E?new Uint8Array(F):void 0,U=r.st?new Float32Array(2*F):void 0;const G=i===GeometryOffsetAttribute$1.TOP;E&&!G&&(v=i===GeometryOffsetAttribute$1.ALL?1:0,k=arrayFill(k,v));let $=0,z=0,H=0,W=0;const q=l*I;let j;for(u=0;u<q;u+=l)j=3*u,N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*u,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1);if(M){const e=w?q+1:q;for(j=3*e,u=0;u<2;u++)N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*e,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1)}else for(u=q-l;u<q;u++)j=3*u,N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*u,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1);for(u=q-1;u>0;u-=l)j=3*u,N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*u,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1);if(w){const e=q;for(j=3*e,u=0;u<2;u++)N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*e,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1)}else for(u=l-1;u>=0;u--)j=3*u,N=addWallPositions(N,$,j,h,g),$+=6,r.st&&(U=addWallTextureCoordinates(U,z,2*u,S),z+=4),n&&(H+=3,V[H++]=A[j],V[H++]=A[j+1],V[H++]=A[j+2]),G&&(k[W++]=1,W+=1);let X=calculateAttributesWall(N,r,s);r.st&&(X.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:U})),n&&(X.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:V})),E&&(X.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:k}));const Y=IndexDatatype$1.createTypedArray(F,6*O);let K,J,Q,Z;p=N.length/3;let ee=0;for(u=0;u<p-1;u+=2){K=u,Z=(K+2)%p;const e=Cartesian3.fromArray(N,3*K,v1Scratch),t=Cartesian3.fromArray(N,3*Z,v2Scratch);Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON10)||(J=(K+1)%p,Q=(J+2)%p,Y[ee++]=K,Y[ee++]=J,Y[ee++]=Z,Y[ee++]=Z,Y[ee++]=J,Y[ee++]=Q)}return X.indices=Y,X=GeometryPipeline.combineInstances([new GeometryInstance({geometry:d}),new GeometryInstance({geometry:X})]),X[0]}const scratchRectanglePoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3],nwScratch$1=new Cartographic,stNwScratch=new Cartographic;function computeRectangle(e,t,n,i,r){if(0===n)return Rectangle.clone(e,r);const o=RectangleGeometryLibrary.computeOptions(e,t,n,0,rectangleScratch$4,nwScratch$1),a=o.height,s=o.width,c=scratchRectanglePoints;return RectangleGeometryLibrary.computePosition(o,i,!1,0,0,c[0]),RectangleGeometryLibrary.computePosition(o,i,!1,0,s-1,c[1]),RectangleGeometryLibrary.computePosition(o,i,!1,a-1,0,c[2]),RectangleGeometryLibrary.computePosition(o,i,!1,a-1,s-1,c[3]),Rectangle.fromCartesianArray(c,i,r)}function RectangleGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,n=defaultValue(e.height,0),i=defaultValue(e.extrudedHeight,n);this._rectangle=Rectangle.clone(t),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}RectangleGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7,RectangleGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Rectangle.pack(e._rectangle,t,n),n+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),n+=VertexFormat.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchRectangle$8=new Rectangle,scratchEllipsoid$4=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$5={rectangle:scratchRectangle$8,ellipsoid:scratchEllipsoid$4,vertexFormat:scratchVertexFormat$1,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};RectangleGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Rectangle.unpack(e,t,scratchRectangle$8);t+=Rectangle.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$4);t+=Ellipsoid.packedLength;const o=VertexFormat.unpack(e,t,scratchVertexFormat$1);t+=VertexFormat.packedLength;const a=e[t++],s=e[t++],c=e[t++],l=e[t++],u=e[t++],d=1===e[t++],h=e[t];return defined(n)?(n._rectangle=Rectangle.clone(i,n._rectangle),n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._vertexFormat=VertexFormat.clone(o,n._vertexFormat),n._granularity=a,n._surfaceHeight=s,n._rotation=c,n._stRotation=l,n._extrudedHeight=u,n._shadowVolume=d,n._offsetAttribute=-1===h?void 0:h,n):(scratchOptions$5.granularity=a,scratchOptions$5.height=s,scratchOptions$5.rotation=c,scratchOptions$5.stRotation=l,scratchOptions$5.extrudedHeight=u,scratchOptions$5.shadowVolume=d,scratchOptions$5.offsetAttribute=-1===h?void 0:h,new RectangleGeometry(scratchOptions$5))},RectangleGeometry.computeRectangle=function(e,t){const n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle(n,i,defaultValue(e.rotation,0),r,t)};const tangentRotationMatrixScratch=new Matrix3,quaternionScratch=new Quaternion,centerScratch$2=new Cartographic;RectangleGeometry.createGeometry=function(e){if(CesiumMath.equalsEpsilon(e._rectangle.north,e._rectangle.south,CesiumMath.EPSILON10)||CesiumMath.equalsEpsilon(e._rectangle.east,e._rectangle.west,CesiumMath.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,r=e._stRotation,o=e._vertexFormat,a=RectangleGeometryLibrary.computeOptions(t,e._granularity,i,r,rectangleScratch$4,nwScratch$1,stNwScratch),s=tangentRotationMatrixScratch;if(0!==r||0!==i){const e=Rectangle.center(t,centerScratch$2),i=n.geodeticSurfaceNormalCartographic(e,v1Scratch);Quaternion.fromAxisAngle(i,-r,quaternionScratch),Matrix3.fromQuaternion(quaternionScratch,s)}else Matrix3.clone(Matrix3.IDENTITY,s);const c=e._surfaceHeight,l=e._extrudedHeight,u=!CesiumMath.equalsEpsilon(c,l,0,CesiumMath.EPSILON2);let d,h;if(a.lonScalar=1/e._rectangle.width,a.latScalar=1/e._rectangle.height,a.tangentRotationMatrix=s,t=e._rectangle,u){d=constructExtrudedRectangle$1(e,a);const i=BoundingSphere.fromRectangle3D(t,n,c,topBoundingSphere$1),r=BoundingSphere.fromRectangle3D(t,n,l,bottomBoundingSphere$1);h=BoundingSphere.union(i,r)}else{if(d=constructRectangle$1(e,a),d.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(d.attributes.position.values,c,n,!1),defined(e._offsetAttribute)){const t=d.attributes.position.values.length,n=new Uint8Array(t/3);arrayFill(n,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),d.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}h=BoundingSphere.fromRectangle3D(t,n,c)}return o.position||delete d.attributes.position,new Geometry({attributes:d.attributes,indices:d.indices,primitiveType:d.primitiveType,boundingSphere:h,offsetAttribute:e._offsetAttribute})},RectangleGeometry.createShadowVolume=function(e,t,n){const i=e._granularity,r=e._ellipsoid,o=t(i,r),a=n(i,r);return new RectangleGeometry({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:r,stRotation:e._stRotation,granularity:i,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})};const unrotatedTextureRectangleScratch=new Rectangle,points2DScratch$1=[new Cartesian2,new Cartesian2,new Cartesian2],rotation2DScratch=new Matrix2,rectangleCenterScratch$2=new Cartographic;function textureCoordinateRotationPoints(e){if(0===e._stRotation)return[0,0,0,1,1,0];const t=Rectangle.clone(e._rectangle,unrotatedTextureRectangleScratch),n=e._granularity,i=e._ellipsoid,r=computeRectangle(t,n,e._rotation-e._stRotation,i,unrotatedTextureRectangleScratch),o=points2DScratch$1;o[0].x=r.west,o[0].y=r.south,o[1].x=r.west,o[1].y=r.north,o[2].x=r.east,o[2].y=r.south;const a=e.rectangle,s=Matrix2.fromRotation(e._stRotation,rotation2DScratch),c=Rectangle.center(a,rectangleCenterScratch$2);for(let e=0;e<3;++e){const t=o[e];t.x-=c.longitude,t.y-=c.latitude,Matrix2.multiplyByVector(s,t,t),t.x+=c.longitude,t.y+=c.latitude,t.x=(t.x-a.west)/a.width,t.y=(t.y-a.south)/a.height}const l=o[0],u=o[1],d=o[2],h=new Array(6);return Cartesian2.pack(l,h),Cartesian2.pack(u,h,2),Cartesian2.pack(d,h,4),h}Object.defineProperties(RectangleGeometry.prototype,{rectangle:{get:function(){return defined(this._rotatedRectangle)||(this._rotatedRectangle=computeRectangle(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints(this)),this._textureCoordinateRotationPoints}}});const bottomBoundingSphere=new BoundingSphere,topBoundingSphere=new BoundingSphere,positionScratch$9=new Cartesian3,rectangleScratch$3=new Rectangle;function constructRectangle(e,t){const n=e._ellipsoid,i=t.height,r=t.width,o=t.northCap,a=t.southCap;let s=i,c=2,l=0,u=4;o&&(c-=1,s-=1,l+=1,u-=2),a&&(c-=1,s-=1,l+=1,u-=2),l+=c*r+2*s-u;const d=new Float64Array(3*l);let h,p=0,f=0;const m=positionScratch$9;if(o)RectangleGeometryLibrary.computePosition(t,n,!1,f,0,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;else for(h=0;h<r;h++)RectangleGeometryLibrary.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=r-1,f=1;f<i;f++)RectangleGeometryLibrary.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;if(f=i-1,!a)for(h=r-2;h>=0;h--)RectangleGeometryLibrary.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=0,f=i-2;f>0;f--)RectangleGeometryLibrary.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;const g=d.length/3*2,_=IndexDatatype$1.createTypedArray(d.length/3,g);let y=0;for(let e=0;e<d.length/3-1;e++)_[y++]=e,_[y++]=e+1;_[y++]=d.length/3-1,_[y++]=0;const C=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.LINES});return C.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d}),C.indices=_,C}function constructExtrudedRectangle(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,r=e._ellipsoid,o=i,a=n,s=constructRectangle(e,t),c=t.height,l=t.width,u=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,a,r,!1);let d=u.length;const h=new Float64Array(2*d);h.set(u);const p=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,o,r);h.set(p,d),s.attributes.position.values=h;const f=t.northCap,m=t.southCap;let g=4;f&&(g-=1),m&&(g-=1);const _=2*(h.length/3+g),y=IndexDatatype$1.createTypedArray(h.length/3,_);d=h.length/6;let C,T=0;for(let e=0;e<d-1;e++)y[T++]=e,y[T++]=e+1,y[T++]=e+d,y[T++]=e+d+1;if(y[T++]=d-1,y[T++]=0,y[T++]=d+d-1,y[T++]=d,y[T++]=0,y[T++]=d,f)C=c-1;else{const e=l-1;y[T++]=e,y[T++]=e+d,C=l+c-2}if(y[T++]=C,y[T++]=C+d,!m){const e=l+C-1;y[T++]=e,y[T]=e+d}return s.indices=y,s}function RectangleOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.rotation,0),o=defaultValue(e.height,0),a=defaultValue(e.extrudedHeight,o);this._rectangle=Rectangle.clone(t),this._granularity=n,this._ellipsoid=i,this._surfaceHeight=Math.max(o,a),this._rotation=r,this._extrudedHeight=Math.min(o,a),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}RectangleOutlineGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+5,RectangleOutlineGeometry.pack=function(e,t,n){return n=defaultValue(n,0),Rectangle.pack(e._rectangle,t,n),n+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=defaultValue(e._offsetAttribute,-1),t};const scratchRectangle$7=new Rectangle,scratchEllipsoid$3=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$4={rectangle:scratchRectangle$7,ellipsoid:scratchEllipsoid$3,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};RectangleOutlineGeometry.unpack=function(e,t,n){t=defaultValue(t,0);const i=Rectangle.unpack(e,t,scratchRectangle$7);t+=Rectangle.packedLength;const r=Ellipsoid.unpack(e,t,scratchEllipsoid$3);t+=Ellipsoid.packedLength;const o=e[t++],a=e[t++],s=e[t++],c=e[t++],l=e[t];return defined(n)?(n._rectangle=Rectangle.clone(i,n._rectangle),n._ellipsoid=Ellipsoid.clone(r,n._ellipsoid),n._surfaceHeight=a,n._rotation=s,n._extrudedHeight=c,n._offsetAttribute=-1===l?void 0:l,n):(scratchOptions$4.granularity=o,scratchOptions$4.height=a,scratchOptions$4.rotation=s,scratchOptions$4.extrudedHeight=c,scratchOptions$4.offsetAttribute=-1===l?void 0:l,new RectangleOutlineGeometry(scratchOptions$4))};const nwScratch=new Cartographic;RectangleOutlineGeometry.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=RectangleGeometryLibrary.computeOptions(t,e._granularity,e._rotation,0,rectangleScratch$3,nwScratch);let r,o;if(CesiumMath.equalsEpsilon(t.north,t.south,CesiumMath.EPSILON10)||CesiumMath.equalsEpsilon(t.east,t.west,CesiumMath.EPSILON10))return;const a=e._surfaceHeight,s=e._extrudedHeight;let c;if(!CesiumMath.equalsEpsilon(a,s,0,CesiumMath.EPSILON2)){if(r=constructExtrudedRectangle(e,i),defined(e._offsetAttribute)){const t=r.attributes.position.values.length/3;let n=new Uint8Array(t);e._offsetAttribute===GeometryOffsetAttribute$1.TOP?n=arrayFill(n,1,0,t/2):(c=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,n=arrayFill(n,c)),r.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}const l=BoundingSphere.fromRectangle3D(t,n,a,topBoundingSphere),u=BoundingSphere.fromRectangle3D(t,n,s,bottomBoundingSphere);o=BoundingSphere.union(l,u)}else{if(r=constructRectangle(e,i),r.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(r.attributes.position.values,a,n,!1),defined(e._offsetAttribute)){const t=r.attributes.position.values.length,n=new Uint8Array(t/3);c=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,arrayFill(n,c),r.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}o=BoundingSphere.fromRectangle3D(t,n,a)}return new Geometry({attributes:r.attributes,indices:r.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:o,offsetAttribute:e._offsetAttribute})};const ReferenceFrame={FIXED:0,INERTIAL:1};var ReferenceFrame$1=Object.freeze(ReferenceFrame);let implementation;function requestAnimationFramePolyFill(e){return implementation(e)}"undefined"!=typeof requestAnimationFrame&&(implementation=requestAnimationFrame),function(){if(!defined(implementation)&&"undefined"!=typeof window){const e=["webkit","moz","ms","o"];let t=0;const n=e.length;for(;t<n&&!defined(implementation);)implementation=window[e[t]+"RequestAnimationFrame"],++t}if(!defined(implementation)){const e=1e3/60;let t=0;implementation=function(n){const i=getTimestamp$1(),r=Math.max(e-(i-t),0);return t=i+r,setTimeout((function(){n(t)}),r)}}}();const S2_MAX_LEVEL=30,S2_LIMIT_IJ=1<<S2_MAX_LEVEL,S2_MAX_SITI=1<<S2_MAX_LEVEL+1>>>0,S2_POSITION_BITS=2*S2_MAX_LEVEL+1,S2_LOOKUP_BITS=4,S2_LOOKUP_POSITIONS=[],S2_LOOKUP_IJ=[],S2_POSITION_TO_IJ=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],S2_SWAP_MASK=1,S2_INVERT_MASK=2,S2_POSITION_TO_ORIENTATION_MASK=[S2_SWAP_MASK,0,0,S2_SWAP_MASK|S2_INVERT_MASK];function S2Cell(e){if(!FeatureDetection.supportsBigInt())throw new RuntimeError("S2 required BigInt support");this._cellId=e,this._level=S2Cell.getLevel(e)}function getS2Center(e,t){const n=convertCellIdToFaceSiTi(e,t);return convertFaceSiTitoXYZ(n[0],n[1],n[2])}function getS2Vertex(e,t,n){const i=convertCellIdToFaceIJ(e),r=convertIJLeveltoBoundUV([i[1],i[2]],t),o=n>>1&1;return convertFaceUVtoXYZ(i[0],r[0][o^1&n],r[1][o])}function convertCellIdToFaceSiTi(e,t){const n=convertCellIdToFaceIJ(e),i=n[0],r=n[1],o=n[2],a=30===t,s=!a&&(BigInt(r)^e>>BigInt(2))&BigInt(1),c=a?1:s?2:0;return[i,(r<<1)+c,(o<<1)+c]}function convertCellIdToFaceIJ(e){0===S2_LOOKUP_POSITIONS.length&&generateLookupTable();var t=Number(e>>BigInt(S2_POSITION_BITS));let n=t&S2_SWAP_MASK;const i=(1<<S2_LOOKUP_BITS)-1;let r=0,o=0;for(let t=7;t>=0;t--){const a=(1<<2*(7===t?S2_MAX_LEVEL-7*S2_LOOKUP_BITS:S2_LOOKUP_BITS))-1;n+=Number(e>>BigInt(2*t*S2_LOOKUP_BITS+1)&BigInt(a))<<2,n=S2_LOOKUP_IJ[n];const s=t*S2_LOOKUP_BITS;r+=n>>S2_LOOKUP_BITS+2<<s,o+=(n>>2&i)<<s,n&=S2_SWAP_MASK|S2_INVERT_MASK}return[t,r,o]}function convertFaceSiTitoXYZ(e,t,n){const i=convertSiTitoST(t),r=convertSiTitoST(n);return convertFaceUVtoXYZ(e,convertSTtoUV(i),convertSTtoUV(r))}function convertFaceUVtoXYZ(e,t,n){switch(e){case 0:return new Cartesian3(1,t,n);case 1:return new Cartesian3(-t,1,n);case 2:return new Cartesian3(-t,-n,1);case 3:return new Cartesian3(-1,-n,-t);case 4:return new Cartesian3(n,-1,-t);default:return new Cartesian3(n,t,-1)}}function convertSTtoUV(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function convertSiTitoST(e){return 1/S2_MAX_SITI*e}function convertIJLeveltoBoundUV(e,t){const n=[[],[]],i=getSizeIJ(t);for(let t=0;t<2;++t){const r=e[t]&-i,o=r+i;n[t][0]=convertSTtoUV(convertIJtoSTMinimum(r)),n[t][1]=convertSTtoUV(convertIJtoSTMinimum(o))}return n}function getSizeIJ(e){return 1<<S2_MAX_LEVEL-e>>>0}function convertIJtoSTMinimum(e){return 1/S2_LIMIT_IJ*e}function generateLookupCell(e,t,n,i,r,o){if(e===S2_LOOKUP_BITS){const e=(t<<S2_LOOKUP_BITS)+n;S2_LOOKUP_POSITIONS[(e<<2)+i]=(r<<2)+o,S2_LOOKUP_IJ[(r<<2)+i]=(e<<2)+o}else{e++,t<<=1,n<<=1,r<<=2;const a=S2_POSITION_TO_IJ[o];generateLookupCell(e,t+(a[0]>>1),n+(1&a[0]),i,r,o^S2_POSITION_TO_ORIENTATION_MASK[0]),generateLookupCell(e,t+(a[1]>>1),n+(1&a[1]),i,r+1,o^S2_POSITION_TO_ORIENTATION_MASK[1]),generateLookupCell(e,t+(a[2]>>1),n+(1&a[2]),i,r+2,o^S2_POSITION_TO_ORIENTATION_MASK[2]),generateLookupCell(e,t+(a[3]>>1),n+(1&a[3]),i,r+3,o^S2_POSITION_TO_ORIENTATION_MASK[3])}}function generateLookupTable(){generateLookupCell(0,0,0,0,0,0),generateLookupCell(0,0,0,S2_SWAP_MASK,0,S2_SWAP_MASK),generateLookupCell(0,0,0,S2_INVERT_MASK,0,S2_INVERT_MASK),generateLookupCell(0,0,0,S2_SWAP_MASK|S2_INVERT_MASK,0,S2_SWAP_MASK|S2_INVERT_MASK)}function lsb(e){return e&~e+BigInt(1)}function lsbForLevel(e){return BigInt(1)<<BigInt(2*(S2_MAX_LEVEL-e))}S2Cell.fromToken=function(e){return new S2Cell(S2Cell.getIdFromToken(e))},S2Cell.isValidId=function(e){return!(e<=0)&&(!(e>>BigInt(S2_POSITION_BITS)>5)&&!!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))},S2Cell.isValidToken=function(e){return!!/^[0-9a-fA-F]{1,16}$/.test(e)&&S2Cell.isValidId(S2Cell.getIdFromToken(e))},S2Cell.getIdFromToken=function(e){return BigInt("0x"+e+"0".repeat(16-e.length))},S2Cell.getTokenFromId=function(e){const t=Math.floor(countTrailingZeroBits(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n},S2Cell.getLevel=function(e){let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e>>=BigInt(1);return S2_MAX_LEVEL-(t>>1)},S2Cell.prototype.getChild=function(e){var t=lsb(this._cellId)>>BigInt(2);return new S2Cell(this._cellId+BigInt(2*e+1-4)*t)},S2Cell.prototype.getParent=function(){var e=lsb(this._cellId)<<BigInt(2);return new S2Cell(this._cellId&~e+BigInt(1)|e)},S2Cell.prototype.getParentAtLevel=function(e){const t=lsbForLevel(e);return new S2Cell(this._cellId&-t|t)},S2Cell.prototype.getCenter=function(e){e=defaultValue(e,Ellipsoid.WGS84);let t=getS2Center(this._cellId,this._level);t=Cartesian3.normalize(t,t);const n=new Cartographic.fromCartesian(t,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(n,e,new Cartesian3)},S2Cell.prototype.getVertex=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);let n=getS2Vertex(this._cellId,this._level,e);n=Cartesian3.normalize(n,n);const i=new Cartographic.fromCartesian(n,Ellipsoid.UNIT_SPHERE);return Cartographic.toCartesian(i,t,new Cartesian3)},S2Cell.fromFacePositionLevel=function(e,t,n){const i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),r=t.toString(2),o=Array(2*n-r.length+1).join("0"),a=Array(S2_POSITION_BITS-2*n).join("0");return new S2Cell(BigInt("0b"+i+o+r+"1"+a))};const Mod67BitPosition=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function countTrailingZeroBits(e){return Mod67BitPosition[(-e&e)%BigInt(67)]}function sampleTerrain(e,t,n){return e.readyPromise.then((function(){return doSampling(e,t,n)}))}function doSampling(e,t,n){const i=e.tilingScheme;let r;const o=[],a={};for(r=0;r<n.length;++r){const s=i.positionToTileXY(n[r],t),c=s.toString();if(!a.hasOwnProperty(c)){const n={x:s.x,y:s.y,level:t,tilingScheme:i,terrainProvider:e,positions:[]};a[c]=n,o.push(n)}a[c].positions.push(n[r])}const s=[];for(r=0;r<o.length;++r){const e=o[r],t=e.terrainProvider.requestTileGeometry(e.x,e.y,e.level).then(createInterpolateFunction(e)).otherwise(createMarkFailedFunction(e));s.push(t)}return when.all(s,(function(){return n}))}function interpolateAndAssignHeight(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return void 0!==i&&(e.height=i,!0)}function createInterpolateFunction(e){const t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let r=!1;for(let e=0;e<t.length;++e){if(!interpolateAndAssignHeight(t[e],i,n)){r=!0;break}}return r?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then((function(){for(let e=0;e<t.length;++e){interpolateAndAssignHeight(t[e],i,n)}})):when.resolve()}}function createMarkFailedFunction(e){const t=e.positions;return function(){for(let e=0;e<t.length;++e){t[e].height=void 0}}}const scratchCartesian2$4=new Cartesian2;function sampleTerrainMostDetailed(e,t){return e.readyPromise.then((function(){const n=[],i=[],r=e.availability,o=[];for(let a=0;a<t.length;++a){const s=t[a],c=r.computeMaximumLevelAtPosition(s);if(i[a]=c,0===c){e.tilingScheme.positionToTileXY(s,1,scratchCartesian2$4);const t=e.loadTileDataAvailability(scratchCartesian2$4.x,scratchCartesian2$4.y,1);defined(t)&&o.push(t)}let l=n[c];defined(l)||(n[c]=l=[]),l.push(s)}return when.all(o).then((function(){return when.all(n.map((function(t,n){if(defined(t))return sampleTerrain(e,n,t)})))})).then((function(){const n=[];for(let e=0;e<t.length;++e){const o=t[e];r.computeMaximumLevelAtPosition(o)!==i[e]&&n.push(o)}if(n.length>0)return sampleTerrainMostDetailed(e,n)})).then((function(){return t}))}))}const ScreenSpaceEventType={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19};var ScreenSpaceEventType$1=Object.freeze(ScreenSpaceEventType);function getPosition$1(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const r=i.getBoundingClientRect();return n.x=t.clientX-r.left,n.y=t.clientY-r.top,n}function getInputEventKey(e,t){let n=e;return defined(t)&&(n+="+"+t),n}function getModifier(e){return e.shiftKey?KeyboardEventModifier$1.SHIFT:e.ctrlKey?KeyboardEventModifier$1.CTRL:e.altKey?KeyboardEventModifier$1.ALT:void 0}const MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};function registerListener(e,t,n,i){function r(t){i(e,t)}FeatureDetection.isInternetExplorer()?n.addEventListener(t,r,!1):n.addEventListener(t,r,{capture:!1,passive:!1}),e._removalFunctions.push((function(){n.removeEventListener(t,r,!1)}))}function registerListeners(e){const t=e._element,n=defined(t.disableRootEvents)?t:document;let i;FeatureDetection.supportsPointerEvents()?(registerListener(e,"pointerdown",t,handlePointerDown),registerListener(e,"pointerup",t,handlePointerUp),registerListener(e,"pointermove",t,handlePointerMove),registerListener(e,"pointercancel",t,handlePointerUp)):(registerListener(e,"mousedown",t,handleMouseDown),registerListener(e,"mouseup",n,handleMouseUp),registerListener(e,"mousemove",n,handleMouseMove),registerListener(e,"touchstart",t,handleTouchStart),registerListener(e,"touchend",n,handleTouchEnd),registerListener(e,"touchmove",n,handleTouchMove),registerListener(e,"touchcancel",n,handleTouchEnd)),registerListener(e,"dblclick",t,handleDblClick),i="onwheel"in t?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",registerListener(e,i,t,handleWheel)}function unregisterListeners(e){const t=e._removalFunctions;for(let e=0;e<t.length;++e)t[e]()}const mouseDownEvent={position:new Cartesian2};function gotTouchEvent(e){e._lastSeenTouchEvent=getTimestamp$1()}function canProcessMouseEvent(e){return getTimestamp$1()-e._lastSeenTouchEvent>ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds}function checkPixelTolerance(e,t,n){const i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)<n}function handleMouseDown(e,t){if(!canProcessMouseEvent(e))return;const n=t.button;let i;if(e._buttonDown[n]=!0,n===MouseButton.LEFT)i=ScreenSpaceEventType$1.LEFT_DOWN;else if(n===MouseButton.MIDDLE)i=ScreenSpaceEventType$1.MIDDLE_DOWN;else{if(n!==MouseButton.RIGHT)return;i=ScreenSpaceEventType$1.RIGHT_DOWN}const r=getPosition$1(e,t,e._primaryPosition);Cartesian2.clone(r,e._primaryStartPosition),Cartesian2.clone(r,e._primaryPreviousPosition);const o=getModifier(t),a=e.getInputAction(i,o);defined(a)&&(Cartesian2.clone(r,mouseDownEvent.position),a(mouseDownEvent),t.preventDefault())}const mouseUpEvent={position:new Cartesian2},mouseClickEvent={position:new Cartesian2};function cancelMouseEvent(e,t,n,i){const r=getModifier(i),o=e.getInputAction(t,r),a=e.getInputAction(n,r);if(defined(o)||defined(a)){const t=getPosition$1(e,i,e._primaryPosition);if(defined(o)&&(Cartesian2.clone(t,mouseUpEvent.position),o(mouseUpEvent)),defined(a)){checkPixelTolerance(e._primaryStartPosition,t,e._clickPixelTolerance)&&(Cartesian2.clone(t,mouseClickEvent.position),a(mouseClickEvent))}}}function handleMouseUp(e,t){if(!canProcessMouseEvent(e))return;const n=t.button;n!==MouseButton.LEFT&&n!==MouseButton.MIDDLE&&n!==MouseButton.RIGHT||(e._buttonDown[MouseButton.LEFT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.LEFT_UP,ScreenSpaceEventType$1.LEFT_CLICK,t),e._buttonDown[MouseButton.LEFT]=!1),e._buttonDown[MouseButton.MIDDLE]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.MIDDLE_UP,ScreenSpaceEventType$1.MIDDLE_CLICK,t),e._buttonDown[MouseButton.MIDDLE]=!1),e._buttonDown[MouseButton.RIGHT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.RIGHT_UP,ScreenSpaceEventType$1.RIGHT_CLICK,t),e._buttonDown[MouseButton.RIGHT]=!1))}const mouseMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2};function handleMouseMove(e,t){if(!canProcessMouseEvent(e))return;const n=getModifier(t),i=getPosition$1(e,t,e._primaryPosition),r=e._primaryPreviousPosition,o=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,n);defined(o)&&(Cartesian2.clone(r,mouseMoveEvent.startPosition),Cartesian2.clone(i,mouseMoveEvent.endPosition),o(mouseMoveEvent)),Cartesian2.clone(i,r),(e._buttonDown[MouseButton.LEFT]||e._buttonDown[MouseButton.MIDDLE]||e._buttonDown[MouseButton.RIGHT])&&t.preventDefault()}const mouseDblClickEvent={position:new Cartesian2};function handleDblClick(e,t){let n;if(t.button!==MouseButton.LEFT)return;n=ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK;const i=getModifier(t),r=e.getInputAction(n,i);defined(r)&&(getPosition$1(e,t,mouseDblClickEvent.position),r(mouseDblClickEvent))}function handleWheel(e,t){let n;if(defined(t.deltaY)){const e=t.deltaMode;n=e===t.DOM_DELTA_PIXEL?-t.deltaY:e===t.DOM_DELTA_LINE?40*-t.deltaY:120*-t.deltaY}else n=t.detail>0?-120*t.detail:t.wheelDelta;if(!defined(n))return;const i=getModifier(t),r=e.getInputAction(ScreenSpaceEventType$1.WHEEL,i);defined(r)&&(r(n),t.preventDefault())}function handleTouchStart(e,t){gotTouchEvent(e);const n=t.changedTouches;let i;const r=n.length;let o,a;const s=e._positions;for(i=0;i<r;++i)o=n[i],a=o.identifier,s.set(a,getPosition$1(e,o,new Cartesian2));fireTouchEvents(e,t);const c=e._previousPositions;for(i=0;i<r;++i)o=n[i],a=o.identifier,c.set(a,Cartesian2.clone(s.get(a)))}function handleTouchEnd(e,t){gotTouchEvent(e);const n=t.changedTouches;let i;const r=n.length;let o,a;const s=e._positions;for(i=0;i<r;++i)o=n[i],a=o.identifier,s.remove(a);fireTouchEvents(e,t);const c=e._previousPositions;for(i=0;i<r;++i)o=n[i],a=o.identifier,c.remove(a)}const touchStartEvent={position:new Cartesian2},touch2StartEvent={position1:new Cartesian2,position2:new Cartesian2},touchEndEvent={position:new Cartesian2},touchClickEvent={position:new Cartesian2},touchHoldEvent={position:new Cartesian2};function fireTouchEvents(e,t){const n=getModifier(t),i=e._positions,r=i.length;let o,a;const s=e._isPinching;if(1!==r&&e._buttonDown[MouseButton.LEFT]){if(e._buttonDown[MouseButton.LEFT]=!1,defined(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),o=e.getInputAction(ScreenSpaceEventType$1.LEFT_UP,n),defined(o)&&(Cartesian2.clone(e._primaryPosition,touchEndEvent.position),o(touchEndEvent)),0===r&&!e._isTouchHolding&&(a=e.getInputAction(ScreenSpaceEventType$1.LEFT_CLICK,n),defined(a))){checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._clickPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchClickEvent.position),a(touchClickEvent))}e._isTouchHolding=!1}if(0===r&&s&&(e._isPinching=!1,o=e.getInputAction(ScreenSpaceEventType$1.PINCH_END,n),defined(o)&&o()),1===r&&!s){const r=i.values[0];Cartesian2.clone(r,e._primaryPosition),Cartesian2.clone(r,e._primaryStartPosition),Cartesian2.clone(r,e._primaryPreviousPosition),e._buttonDown[MouseButton.LEFT]=!0,o=e.getInputAction(ScreenSpaceEventType$1.LEFT_DOWN,n),defined(o)&&(Cartesian2.clone(r,touchStartEvent.position),o(touchStartEvent)),e._touchHoldTimer=setTimeout((function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,a=e.getInputAction(ScreenSpaceEventType$1.RIGHT_CLICK,n),defined(a))){checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._holdPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchHoldEvent.position),a(touchHoldEvent))}}),ScreenSpaceEventHandler.touchHoldDelayMilliseconds),t.preventDefault()}2!==r||s||(e._isPinching=!0,o=e.getInputAction(ScreenSpaceEventType$1.PINCH_START,n),defined(o)&&(Cartesian2.clone(i.values[0],touch2StartEvent.position1),Cartesian2.clone(i.values[1],touch2StartEvent.position2),o(touch2StartEvent),t.preventDefault()))}function handleTouchMove(e,t){gotTouchEvent(e);const n=t.changedTouches;let i;const r=n.length;let o,a;const s=e._positions;for(i=0;i<r;++i){o=n[i],a=o.identifier;const t=s.get(a);defined(t)&&getPosition$1(e,o,t)}fireTouchMoveEvents(e,t);const c=e._previousPositions;for(i=0;i<r;++i)o=n[i],a=o.identifier,Cartesian2.clone(s.get(a),c.get(a))}const touchMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2},touchPinchMovementEvent={distance:{startPosition:new Cartesian2,endPosition:new Cartesian2},angleAndHeight:{startPosition:new Cartesian2,endPosition:new Cartesian2}};function fireTouchMoveEvents(e,t){const n=getModifier(t),i=e._positions,r=e._previousPositions,o=i.length;let a;if(1===o&&e._buttonDown[MouseButton.LEFT]){const r=i.values[0];Cartesian2.clone(r,e._primaryPosition);const o=e._primaryPreviousPosition;a=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,n),defined(a)&&(Cartesian2.clone(o,touchMoveEvent.startPosition),Cartesian2.clone(r,touchMoveEvent.endPosition),a(touchMoveEvent)),Cartesian2.clone(r,o),t.preventDefault()}else if(2===o&&e._isPinching&&(a=e.getInputAction(ScreenSpaceEventType$1.PINCH_MOVE,n),defined(a))){const e=i.values[0],t=i.values[1],n=r.values[0],o=r.values[1],s=t.x-e.x,c=t.y-e.y,l=.25*Math.sqrt(s*s+c*c),u=o.x-n.x,d=o.y-n.y,h=.25*Math.sqrt(u*u+d*d),p=.125*(t.y+e.y),f=.125*(o.y+n.y),m=Math.atan2(c,s),g=Math.atan2(d,u);Cartesian2.fromElements(0,h,touchPinchMovementEvent.distance.startPosition),Cartesian2.fromElements(0,l,touchPinchMovementEvent.distance.endPosition),Cartesian2.fromElements(g,f,touchPinchMovementEvent.angleAndHeight.startPosition),Cartesian2.fromElements(m,p,touchPinchMovementEvent.angleAndHeight.endPosition),a(touchPinchMovementEvent)}}function handlePointerDown(e,t){if(t.target.setPointerCapture(t.pointerId),"touch"===t.pointerType){const n=e._positions,i=t.pointerId;n.set(i,getPosition$1(e,t,new Cartesian2)),fireTouchEvents(e,t);e._previousPositions.set(i,Cartesian2.clone(n.get(i)))}else handleMouseDown(e,t)}function handlePointerUp(e,t){if("touch"===t.pointerType){const n=e._positions,i=t.pointerId;n.remove(i),fireTouchEvents(e,t);e._previousPositions.remove(i)}else handleMouseUp(e,t)}function handlePointerMove(e,t){if("touch"===t.pointerType){const n=e._positions,i=t.pointerId,r=n.get(i);if(!defined(r))return;getPosition$1(e,t,r),fireTouchMoveEvents(e,t);const o=e._previousPositions;Cartesian2.clone(n.get(i),o.get(i))}else handleMouseMove(e,t)}function ScreenSpaceEventHandler(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new Cartesian2,this._primaryPosition=new Cartesian2,this._primaryPreviousPosition=new Cartesian2,this._positions=new AssociativeArray,this._previousPositions=new AssociativeArray,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=defaultValue(e,document),registerListeners(this)}function ShowGeometryInstanceAttribute(e){e=defaultValue(e,!0),this.value=ShowGeometryInstanceAttribute.toValue(e)}ScreenSpaceEventHandler.prototype.setInputAction=function(e,t,n){const i=getInputEventKey(t,n);this._inputEvents[i]=e},ScreenSpaceEventHandler.prototype.getInputAction=function(e,t){const n=getInputEventKey(e,t);return this._inputEvents[n]},ScreenSpaceEventHandler.prototype.removeInputAction=function(e,t){const n=getInputEventKey(e,t);delete this._inputEvents[n]},ScreenSpaceEventHandler.prototype.isDestroyed=function(){return!1},ScreenSpaceEventHandler.prototype.destroy=function(){return unregisterListeners(this),destroyObject(this)},ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds=800,ScreenSpaceEventHandler.touchHoldDelayMilliseconds=1500,Object.defineProperties(ShowGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}}),ShowGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e,t):new Uint8Array([e])};const Simon1994PlanetaryPositions={};function computeTdbMinusTtSpice(e){const t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}const TdtMinusTai=32.184,J2000d=2451545;function taiToTdb(e,t){t=JulianDate.addSeconds(e,TdtMinusTai,t);const n=JulianDate.totalDays(t)-J2000d;return t=JulianDate.addSeconds(t,computeTdbMinusTtSpice(n),t)}const epoch=new JulianDate(2451545,0,TimeStandard$1.TAI),MetersPerKilometer=1e3,RadiansPerDegree=CesiumMath.RADIANS_PER_DEGREE,RadiansPerArcSecond=CesiumMath.RADIANS_PER_ARCSECOND,MetersPerAstronomicalUnit=14959787e4,perifocalToEquatorial=new Matrix3;function elementsToCartesian(e,t,n,i,r,o,a){n<0&&(n=-n,r+=CesiumMath.PI);const s=e*(1-t),c=i-r,l=r,u=meanAnomalyToTrueAnomaly(o-i,t);perifocalToCartesianMatrix(c,n,l,perifocalToEquatorial);const d=s*(1+t),h=Math.cos(u),p=Math.sin(u),f=d/(1+t*h);return defined(a)?(a.x=f*h,a.y=f*p,a.z=0):a=new Cartesian3(f*h,f*p,0),Matrix3.multiplyByVector(perifocalToEquatorial,a,a)}function meanAnomalyToTrueAnomaly(e,t){return eccentricAnomalyToTrueAnomaly(meanAnomalyToEccentricAnomaly(e,t),t)}const maxIterationCount=50,keplerEqConvergence=CesiumMath.EPSILON8;function meanAnomalyToEccentricAnomaly(e,t){const n=Math.floor(e/CesiumMath.TWO_PI);let i,r=(e-=n*CesiumMath.TWO_PI)+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE;for(i=0;i<maxIterationCount&&Math.abs(o-r)>keplerEqConvergence;++i){o=r;r=o-(o-t*Math.sin(o)-e)/(1-t*Math.cos(o))}return o=r+n*CesiumMath.TWO_PI,o}function eccentricAnomalyToTrueAnomaly(e,t){const n=Math.floor(e/CesiumMath.TWO_PI);e-=n*CesiumMath.TWO_PI;const i=Math.cos(e)-t,r=Math.sin(e)*Math.sqrt(1-t*t);let o=Math.atan2(r,i);return o=CesiumMath.zeroToTwoPi(o),e<0&&(o-=CesiumMath.TWO_PI),o+=n*CesiumMath.TWO_PI,o}function perifocalToCartesianMatrix(e,t,n,i){const r=Math.cos(e),o=Math.sin(e),a=Math.cos(t),s=Math.sin(t),c=Math.cos(n),l=Math.sin(n);return defined(i)?(i[0]=c*r-l*o*a,i[1]=l*r+c*o*a,i[2]=o*s,i[3]=-c*o-l*r*a,i[4]=-l*o+c*r*a,i[5]=r*s,i[6]=l*s,i[7]=-c*s,i[8]=a):i=new Matrix3(c*r-l*o*a,-c*o-l*r*a,l*s,l*r+c*o*a,-l*o+c*r*a,-c*s,o*s,r*s,a),i}const semiMajorAxis0=1.0000010178*MetersPerAstronomicalUnit,meanLongitude0=100.46645683*RadiansPerDegree,meanLongitude1=1295977422.83429*RadiansPerArcSecond,p1u=16002,p2u=21863,p3u=32004,p4u=10931,p5u=14529,p6u=16368,p7u=15318,p8u=32794,Ca1=64*1e-7*MetersPerAstronomicalUnit,Ca2=1e-7*-152*MetersPerAstronomicalUnit,Ca3=62*1e-7*MetersPerAstronomicalUnit,Ca4=-8e-7*MetersPerAstronomicalUnit,Ca5=32*1e-7*MetersPerAstronomicalUnit,Ca6=1e-7*-41*MetersPerAstronomicalUnit,Ca7=19*1e-7*MetersPerAstronomicalUnit,Ca8=1e-7*-11*MetersPerAstronomicalUnit,Sa1=1e-7*-150*MetersPerAstronomicalUnit,Sa2=1e-7*-46*MetersPerAstronomicalUnit,Sa3=68*1e-7*MetersPerAstronomicalUnit,Sa4=54*1e-7*MetersPerAstronomicalUnit,Sa5=14*1e-7*MetersPerAstronomicalUnit,Sa6=24*1e-7*MetersPerAstronomicalUnit,Sa7=1e-7*-28*MetersPerAstronomicalUnit,Sa8=22*1e-7*MetersPerAstronomicalUnit,q1u=10,q2u=16002,q3u=21863,q4u=10931,q5u=1473,q6u=32004,q7u=4387,q8u=73,Cl1=1e-7*-325,Cl2=1e-7*-322,Cl3=1e-7*-79,Cl4=232*1e-7,Cl5=1e-7*-52,Cl6=97*1e-7,Cl7=55*1e-7,Cl8=1e-7*-41,Sl1=1e-7*-105,Sl2=1e-7*-137,Sl3=258*1e-7,Sl4=35*1e-7,Sl5=1e-7*-116,Sl6=1e-7*-88,Sl7=1e-7*-112,Sl8=1e-7*-80,scratchDate$1=new JulianDate(0,0,TimeStandard$1.TAI);function computeSimonEarthMoonBarycenter(e,t){taiToTdb(e,scratchDate$1);const n=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/(10*TimeConstants$1.DAYS_PER_JULIAN_CENTURY),i=.3595362*n,r=semiMajorAxis0+Ca1*Math.cos(p1u*i)+Sa1*Math.sin(p1u*i)+Ca2*Math.cos(p2u*i)+Sa2*Math.sin(p2u*i)+Ca3*Math.cos(p3u*i)+Sa3*Math.sin(p3u*i)+Ca4*Math.cos(p4u*i)+Sa4*Math.sin(p4u*i)+Ca5*Math.cos(p5u*i)+Sa5*Math.sin(p5u*i)+Ca6*Math.cos(p6u*i)+Sa6*Math.sin(p6u*i)+Ca7*Math.cos(p7u*i)+Sa7*Math.sin(p7u*i)+Ca8*Math.cos(p8u*i)+Sa8*Math.sin(p8u*i),o=meanLongitude0+meanLongitude1*n+Cl1*Math.cos(q1u*i)+Sl1*Math.sin(q1u*i)+Cl2*Math.cos(q2u*i)+Sl2*Math.sin(q2u*i)+Cl3*Math.cos(q3u*i)+Sl3*Math.sin(q3u*i)+Cl4*Math.cos(q4u*i)+Sl4*Math.sin(q4u*i)+Cl5*Math.cos(q5u*i)+Sl5*Math.sin(q5u*i)+Cl6*Math.cos(q6u*i)+Sl6*Math.sin(q6u*i)+Cl7*Math.cos(q7u*i)+Sl7*Math.sin(q7u*i)+Cl8*Math.cos(q8u*i)+Sl8*Math.sin(q8u*i);return elementsToCartesian(r,.0167086342-.0004203654*n,469.97289*RadiansPerArcSecond*n,102.93734808*RadiansPerDegree+11612.3529*RadiansPerArcSecond*n,174.87317577*RadiansPerDegree-8679.27034*RadiansPerArcSecond*n,o,t)}function computeSimonMoon(e,t){taiToTdb(e,scratchDate$1);const n=(scratchDate$1.dayNumber-epoch.dayNumber+(scratchDate$1.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,i=n*n,r=i*n,o=r*n;let a=383397.7725+.004*n,s=.055545526-16e-9*n;const c=5.15668983*RadiansPerDegree;let l=-8e-5*n+.02966*i-42e-6*r-13e-8*o;const u=83.35324312*RadiansPerDegree;let d=14643420.2669*n-38.2702*i-.045047*r+21301e-8*o;const h=125.04455501*RadiansPerDegree;let p=-6967919.3631*n+6.3602*i+.007625*r-3586e-8*o;const f=218.31664563*RadiansPerDegree;let m=1732559343.4847*n-6.391*i+.006588*r-3169e-8*o;const g=297.85019547*RadiansPerDegree+RadiansPerArcSecond*(1602961601.209*n-6.3706*i+.006593*r-3169e-8*o),_=134.96340251*RadiansPerDegree+RadiansPerArcSecond*(1717915923.2178*n+31.8792*i+.051635*r-2447e-7*o),y=357.52910918*RadiansPerDegree+RadiansPerArcSecond*(129596581.0481*n-.5532*i+136e-6*r-1149e-8*o),C=310.17137918*RadiansPerDegree-RadiansPerArcSecond*(6967051.436*n+6.2068*i+.007618*r-3219e-8*o),T=2*g,S=4*g,A=6*g,v=2*_,E=3*_,b=4*_,x=2*(93.27209062*RadiansPerDegree+RadiansPerArcSecond*(1739527262.8478*n-12.7512*i-.001037*r+417e-8*o));a+=3400.4*Math.cos(T)-635.6*Math.cos(T-_)-235.6*Math.cos(_)+218.1*Math.cos(T-y)+181*Math.cos(T+_),s+=.014216*Math.cos(T-_)+.008551*Math.cos(T-v)-.001383*Math.cos(_)+.001356*Math.cos(T+_)-.001147*Math.cos(S-E)-914e-6*Math.cos(S-v)+869e-6*Math.cos(T-y-_)-627e-6*Math.cos(T)-394e-6*Math.cos(S-b)+282e-6*Math.cos(T-y-v)-279e-6*Math.cos(g-_)-236e-6*Math.cos(v)+231e-6*Math.cos(S)+229e-6*Math.cos(A-b)-201e-6*Math.cos(v-x),l+=486.26*Math.cos(T-x)-40.13*Math.cos(T)+37.51*Math.cos(x)+25.73*Math.cos(v-x)+19.97*Math.cos(T-y-x),d+=-55609*Math.sin(T-_)-34711*Math.sin(T-v)-9792*Math.sin(_)+9385*Math.sin(S-E)+7505*Math.sin(S-v)+5318*Math.sin(T+_)+3484*Math.sin(S-b)-3417*Math.sin(T-y-_)-2530*Math.sin(A-b)-2376*Math.sin(T)-2075*Math.sin(T-E)-1883*Math.sin(v)-1736*Math.sin(A-5*_)+1626*Math.sin(y)-1370*Math.sin(A-E),p+=-5392*Math.sin(T-x)-540*Math.sin(y)-441*Math.sin(T)+423*Math.sin(x)-288*Math.sin(v-x),m+=-3332.9*Math.sin(T)+1197.4*Math.sin(T-_)-662.5*Math.sin(y)+396.3*Math.sin(_)-218*Math.sin(T-y);const P=2*C,D=3*C;l+=46.997*Math.cos(C)*n-.614*Math.cos(T-x+C)*n+.614*Math.cos(T-x-C)*n-.0297*Math.cos(P)*i-.0335*Math.cos(C)*i+.0012*Math.cos(T-x+P)*i-16e-5*Math.cos(C)*r+4e-5*Math.cos(D)*r+4e-5*Math.cos(P)*r;const w=2.116*Math.sin(C)*n-.111*Math.sin(T-x-C)*n-.0015*Math.sin(C)*i;d+=w,m+=w,p+=-520.77*Math.sin(C)*n+13.66*Math.sin(T-x+C)*n+1.12*Math.sin(T-C)*n-1.06*Math.sin(x-C)*n+.66*Math.sin(P)*i+.371*Math.sin(C)*i-.035*Math.sin(T-x+P)*i-.015*Math.sin(T-x+C)*i+.0014*Math.sin(C)*r-.0011*Math.sin(D)*r-9e-4*Math.sin(P)*r,a*=MetersPerKilometer;return elementsToCartesian(a,s,c+l*RadiansPerArcSecond,u+d*RadiansPerArcSecond,h+p*RadiansPerArcSecond,f+m*RadiansPerArcSecond,t)}const moonEarthMassRatio=.012300034,factor=moonEarthMassRatio/(moonEarthMassRatio+1)*-1;function computeSimonEarth(e,t){return t=computeSimonMoon(e,t),Cartesian3.multiplyByScalar(t,factor,t)}const axesTransformation=new Matrix3(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let translation=new Cartesian3;function interpolateColors(e,t,n,i,r,o,a){const s=PolylinePipeline.numberOfPoints(e,t,r);let c;const l=n.red,u=n.green,d=n.blue,h=n.alpha,p=i.red,f=i.green,m=i.blue,g=i.alpha;if(Color.equals(n,i)){for(c=0;c<s;c++)o[a++]=Color.floatToByte(l),o[a++]=Color.floatToByte(u),o[a++]=Color.floatToByte(d),o[a++]=Color.floatToByte(h);return a}const _=(p-l)/s,y=(f-u)/s,C=(m-d)/s,T=(g-h)/s;let S=a;for(c=0;c<s;c++)o[S++]=Color.floatToByte(l+c*_),o[S++]=Color.floatToByte(u+c*y),o[S++]=Color.floatToByte(d+c*C),o[S++]=Color.floatToByte(h+c*T);return S}function SimplePolylineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.colors,i=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=n,this._colorsPerVertex=i,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";let r=1+t.length*Cartesian3.packedLength;r+=defined(n)?1+n.length*Color.packedLength:1,this.packedLength=r+Ellipsoid.packedLength+3}Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),defined(t)||(t=new Cartesian3),translation=computeSimonEarthMoonBarycenter(e,translation),t=Cartesian3.negate(translation,t),computeSimonEarth(e,translation),Cartesian3.subtract(t,translation,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),t=computeSimonMoon(e,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},SimplePolylineGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._colors;for(o=defined(a)?a.length:0,t[n++]=o,i=0;i<o;++i,n+=Color.packedLength)Color.pack(a[i],t,n);return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t},SimplePolylineGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);r=e[t++];const a=r>0?new Array(r):void 0;for(i=0;i<r;++i,t+=Color.packedLength)a[i]=Color.unpack(e,t);const s=Ellipsoid.unpack(e,t);t+=Ellipsoid.packedLength;const c=1===e[t++],l=e[t++],u=e[t];return defined(n)?(n._positions=o,n._colors=a,n._ellipsoid=s,n._colorsPerVertex=c,n._arcType=l,n._granularity=u,n):new SimplePolylineGeometry({positions:o,colors:a,ellipsoid:s,colorsPerVertex:c,arcType:l,granularity:u})};const scratchArray1=new Array(2),scratchArray2=new Array(2),generateArcOptionsScratch$1={positions:scratchArray1,height:scratchArray2,ellipsoid:void 0,minDistance:void 0,granularity:void 0};function SphereGeometry(e){const t=defaultValue(e.radius,1),n={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new EllipsoidGeometry(n),this._workerName="createSphereGeometry"}SimplePolylineGeometry.createGeometry=function(e){const t=e._positions,n=e._colors,i=e._colorsPerVertex,r=e._arcType,o=e._granularity,a=e._ellipsoid,s=CesiumMath.chordLength(o,a.maximumRadius),c=defined(n)&&!i;let l;const u=t.length;let d,h,p,f,m=0;if(r===ArcType$1.GEODESIC||r===ArcType$1.RHUMB){let e,i,h;r===ArcType$1.GEODESIC?(e=CesiumMath.chordLength(o,a.maximumRadius),i=PolylinePipeline.numberOfPoints,h=PolylinePipeline.generateArc):(e=o,i=PolylinePipeline.numberOfPointsRhumbLine,h=PolylinePipeline.generateRhumbArc);const g=PolylinePipeline.extractHeights(t,a),_=generateArcOptionsScratch$1;if(r===ArcType$1.GEODESIC?_.minDistance=s:_.granularity=o,_.ellipsoid=a,c){let r=0;for(l=0;l<u-1;l++)r+=i(t[l],t[l+1],e)+1;d=new Float64Array(3*r),p=new Uint8Array(4*r),_.positions=scratchArray1,_.height=scratchArray2;let o=0;for(l=0;l<u-1;++l){scratchArray1[0]=t[l],scratchArray1[1]=t[l+1],scratchArray2[0]=g[l],scratchArray2[1]=g[l+1];const e=h(_);if(defined(n)){const t=e.length/3;f=n[l];for(let e=0;e<t;++e)p[o++]=Color.floatToByte(f.red),p[o++]=Color.floatToByte(f.green),p[o++]=Color.floatToByte(f.blue),p[o++]=Color.floatToByte(f.alpha)}d.set(e,m),m+=e.length}}else if(_.positions=t,_.height=g,d=new Float64Array(h(_)),defined(n)){for(p=new Uint8Array(d.length/3*4),l=0;l<u-1;++l){m=interpolateColors(t[l],t[l+1],n[l],n[l+1],s,p,m)}const e=n[u-1];p[m++]=Color.floatToByte(e.red),p[m++]=Color.floatToByte(e.green),p[m++]=Color.floatToByte(e.blue),p[m++]=Color.floatToByte(e.alpha)}}else{h=c?2*u-2:u,d=new Float64Array(3*h),p=defined(n)?new Uint8Array(4*h):void 0;let e=0,i=0;for(l=0;l<u;++l){const r=t[l];if(c&&l>0&&(Cartesian3.pack(r,d,e),e+=3,f=n[l-1],p[i++]=Color.floatToByte(f.red),p[i++]=Color.floatToByte(f.green),p[i++]=Color.floatToByte(f.blue),p[i++]=Color.floatToByte(f.alpha)),c&&l===u-1)break;Cartesian3.pack(r,d,e),e+=3,defined(n)&&(f=n[l],p[i++]=Color.floatToByte(f.red),p[i++]=Color.floatToByte(f.green),p[i++]=Color.floatToByte(f.blue),p[i++]=Color.floatToByte(f.alpha))}}const g=new GeometryAttributes;g.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d}),defined(n)&&(g.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:p,normalize:!0})),h=d.length/3;const _=2*(h-1),y=IndexDatatype$1.createTypedArray(h,_);let C=0;for(l=0;l<h-1;++l)y[C++]=l,y[C++]=l+1;return new Geometry({attributes:g,indices:y,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromPoints(t)})},SphereGeometry.packedLength=EllipsoidGeometry.packedLength,SphereGeometry.pack=function(e,t,n){return EllipsoidGeometry.pack(e._ellipsoidGeometry,t,n)};const scratchEllipsoidGeometry$1=new EllipsoidGeometry,scratchOptions$3={radius:void 0,radii:new Cartesian3,vertexFormat:new VertexFormat,stackPartitions:void 0,slicePartitions:void 0};function SphereOutlineGeometry(e){const t=defaultValue(e.radius,1),n={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new EllipsoidOutlineGeometry(n),this._workerName="createSphereOutlineGeometry"}SphereGeometry.unpack=function(e,t,n){const i=EllipsoidGeometry.unpack(e,t,scratchEllipsoidGeometry$1);return scratchOptions$3.vertexFormat=VertexFormat.clone(i._vertexFormat,scratchOptions$3.vertexFormat),scratchOptions$3.stackPartitions=i._stackPartitions,scratchOptions$3.slicePartitions=i._slicePartitions,defined(n)?(Cartesian3.clone(i._radii,scratchOptions$3.radii),n._ellipsoidGeometry=new EllipsoidGeometry(scratchOptions$3),n):(scratchOptions$3.radius=i._radii.x,new SphereGeometry(scratchOptions$3))},SphereGeometry.createGeometry=function(e){return EllipsoidGeometry.createGeometry(e._ellipsoidGeometry)},SphereOutlineGeometry.packedLength=EllipsoidOutlineGeometry.packedLength,SphereOutlineGeometry.pack=function(e,t,n){return EllipsoidOutlineGeometry.pack(e._ellipsoidGeometry,t,n)};const scratchEllipsoidGeometry=new EllipsoidOutlineGeometry,scratchOptions$2={radius:void 0,radii:new Cartesian3,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};function Spherical(e,t,n){this.clock=defaultValue(e,0),this.cone=defaultValue(t,0),this.magnitude=defaultValue(n,1)}function subdivideArray(e,t){const n=[],i=e.length;let r=0;for(;r<i;){const o=Math.ceil((i-r)/t--);n.push(e.slice(r,r+o)),r+=o}return n}SphereOutlineGeometry.unpack=function(e,t,n){const i=EllipsoidOutlineGeometry.unpack(e,t,scratchEllipsoidGeometry);return scratchOptions$2.stackPartitions=i._stackPartitions,scratchOptions$2.slicePartitions=i._slicePartitions,scratchOptions$2.subdivisions=i._subdivisions,defined(n)?(Cartesian3.clone(i._radii,scratchOptions$2.radii),n._ellipsoidGeometry=new EllipsoidOutlineGeometry(scratchOptions$2),n):(scratchOptions$2.radius=i._radii.x,new SphereOutlineGeometry(scratchOptions$2))},SphereOutlineGeometry.createGeometry=function(e){return EllipsoidOutlineGeometry.createGeometry(e._ellipsoidGeometry)},Spherical.fromCartesian3=function(e,t){const n=e.x,i=e.y,r=e.z,o=n*n+i*i;return defined(t)||(t=new Spherical),t.clock=Math.atan2(i,n),t.cone=Math.atan2(Math.sqrt(o),r),t.magnitude=Math.sqrt(o+r*r),t},Spherical.clone=function(e,t){if(defined(e))return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new Spherical(e.clock,e.cone,e.magnitude)},Spherical.normalize=function(e,t){return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new Spherical(e.clock,e.cone,1)},Spherical.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude},Spherical.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.clock-t.clock)<=n&&Math.abs(e.cone-t.cone)<=n&&Math.abs(e.magnitude-t.magnitude)<=n},Spherical.prototype.equals=function(e){return Spherical.equals(this,e)},Spherical.prototype.clone=function(e){return Spherical.clone(this,e)},Spherical.prototype.equalsEpsilon=function(e,t){return Spherical.equalsEpsilon(this,e,t)},Spherical.prototype.toString=function(){return"("+this.clock+", "+this.cone+", "+this.magnitude+")"};const TileEdge={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7};function TilingScheme(e){}function compareIntervalStartTimes(e,t){return JulianDate.compare(e.start,t.start)}function TimeIntervalCollection(e){if(this._intervals=[],this._changedEvent=new Event,defined(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(TilingScheme.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},projection:{get:DeveloperError.throwInstantiationError}}),TilingScheme.prototype.getNumberOfXTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.getNumberOfYTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.rectangleToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.positionToTileXY=DeveloperError.throwInstantiationError,Object.defineProperties(TimeIntervalCollection.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return 0!==e.length&&e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const e=this._intervals,t=e.length;return 0!==t&&e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return 0===this._intervals.length}}}),TimeIntervalCollection.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof TimeIntervalCollection))return!1;const n=this._intervals,i=e._intervals,r=n.length;if(r!==i.length)return!1;for(let e=0;e<r;e++)if(!TimeInterval.equals(n[e],i[e],t))return!1;return!0},TimeIntervalCollection.prototype.get=function(e){return this._intervals[e]},TimeIntervalCollection.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},TimeIntervalCollection.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0},TimeIntervalCollection.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0},TimeIntervalCollection.prototype.contains=function(e){return this.indexOf(e)>=0};const indexOfScratch=new TimeInterval;TimeIntervalCollection.prototype.indexOf=function(e){const t=this._intervals;indexOfScratch.start=e,indexOfScratch.stop=e;let n=binarySearch(t,indexOfScratch,compareIntervalStartTimes);return n>=0?t[n].isStartIncluded?n:n>0&&t[n-1].stop.equals(e)&&t[n-1].isStopIncluded?n-1:~n:(n=~n,n>0&&n-1<t.length&&TimeInterval.contains(t[n-1],e)?n-1:~n)},TimeIntervalCollection.prototype.findInterval=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).start,n=e.stop,i=e.isStartIncluded,r=e.isStopIncluded,o=this._intervals;for(let e=0,a=o.length;e<a;e++){const a=o[e];if((!defined(t)||a.start.equals(t))&&(!defined(n)||a.stop.equals(n))&&(!defined(i)||a.isStartIncluded===i)&&(!defined(r)||a.isStopIncluded===r))return o[e]}},TimeIntervalCollection.prototype.addInterval=function(e,t){if(e.isEmpty)return;const n=this._intervals;if(0===n.length||JulianDate.greaterThan(e.start,n[n.length-1].stop))return n.push(e),void this._changedEvent.raiseEvent(this);let i,r=binarySearch(n,e,compareIntervalStartTimes);for(r<0?r=~r:r>0&&e.isStartIncluded&&n[r-1].isStartIncluded&&n[r-1].start.equals(e.start)?--r:r<n.length&&!e.isStartIncluded&&n[r].isStartIncluded&&n[r].start.equals(e.start)&&++r,r>0&&(i=JulianDate.compare(n[r-1].stop,e.start),(i>0||0===i&&(n[r-1].isStopIncluded||e.isStartIncluded))&&((defined(t)?t(n[r-1].data,e.data):n[r-1].data===e.data)?(e=JulianDate.greaterThan(e.stop,n[r-1].stop)?new TimeInterval({start:n[r-1].start,stop:e.stop,isStartIncluded:n[r-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):new TimeInterval({start:n[r-1].start,stop:n[r-1].stop,isStartIncluded:n[r-1].isStartIncluded,isStopIncluded:n[r-1].isStopIncluded||e.stop.equals(n[r-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(r-1,1),--r):(i=JulianDate.compare(n[r-1].stop,e.stop),(i>0||0===i&&n[r-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(r,0,new TimeInterval({start:e.stop,stop:n[r-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[r-1].isStopIncluded,data:n[r-1].data})),n[r-1]=new TimeInterval({start:n[r-1].start,stop:e.start,isStartIncluded:n[r-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[r-1].data}))));r<n.length&&(i=JulianDate.compare(e.stop,n[r].start),i>0||0===i&&(e.isStopIncluded||n[r].isStartIncluded));)if(defined(t)?t(n[r].data,e.data):n[r].data===e.data)e=new TimeInterval({start:e.start,stop:JulianDate.greaterThan(n[r].stop,e.stop)?n[r].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:JulianDate.greaterThan(n[r].stop,e.stop)?n[r].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(r,1);else{if(n[r]=new TimeInterval({start:e.stop,stop:n[r].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[r].isStopIncluded,data:n[r].data}),!n[r].isEmpty)break;n.splice(r,1)}n.splice(r,0,e),this._changedEvent.raiseEvent(this)},TimeIntervalCollection.prototype.removeInterval=function(e){if(e.isEmpty)return!1;const t=this._intervals;let n=binarySearch(t,e,compareIntervalStartTimes);n<0&&(n=~n);let i=!1;for(n>0&&(JulianDate.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(JulianDate.greaterThan(t[n-1].stop,e.stop)||t[n-1].isStopIncluded&&!e.isStopIncluded&&t[n-1].stop.equals(e.stop))&&t.splice(n,0,new TimeInterval({start:e.stop,stop:t[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n-1].isStopIncluded,data:t[n-1].data})),t[n-1]=new TimeInterval({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n<t.length&&!e.isStartIncluded&&t[n].isStartIncluded&&e.start.equals(t[n].start)&&(i=!0,t.splice(n,0,new TimeInterval({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&JulianDate.greaterThan(e.stop,t[n].stop);)i=!0,t.splice(n,1);return n<t.length&&e.stop.equals(t[n].stop)&&(i=!0,!e.isStopIncluded&&t[n].isStopIncluded?n+1<t.length&&t[n+1].start.equals(e.stop)&&t[n].data===t[n+1].data?(t.splice(n,1),t[n]=new TimeInterval({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new TimeInterval({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(JulianDate.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new TimeInterval({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i},TimeIntervalCollection.prototype.intersect=function(e,t,n){const i=new TimeIntervalCollection;let r=0,o=0;const a=this._intervals,s=e._intervals;for(;r<a.length&&o<s.length;){const e=a[r],c=s[o];if(JulianDate.lessThan(e.stop,c.start))++r;else if(JulianDate.lessThan(c.stop,e.start))++o;else{if(defined(n)||defined(t)&&t(e.data,c.data)||!defined(t)&&c.data===e.data){const r=TimeInterval.intersect(e,c,new TimeInterval,n);r.isEmpty||i.addInterval(r,t)}JulianDate.lessThan(e.stop,c.stop)||e.stop.equals(c.stop)&&!e.isStopIncluded&&c.isStopIncluded?++r:++o}}return i},TimeIntervalCollection.fromJulianDateArray=function(e,t){defined(t)||(t=new TimeIntervalCollection);const n=e.julianDates,i=n.length,r=e.dataCallback,o=defaultValue(e.isStartIncluded,!0),a=defaultValue(e.isStopIncluded,!0),s=defaultValue(e.leadingInterval,!1),c=defaultValue(e.trailingInterval,!1);let l,u=0;s&&(++u,l=new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!o}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l));for(let e=0;e<i-1;++e){let s=n[e];const c=n[e+1];l=new TimeInterval({start:s,stop:c,isStartIncluded:t.length!==u||o,isStopIncluded:e===i-2&&a}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l),s=c}return c&&(l=new TimeInterval({start:n[i-1],stop:Iso8601.MAXIMUM_VALUE,isStartIncluded:!a,isStopIncluded:!0}),l.data=defined(r)?r(l,t.length):t.length,t.addInterval(l)),t};const scratchGregorianDate=new GregorianDate,monthLengths=[0,31,28,31,30,31,30,31,31,30,31,30,31];function addToDate(e,t,n){defined(n)||(n=new JulianDate),JulianDate.toGregorianDate(e,scratchGregorianDate);let i=scratchGregorianDate.millisecond+t.millisecond,r=scratchGregorianDate.second+t.second,o=scratchGregorianDate.minute+t.minute,a=scratchGregorianDate.hour+t.hour,s=scratchGregorianDate.day+t.day,c=scratchGregorianDate.month+t.month,l=scratchGregorianDate.year+t.year;for(i>=1e3&&(r+=Math.floor(i/1e3),i%=1e3),r>=60&&(o+=Math.floor(r/60),r%=60),o>=60&&(a+=Math.floor(o/60),o%=60),a>=24&&(s+=Math.floor(a/24),a%=24),monthLengths[2]=isLeapYear(l)?29:28;s>monthLengths[c]||c>=13;)s>monthLengths[c]&&(s-=monthLengths[c],++c),c>=13&&(--c,l+=Math.floor(c/12),c%=12,++c),monthLengths[2]=isLeapYear(l)?29:28;return scratchGregorianDate.millisecond=i,scratchGregorianDate.second=r,scratchGregorianDate.minute=o,scratchGregorianDate.hour=a,scratchGregorianDate.day=s,scratchGregorianDate.month=c,scratchGregorianDate.year=l,JulianDate.fromGregorianDate(scratchGregorianDate,n)}const scratchJulianDate$2=new JulianDate,durationRegex=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function parseDuration(e,t){if(!defined(e)||0===e.length)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,"P"===e[0]){const n=e.match(durationRegex);if(!defined(n))return!1;if(defined(n[1])&&(t.year=Number(n[1].replace(",","."))),defined(n[2])&&(t.month=Number(n[2].replace(",","."))),defined(n[3])&&(t.day=7*Number(n[3].replace(",","."))),defined(n[4])&&(t.day+=Number(n[4].replace(",","."))),defined(n[5])&&(t.hour=Number(n[5].replace(",","."))),defined(n[6])&&(t.minute=Number(n[6].replace(",","."))),defined(n[7])){const e=Number(n[7].replace(",","."));t.second=Math.floor(e),t.millisecond=e%1*1e3}}else"Z"!==e[e.length-1]&&(e+="Z"),JulianDate.toGregorianDate(JulianDate.fromIso8601(e,scratchJulianDate$2),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const scratchDuration=new GregorianDate;TimeIntervalCollection.fromIso8601=function(e,t){const n=e.iso8601.split("/"),i=JulianDate.fromIso8601(n[0]),r=JulianDate.fromIso8601(n[1]),o=[];if(parseDuration(n[2],scratchDuration)){let e=JulianDate.clone(i);for(o.push(e);JulianDate.compare(e,r)<0;){e=addToDate(e,scratchDuration);JulianDate.compare(r,e)<=0&&JulianDate.clone(r,e),o.push(e)}}else o.push(i,r);return TimeIntervalCollection.fromJulianDateArray({julianDates:o,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DateArray=function(e,t){return TimeIntervalCollection.fromJulianDateArray({julianDates:e.iso8601Dates.map((function(e){return JulianDate.fromIso8601(e)})),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DurationArray=function(e,t){const n=e.epoch,i=e.iso8601Durations,r=defaultValue(e.relativeToPrevious,!1),o=[];let a,s;const c=i.length;for(let e=0;e<c;++e)(parseDuration(i[e],scratchDuration)||0===e)&&(a=r&&defined(s)?addToDate(s,scratchDuration):addToDate(n,scratchDuration),o.push(a),s=a);return TimeIntervalCollection.fromJulianDateArray({julianDates:o,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};const defaultScale$4=new Cartesian3(1,1,1),defaultTranslation=Cartesian3.ZERO,defaultRotation$1=Quaternion.IDENTITY;function TranslationRotationScale(e,t,n){this.translation=Cartesian3.clone(defaultValue(e,defaultTranslation)),this.rotation=Quaternion.clone(defaultValue(t,defaultRotation$1)),this.scale=Cartesian3.clone(defaultValue(n,defaultScale$4))}function VideoSynchronizer(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clock=void 0,this._element=void 0,this._clockSubscription=void 0,this._seekFunction=void 0,this._lastPlaybackRate=void 0,this.clock=e.clock,this.element=e.element,this.epoch=defaultValue(e.epoch,Iso8601.MINIMUM_VALUE),this.tolerance=defaultValue(e.tolerance,1),this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}function createSeekFunction(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}function DataRectangle(e,t){this.rectangle=e,this.maxLevel=t}function VRTheWorldTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=Resource.createIfNeeded(e.url);this._resource=t,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer(),this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:16777215};let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this._tilingScheme=void 0,this._rectangles=[];const i=this;let r;const o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);function a(e){const t=e.getElementsByTagName("SRS")[0].textContent;if("EPSG:4326"!==t)return void s("SRS "+t+" is not supported.");i._tilingScheme=new GeographicTilingScheme({ellipsoid:o});const n=e.getElementsByTagName("TileFormat")[0];i._heightmapWidth=parseInt(n.getAttribute("width"),10),i._heightmapHeight=parseInt(n.getAttribute("height"),10),i._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(o,Math.min(i._heightmapWidth,i._heightmapHeight),i._tilingScheme.getNumberOfXTilesAtLevel(0));const r=e.getElementsByTagName("DataExtent");for(let e=0;e<r.length;++e){const t=r[e],n=CesiumMath.toRadians(parseFloat(t.getAttribute("minx"))),o=CesiumMath.toRadians(parseFloat(t.getAttribute("miny"))),a=CesiumMath.toRadians(parseFloat(t.getAttribute("maxx"))),s=CesiumMath.toRadians(parseFloat(t.getAttribute("maxy"))),c=parseInt(t.getAttribute("maxlevel"),10);i._rectangles.push(new DataRectangle(new Rectangle(n,o,a,s),c))}i._ready=!0,i._readyPromise.resolve(!0)}function s(e){const t=defaultValue(e,"An error occurred while accessing "+i._resource.url+".");r=TileProviderError.handleError(r,i,i._errorEvent,t,void 0,void 0,void 0,c)}function c(){when(i._resource.fetchXML(),a,s)}c()}TranslationRotationScale.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this.translation,e.translation)&&Quaternion.equals(this.rotation,e.rotation)&&Cartesian3.equals(this.scale,e.scale)},Object.defineProperties(VideoSynchronizer.prototype,{clock:{get:function(){return this._clock},set:function(e){const t=this._clock;t!==e&&(defined(t)&&(this._clockSubscription(),this._clockSubscription=void 0),defined(e)&&(this._clockSubscription=e.onTick.addEventListener(VideoSynchronizer.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){const t=this._element;t!==e&&(defined(t)&&t.removeEventListener("seeked",this._seekFunction,!1),defined(e)&&(this._seeking=!1,this._seekFunction=createSeekFunction(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}}),VideoSynchronizer.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,destroyObject(this)},VideoSynchronizer.prototype.isDestroyed=function(){return!1},VideoSynchronizer.prototype._trySetPlaybackRate=function(e){if(this._lastPlaybackRate===e.multiplier)return;const t=this._element;try{t.playbackRate=e.multiplier}catch(e){t.playbackRate=0}this._lastPlaybackRate=e.multiplier},VideoSynchronizer.prototype._onTick=function(e){const t=this._element;if(!defined(t)||t.readyState<2)return;const n=t.paused,i=e.shouldAnimate;if(i===n&&(i?t.play():t.pause()),this._seeking||this._firstTickAfterSeek)return void(this._firstTickAfterSeek=!1);this._trySetPlaybackRate(e);const r=e.currentTime,o=defaultValue(this.epoch,Iso8601.MINIMUM_VALUE);let a=JulianDate.secondsDifference(r,o);const s=t.duration;let c;const l=t.currentTime;t.loop?(a%=s,a<0&&(a=s-a),c=a):c=a>s?s:a<0?0:a;const u=i?defaultValue(this.tolerance,1):.001;Math.abs(c-l)>u&&(this._seeking=!0,t.currentTime=c)},Object.defineProperties(VRTheWorldTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),VRTheWorldTerrainProvider.prototype.requestTileGeometry=function(e,t,n,i){const r=this._tilingScheme.getNumberOfYTilesAtLevel(n),o=this._resource.getDerivedResource({url:n+"/"+e+"/"+(r-t-1)+".tif",queryParameters:{cesium:!0},request:i}).fetchImage({preferImageBitmap:!0});if(!defined(o))return;const a=this;return when(o).then((function(i){return new HeightmapTerrainData({buffer:getImagePixels(i),width:a._heightmapWidth,height:a._heightmapHeight,childTileMask:getChildMask(a,e,t,n),structure:a._terrainDataStructure})}))},VRTheWorldTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};const rectangleScratch$2=new Rectangle;function getChildMask(e,t,n,i){const r=e._tilingScheme,o=e._rectangles,a=r.tileXYToRectangle(t,n,i);let s=0;for(let e=0;e<o.length&&15!==s;++e){const c=o[e];if(c.maxLevel<=i)continue;const l=c.rectangle;defined(Rectangle.intersection(l,a,rectangleScratch$2))&&(isTileInRectangle(r,l,2*t,2*n,i+1)&&(s|=4),isTileInRectangle(r,l,2*t+1,2*n,i+1)&&(s|=8),isTileInRectangle(r,l,2*t,2*n+1,i+1)&&(s|=1),isTileInRectangle(r,l,2*t+1,2*n+1,i+1)&&(s|=2))}return s}function isTileInRectangle(e,t,n,i,r){const o=e.tileXYToRectangle(n,i,r);return defined(Rectangle.intersection(o,t,rectangleScratch$2))}VRTheWorldTerrainProvider.prototype.getTileDataAvailable=function(e,t,n){},VRTheWorldTerrainProvider.prototype.loadTileDataAvailability=function(e,t,n){};const VulkanConstants={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033};var VulkanConstants$1=Object.freeze(VulkanConstants);const WallGeometryLibrary={};function latLonEquals(e,t){return CesiumMath.equalsEpsilon(e.latitude,t.latitude,CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(e.longitude,t.longitude,CesiumMath.EPSILON10)}const scratchCartographic1=new Cartographic,scratchCartographic2=new Cartographic;function removeDuplicates$1(e,t,n,i){const r=(t=arrayRemoveDuplicates(t,Cartesian3.equalsEpsilon)).length;if(r<2)return;const o=defined(i),a=defined(n),s=new Array(r),c=new Array(r),l=new Array(r),u=t[0];s[0]=u;const d=e.cartesianToCartographic(u,scratchCartographic1);a&&(d.height=n[0]),c[0]=d.height,l[0]=o?i[0]:0;let h=c[0]===l[0],p=1;for(let u=1;u<r;++u){const r=t[u],f=e.cartesianToCartographic(r,scratchCartographic2);a&&(f.height=n[u]),h=h&&0===f.height,latLonEquals(d,f)?d.height<f.height&&(c[p-1]=f.height):(s[p]=r,c[p]=f.height,l[p]=o?i[u]:0,h=h&&c[p]===l[p],Cartographic.clone(f,d),++p)}return h||p<2?void 0:(s.length=p,c.length=p,l.length=p,{positions:s,topHeights:c,bottomHeights:l})}const positionsArrayScratch=new Array(2),heightsArrayScratch=new Array(2),generateArcOptionsScratch={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};WallGeometryLibrary.computePositions=function(e,t,n,i,r,o){const a=removeDuplicates$1(e,t,n,i);if(!defined(a))return;t=a.positions,n=a.topHeights,i=a.bottomHeights;const s=t.length,c=s-2;let l,u;const d=CesiumMath.chordLength(r,e.maximumRadius),h=generateArcOptionsScratch;if(h.minDistance=d,h.ellipsoid=e,o){let e,r=0;for(e=0;e<s-1;e++)r+=PolylinePipeline.numberOfPoints(t[e],t[e+1],d)+1;l=new Float64Array(3*r),u=new Float64Array(3*r);const o=positionsArrayScratch,a=heightsArrayScratch;h.positions=o,h.height=a;let c=0;for(e=0;e<s-1;e++){o[0]=t[e],o[1]=t[e+1],a[0]=n[e],a[1]=n[e+1];const r=PolylinePipeline.generateArc(h);l.set(r,c),a[0]=i[e],a[1]=i[e+1],u.set(PolylinePipeline.generateArc(h),c),c+=r.length}}else h.positions=t,h.height=n,l=new Float64Array(PolylinePipeline.generateArc(h)),h.height=i,u=new Float64Array(PolylinePipeline.generateArc(h));return{bottomPositions:u,topPositions:l,numCorners:c}};const scratchCartesian3Position1$1=new Cartesian3,scratchCartesian3Position2$1=new Cartesian3,scratchCartesian3Position4=new Cartesian3,scratchCartesian3Position5=new Cartesian3,scratchBitangent=new Cartesian3,scratchTangent=new Cartesian3,scratchNormal$1=new Cartesian3;function WallGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.maximumHeights,i=e.minimumHeights,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=VertexFormat.clone(r),this._granularity=o,this._ellipsoid=Ellipsoid.clone(a),this._workerName="createWallGeometry";let s=1+t.length*Cartesian3.packedLength+2;defined(i)&&(s+=i.length),defined(n)&&(s+=n.length),this.packedLength=s+Ellipsoid.packedLength+VertexFormat.packedLength+1}WallGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._minimumHeights;if(o=defined(a)?a.length:0,t[n++]=o,defined(a))for(i=0;i<o;++i)t[n++]=a[i];const s=e._maximumHeights;if(o=defined(s)?s.length:0,t[n++]=o,defined(s))for(i=0;i<o;++i)t[n++]=s[i];return Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,n),t[n+=VertexFormat.packedLength]=e._granularity,t};const scratchEllipsoid$2=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat=new VertexFormat,scratchOptions$1={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$2,vertexFormat:scratchVertexFormat,granularity:void 0};WallGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);let a,s;if(r=e[t++],r>0)for(a=new Array(r),i=0;i<r;++i)a[i]=e[t++];if(r=e[t++],r>0)for(s=new Array(r),i=0;i<r;++i)s[i]=e[t++];const c=Ellipsoid.unpack(e,t,scratchEllipsoid$2);t+=Ellipsoid.packedLength;const l=VertexFormat.unpack(e,t,scratchVertexFormat),u=e[t+=VertexFormat.packedLength];return defined(n)?(n._positions=o,n._minimumHeights=a,n._maximumHeights=s,n._ellipsoid=Ellipsoid.clone(c,n._ellipsoid),n._vertexFormat=VertexFormat.clone(l,n._vertexFormat),n._granularity=u,n):(scratchOptions$1.positions=o,scratchOptions$1.minimumHeights=a,scratchOptions$1.maximumHeights=s,scratchOptions$1.granularity=u,new WallGeometry(scratchOptions$1))},WallGeometry.fromConstantHeights=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;let n,i;const r=e.minimumHeight,o=e.maximumHeight,a=defined(r),s=defined(o);if(a||s){const e=t.length;n=a?new Array(e):void 0,i=s?new Array(e):void 0;for(let t=0;t<e;++t)a&&(n[t]=r),s&&(i[t]=o)}return new WallGeometry({positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},WallGeometry.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,r=e._vertexFormat,o=e._granularity,a=e._ellipsoid,s=WallGeometryLibrary.computePositions(a,t,i,n,o,!0);if(!defined(s))return;const c=s.bottomPositions,l=s.topPositions,u=s.numCorners;let d=l.length,h=2*d;const p=r.position?new Float64Array(h):void 0,f=r.normal?new Float32Array(h):void 0,m=r.tangent?new Float32Array(h):void 0,g=r.bitangent?new Float32Array(h):void 0,_=r.st?new Float32Array(h/3*2):void 0;let y,C=0,T=0,S=0,A=0,v=0,E=scratchNormal$1,b=scratchTangent,x=scratchBitangent,P=!0;d/=3;let D=0;const w=1/(d-u-1);for(y=0;y<d;++y){const e=3*y,t=Cartesian3.fromArray(l,e,scratchCartesian3Position1$1),n=Cartesian3.fromArray(c,e,scratchCartesian3Position2$1);if(r.position&&(p[C++]=n.x,p[C++]=n.y,p[C++]=n.z,p[C++]=t.x,p[C++]=t.y,p[C++]=t.z),r.st&&(_[v++]=D,_[v++]=0,_[v++]=D,_[v++]=1),r.normal||r.tangent||r.bitangent){let n=Cartesian3.clone(Cartesian3.ZERO,scratchCartesian3Position5);const i=Cartesian3.subtract(t,a.geodeticSurfaceNormal(t,scratchCartesian3Position2$1),scratchCartesian3Position2$1);if(y+1<d&&(n=Cartesian3.fromArray(l,e+3,scratchCartesian3Position5)),P){const e=Cartesian3.subtract(n,t,scratchCartesian3Position4),r=Cartesian3.subtract(i,t,scratchCartesian3Position1$1);E=Cartesian3.normalize(Cartesian3.cross(r,e,E),E),P=!1}Cartesian3.equalsEpsilon(t,n,CesiumMath.EPSILON10)?P=!0:(D+=w,r.tangent&&(b=Cartesian3.normalize(Cartesian3.subtract(n,t,b),b)),r.bitangent&&(x=Cartesian3.normalize(Cartesian3.cross(E,b,x),x))),r.normal&&(f[T++]=E.x,f[T++]=E.y,f[T++]=E.z,f[T++]=E.x,f[T++]=E.y,f[T++]=E.z),r.tangent&&(m[A++]=b.x,m[A++]=b.y,m[A++]=b.z,m[A++]=b.x,m[A++]=b.y,m[A++]=b.z),r.bitangent&&(g[S++]=x.x,g[S++]=x.y,g[S++]=x.z,g[S++]=x.x,g[S++]=x.y,g[S++]=x.z)}}const M=new GeometryAttributes;r.position&&(M.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:p})),r.normal&&(M.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),r.tangent&&(M.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),r.bitangent&&(M.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),r.st&&(M.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:_}));const I=h/3;h-=6*(u+1);const R=IndexDatatype$1.createTypedArray(I,h);let O=0;for(y=0;y<I-2;y+=2){const e=y,t=y+2,n=Cartesian3.fromArray(p,3*e,scratchCartesian3Position1$1),i=Cartesian3.fromArray(p,3*t,scratchCartesian3Position2$1);if(Cartesian3.equalsEpsilon(n,i,CesiumMath.EPSILON10))continue;const r=y+1,o=y+3;R[O++]=r,R[O++]=e,R[O++]=o,R[O++]=o,R[O++]=e,R[O++]=t}return new Geometry({attributes:M,indices:R,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere.fromVertices(p)})};const scratchCartesian3Position1=new Cartesian3,scratchCartesian3Position2=new Cartesian3;function WallOutlineGeometry(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.maximumHeights,i=e.minimumHeights,r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=r,this._ellipsoid=Ellipsoid.clone(o),this._workerName="createWallOutlineGeometry";let a=1+t.length*Cartesian3.packedLength+2;defined(i)&&(a+=i.length),defined(n)&&(a+=n.length),this.packedLength=a+Ellipsoid.packedLength+1}WallOutlineGeometry.pack=function(e,t,n){let i;n=defaultValue(n,0);const r=e._positions;let o=r.length;for(t[n++]=o,i=0;i<o;++i,n+=Cartesian3.packedLength)Cartesian3.pack(r[i],t,n);const a=e._minimumHeights;if(o=defined(a)?a.length:0,t[n++]=o,defined(a))for(i=0;i<o;++i)t[n++]=a[i];const s=e._maximumHeights;if(o=defined(s)?s.length:0,t[n++]=o,defined(s))for(i=0;i<o;++i)t[n++]=s[i];return Ellipsoid.pack(e._ellipsoid,t,n),t[n+=Ellipsoid.packedLength]=e._granularity,t};const scratchEllipsoid$1=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$1,granularity:void 0};function webGLConstantToGlslType(e){switch(e){case WebGLConstants$1.FLOAT:return"float";case WebGLConstants$1.FLOAT_VEC2:return"vec2";case WebGLConstants$1.FLOAT_VEC3:return"vec3";case WebGLConstants$1.FLOAT_VEC4:return"vec4";case WebGLConstants$1.FLOAT_MAT2:return"mat2";case WebGLConstants$1.FLOAT_MAT3:return"mat3";case WebGLConstants$1.FLOAT_MAT4:return"mat4";case WebGLConstants$1.SAMPLER_2D:return"sampler2D";case WebGLConstants$1.BOOL:return"bool"}}function WeightSpline(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).weights,n=e.times;this._times=n,this._weights=t,this._count=t.length/n.length,this._lastTimeIndex=0}function wrapFunction(e,t,n){return function(){n.apply(e,arguments),t.apply(e,arguments)}}function ConstantProperty(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Event,this.setValue(e)}function createProperty(e,t,n,i,r){return{configurable:i,get:function(){return this[t]},set:function(i){const o=this[t],a=this[n];defined(a)&&(a(),this[n]=void 0);!(void 0!==i)||defined(i)&&defined(i.getValue)||!defined(r)||(i=r(i)),o!==i&&(this[t]=i,this._definitionChanged.raiseEvent(this,e,i,o)),defined(i)&&defined(i.definitionChanged)&&(this[n]=i.definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this,e,i,i)}),this))}}}function createConstantProperty$1(e){return new ConstantProperty(e)}function createPropertyDescriptor(e,t,n){return createProperty(e,"_"+e.toString(),"_"+e.toString()+"Subscription",defaultValue(t,!1),defaultValue(n,createConstantProperty$1))}function BillboardGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}WallOutlineGeometry.unpack=function(e,t,n){let i;t=defaultValue(t,0);let r=e[t++];const o=new Array(r);for(i=0;i<r;++i,t+=Cartesian3.packedLength)o[i]=Cartesian3.unpack(e,t);let a,s;if(r=e[t++],r>0)for(a=new Array(r),i=0;i<r;++i)a[i]=e[t++];if(r=e[t++],r>0)for(s=new Array(r),i=0;i<r;++i)s[i]=e[t++];const c=Ellipsoid.unpack(e,t,scratchEllipsoid$1),l=e[t+=Ellipsoid.packedLength];return defined(n)?(n._positions=o,n._minimumHeights=a,n._maximumHeights=s,n._ellipsoid=Ellipsoid.clone(c,n._ellipsoid),n._granularity=l,n):(scratchOptions.positions=o,scratchOptions.minimumHeights=a,scratchOptions.maximumHeights=s,scratchOptions.granularity=l,new WallOutlineGeometry(scratchOptions))},WallOutlineGeometry.fromConstantHeights=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;let n,i;const r=e.minimumHeight,o=e.maximumHeight,a=defined(r),s=defined(o);if(a||s){const e=t.length;n=a?new Array(e):void 0,i=s?new Array(e):void 0;for(let t=0;t<e;++t)a&&(n[t]=r),s&&(i[t]=o)}return new WallOutlineGeometry({positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid})},WallOutlineGeometry.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,r=e._granularity,o=e._ellipsoid,a=WallGeometryLibrary.computePositions(o,t,i,n,r,!1);if(!defined(a))return;const s=a.bottomPositions,c=a.topPositions;let l=c.length,u=2*l;const d=new Float64Array(u);let h,p=0;for(l/=3,h=0;h<l;++h){const e=3*h,t=Cartesian3.fromArray(c,e,scratchCartesian3Position1),n=Cartesian3.fromArray(s,e,scratchCartesian3Position2);d[p++]=n.x,d[p++]=n.y,d[p++]=n.z,d[p++]=t.x,d[p++]=t.y,d[p++]=t.z}const f=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d})}),m=u/3;u=2*m-4+m;const g=IndexDatatype$1.createTypedArray(m,u);let _=0;for(h=0;h<m-2;h+=2){const e=h,t=h+2,n=Cartesian3.fromArray(d,3*e,scratchCartesian3Position1),i=Cartesian3.fromArray(d,3*t,scratchCartesian3Position2);if(Cartesian3.equalsEpsilon(n,i,CesiumMath.EPSILON10))continue;const r=h+1,o=h+3;g[_++]=r,g[_++]=e,g[_++]=r,g[_++]=o,g[_++]=e,g[_++]=t}return g[_++]=m-2,g[_++]=m-1,new Geometry({attributes:f,indices:g,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere.fromVertices(d)})},Object.defineProperties(WeightSpline.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}}),WeightSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,WeightSpline.prototype.wrapTime=Spline.prototype.wrapTime,WeightSpline.prototype.clampTime=Spline.prototype.clampTime,WeightSpline.prototype.evaluate=function(e,t){const n=this.weights,i=this.times,r=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),o=(e-i[r])/(i[r+1]-i[r]);defined(t)||(t=new Array(this._count));for(let e=0;e<this._count;e++){const i=r*this._count+e;t[e]=n[i]*(1-o)+n[i+this._count]*o}return t},Object.defineProperties(ConstantProperty.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),ConstantProperty.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},ConstantProperty.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=defined(e),i=n&&"function"==typeof e.clone,r=n&&"function"==typeof e.equals;(!r||!e.equals(t))&&(this._hasClone=i,this._hasEquals=r,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},ConstantProperty.prototype.equals=function(e){return this===e||e instanceof ConstantProperty&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},ConstantProperty.prototype.valueOf=function(){return this._value},ConstantProperty.prototype.toString=function(){return String(this._value)},Object.defineProperties(BillboardGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),image:createPropertyDescriptor("image"),scale:createPropertyDescriptor("scale"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),rotation:createPropertyDescriptor("rotation"),alignedAxis:createPropertyDescriptor("alignedAxis"),sizeInMeters:createPropertyDescriptor("sizeInMeters"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),imageSubRegion:createPropertyDescriptor("imageSubRegion"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),BillboardGraphics.prototype.clone=function(e){return defined(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e):new BillboardGraphics(this)},BillboardGraphics.prototype.merge=function(e){this.show=defaultValue(this._show,e.show),this.image=defaultValue(this._image,e.image),this.scale=defaultValue(this._scale,e.scale),this.pixelOffset=defaultValue(this._pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this._verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this._heightReference,e.heightReference),this.color=defaultValue(this._color,e.color),this.rotation=defaultValue(this._rotation,e.rotation),this.alignedAxis=defaultValue(this._alignedAxis,e.alignedAxis),this.sizeInMeters=defaultValue(this._sizeInMeters,e.sizeInMeters),this.width=defaultValue(this._width,e.width),this.height=defaultValue(this._height,e.height),this.scaleByDistance=defaultValue(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=defaultValue(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=defaultValue(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this._disableDepthTestDistance,e.disableDepthTestDistance)};const HeightReference={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2,CLIP_TO_GROUND:3};var HeightReference$1=Object.freeze(HeightReference);const HorizontalOrigin={CENTER:0,LEFT:1,RIGHT:-1};var HorizontalOrigin$1=Object.freeze(HorizontalOrigin);const VerticalOrigin={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1};var VerticalOrigin$1=Object.freeze(VerticalOrigin);const BoundingSphereState={DONE:0,PENDING:1,FAILED:2};var BoundingSphereState$1=Object.freeze(BoundingSphereState);function Property(){DeveloperError.throwInstantiationError()}Object.defineProperties(Property.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),Property.prototype.getValue=DeveloperError.throwInstantiationError,Property.prototype.equals=DeveloperError.throwInstantiationError,Property.equals=function(e,t){return e===t||defined(e)&&e.equals(t)},Property.arrayEquals=function(e,t){if(e===t)return!0;if(!defined(e)||!defined(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i<n;i++)if(!Property.equals(e[i],t[i]))return!1;return!0},Property.isConstant=function(e){return!defined(e)||e.isConstant},Property.getValueOrUndefined=function(e,t,n){return defined(e)?e.getValue(t,n):void 0},Property.getValueOrDefault=function(e,t,n,i){return defined(e)?defaultValue(e.getValue(t,i),n):n},Property.getValueOrClonedDefault=function(e,t,n,i){let r;return defined(e)&&(r=e.getValue(t,i)),defined(r)||(r=n.clone(r)),r};const defaultColor$8=Color.WHITE,defaultEyeOffset$1=Cartesian3.ZERO,defaultHeightReference$2=HeightReference$1.NONE,defaultPixelOffset$1=Cartesian2.ZERO,defaultScale$3=1,defaultRotation=0,defaultAlignedAxis=Cartesian3.ZERO,defaultHorizontalOrigin$1=HorizontalOrigin$1.CENTER,defaultVerticalOrigin$1=VerticalOrigin$1.CENTER,defaultSizeInMeters=!1,positionScratch$8=new Cartesian3,colorScratch$6=new Color,eyeOffsetScratch$1=new Cartesian3,pixelOffsetScratch$1=new Cartesian2,scaleByDistanceScratch$2=new NearFarScalar,translucencyByDistanceScratch$2=new NearFarScalar,pixelOffsetScaleByDistanceScratch$1=new NearFarScalar,boundingRectangleScratch=new BoundingRectangle,distanceDisplayConditionScratch$8=new DistanceDisplayCondition;function EntityData$3(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function BillboardVisualizer(e,t){t.collectionChanged.addEventListener(BillboardVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$2(e,t,n){defined(e)&&(e.billboard=void 0,n.removeBillboard(t))}BillboardVisualizer.prototype.update=function(e){const t=this._items.values,n=this._cluster;for(let i=0,r=t.length;i<r;i++){const r=t[i],o=r.entity,a=o._billboard;let s,c,l=r.billboard,u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=Property.getValueOrUndefined(o._position,e,positionScratch$8),s=Property.getValueOrUndefined(a._image,e),u=defined(c)&&defined(s)),!u){returnPrimitive$2(r,o,n);continue}Property.isConstant(o._position)||(n._clusterDirty=!0),defined(l)||(l=n.getBillboard(o),l.id=o,l.image=void 0,r.billboard=l),l.show=u,defined(l.image)&&r.textureValue===s||(l.image=s,r.textureValue=s),l.position=c,l.color=Property.getValueOrDefault(a._color,e,defaultColor$8,colorScratch$6),l.eyeOffset=Property.getValueOrDefault(a._eyeOffset,e,defaultEyeOffset$1,eyeOffsetScratch$1),l.heightReference=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference$2),l.pixelOffset=Property.getValueOrDefault(a._pixelOffset,e,defaultPixelOffset$1,pixelOffsetScratch$1),l.scale=Property.getValueOrDefault(a._scale,e,defaultScale$3),l.rotation=Property.getValueOrDefault(a._rotation,e,defaultRotation),l.alignedAxis=Property.getValueOrDefault(a._alignedAxis,e,defaultAlignedAxis),l.horizontalOrigin=Property.getValueOrDefault(a._horizontalOrigin,e,defaultHorizontalOrigin$1),l.verticalOrigin=Property.getValueOrDefault(a._verticalOrigin,e,defaultVerticalOrigin$1),l.width=Property.getValueOrUndefined(a._width,e),l.height=Property.getValueOrUndefined(a._height,e),l.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch$2),l.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch$2),l.pixelOffsetScaleByDistance=Property.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch$1),l.sizeInMeters=Property.getValueOrDefault(a._sizeInMeters,e,defaultSizeInMeters),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$8),l.disableDepthTestDistance=Property.getValueOrUndefined(a._disableDepthTestDistance,e);const d=Property.getValueOrUndefined(a._imageSubRegion,e,boundingRectangleScratch);defined(d)&&l.setImageSubRegion(l._imageId,d)}return!0},BillboardVisualizer.prototype.getBoundingSphere=function(e,t){const n=this._items.get(e.id);if(!defined(n)||!defined(n.billboard))return BoundingSphereState$1.FAILED;const i=n.billboard;if(i.heightReference===HeightReference$1.NONE)t.center=Cartesian3.clone(i.position,t.center);else{if(!defined(i._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(i._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},BillboardVisualizer.prototype.isDestroyed=function(){return!1},BillboardVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(BillboardVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return destroyObject(this)},BillboardVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._billboard)&&defined(o._position)&&a.set(o.id,new EntityData$3(o));for(r=i.length-1;r>-1;r--)o=i[r],defined(o._billboard)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData$3(o)):(returnPrimitive$2(a.get(o.id),o,s),a.remove(o.id));for(r=n.length-1;r>-1;r--)o=n[r],returnPrimitive$2(a.get(o.id),o,s),a.remove(o.id)};var AllMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\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, czm_lightDirectionEC);\n#endif\n}\n",AllMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 bitangent;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_bitangentEC = czm_normal * bitangent;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BasicMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\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, czm_lightDirectionEC);\n#endif\n}\n",BasicMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",TexturedMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\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, czm_lightDirectionEC);\n#endif\n}\n",TexturedMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";const BlendEquation={ADD:WebGLConstants$1.FUNC_ADD,SUBTRACT:WebGLConstants$1.FUNC_SUBTRACT,REVERSE_SUBTRACT:WebGLConstants$1.FUNC_REVERSE_SUBTRACT,MIN:WebGLConstants$1.MIN,MAX:WebGLConstants$1.MAX};var BlendEquation$1=Object.freeze(BlendEquation);const BlendFunction={ZERO:WebGLConstants$1.ZERO,ONE:WebGLConstants$1.ONE,SOURCE_COLOR:WebGLConstants$1.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:WebGLConstants$1.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:WebGLConstants$1.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:WebGLConstants$1.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:WebGLConstants$1.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:WebGLConstants$1.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:WebGLConstants$1.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:WebGLConstants$1.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:WebGLConstants$1.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:WebGLConstants$1.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:WebGLConstants$1.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:WebGLConstants$1.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:WebGLConstants$1.SRC_ALPHA_SATURATE};var BlendFunction$1=Object.freeze(BlendFunction);const BlendingState={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE})};var BlendingState$1=Object.freeze(BlendingState);const CullFace={FRONT:WebGLConstants$1.FRONT,BACK:WebGLConstants$1.BACK,FRONT_AND_BACK:WebGLConstants$1.FRONT_AND_BACK};var CullFace$1=Object.freeze(CullFace);function Appearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.material=e.material,this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=defaultValue(e.closed,!1)}Object.defineProperties(Appearance.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}}}),Appearance.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),defined(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},Appearance.prototype.isTranslucent=function(){return defined(this.material)&&this.material.isTranslucent()||!defined(this.material)&&this.translucent},Appearance.prototype.getRenderState=function(){const e=this.isTranslucent(),t=clone$1(this.renderState,!1);return e?(t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND):t.depthMask=!0,t},Appearance.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=BlendingState$1.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:CullFace$1.BACK}),defined(n)&&(i=combine$2(n,i,!0)),i};const ContextLimits={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_highpFloatSupported:!1,_highpIntSupported:!1};function CubeMapFace(e,t,n,i,r,o,a,s,c,l,u){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=a,this._internalFormat=r,this._pixelFormat=o,this._size=s,this._preMultiplyAlpha=c,this._flipY=l,this._initialized=u}Object.defineProperties(ContextLimits,{maximumCombinedTextureImageUnits:{get:function(){return ContextLimits._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return ContextLimits._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return ContextLimits._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return ContextLimits._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return ContextLimits._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return ContextLimits._maximumTextureSize}},maximumVaryingVectors:{get:function(){return ContextLimits._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return ContextLimits._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return ContextLimits._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return ContextLimits._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return ContextLimits._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return ContextLimits._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return ContextLimits._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return ContextLimits._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return ContextLimits._maximumViewportWidth}},maximumViewportHeight:{get:function(){return ContextLimits._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return ContextLimits._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return ContextLimits._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return ContextLimits._maximumColorAttachments}},highpFloatSupported:{get:function(){return ContextLimits._highpFloatSupported}},highpIntSupported:{get:function(){return ContextLimits._highpIntSupported}}}),Object.defineProperties(CubeMapFace.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),CubeMapFace.prototype.copyFrom=function(e){const t=defaultValue(e.xOffset,0),n=defaultValue(e.yOffset,0),i=e.source,r=this._context._gl,o=this._textureTarget,a=this._targetFace;r.activeTexture(r.TEXTURE0),r.bindTexture(o,this._texture);const s=i.width,c=i.height;let l=i.arrayBufferView;const u=this._size,d=this._pixelFormat,h=this._internalFormat,p=this._pixelDatatype,f=this._preMultiplyAlpha,m=this._flipY,g=defaultValue(e.skipColorSpaceConversion,!1);let _=4;defined(l)&&(_=PixelFormat$1.alignmentInBytes(d,p,s)),r.pixelStorei(r.UNPACK_ALIGNMENT,_),g?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let y=!1;if(!this._initialized){if(0===t&&0===n&&s===u&&c===u)defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=PixelFormat$1.flipY(l,d,p,u,u)),r.texImage2D(a,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,m),r.texImage2D(a,0,h,d,PixelDatatype$1.toWebGLConstant(p,this._context),i)),y=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const e=PixelFormat$1.createTypedArray(d,p,u,u);r.texImage2D(a,0,h,u,u,0,d,PixelDatatype$1.toWebGLConstant(p,this._context),e)}this._initialized=!0}y||(defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=PixelFormat$1.flipY(l,d,p,s,c)),r.texSubImage2D(a,0,t,n,s,c,d,PixelDatatype$1.toWebGLConstant(p,this._context),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,m),r.texSubImage2D(a,0,t,n,d,PixelDatatype$1.toWebGLConstant(p,this._context),i))),r.bindTexture(o,null)},CubeMapFace.prototype.copyFromFramebuffer=function(e,t,n,i,r,o){e=defaultValue(e,0),t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,0),r=defaultValue(r,this._size),o=defaultValue(o,this._size);const a=this._context._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.copyTexSubImage2D(this._targetFace,0,e,t,n,i,r,o),a.bindTexture(s,null),this._initialized=!0};const MipmapHint={DONT_CARE:WebGLConstants$1.DONT_CARE,FASTEST:WebGLConstants$1.FASTEST,NICEST:WebGLConstants$1.NICEST,validate:function(e){return e===MipmapHint.DONT_CARE||e===MipmapHint.FASTEST||e===MipmapHint.NICEST}};var MipmapHint$1=Object.freeze(MipmapHint);const TextureMagnificationFilter={NEAREST:WebGLConstants$1.NEAREST,LINEAR:WebGLConstants$1.LINEAR,validate:function(e){return e===TextureMagnificationFilter.NEAREST||e===TextureMagnificationFilter.LINEAR}};var TextureMagnificationFilter$1=Object.freeze(TextureMagnificationFilter);const TextureMinificationFilter={NEAREST:WebGLConstants$1.NEAREST,LINEAR:WebGLConstants$1.LINEAR,NEAREST_MIPMAP_NEAREST:WebGLConstants$1.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:WebGLConstants$1.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:WebGLConstants$1.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:WebGLConstants$1.LINEAR_MIPMAP_LINEAR,validate:function(e){return e===TextureMinificationFilter.NEAREST||e===TextureMinificationFilter.LINEAR||e===TextureMinificationFilter.NEAREST_MIPMAP_NEAREST||e===TextureMinificationFilter.LINEAR_MIPMAP_NEAREST||e===TextureMinificationFilter.NEAREST_MIPMAP_LINEAR||e===TextureMinificationFilter.LINEAR_MIPMAP_LINEAR}};var TextureMinificationFilter$1=Object.freeze(TextureMinificationFilter);const TextureWrap={CLAMP_TO_EDGE:WebGLConstants$1.CLAMP_TO_EDGE,REPEAT:WebGLConstants$1.REPEAT,MIRRORED_REPEAT:WebGLConstants$1.MIRRORED_REPEAT,validate:function(e){return e===TextureWrap.CLAMP_TO_EDGE||e===TextureWrap.REPEAT||e===TextureWrap.MIRRORED_REPEAT}};var TextureWrap$1=Object.freeze(TextureWrap);function Sampler(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.wrapS,TextureWrap$1.CLAMP_TO_EDGE),n=defaultValue(e.wrapT,TextureWrap$1.CLAMP_TO_EDGE),i=defaultValue(e.minificationFilter,TextureMinificationFilter$1.LINEAR),r=defaultValue(e.magnificationFilter,TextureMagnificationFilter$1.LINEAR),o=defined(e.maximumAnisotropy)?e.maximumAnisotropy:1;this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=r,this._maximumAnisotropy=o}function CubeMap(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=e.source;let i;if(defined(n)){const e=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];i=e[0].width}else i=e.width;const r=i,o=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),a=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),s=PixelFormat$1.toInternalFormat(a,o,t),c=6*PixelFormat$1.textureSizeInBytes(a,o,r,r),l=e.preMultiplyAlpha||a===PixelFormat$1.RGB||a===PixelFormat$1.LUMINANCE,u=defaultValue(e.flipY,!0),d=defaultValue(e.skipColorSpaceConversion,!1),h=t._gl,p=h.TEXTURE_CUBE_MAP,f=h.createTexture();function m(e,n,c,l,u){let d=n.arrayBufferView;defined(d)||(d=n.bufferView);let p=4;defined(d)&&(p=PixelFormat$1.alignmentInBytes(a,o,i)),h.pixelStorei(h.UNPACK_ALIGNMENT,p),u?h.pixelStorei(h.UNPACK_COLORSPACE_CONVERSION_WEBGL,h.NONE):h.pixelStorei(h.UNPACK_COLORSPACE_CONVERSION_WEBGL,h.BROWSER_DEFAULT_WEBGL),defined(d)?(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1),l&&(d=PixelFormat$1.flipY(d,a,o,r,r)),h.texImage2D(e,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),d)):(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,c),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,l),h.texImage2D(e,0,s,a,PixelDatatype$1.toWebGLConstant(o,t),n))}h.activeTexture(h.TEXTURE0),h.bindTexture(p,f),defined(n)?(m(h.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,l,u,d),m(h.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,l,u,d),m(h.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,l,u,d),m(h.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,l,u,d)):(h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_X,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_Y,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_Z,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null),h.texImage2D(h.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,s,r,r,0,a,PixelDatatype$1.toWebGLConstant(o,t),null)),h.bindTexture(p,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=f,this._pixelFormat=a,this._pixelDatatype=o,this._size=r,this._hasMipmap=!1,this._sizeInBytes=c,this._preMultiplyAlpha=l,this._flipY=u,this._sampler=void 0;const g=defined(n);this._positiveX=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_X,s,a,o,r,l,u,g),this._negativeX=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_X,s,a,o,r,l,u,g),this._positiveY=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_Y,s,a,o,r,l,u,g),this._negativeY=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_Y,s,a,o,r,l,u,g),this._positiveZ=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_POSITIVE_Z,s,a,o,r,l,u,g),this._negativeZ=new CubeMapFace(t,f,p,h.TEXTURE_CUBE_MAP_NEGATIVE_Z,s,a,o,r,l,u,g),this.sampler=defined(e.sampler)?e.sampler:new Sampler}function Texture(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context;let n=e.width,i=e.height;const r=e.source;defined(r)&&(defined(n)||(n=defaultValue(r.videoWidth,r.width)),defined(i)||(i=defaultValue(r.videoHeight,r.height)));const o=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),a=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),s=PixelFormat$1.toInternalFormat(o,a,t),c=PixelFormat$1.isCompressedFormat(s),l=e.preMultiplyAlpha||o===PixelFormat$1.RGB||o===PixelFormat$1.LUMINANCE,u=defaultValue(e.flipY,!0),d=defaultValue(e.skipColorSpaceConversion,!1);let h=!0;const p=t._gl,f=p.TEXTURE_2D,m=p.createTexture();p.activeTexture(p.TEXTURE0),p.bindTexture(f,m);let g,_=4;if(defined(r)&&defined(r.arrayBufferView)&&!c&&(_=PixelFormat$1.alignmentInBytes(o,a,n)),p.pixelStorei(p.UNPACK_ALIGNMENT,_),d?p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.NONE):p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.BROWSER_DEFAULT_WEBGL),defined(r))if(defined(r.arrayBufferView)){p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1);let e,l,d,h=r.arrayBufferView;if(c){if(p.compressedTexImage2D(f,0,s,n,i,0,h),defined(r.mipLevels))for(l=n,d=i,e=0;e<r.mipLevels.length;++e)l=0|Math.floor(l/2),l<1&&(l=1),d=0|Math.floor(d/2),d<1&&(d=1),p.compressedTexImage2D(f,e+1,s,l,d,0,r.mipLevels[e])}else if(u&&(h=PixelFormat$1.flipY(h,o,a,n,i)),p.texImage2D(f,0,s,n,i,0,o,PixelDatatype$1.toWebGLConstant(a,t),h),defined(r.mipLevels))for(l=n,d=i,e=0;e<r.mipLevels.length;++e)l=0|Math.floor(l/2),l<1&&(l=1),d=0|Math.floor(d/2),d<1&&(d=1),p.texImage2D(f,e+1,s,l,d,0,o,PixelDatatype$1.toWebGLConstant(a,t),r.mipLevels[e])}else defined(r.framebuffer)?(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1),r.framebuffer!==t.defaultFramebuffer&&r.framebuffer._bind(),p.copyTexImage2D(f,0,s,r.xOffset,r.yOffset,n,i,0),r.framebuffer!==t.defaultFramebuffer&&r.framebuffer._unBind()):(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,u),p.texImage2D(f,0,s,o,PixelDatatype$1.toWebGLConstant(a,t),r));else p.texImage2D(f,0,s,n,i,0,o,PixelDatatype$1.toWebGLConstant(a,t),null),h=!1;p.bindTexture(f,null),g=c?PixelFormat$1.compressedTextureSizeInBytes(o,n,i):PixelFormat$1.textureSizeInBytes(o,a,n,i),this._id=createGuid(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=f,this._texture=m,this._internalFormat=s,this._pixelFormat=o,this._pixelDatatype=a,this._width=n,this._height=i,this._dimensions=new Cartesian2(n,i),this._hasMipmap=!1,this._sizeInBytes=g,this._preMultiplyAlpha=l,this._flipY=u,this._initialized=h,this._sampler=void 0,this.sampler=defined(e.sampler)?e.sampler:new Sampler}Object.defineProperties(Sampler.prototype,{wrapS:{get:function(){return this._wrapS}},wrapT:{get:function(){return this._wrapT}},minificationFilter:{get:function(){return this._minificationFilter}},magnificationFilter:{get:function(){return this._magnificationFilter}},maximumAnisotropy:{get:function(){return this._maximumAnisotropy}}}),Sampler.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy},Sampler.NEAREST=Object.freeze(new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})),Object.defineProperties(CubeMap.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,r=this._context,o=this._pixelDatatype;(o===PixelDatatype$1.FLOAT&&!r.textureFloatLinear||o===PixelDatatype$1.HALF_FLOAT&&!r.textureHalfFloatLinear)&&(t=i?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,n=TextureMagnificationFilter$1.NEAREST);const a=r._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.texParameteri(s,a.TEXTURE_MIN_FILTER,t),a.texParameteri(s,a.TEXTURE_MAG_FILTER,n),a.texParameteri(s,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(s,a.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&a.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(s,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(4*this._sizeInBytes/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),CubeMap.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)},CubeMap.prototype.isDestroyed=function(){return!1},CubeMap.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=destroyObject(this._positiveX),this._negativeX=destroyObject(this._negativeX),this._positiveY=destroyObject(this._positiveY),this._negativeY=destroyObject(this._negativeY),this._positiveZ=destroyObject(this._positiveZ),this._negativeZ=destroyObject(this._negativeZ),destroyObject(this)},Texture.create=function(e){return new Texture(e)},Texture.fromFramebuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=t._gl,i=defaultValue(e.pixelFormat,PixelFormat$1.RGB),r=defaultValue(e.framebufferXOffset,0),o=defaultValue(e.framebufferYOffset,0),a=defaultValue(e.width,n.drawingBufferWidth),s=defaultValue(e.height,n.drawingBufferHeight),c=e.framebuffer;return new Texture({context:t,width:a,height:s,pixelFormat:i,source:{framebuffer:defined(c)?c:t.defaultFramebuffer,xOffset:r,yOffset:o,width:a,height:s}})},Object.defineProperties(Texture.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=this._context,r=this._pixelFormat,o=this._pixelDatatype,a=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR;(o===PixelDatatype$1.FLOAT&&!i.textureFloatLinear||o===PixelDatatype$1.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=a?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,n=TextureMagnificationFilter$1.NEAREST),i.webgl2&&PixelFormat$1.isDepthFormat(r)&&(t=TextureMinificationFilter$1.NEAREST,n=TextureMagnificationFilter$1.NEAREST);const s=i._gl,c=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(c,this._texture),s.texParameteri(c,s.TEXTURE_MIN_FILTER,t),s.texParameteri(c,s.TEXTURE_MAG_FILTER,n),s.texParameteri(c,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(c,s.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&s.texParameteri(c,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(c,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},dimensions:{get:function(){return this._dimensions}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(4*this._sizeInBytes/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}}),Texture.prototype.copyFrom=function(e){const t=defaultValue(e.xOffset,0),n=defaultValue(e.yOffset,0),i=e.source,r=this._context,o=r._gl,a=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(a,this._texture);const s=i.width,c=i.height;let l=i.arrayBufferView;const u=this._width,d=this._height,h=this._internalFormat,p=this._pixelFormat,f=this._pixelDatatype,m=this._preMultiplyAlpha,g=this._flipY,_=defaultValue(e.skipColorSpaceConversion,!1);let y=4;defined(l)&&(y=PixelFormat$1.alignmentInBytes(p,f,s)),o.pixelStorei(o.UNPACK_ALIGNMENT,y),_?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let C=!1;if(!this._initialized){if(0===t&&0===n&&s===u&&c===d)defined(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),g&&(l=PixelFormat$1.flipY(l,p,f,u,d)),o.texImage2D(a,0,h,u,d,0,p,PixelDatatype$1.toWebGLConstant(f,r),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,g),o.texImage2D(a,0,h,p,PixelDatatype$1.toWebGLConstant(f,r),i)),C=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const e=PixelFormat$1.createTypedArray(p,f,u,d);o.texImage2D(a,0,h,u,d,0,p,PixelDatatype$1.toWebGLConstant(f,r),e)}this._initialized=!0}C||(defined(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),g&&(l=PixelFormat$1.flipY(l,p,f,s,c)),o.texSubImage2D(a,0,t,n,s,c,p,PixelDatatype$1.toWebGLConstant(f,r),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,g),o.texSubImage2D(a,0,t,n,p,PixelDatatype$1.toWebGLConstant(f,r),i))),o.bindTexture(a,null)},Texture.prototype.copyFromFramebuffer=function(e,t,n,i,r,o){e=defaultValue(e,0),t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,0),r=defaultValue(r,this._width),o=defaultValue(o,this._height);const a=this._context._gl,s=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(s,this._texture),a.copyTexSubImage2D(s,0,e,t,n,i,r,o),a.bindTexture(s,null),this._initialized=!0},Texture.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)},Texture.prototype.isDestroyed=function(){return!1},Texture.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),destroyObject(this)};var AspectRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",BumpMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n",CheckerboardMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",DotMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationBandMaterial="uniform sampler2D heights;\nuniform sampler2D colors;\nfloat getHeight(int idx, float invTexSize)\n{\nvec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\nreturn texture2D(heights, uv).x;\n#else\nreturn czm_unpackFloat(texture2D(heights, uv));\n#endif\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat height = materialInput.height;\nfloat invTexSize = 1.0 / float(heightsDimensions.x);\nfloat minHeight = getHeight(0, invTexSize);\nfloat maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\nif (height < minHeight || height > maxHeight) {\nmaterial.diffuse = vec3(0.0);\nmaterial.alpha = 0.0;\nreturn material;\n}\nint idxBelow = 0;\nint idxAbove = heightsDimensions.x;\nfloat heightBelow = minHeight;\nfloat heightAbove = maxHeight;\nconst int maxIterations = 16;\nfor (int i = 0; i < maxIterations; i++) {\nif (idxBelow >= idxAbove - 1) {\nbreak;\n}\nint idxMid = (idxBelow + idxAbove) / 2;\nfloat heightTex = getHeight(idxMid, invTexSize);\nif (height > heightTex) {\nidxBelow = idxMid;\nheightBelow = heightTex;\n} else {\nidxAbove = idxMid;\nheightAbove = heightTex;\n}\n}\nfloat lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\nvec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\nvec4 color = texture2D(colors, colorUv);\nif (color.a > 0.0)\n{\ncolor.rgb /= color.a;\n}\ncolor.rgb = czm_gammaCorrect(color.rgb);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationContourMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat distanceToContour = mod(materialInput.height, spacing);\n#ifdef GL_OES_standard_derivatives\nfloat dxc = abs(dFdx(materialInput.height));\nfloat dyc = abs(dFdy(materialInput.height));\nfloat dF = max(dxc, dyc) * czm_pixelRatio * width;\nfloat alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\nfloat alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\nvec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",ElevationRampMaterial="uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\nvec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",FadeMaterial="uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\ncolor = czm_gammaCorrect(color);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",GridMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec4 halfColor;\nhalfColor.rgb = color.rgb * 0.5;\nhalfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nhalfColor = czm_gammaCorrect(halfColor);\nmaterial.diffuse = halfColor.rgb;\nmaterial.emission = halfColor.rgb;\nmaterial.alpha = halfColor.a;\nreturn material;\n}\n",NormalMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n",PolylineArrowMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\n#ifdef GL_OES_standard_derivatives\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\nfloat base = 0.975;\n#endif\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",PolylineDashMaterial="uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\nconst float maskLength = 16.0;\nmat2 rotate(float rad) {\nfloat c = cos(rad);\nfloat s = sin(rad);\nreturn mat2(\nc, s,\n-s, c\n);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\nfloat dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\nfloat maskIndex = floor(dashPosition * maskLength);\nfloat maskTest = floor(dashPattern / pow(2.0, maskIndex));\nvec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\nif (fragColor.a < 0.005) {\ndiscard;\n}\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineGlowMaterial="uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nif (taperPower <= 0.99999) {\nglow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n}\nvec4 fragColor;\nfragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nfragColor.a = clamp(0.0, 1.0, glow) * color.a;\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineOutlineMaterial="uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",RimLightingMaterial="uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nvec4 outColor = czm_gammaCorrect(color);\nvec4 outRimColor = czm_gammaCorrect(rimColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.emission = outRimColor.rgb * s;\nmaterial.alpha = mix(outColor.a, outRimColor.a, s);\nreturn material;\n}\n",SlopeRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",StripeMaterial="uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",WaterMaterial="uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.diffuse = material.diffuse;\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n";function Material$4(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=defaultValue(e.minificationFilter,TextureMinificationFilter$1.LINEAR),this._magnificationFilter=defaultValue(e.magnificationFilter,TextureMagnificationFilter$1.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,initializeMaterial(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),defined(Material$4._uniformList[this.type])||(Material$4._uniformList[this.type]=Object.keys(this._uniforms))}function initializeMaterial(e,t){let n;e=defaultValue(e,defaultValue.EMPTY_OBJECT),t._strict=defaultValue(e.strict,!1),t._count=defaultValue(e.count,0),t._template=clone$1(defaultValue(e.fabric,defaultValue.EMPTY_OBJECT)),t._template.uniforms=clone$1(defaultValue(t._template.uniforms,defaultValue.EMPTY_OBJECT)),t._template.materials=clone$1(defaultValue(t._template.materials,defaultValue.EMPTY_OBJECT)),t.type=defined(t._template.type)?t._template.type:createGuid(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];const i=Material$4._materialCache.getMaterial(t.type);if(defined(i)){const e=clone$1(i.fabric,!0);t._template=combine$2(t._template,e,!0),n=i.translucent}checkForTemplateErrors(t),defined(i)||Material$4._materialCache.addMaterial(t.type,t),createMethodDefinition(t),createUniforms(t),createSubMaterials(t);const r=0===t._translucentFunctions.length||void 0;if(n=defaultValue(n,r),n=defaultValue(e.translucent,n),defined(n))if("function"==typeof n){const e=function(){return n(t)};t._translucentFunctions.push(e)}else t._translucentFunctions.push(n)}function checkForValidProperties(e,t,n,i){if(defined(e))for(const r in e)if(e.hasOwnProperty(r)){const e=-1!==t.indexOf(r);(i&&!e||!i&&e)&&n(r,t)}}function invalidNameError(e,t){}function duplicateNameError(e,t){}Material$4._uniformList={},Material$4.fromType=function(e,t){const n=new Material$4({fabric:{type:e}});if(defined(t))for(const e in t)t.hasOwnProperty(e)&&(n.uniforms[e]=t[e]);return n},Material$4.prototype.isTranslucent=function(){if(defined(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){const n=t[i];if(e="function"==typeof n?e&&n():e&&n,!e)break}return e},Material$4.prototype.update=function(e){let t,n;this._defaultTexture=e.defaultTexture;const i=this._loadedImages;let r=i.length;for(t=0;t<r;++t){const r=i[t];n=r.id;let o,a=r.image;Array.isArray(a)&&(o=a.slice(1,a.length).map((function(e){return e.bufferView})),a=a[0]);const s=new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let c;c=defined(a.internalFormat)?new Texture({context:e,pixelFormat:a.internalFormat,width:a.width,height:a.height,source:{arrayBufferView:a.bufferView,mipLevels:o},sampler:s}):new Texture({context:e,source:a,sampler:s});const l=this._textures[n];defined(l)&&l!==this._defaultTexture&&l.destroy(),this._textures[n]=c;const u=n+"Dimensions";if(this.uniforms.hasOwnProperty(u)){const e=this.uniforms[u];e.x=c._width,e.y=c._height}}i.length=0;const o=this._loadedCubeMaps;for(r=o.length,t=0;t<r;++t){const i=o[t];n=i.id;const r=i.images,a=new CubeMap({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]},sampler:new Sampler({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=a}o.length=0;const a=this._updateFunctions;for(r=a.length,t=0;t<r;++t)a[t](this,e);const s=this.materials;for(const t in s)s.hasOwnProperty(t)&&s[t].update(e)},Material$4.prototype.isDestroyed=function(){return!1},Material$4.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}const t=this.materials;for(const e in t)t.hasOwnProperty(e)&&t[e].destroy();return destroyObject(this)};const templateProperties=["type","materials","uniforms","components","source"],componentProperties=["diffuse","specular","shininess","normal","emission","alpha"];function checkForTemplateErrors(e){const t=e._template,n=t.uniforms,i=t.materials,r=t.components;checkForValidProperties(t,templateProperties,invalidNameError,!0),checkForValidProperties(r,componentProperties,invalidNameError,!0);const o=[];for(const e in i)i.hasOwnProperty(e)&&o.push(e);checkForValidProperties(n,o,duplicateNameError,!1)}function isMaterialFused(e,t){const n=t._template.materials;for(const t in n)if(n.hasOwnProperty(t)&&e.indexOf(t)>-1)return!0;return!1}function createMethodDefinition(e){const t=e._template.components,n=e._template.source;if(defined(n))e.shaderSource+=n+"\n";else{if(e.shaderSource+="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n",e.shaderSource+="czm_material material = czm_getDefaultMaterial(materialInput);\n",defined(t)){const n=Object.keys(e._template.materials).length>0;for(const i in t)if(t.hasOwnProperty(i))if("diffuse"===i||"emission"===i){const r=n&&isMaterialFused(t[i],e)?t[i]:"czm_gammaCorrect("+t[i]+")";e.shaderSource+="material."+i+" = "+r+"; \n"}else e.shaderSource+="alpha"===i?"material.alpha = "+t.alpha+"; \n":"material."+i+" = "+t[i]+";\n"}e.shaderSource+="return material;\n}\n"}}const matrixMap={mat2:Matrix2,mat3:Matrix3,mat4:Matrix4},ktx2Regex$3=/\.ktx2$/i;function createTexture2DUpdateFunction(e){let t;return function(n,i){const r=n.uniforms,o=r[e],a=t!==o,s=!defined(o)||o===Material$4.DefaultImageId;t=o;let c,l,u=n._textures[e];if(o instanceof HTMLVideoElement){if(o.readyState>=2){if(a&&defined(u)&&(u!==i.defaultTexture&&u.destroy(),u=void 0),!defined(u)||u===i.defaultTexture){const t=new Sampler({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});return u=new Texture({context:i,source:o,sampler:t}),void(n._textures[e]=u)}u.copyFrom({source:o})}else defined(u)||(n._textures[e]=i.defaultTexture);return}if(o instanceof Texture&&o!==u){n._texturePaths[e]=void 0;const t=n._textures[e];return defined(t)&&t!==n._defaultTexture&&t.destroy(),n._textures[e]=o,c=e+"Dimensions",void(r.hasOwnProperty(c)&&(l=r[c],l.x=o._width,l.y=o._height))}if(a&&defined(u)&&s&&(u!==n._defaultTexture&&u.destroy(),u=void 0),defined(u)||(n._texturePaths[e]=void 0,u=n._textures[e]=n._defaultTexture,c=e+"Dimensions",r.hasOwnProperty(c)&&(l=r[c],l.x=u._width,l.y=u._height)),s)return;const d=o instanceof Resource;if(!defined(n._texturePaths[e])||d&&o.url!==n._texturePaths[e].url||!d&&o!==n._texturePaths[e]){if("string"==typeof o||d){const t=d?o:Resource.createIfNeeded(o);let i;i=ktx2Regex$3.test(t.url)?loadKTX2(t.url):t.fetchImage(),i.then((function(t){n._loadedImages.push({id:e,image:t})})).otherwise((function(){defined(u)&&u!==n._defaultTexture&&u.destroy(),n._textures[e]=n._defaultTexture}))}else(o instanceof HTMLCanvasElement||o instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:o});n._texturePaths[e]=o}}}function createCubeMapUpdateFunction(e){return function(t,n){const i=t.uniforms[e];if(i instanceof CubeMap){const n=t._textures[e];return n!==t._defaultTexture&&n.destroy(),t._texturePaths[e]=void 0,void(t._textures[e]=i)}if(defined(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===Material$4.DefaultCubeMapId)return;const r=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(r!==t._texturePaths[e]){const n=[Resource.createIfNeeded(i.positiveX).fetchImage(),Resource.createIfNeeded(i.negativeX).fetchImage(),Resource.createIfNeeded(i.positiveY).fetchImage(),Resource.createIfNeeded(i.negativeY).fetchImage(),Resource.createIfNeeded(i.positiveZ).fetchImage(),Resource.createIfNeeded(i.negativeZ).fetchImage()];when.all(n).then((function(n){t._loadedCubeMaps.push({id:e,images:n})})),t._texturePaths[e]=r}}}function createUniforms(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&createUniform$1(e,n)}function createUniform$1(e,t){e._strict;const n=e._template.uniforms,i=n[t],r=getUniformType(i);if("channels"===r)replaceToken(e,t,i,!1);else{if("sampler2D"===r){const i=t+"Dimensions";getNumberOfTokens(e,i)>0&&(n[i]={type:"ivec3",x:1,y:1},createUniform$1(e,i))}if(!new RegExp("uniform\\s+"+r+"\\s+"+t+"\\s*;").test(e.shaderSource)){const n="uniform "+r+" "+t+";";e.shaderSource=n+e.shaderSource}const o=t+"_"+e._count++;if(replaceToken(e,t,o),e.uniforms[t]=i,"sampler2D"===r)e._uniforms[o]=function(){return e._textures[t]},e._updateFunctions.push(createTexture2DUpdateFunction(t));else if("samplerCube"===r)e._uniforms[o]=function(){return e._textures[t]},e._updateFunctions.push(createCubeMapUpdateFunction(t));else if(-1!==r.indexOf("mat")){const n=new matrixMap[r];e._uniforms[o]=function(){return matrixMap[r].fromColumnMajorArray(e.uniforms[t],n)}}else e._uniforms[o]=function(){return e.uniforms[t]}}}function getUniformType(e){let t=e.type;if(!defined(t)){const n=typeof e;if("number"===n)t="float";else if("boolean"===n)t="bool";else if("string"===n||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===Material$4.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===n)if(Array.isArray(e))4!==e.length&&9!==e.length&&16!==e.length||(t="mat"+Math.sqrt(e.length));else{let n=0;for(const t in e)e.hasOwnProperty(t)&&(n+=1);n>=2&&n<=4?t="vec"+n:6===n&&(t="samplerCube")}}return t}function createSubMaterials(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const r=new Material$4({strict:t,fabric:n[i],count:e._count});e._count=r._count,e._uniforms=combine$2(e._uniforms,r._uniforms,!0),e.materials[i]=r,e._translucentFunctions=e._translucentFunctions.concat(r._translucentFunctions);const o="czm_getMaterial",a=o+"_"+e._count++;replaceToken(r,o,a),e.shaderSource=r.shaderSource+e.shaderSource;replaceToken(e,i,a+"(materialInput)")}}function replaceToken(e,t,n,i){i=defaultValue(i,!0);let r=0;const o=new RegExp("([\\w"+(i?".":"")+"])?"+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(o,(function(e,t,i){return t||i?e:(r+=1,n)})),r}function getNumberOfTokens(e,t,n){return replaceToken(e,t,t,n)}function MaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),n=defaultValue(e.closed,!1),i=defaultValue(e.materialSupport,MaterialAppearance.MaterialSupport.TEXTURED);this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,!n)}Material$4._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},Material$4.DefaultImageId="czm_defaultImage",Material$4.DefaultCubeMapId="czm_defaultCubeMap",Material$4.ColorType="Color",Material$4._materialCache.addMaterial(Material$4.ColorType,{fabric:{type:Material$4.ColorType,uniforms:{color:new Color(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$4.ImageType="Image",Material$4._materialCache.addMaterial(Material$4.ImageType,{fabric:{type:Material$4.ImageType,uniforms:{image:Material$4.DefaultImageId,repeat:new Cartesian2(1,1),color:new Color(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material$4.DiffuseMapType="DiffuseMap",Material$4._materialCache.addMaterial(Material$4.DiffuseMapType,{fabric:{type:Material$4.DiffuseMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$4.AlphaMapType="AlphaMap",Material$4._materialCache.addMaterial(Material$4.AlphaMapType,{fabric:{type:Material$4.AlphaMapType,uniforms:{image:Material$4.DefaultImageId,channel:"a",repeat:new Cartesian2(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),Material$4.SpecularMapType="SpecularMap",Material$4._materialCache.addMaterial(Material$4.SpecularMapType,{fabric:{type:Material$4.SpecularMapType,uniforms:{image:Material$4.DefaultImageId,channel:"r",repeat:new Cartesian2(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),Material$4.EmissionMapType="EmissionMap",Material$4._materialCache.addMaterial(Material$4.EmissionMapType,{fabric:{type:Material$4.EmissionMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material$4.BumpMapType="BumpMap",Material$4._materialCache.addMaterial(Material$4.BumpMapType,{fabric:{type:Material$4.BumpMapType,uniforms:{image:Material$4.DefaultImageId,channel:"r",strength:.8,repeat:new Cartesian2(1,1)},source:BumpMapMaterial},translucent:!1}),Material$4.NormalMapType="NormalMap",Material$4._materialCache.addMaterial(Material$4.NormalMapType,{fabric:{type:Material$4.NormalMapType,uniforms:{image:Material$4.DefaultImageId,channels:"rgb",strength:.8,repeat:new Cartesian2(1,1)},source:NormalMapMaterial},translucent:!1}),Material$4.GridType="Grid",Material$4._materialCache.addMaterial(Material$4.GridType,{fabric:{type:Material$4.GridType,uniforms:{color:new Color(0,1,0,1),cellAlpha:.1,lineCount:new Cartesian2(8,8),lineThickness:new Cartesian2(1,1),lineOffset:new Cartesian2(0,0)},source:GridMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),Material$4.StripeType="Stripe",Material$4._materialCache.addMaterial(Material$4.StripeType,{fabric:{type:Material$4.StripeType,uniforms:{horizontal:!0,evenColor:new Color(1,1,1,.5),oddColor:new Color(0,0,1,.5),offset:0,repeat:5},source:StripeMaterial},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),Material$4.CheckerboardType="Checkerboard",Material$4._materialCache.addMaterial(Material$4.CheckerboardType,{fabric:{type:Material$4.CheckerboardType,uniforms:{lightColor:new Color(1,1,1,.5),darkColor:new Color(0,0,0,.5),repeat:new Cartesian2(5,5)},source:CheckerboardMaterial},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$4.DotType="Dot",Material$4._materialCache.addMaterial(Material$4.DotType,{fabric:{type:Material$4.DotType,uniforms:{lightColor:new Color(1,1,0,.75),darkColor:new Color(0,1,1,.75),repeat:new Cartesian2(5,5)},source:DotMaterial},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material$4.WaterType="Water",Material$4._materialCache.addMaterial(Material$4.WaterType,{fabric:{type:Material$4.WaterType,uniforms:{baseWaterColor:new Color(.2,.3,.6,1),blendColor:new Color(0,1,.699,1),specularMap:Material$4.DefaultImageId,normalMap:Material$4.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:WaterMaterial},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),Material$4.RimLightingType="RimLighting",Material$4._materialCache.addMaterial(Material$4.RimLightingType,{fabric:{type:Material$4.RimLightingType,uniforms:{color:new Color(1,0,0,.7),rimColor:new Color(1,1,1,.4),width:.3},source:RimLightingMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),Material$4.FadeType="Fade",Material$4._materialCache.addMaterial(Material$4.FadeType,{fabric:{type:Material$4.FadeType,uniforms:{fadeInColor:new Color(1,0,0,1),fadeOutColor:new Color(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new Cartesian2(.5,.5)},source:FadeMaterial},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),Material$4.PolylineArrowType="PolylineArrow",Material$4._materialCache.addMaterial(Material$4.PolylineArrowType,{fabric:{type:Material$4.PolylineArrowType,uniforms:{color:new Color(1,1,1,1)},source:PolylineArrowMaterial},translucent:!0}),Material$4.PolylineDashType="PolylineDash",Material$4._materialCache.addMaterial(Material$4.PolylineDashType,{fabric:{type:Material$4.PolylineDashType,uniforms:{color:new Color(1,0,1,1),gapColor:new Color(0,0,0,0),dashLength:16,dashPattern:255},source:PolylineDashMaterial},translucent:!0}),Material$4.PolylineGlowType="PolylineGlow",Material$4._materialCache.addMaterial(Material$4.PolylineGlowType,{fabric:{type:Material$4.PolylineGlowType,uniforms:{color:new Color(0,.5,1,1),glowPower:.25,taperPower:1},source:PolylineGlowMaterial},translucent:!0}),Material$4.PolylineOutlineType="PolylineOutline",Material$4._materialCache.addMaterial(Material$4.PolylineOutlineType,{fabric:{type:Material$4.PolylineOutlineType,uniforms:{color:new Color(1,1,1,1),outlineColor:new Color(1,0,0,1),outlineWidth:1},source:PolylineOutlineMaterial},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),Material$4.ElevationContourType="ElevationContour",Material$4._materialCache.addMaterial(Material$4.ElevationContourType,{fabric:{type:Material$4.ElevationContourType,uniforms:{spacing:100,color:new Color(1,0,0,1),width:1},source:ElevationContourMaterial},translucent:!1}),Material$4.ElevationRampType="ElevationRamp",Material$4._materialCache.addMaterial(Material$4.ElevationRampType,{fabric:{type:Material$4.ElevationRampType,uniforms:{image:Material$4.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:ElevationRampMaterial},translucent:!1}),Material$4.SlopeRampMaterialType="SlopeRamp",Material$4._materialCache.addMaterial(Material$4.SlopeRampMaterialType,{fabric:{type:Material$4.SlopeRampMaterialType,uniforms:{image:Material$4.DefaultImageId},source:SlopeRampMaterial},translucent:!1}),Material$4.AspectRampMaterialType="AspectRamp",Material$4._materialCache.addMaterial(Material$4.AspectRampMaterialType,{fabric:{type:Material$4.AspectRampMaterialType,uniforms:{image:Material$4.DefaultImageId},source:AspectRampMaterial},translucent:!1}),Material$4.ElevationBandType="ElevationBand",Material$4._materialCache.addMaterial(Material$4.ElevationBandType,{fabric:{type:Material$4.ElevationBandType,uniforms:{heights:Material$4.DefaultImageId,colors:Material$4.DefaultImageId},source:ElevationBandMaterial},translucent:!0}),Object.defineProperties(MaterialAppearance.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}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),MaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,MaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,MaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,MaterialAppearance.MaterialSupport={BASIC:Object.freeze({vertexFormat:VertexFormat.POSITION_AND_NORMAL,vertexShaderSource:BasicMaterialAppearanceVS,fragmentShaderSource:BasicMaterialAppearanceFS}),TEXTURED:Object.freeze({vertexFormat:VertexFormat.POSITION_NORMAL_AND_ST,vertexShaderSource:TexturedMaterialAppearanceVS,fragmentShaderSource:TexturedMaterialAppearanceFS}),ALL:Object.freeze({vertexFormat:VertexFormat.ALL,vertexShaderSource:AllMaterialAppearanceVS,fragmentShaderSource:AllMaterialAppearanceFS})};var PerInstanceColorAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nvec4 color = czm_gammaCorrect(v_color);\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n",PerInstanceColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",PerInstanceFlatColorAppearanceFS="varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = czm_gammaCorrect(v_color);\n}\n",PerInstanceFlatColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function PerInstanceColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),n=defaultValue(e.closed,!1),i=defaultValue(e.flat,!1),r=i?PerInstanceFlatColorAppearanceVS:PerInstanceColorAppearanceVS,o=i?PerInstanceFlatColorAppearanceFS:PerInstanceColorAppearanceFS,a=i?PerInstanceColorAppearance.FLAT_VERTEX_FORMAT:PerInstanceColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,r),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,o),this._renderState=Appearance.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=a,this._flat=i,this._faceForward=defaultValue(e.faceForward,!n)}function ColorMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}function DrawCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._cull=defaultValue(e.cull,!0),this._occlude=defaultValue(e.occlude,!0),this._modelMatrix=e.modelMatrix,this._primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=defaultValue(e.offset,0),this._instanceCount=defaultValue(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._executeInClosestFrustum=defaultValue(e.executeInClosestFrustum,!1),this._owner=e.owner,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugOverlappingFrustums=0,this._castShadows=defaultValue(e.castShadows,!1),this._receiveShadows=defaultValue(e.receiveShadows,!1),this._pickId=e.pickId,this._pickOnly=defaultValue(e.pickOnly,!1),this._depthForTranslucentClassification=defaultValue(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}Object.defineProperties(PerInstanceColorAppearance.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}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}}),PerInstanceColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_NORMAL,PerInstanceColorAppearance.FLAT_VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PerInstanceColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PerInstanceColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PerInstanceColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(ColorMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),ColorMaterialProperty.prototype.getType=function(e){return"Color"},ColorMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},ColorMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ColorMaterialProperty&&Property.equals(this._color,e._color)},Object.defineProperties(DrawCommand.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this.dirty=!0)}},occlude:{get:function(){return this._occlude},set:function(e){this._occlude!==e&&(this._occlude=e,this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return this._castShadows},set:function(e){this._castShadows!==e&&(this._castShadows=e,this.dirty=!0)}},receiveShadows:{get:function(){return this._receiveShadows},set:function(e){this._receiveShadows!==e&&(this._receiveShadows=e,this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return this._executeInClosestFrustum},set:function(e){this._executeInClosestFrustum!==e&&(this._executeInClosestFrustum=e,this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickOnly:{get:function(){return this._pickOnly},set:function(e){this._pickOnly!==e&&(this._pickOnly=e,this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return this._depthForTranslucentClassification},set:function(e){this._depthForTranslucentClassification!==e&&(this._depthForTranslucentClassification=e,this.dirty=!0)}}}),DrawCommand.shallowClone=function(e,t){if(defined(e))return defined(t)||(t=new DrawCommand),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._cull=e._cull,t._occlude=e._occlude,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._executeInClosestFrustum=e._executeInClosestFrustum,t._owner=e._owner,t._debugShowBoundingVolume=e._debugShowBoundingVolume,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._castShadows=e._castShadows,t._receiveShadows=e._receiveShadows,t._pickId=e._pickId,t._pickOnly=e._pickOnly,t._depthForTranslucentClassification=e._depthForTranslucentClassification,t.dirty=!0,t.lastDirtyTime=0,t},DrawCommand.prototype.execute=function(e,t){e.draw(this,t)};const Pass={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,OVERLAY:9,NUMBER_OF_PASSES:10};var Pass$1=Object.freeze(Pass);function freezeRenderState(e){if("object"!=typeof e||null===e)return e;let t;const n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=freezeRenderState(e[t]));return Object.freeze(e)}function RenderState(e){const t=defaultValue(e,defaultValue.EMPTY_OBJECT),n=defaultValue(t.cull,defaultValue.EMPTY_OBJECT),i=defaultValue(t.polygonOffset,defaultValue.EMPTY_OBJECT),r=defaultValue(t.scissorTest,defaultValue.EMPTY_OBJECT),o=defaultValue(r.rectangle,defaultValue.EMPTY_OBJECT),a=defaultValue(t.depthRange,defaultValue.EMPTY_OBJECT),s=defaultValue(t.depthTest,defaultValue.EMPTY_OBJECT),c=defaultValue(t.colorMask,defaultValue.EMPTY_OBJECT),l=defaultValue(t.blending,defaultValue.EMPTY_OBJECT),u=defaultValue(l.color,defaultValue.EMPTY_OBJECT),d=defaultValue(t.stencilTest,defaultValue.EMPTY_OBJECT),h=defaultValue(d.frontOperation,defaultValue.EMPTY_OBJECT),p=defaultValue(d.backOperation,defaultValue.EMPTY_OBJECT),f=defaultValue(t.sampleCoverage,defaultValue.EMPTY_OBJECT),m=t.viewport;this.frontFace=defaultValue(t.frontFace,WindingOrder$1.COUNTER_CLOCKWISE),this.cull={enabled:defaultValue(n.enabled,!1),face:defaultValue(n.face,WebGLConstants$1.BACK)},this.lineWidth=defaultValue(t.lineWidth,1),this.polygonOffset={enabled:defaultValue(i.enabled,!1),factor:defaultValue(i.factor,0),units:defaultValue(i.units,0)},this.scissorTest={enabled:defaultValue(r.enabled,!1),rectangle:BoundingRectangle.clone(o)},this.depthRange={near:defaultValue(a.near,0),far:defaultValue(a.far,1)},this.depthTest={enabled:defaultValue(s.enabled,!1),func:defaultValue(s.func,WebGLConstants$1.LESS)},this.colorMask={red:defaultValue(c.red,!0),green:defaultValue(c.green,!0),blue:defaultValue(c.blue,!0),alpha:defaultValue(c.alpha,!0)},this.depthMask=defaultValue(t.depthMask,!0),this.stencilMask=defaultValue(t.stencilMask,-1),this.blending={enabled:defaultValue(l.enabled,!1),color:new Color(defaultValue(u.red,0),defaultValue(u.green,0),defaultValue(u.blue,0),defaultValue(u.alpha,0)),equationRgb:defaultValue(l.equationRgb,WebGLConstants$1.FUNC_ADD),equationAlpha:defaultValue(l.equationAlpha,WebGLConstants$1.FUNC_ADD),functionSourceRgb:defaultValue(l.functionSourceRgb,WebGLConstants$1.ONE),functionSourceAlpha:defaultValue(l.functionSourceAlpha,WebGLConstants$1.ONE),functionDestinationRgb:defaultValue(l.functionDestinationRgb,WebGLConstants$1.ZERO),functionDestinationAlpha:defaultValue(l.functionDestinationAlpha,WebGLConstants$1.ZERO)},this.stencilTest={enabled:defaultValue(d.enabled,!1),frontFunction:defaultValue(d.frontFunction,WebGLConstants$1.ALWAYS),backFunction:defaultValue(d.backFunction,WebGLConstants$1.ALWAYS),reference:defaultValue(d.reference,0),mask:defaultValue(d.mask,-1),frontOperation:{fail:defaultValue(h.fail,WebGLConstants$1.KEEP),zFail:defaultValue(h.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(h.zPass,WebGLConstants$1.KEEP)},backOperation:{fail:defaultValue(p.fail,WebGLConstants$1.KEEP),zFail:defaultValue(p.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(p.zPass,WebGLConstants$1.KEEP)}},this.sampleCoverage={enabled:defaultValue(f.enabled,!1),value:defaultValue(f.value,1),invert:defaultValue(f.invert,!1)},this.viewport=defined(m)?new BoundingRectangle(m.x,m.y,m.width,m.height):void 0,this.id=0,this._applyFunctions=[]}let nextRenderStateId=0,renderStateCache={};function enableOrDisable(e,t,n){n?e.enable(t):e.disable(t)}function applyFrontFace(e,t){e.frontFace(t.frontFace)}function applyCull(e,t){const n=t.cull,i=n.enabled;enableOrDisable(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function applyLineWidth(e,t){e.lineWidth(t.lineWidth)}function applyPolygonOffset(e,t){const n=t.polygonOffset,i=n.enabled;enableOrDisable(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function applyScissorTest(e,t,n){const i=t.scissorTest,r=defined(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(enableOrDisable(e,e.SCISSOR_TEST,r),r){const t=defined(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(t.x,t.y,t.width,t.height)}}function applyDepthRange(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function applyDepthTest(e,t){const n=t.depthTest,i=n.enabled;enableOrDisable(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function applyColorMask(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function applyDepthMask(e,t){e.depthMask(t.depthMask)}function applyStencilMask(e,t){e.stencilMask(t.stencilMask)}function applyBlendingColor(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function applyBlending(e,t,n){const i=t.blending,r=defined(n.blendingEnabled)?n.blendingEnabled:i.enabled;enableOrDisable(e,e.BLEND,r),r&&(applyBlendingColor(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function applyStencilTest(e,t){const n=t.stencilTest,i=n.enabled;if(enableOrDisable(e,e.STENCIL_TEST,i),i){const t=n.frontFunction,i=n.backFunction,r=n.reference,o=n.mask;e.stencilFunc(t,r,o),e.stencilFuncSeparate(e.BACK,i,r,o),e.stencilFuncSeparate(e.FRONT,t,r,o);const a=n.frontOperation,s=a.fail,c=a.zFail,l=a.zPass;e.stencilOpSeparate(e.FRONT,s,c,l);const u=n.backOperation,d=u.fail,h=u.zFail,p=u.zPass;e.stencilOpSeparate(e.BACK,d,h,p)}}function applySampleCoverage(e,t){const n=t.sampleCoverage,i=n.enabled;enableOrDisable(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}RenderState.fromCache=function(e){const t=JSON.stringify(e);let n=renderStateCache[t];if(defined(n))return++n.referenceCount,n.state;let i=new RenderState(e);const r=JSON.stringify(i);return n=renderStateCache[r],defined(n)||(i.id=nextRenderStateId++,n={referenceCount:0,state:i},renderStateCache[r]=n),++n.referenceCount,renderStateCache[t]={referenceCount:1,state:n.state},n.state},RenderState.removeFromCache=function(e){const t=new RenderState(e),n=JSON.stringify(t),i=renderStateCache[n],r=JSON.stringify(e),o=renderStateCache[r];defined(o)&&(--o.referenceCount,0===o.referenceCount&&(delete renderStateCache[r],defined(i)&&--i.referenceCount)),defined(i)&&0===i.referenceCount&&delete renderStateCache[n]},RenderState.getCache=function(){return renderStateCache},RenderState.clearCache=function(){renderStateCache={}};const scratchViewport$2=new BoundingRectangle;function applyViewport(e,t,n){let i=defaultValue(t.viewport,n.viewport);defined(i)||(i=scratchViewport$2,i.width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}function createFuncs(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(applyFrontFace),e.cull.enabled===t.cull.enabled&&e.cull.face===t.cull.face||n.push(applyCull),e.lineWidth!==t.lineWidth&&n.push(applyLineWidth),e.polygonOffset.enabled===t.polygonOffset.enabled&&e.polygonOffset.factor===t.polygonOffset.factor&&e.polygonOffset.units===t.polygonOffset.units||n.push(applyPolygonOffset),e.depthRange.near===t.depthRange.near&&e.depthRange.far===t.depthRange.far||n.push(applyDepthRange),e.depthTest.enabled===t.depthTest.enabled&&e.depthTest.func===t.depthTest.func||n.push(applyDepthTest),e.colorMask.red===t.colorMask.red&&e.colorMask.green===t.colorMask.green&&e.colorMask.blue===t.colorMask.blue&&e.colorMask.alpha===t.colorMask.alpha||n.push(applyColorMask),e.depthMask!==t.depthMask&&n.push(applyDepthMask),e.stencilMask!==t.stencilMask&&n.push(applyStencilMask),e.stencilTest.enabled===t.stencilTest.enabled&&e.stencilTest.frontFunction===t.stencilTest.frontFunction&&e.stencilTest.backFunction===t.stencilTest.backFunction&&e.stencilTest.reference===t.stencilTest.reference&&e.stencilTest.mask===t.stencilTest.mask&&e.stencilTest.frontOperation.fail===t.stencilTest.frontOperation.fail&&e.stencilTest.frontOperation.zFail===t.stencilTest.frontOperation.zFail&&e.stencilTest.backOperation.fail===t.stencilTest.backOperation.fail&&e.stencilTest.backOperation.zFail===t.stencilTest.backOperation.zFail&&e.stencilTest.backOperation.zPass===t.stencilTest.backOperation.zPass||n.push(applyStencilTest),e.sampleCoverage.enabled===t.sampleCoverage.enabled&&e.sampleCoverage.value===t.sampleCoverage.value&&e.sampleCoverage.invert===t.sampleCoverage.invert||n.push(applySampleCoverage),n}RenderState.apply=function(e,t,n){applyFrontFace(e,t),applyCull(e,t),applyLineWidth(e,t),applyPolygonOffset(e,t),applyDepthRange(e,t),applyDepthTest(e,t),applyColorMask(e,t),applyDepthMask(e,t),applyStencilMask(e,t),applyStencilTest(e,t),applySampleCoverage(e,t),applyScissorTest(e,t,n),applyBlending(e,t,n),applyViewport(e,t,n)},RenderState.partialApply=function(e,t,n,i,r,o){if(t!==n){let i=n._applyFunctions[t.id];defined(i)||(i=createFuncs(t,n),n._applyFunctions[t.id]=i);const r=i.length;for(let t=0;t<r;++t)i[t](e,n)}((defined(i.scissorTest)?i.scissorTest:t.scissorTest)!==(defined(r.scissorTest)?r.scissorTest:n.scissorTest)||o)&&applyScissorTest(e,n,r);const a=defined(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,s=defined(r.blendingEnabled)?r.blendingEnabled:n.blending.enabled;(a!==s||s&&t.blending!==n.blending)&&applyBlending(e,n,r),t===n&&i===r&&i.context===r.context||applyViewport(e,n,r)},RenderState.getState=function(e){return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:BoundingRectangle.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:Color.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:defined(e.viewport)?BoundingRectangle.clone(e.viewport):void 0}};const viewerPositionWCScratch=new Cartesian3;function AutomaticUniform(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const datatypeToGlsl={};datatypeToGlsl[WebGLConstants$1.FLOAT]="float",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC2]="vec2",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC3]="vec3",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC4]="vec4",datatypeToGlsl[WebGLConstants$1.INT]="int",datatypeToGlsl[WebGLConstants$1.INT_VEC2]="ivec2",datatypeToGlsl[WebGLConstants$1.INT_VEC3]="ivec3",datatypeToGlsl[WebGLConstants$1.INT_VEC4]="ivec4",datatypeToGlsl[WebGLConstants$1.BOOL]="bool",datatypeToGlsl[WebGLConstants$1.BOOL_VEC2]="bvec2",datatypeToGlsl[WebGLConstants$1.BOOL_VEC3]="bvec3",datatypeToGlsl[WebGLConstants$1.BOOL_VEC4]="bvec4",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT2]="mat2",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT3]="mat3",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT4]="mat4",datatypeToGlsl[WebGLConstants$1.SAMPLER_2D]="sampler2D",datatypeToGlsl[WebGLConstants$1.SAMPLER_CUBE]="samplerCube",AutomaticUniform.prototype.getDeclaration=function(e){let t="uniform "+datatypeToGlsl[this._datatype]+" "+e;const n=this._size;return t+=1===n?";":"["+n.toString()+"];",t};const AutomaticUniforms={czm_viewport:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return Matrix4.getTranslation(e.inverseView,viewerPositionWCScratch)}}),czm_frameNumber:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new AutomaticUniform({size:9,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.fogDensity}}),czm_imagerySplitPosition:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.imagerySplitPosition}}),czm_geometricToleranceOverMeter:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})};function createUniform(e,t,n,i){switch(t.type){case e.FLOAT:return new UniformFloat(e,t,n,i);case e.FLOAT_VEC2:return new UniformFloatVec2(e,t,n,i);case e.FLOAT_VEC3:return new UniformFloatVec3(e,t,n,i);case e.FLOAT_VEC4:return new UniformFloatVec4(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformSampler(e,t,n,i);case e.INT:case e.BOOL:return new UniformInt(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformIntVec2(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformIntVec3(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformIntVec4(e,t,n,i);case e.FLOAT_MAT2:return new UniformMat2(e,t,n,i);case e.FLOAT_MAT3:return new UniformMat3(e,t,n,i);case e.FLOAT_MAT4:return new UniformMat4(e,t,n,i);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+n+'".')}}function UniformFloat(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}function UniformFloatVec2(e,t,n,i){this.name=n,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=i}function UniformFloatVec3(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}function UniformFloatVec4(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}function UniformSampler(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}function UniformInt(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}function UniformIntVec2(e,t,n,i){this.name=n,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=i}function UniformIntVec3(e,t,n,i){this.name=n,this.value=void 0,this._value=new Cartesian3,this._gl=e,this._location=i}function UniformIntVec4(e,t,n,i){this.name=n,this.value=void 0,this._value=new Cartesian4,this._gl=e,this._location=i}UniformFloat.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},UniformFloatVec2.prototype.set=function(){const e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))},UniformFloatVec3.prototype.set=function(){const e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue)):defined(e.x)&&(Cartesian3.equals(e,this._value)||(this._value=Cartesian3.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z)))},UniformFloatVec4.prototype.set=function(){const e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha)):defined(e.x)&&(Cartesian4.equals(e,this._value)||(this._value=Cartesian4.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w)))},UniformSampler.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)},UniformSampler.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},UniformInt.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},UniformIntVec2.prototype.set=function(){const e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))},UniformIntVec3.prototype.set=function(){const e=this.value;Cartesian3.equals(e,this._value)||(Cartesian3.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},UniformIntVec4.prototype.set=function(){const e=this.value;Cartesian4.equals(e,this._value)||(Cartesian4.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};const scratchUniformArray$1=new Float32Array(4);function UniformMat2(e,t,n,i){this.name=n,this.value=void 0,this._value=new Matrix2,this._gl=e,this._location=i}UniformMat2.prototype.set=function(){if(!Matrix2.equalsArray(this.value,this._value,0)){Matrix2.clone(this.value,this._value);const e=Matrix2.toArray(this.value,scratchUniformArray$1);this._gl.uniformMatrix2fv(this._location,!1,e)}};const scratchMat3Array=new Float32Array(9);function UniformMat3(e,t,n,i){this.name=n,this.value=void 0,this._value=new Matrix3,this._gl=e,this._location=i}UniformMat3.prototype.set=function(){if(!Matrix3.equalsArray(this.value,this._value,0)){Matrix3.clone(this.value,this._value);const e=Matrix3.toArray(this.value,scratchMat3Array);this._gl.uniformMatrix3fv(this._location,!1,e)}};const scratchMat4Array=new Float32Array(16);function UniformMat4(e,t,n,i){this.name=n,this.value=void 0,this._value=new Matrix4,this._gl=e,this._location=i}function createUniformArray(e,t,n,i){switch(t.type){case e.FLOAT:return new UniformArrayFloat(e,t,n,i);case e.FLOAT_VEC2:return new UniformArrayFloatVec2(e,t,n,i);case e.FLOAT_VEC3:return new UniformArrayFloatVec3(e,t,n,i);case e.FLOAT_VEC4:return new UniformArrayFloatVec4(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformArraySampler(e,t,n,i);case e.INT:case e.BOOL:return new UniformArrayInt(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformArrayIntVec2(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformArrayIntVec3(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformArrayIntVec4(e,t,n,i);case e.FLOAT_MAT2:return new UniformArrayMat2(e,t,n,i);case e.FLOAT_MAT3:return new UniformArrayMat3(e,t,n,i);case e.FLOAT_MAT4:return new UniformArrayMat4(e,t,n,i);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+n+'".')}}function UniformArrayFloat(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(r),this._gl=e,this._location=i[0]}function UniformArrayFloatVec2(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(2*r),this._gl=e,this._location=i[0]}function UniformArrayFloatVec3(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(3*r),this._gl=e,this._location=i[0]}function UniformArrayFloatVec4(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(4*r),this._gl=e,this._location=i[0]}function UniformArraySampler(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(r),this._gl=e,this._locations=i,this.textureUnitIndex=void 0}function UniformArrayInt(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Int32Array(r),this._gl=e,this._location=i[0]}function UniformArrayIntVec2(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Int32Array(2*r),this._gl=e,this._location=i[0]}function UniformArrayIntVec3(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Int32Array(3*r),this._gl=e,this._location=i[0]}function UniformArrayIntVec4(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Int32Array(4*r),this._gl=e,this._location=i[0]}function UniformArrayMat2(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(4*r),this._gl=e,this._location=i[0]}function UniformArrayMat3(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(9*r),this._gl=e,this._location=i[0]}function UniformArrayMat4(e,t,n,i){const r=i.length;this.name=n,this.value=new Array(r),this._value=new Float32Array(16*r),this._gl=e,this._location=i[0]}UniformMat4.prototype.set=function(){if(!Matrix4.equalsArray(this.value,this._value,0)){Matrix4.clone(this.value,this._value);const e=Matrix4.toArray(this.value,scratchMat4Array);this._gl.uniformMatrix4fv(this._location,!1,e)}},UniformArrayFloat.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let r=0;r<t;++r){const t=e[r];t!==n[r]&&(n[r]=t,i=!0)}i&&this._gl.uniform1fv(this._location,n)},UniformArrayFloatVec2.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian2.equalsArray(t,n,r)||(Cartesian2.pack(t,n,r),i=!0),r+=2}i&&this._gl.uniform2fv(this._location,n)},UniformArrayFloatVec3.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];defined(t.red)?t.red===n[r]&&t.green===n[r+1]&&t.blue===n[r+2]||(n[r]=t.red,n[r+1]=t.green,n[r+2]=t.blue,i=!0):defined(t.x)&&(Cartesian3.equalsArray(t,n,r)||(Cartesian3.pack(t,n,r),i=!0)),r+=3}i&&this._gl.uniform3fv(this._location,n)},UniformArrayFloatVec4.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];defined(t.red)?Color.equalsArray(t,n,r)||(Color.pack(t,n,r),i=!0):defined(t.x)&&(Cartesian4.equalsArray(t,n,r)||(Cartesian4.pack(t,n,r),i=!0)),r+=4}i&&this._gl.uniform4fv(this._location,n)},UniformArraySampler.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let r=0;r<i;++r){const i=n[r];e.activeTexture(t+r),e.bindTexture(i._target,i._texture)}},UniformArraySampler.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,n=t.length;for(let i=0;i<n;++i){const n=e+i;this._gl.uniform1i(t[i],n)}return e+n},UniformArrayInt.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let r=0;r<t;++r){const t=e[r];t!==n[r]&&(n[r]=t,i=!0)}i&&this._gl.uniform1iv(this._location,n)},UniformArrayIntVec2.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian2.equalsArray(t,n,r)||(Cartesian2.pack(t,n,r),i=!0),r+=2}i&&this._gl.uniform2iv(this._location,n)},UniformArrayIntVec3.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian3.equalsArray(t,n,r)||(Cartesian3.pack(t,n,r),i=!0),r+=3}i&&this._gl.uniform3iv(this._location,n)},UniformArrayIntVec4.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Cartesian4.equalsArray(t,n,r)||(Cartesian4.pack(t,n,r),i=!0),r+=4}i&&this._gl.uniform4iv(this._location,n)},UniformArrayMat2.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix2.equalsArray(t,n,r)||(Matrix2.pack(t,n,r),i=!0),r+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)},UniformArrayMat3.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix3.equalsArray(t,n,r)||(Matrix3.pack(t,n,r),i=!0),r+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)},UniformArrayMat4.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,r=0;for(let o=0;o<t;++o){const t=e[o];Matrix4.equalsArray(t,n,r)||(Matrix4.pack(t,n,r),i=!0),r+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};let nextShaderProgramId=0;function ShaderProgram(e){let t=e.vertexShaderText,n=e.fragmentShaderText;"undefined"!=typeof spector&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));const i=handleUniformPrecisionMismatches(t,n);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=i.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=i.fragmentShaderText,this.id=nextShaderProgramId++}function extractUniforms(e){const t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(defined(n)){const e=n.length;for(let i=0;i<e;i++){const e=n[i].trim(),r=e.slice(e.lastIndexOf(" ")+1);t.push(r)}}return t}function handleUniformPrecisionMismatches(e,t){const n={};if(!ContextLimits.highpFloatSupported||!ContextLimits.highpIntSupported){let i,r,o,a;const s=extractUniforms(e),c=extractUniforms(t),l=s.length,u=c.length;for(i=0;i<l;i++)for(r=0;r<u;r++)if(s[i]===c[r]){o=s[i],a="czm_mediump_"+o;const e=new RegExp(o+"\\b","g");t=t.replace(e,a),n[a]=o}}return{fragmentShaderText:t,duplicateUniformNames:n}}ShaderProgram.fromCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.getShaderProgram(e)},ShaderProgram.replaceCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.replaceShaderProgram(e)},Object.defineProperties(ShaderProgram.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return initialize$e(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return initialize$e(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return initialize$e(this),this._uniformsByName}}});const consolePrefix="[Cesium WebGL] ";function createAndLinkProgram(e,t){const n=t._vertexShaderText,i=t._fragmentShaderText,r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,n),e.compileShader(r);const o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,i),e.compileShader(o);const a=e.createProgram();e.attachShader(a,r),e.attachShader(a,o),e.deleteShader(r),e.deleteShader(o);const s=t._attributeLocations;if(defined(s))for(const t in s)s.hasOwnProperty(t)&&e.bindAttribLocation(a,s[t],t);let c;if(e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS)){const n=t._debugShaders;if(!e.getShaderParameter(o,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(o),console.error(consolePrefix+"Fragment shader compile log: "+c),defined(n)){const e=n.getTranslatedShaderSource(o);""!==e?console.error(consolePrefix+"Translated fragment shader source:\n"+e):console.error(consolePrefix+"Fragment shader translation failed.")}throw e.deleteProgram(a),new RuntimeError("Fragment shader failed to compile. Compile log: "+c)}if(!e.getShaderParameter(r,e.COMPILE_STATUS)){if(c=e.getShaderInfoLog(r),console.error(consolePrefix+"Vertex shader compile log: "+c),defined(n)){const e=n.getTranslatedShaderSource(r);""!==e?console.error(consolePrefix+"Translated vertex shader source:\n"+e):console.error(consolePrefix+"Vertex shader translation failed.")}throw e.deleteProgram(a),new RuntimeError("Vertex shader failed to compile. Compile log: "+c)}throw c=e.getProgramInfoLog(a),console.error(consolePrefix+"Shader program link log: "+c),defined(n)&&(console.error(consolePrefix+"Translated vertex shader source:\n"+n.getTranslatedShaderSource(r)),console.error(consolePrefix+"Translated fragment shader source:\n"+n.getTranslatedShaderSource(o))),e.deleteProgram(a),new RuntimeError("Program failed to link. Link log: "+c)}const l=t._logShaderCompilation;return l&&(c=e.getShaderInfoLog(r),defined(c)&&c.length>0&&console.log(consolePrefix+"Vertex shader compile log: "+c)),l&&(c=e.getShaderInfoLog(o),defined(c)&&c.length>0&&console.log(consolePrefix+"Fragment shader compile log: "+c)),l&&(c=e.getProgramInfoLog(a),defined(c)&&c.length>0&&console.log(consolePrefix+"Shader program link log: "+c)),a}function findVertexAttributes(e,t,n){const i={};for(let r=0;r<n;++r){const n=e.getActiveAttrib(t,r),o=e.getAttribLocation(t,n.name);i[n.name]={name:n.name,type:n.type,index:o}}return i}function findUniforms(e,t){const n={},i=[],r=[],o=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){const o=e.getActiveUniform(t,a),s="[0]",c=-1!==o.name.indexOf(s,o.name.length-s.length)?o.name.slice(0,o.name.length-3):o.name;if(0!==c.indexOf("gl_"))if(o.name.indexOf("[")<0){const a=e.getUniformLocation(t,c);if(null!==a){const t=createUniform(e,o,c,a);n[c]=t,i.push(t),t._setSampler&&r.push(t)}}else{let a,s,l,u;const d=c.indexOf("[");if(d>=0){if(a=n[c.slice(0,d)],!defined(a))continue;s=a._locations,s.length<=1&&(l=a.value,u=e.getUniformLocation(t,c),null!==u&&(s.push(u),l.push(e.getUniform(t,u))))}else{s=[];for(let n=0;n<o.size;++n)u=e.getUniformLocation(t,c+"["+n+"]"),null!==u&&s.push(u);a=createUniformArray(e,o,c,s),n[c]=a,i.push(a),a._setSampler&&r.push(a)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:r}}function partitionUniforms(e,t){const n=[],i=[];for(const r in t)if(t.hasOwnProperty(r)){const o=t[r];let a=r;const s=e._duplicateUniformNames[a];defined(s)&&(o.name=s,a=s);const c=AutomaticUniforms[a];defined(c)?n.push({uniform:o,automaticUniform:c}):i.push(o)}return{automaticUniforms:n,manualUniforms:i}}function setSamplerUniforms(e,t,n){e.useProgram(t);let i=0;const r=n.length;for(let e=0;e<r;++e)i=n[e]._setSampler(i);return e.useProgram(null),i}function initialize$e(e){defined(e._program)||reinitialize(e)}function reinitialize(e){const t=e._program,n=e._gl,i=createAndLinkProgram(n,e,e._debugShaders),r=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),o=findUniforms(n,i),a=partitionUniforms(e,o.uniformsByName);e._program=i,e._numberOfVertexAttributes=r,e._vertexAttributes=findVertexAttributes(n,i,r),e._uniformsByName=o.uniformsByName,e._uniforms=o.uniforms,e._automaticUniforms=a.automaticUniforms,e._manualUniforms=a.manualUniforms,e.maximumTextureUnitIndex=setSamplerUniforms(n,i,o.samplerUniforms),t&&e._gl.deleteProgram(t),"undefined"!=typeof spector&&(e._program.__SPECTOR_rebuildProgram=function(t,n,i,r){const o=e._vertexShaderText,a=e._fragmentShaderText,s=/ ! = /g;e._vertexShaderText=t.replace(s," != "),e._fragmentShaderText=n.replace(s," != ");try{reinitialize(e),i(e._program)}catch(t){e._vertexShaderText=o,e._fragmentShaderText=a;const n=/(?:Compile|Link) error: ([^]*)/.exec(t.message);r(n?n[1]:t.message)}})}function modernizeShader(e,t){const n=/#define OUTPUT_DECLARATION/,i=e.split("\n");if(/#version 300 es/g.test(e))return e;let r,o,a=-1;for(r=0;r<i.length;++r)if(o=i[r],n.test(o)){a=r;break}if(-1===a)throw new DeveloperError("Could not find a #define OUTPUT_DECLARATION!");const s=[];for(r=0;r<10;r++){const t="gl_FragData\\["+r+"\\]",n="czm_out"+r;new RegExp(t,"g").test(e)&&(setAdd(n,s),replaceInSourceString(t,n,i),i.splice(a,0,"layout(location = "+r+") out vec4 "+n+";"),a+=1)}const c="czm_fragColor";findInSource("gl_FragColor",i)&&(setAdd(c,s),replaceInSourceString("gl_FragColor",c,i),i.splice(a,0,"layout(location = 0) out vec4 czm_fragColor;"),a+=1);const l=getVariablePreprocessorBranch(s,i),u={};for(r=0;r<i.length;r++){o=i[r];for(const e in l)if(l.hasOwnProperty(e)){new RegExp("(layout)[^]+(out)[^]+("+e+")[^]+","g").test(o)&&(u[o]=e)}}for(const e in u)if(u.hasOwnProperty(e)){const t=u[e];let n=i.indexOf(e);const r=l[t],o=r.length;for(let e=0;e<o;e++)i.splice(n,0,r[e]);n+=o+1;for(let e=o-1;e>=0;e--)i.splice(n,0,"#endif //"+r[e])}const d="WEBGL_2",h="#version 300 es";let p=!1;for(r=0;r<i.length;r++)if(/#version/.test(i[r])){i[r]=h,p=!0;break}return p||i.splice(0,0,h),i.splice(1,0,"#define WEBGL_2"),removeExtension("EXT_draw_buffers",d,i),removeExtension("EXT_frag_depth",d,i),removeExtension("OES_standard_derivatives",d,i),replaceInSourceString("texture2D","texture",i),replaceInSourceString("texture3D","texture",i),replaceInSourceString("textureCube","texture",i),replaceInSourceString("gl_FragDepthEXT","gl_FragDepth",i),t?replaceInSourceString("varying","in",i):(replaceInSourceString("attribute","in",i),replaceInSourceString("varying","out",i)),compileSource(i)}function replaceInSourceString(e,t,n){const i=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),r=n.length;for(let e=0;e<r;++e){const r=n[e];n[e]=r.replace(i,"$1"+t+"$3")}}function replaceInSourceRegex(e,t,n){const i=n.length;for(let r=0;r<i;++r){const i=n[r];n[r]=i.replace(e,t)}}function findInSource(e,t){const n=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),i=t.length;for(let e=0;e<i;++e){const i=t[e];if(n.test(i))return!0}return!1}function compileSource(e){let t="";const n=e.length;for(let i=0;i<n;++i)t+=e[i]+"\n";return t}function setAdd(e,t){-1===t.indexOf(e)&&t.push(e)}function getVariablePreprocessorBranch(e,t){const n={},i=e.length,r=[];for(let o=0;o<t.length;++o){const a=t[o],s=/(#ifdef|#if)/g.test(a),c=/#else/g.test(a),l=/#endif/g.test(a);if(s)r.push(a);else if(c){let e=r[r.length-1].replace("ifdef","ifndef");/if/g.test(e)&&(e=e.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),r.pop(),r.push(e)}else if(l)r.pop();else if(!/layout/g.test(a))for(let t=0;t<i;++t){const i=e[t];-1!==a.indexOf(i)&&(defined(n[i])?n[i]=n[i].filter((function(e){return r.indexOf(e)>=0})):n[i]=r.slice())}}return n}function removeExtension(e,t,n){replaceInSourceRegex(new RegExp("#extension\\s+GL_"+e+"\\s+:\\s+[a-zA-Z0-9]+\\s*$","g"),"",n),replaceInSourceString("GL_"+e,t,n)}ShaderProgram.prototype._bind=function(){initialize$e(this),this._gl.useProgram(this._program)},ShaderProgram.prototype._setUniforms=function(e,t,n){let i,r;if(defined(e)){const t=this._manualUniforms;for(i=t.length,r=0;r<i;++r){const n=t[r];n.value=e[n.name]()}}const o=this._automaticUniforms;for(i=o.length,r=0;r<i;++r){const e=o[r];e.uniform.value=e.automaticUniform.getValue(t)}const a=this._uniforms;for(i=a.length,r=0;r<i;++r)a[r].set();if(n){const e=this._gl,t=this._program;e.validateProgram(t)}},ShaderProgram.prototype.isDestroyed=function(){return!1},ShaderProgram.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)},ShaderProgram.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),destroyObject(this)};var czm_degreesPerRadian="const float czm_degreesPerRadian = 57.29577951308232;\n",czm_depthRange="const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n",czm_epsilon1="const float czm_epsilon1 = 0.1;\n",czm_epsilon2="const float czm_epsilon2 = 0.01;\n",czm_epsilon3="const float czm_epsilon3 = 0.001;\n",czm_epsilon4="const float czm_epsilon4 = 0.0001;\n",czm_epsilon5="const float czm_epsilon5 = 0.00001;\n",czm_epsilon6="const float czm_epsilon6 = 0.000001;\n",czm_epsilon7="const float czm_epsilon7 = 0.0000001;\n",czm_infinity="const float czm_infinity = 5906376272000.0;\n",czm_oneOverPi="const float czm_oneOverPi = 0.3183098861837907;\n",czm_oneOverTwoPi="const float czm_oneOverTwoPi = 0.15915494309189535;\n",czm_passCesium3DTile="const float czm_passCesium3DTile = 4.0;\n",czm_passCesium3DTileClassification="const float czm_passCesium3DTileClassification = 5.0;\n",czm_passCesium3DTileClassificationIgnoreShow="const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n",czm_passClassification="const float czm_passClassification = 7.0;\n",czm_passCompute="const float czm_passCompute = 1.0;\n",czm_passEnvironment="const float czm_passEnvironment = 0.0;\n",czm_passGlobe="const float czm_passGlobe = 2.0;\n",czm_passOpaque="const float czm_passOpaque = 7.0;\n",czm_passOverlay="const float czm_passOverlay = 9.0;\n",czm_passTerrainClassification="const float czm_passTerrainClassification = 3.0;\n",czm_passTranslucent="const float czm_passTranslucent = 8.0;\n",czm_pi="const float czm_pi = 3.141592653589793;\n",czm_piOverFour="const float czm_piOverFour = 0.7853981633974483;\n",czm_piOverSix="const float czm_piOverSix = 0.5235987755982988;\n",czm_piOverThree="const float czm_piOverThree = 1.0471975511965976;\n",czm_piOverTwo="const float czm_piOverTwo = 1.5707963267948966;\n",czm_radiansPerDegree="const float czm_radiansPerDegree = 0.017453292519943295;\n",czm_sceneMode2D="const float czm_sceneMode2D = 2.0;\n",czm_sceneMode3D="const float czm_sceneMode3D = 3.0;\n",czm_sceneModeColumbusView="const float czm_sceneModeColumbusView = 1.0;\n",czm_sceneModeMorphing="const float czm_sceneModeMorphing = 0.0;\n",czm_solarRadius="const float czm_solarRadius = 695500000.0;\n",czm_threePiOver2="const float czm_threePiOver2 = 4.71238898038469;\n",czm_twoPi="const float czm_twoPi = 6.283185307179586;\n",czm_webMercatorMaxLatitude="const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n",czm_depthRangeStruct="struct czm_depthRangeStruct\n{\nfloat near;\nfloat far;\n};\n",czm_material="struct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\n",czm_materialInput="struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\nfloat height;\nfloat slope;\nfloat aspect;\n};\n",czm_modelMaterial="struct czm_modelMaterial {\nvec3 diffuse;\nfloat alpha;\nvec3 specular;\nfloat roughness;\nvec3 normalEC;\nfloat occlusion;\nvec3 emissive;\n};\n",czm_modelVertexOutput="struct czm_modelVertexOutput {\nvec3 positionMC;\nfloat pointSize;\n};\n",czm_pbrParameters="struct czm_pbrParameters\n{\nvec3 diffuseColor;\nfloat roughness;\nvec3 f0;\n};\n",czm_ray="struct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\n",czm_raySegment="struct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n",czm_shadowParameters="struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\nvec3 texCoords;\n#else\nvec2 texCoords;\n#endif\nfloat depthBias;\nfloat depth;\nfloat nDotL;\nvec2 texelStepSize;\nfloat normalShadingSmooth;\nfloat darkness;\n};\n",czm_acesTonemapping="vec3 czm_acesTonemapping(vec3 color) {\nfloat g = 0.985;\nfloat a = 0.065;\nfloat b = 0.0001;\nfloat c = 0.433;\nfloat d = 0.238;\ncolor = (color * (color + a) - b) / (color * (g * color + c) + d);\ncolor = clamp(color, 0.0, 1.0);\nreturn color;\n}\n",czm_alphaWeight="float czm_alphaWeight(float a)\n{\nfloat z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nreturn pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n",czm_antialias="vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n",czm_approximateSphericalCoordinates="vec2 czm_approximateSphericalCoordinates(vec3 normal) {\nfloat latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\nfloat longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\nreturn vec2(latitudeApproximation, longitudeApproximation);\n}\n",czm_backFacing="bool czm_backFacing()\n{\nreturn gl_FrontFacing == false;\n}\n",czm_branchFreeTernary="float czm_branchFreeTernary(bool comparison, float a, float b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\n",czm_cascadeColor="vec4 czm_cascadeColor(vec4 weights)\n{\nreturn vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\nvec4(0.0, 1.0, 0.0, 1.0) * weights.y +\nvec4(0.0, 0.0, 1.0, 1.0) * weights.z +\nvec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n",czm_cascadeDistance="uniform vec4 shadowMap_cascadeDistances;\nfloat czm_cascadeDistance(vec4 weights)\n{\nreturn dot(shadowMap_cascadeDistances, weights);\n}\n",czm_cascadeMatrix="uniform mat4 shadowMap_cascadeMatrices[4];\nmat4 czm_cascadeMatrix(vec4 weights)\n{\nreturn shadowMap_cascadeMatrices[0] * weights.x +\nshadowMap_cascadeMatrices[1] * weights.y +\nshadowMap_cascadeMatrices[2] * weights.z +\nshadowMap_cascadeMatrices[3] * weights.w;\n}\n",czm_cascadeWeights="uniform vec4 shadowMap_cascadeSplits[2];\nvec4 czm_cascadeWeights(float depthEye)\n{\nvec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\nvec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\nreturn near * far;\n}\n",czm_columbusViewMorph="vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n",czm_computePosition="vec4 czm_computePosition();\n",czm_cosineAndSine="vec2 cordic(float angle)\n{\nvec2 vector = vec2(6.0725293500888267e-1, 0.0);\nfloat sense = (angle < 0.0) ? -1.0 : 1.0;\nmat2 rotation = mat2(1.0, sense, -sense, 1.0);\nvector = rotation * vector;\nangle -= sense * 7.8539816339744828e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfloat factor = sense * 5.0e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.6364760900080609e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.5e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4497866312686414e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.25e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2435499454676144e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.25e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.2418809995957350e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.125e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.1239833430268277e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.5625e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5623728620476831e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.8125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.8123410601011111e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.90625e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.9062301319669718e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.953125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9531225164788188e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.765625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.7656218955931946e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.8828125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.8828121119489829e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.44140625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4414062014936177e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.220703125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2207031189367021e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.103515625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.1035156174208773e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.0517578125e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.0517578115526096e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.52587890625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5258789061315762e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.62939453125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.6293945311019700e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.814697265625e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.8146972656064961e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.9073486328125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9073486328101870e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.5367431640625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.5367431640596084e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.76837158203125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.7683715820308884e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.384185791015625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.3841857910155797e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.1920928955078125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nreturn vector;\n}\nvec2 czm_cosineAndSine(float angle)\n{\nif (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n{\nif (angle < 0.0)\n{\nreturn -cordic(angle + czm_pi);\n}\nelse\n{\nreturn -cordic(angle - czm_pi);\n}\n}\nelse\n{\nreturn cordic(angle);\n}\n}\n",czm_decompressTextureCoordinates="vec2 czm_decompressTextureCoordinates(float encoded)\n{\nfloat temp = encoded / 4096.0;\nfloat xZeroTo4095 = floor(temp);\nfloat stx = xZeroTo4095 / 4095.0;\nfloat sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\nreturn vec2(stx, sty);\n}\n",czm_defaultPbrMaterial="czm_pbrParameters czm_defaultPbrMaterial()\n{\nczm_pbrParameters results;\nresults.diffuseColor = vec3(1.0);\nresults.roughness = 1.0;\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nresults.f0 = REFLECTANCE_DIELECTRIC;\nreturn results;\n}\n",czm_depthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvec4 czm_depthClamp(vec4 coords)\n{\n#ifndef LOG_DEPTH\n#ifdef GL_EXT_frag_depth\nv_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\ncoords.z = 0.0;\n#else\ncoords.z = min(coords.z, coords.w);\n#endif\n#endif\nreturn coords;\n}\n",czm_eastNorthUpToEyeCoordinates="mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x, tangentEC.y, tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x, normalEC.y, normalEC.z);\n}\n",czm_ellipsoidContainsPoint="bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\nvec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n",czm_ellipsoidWgs84TextureCoordinates="vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n",czm_equalsEpsilon="bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n",czm_eyeOffset="vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n",czm_eyeToWindowCoordinates="vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_fastApproximateAtan="float czm_fastApproximateAtan(float x) {\nreturn x * (-0.1784 * x - 0.0663 * x * x + 1.0301);\n}\nfloat czm_fastApproximateAtan(float x, float y) {\nfloat t = abs(x);\nfloat opposite = abs(y);\nfloat adjacent = max(t, opposite);\nopposite = min(t, opposite);\nt = czm_fastApproximateAtan(opposite / adjacent);\nt = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);\nt = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);\nt = czm_branchFreeTernary(y < 0.0, -t, t);\nreturn t;\n}\n",czm_fog="vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-(scalar * scalar));\nreturn mix(color, fogColor, fog);\n}\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\nreturn mix(color, fogColor, fog);\n}\n",czm_gammaCorrect="vec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\ncolor = pow(color, vec3(czm_gamma));\n#endif\nreturn color;\n}\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\ncolor.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\nreturn color;\n}\n",czm_geodeticSurfaceNormal="vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n",czm_getDefaultMaterial="czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n",czm_getLambertDiffuse="float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\n",czm_getSpecular="float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, max(shininess, czm_epsilon2));\n}\n",czm_getWaterNoise="vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n",czm_HSBToRGB="const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 czm_HSBToRGB(vec3 hsb)\n{\nvec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\nreturn hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n",czm_HSLToRGB="vec3 hueToRGB(float hue)\n{\nfloat r = abs(hue * 6.0 - 3.0) - 1.0;\nfloat g = 2.0 - abs(hue * 6.0 - 2.0);\nfloat b = 2.0 - abs(hue * 6.0 - 4.0);\nreturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 czm_HSLToRGB(vec3 hsl)\n{\nvec3 rgb = hueToRGB(hsl.x);\nfloat c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\nreturn (rgb - 0.5) * c + hsl.z;\n}\n",czm_hue="vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591, 0.311135);\nconst mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107, 1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n",czm_inverseGamma="vec3 czm_inverseGamma(vec3 color) {\nreturn pow(color, vec3(1.0 / czm_gamma));\n}\n",czm_isEmpty="bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n",czm_isFull="bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n",czm_latitudeToWebMercatorFraction="float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nreturn (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n",czm_linearToSrgb="vec3 czm_linearToSrgb(vec3 linearIn)\n{\nreturn pow(linearIn, vec3(1.0/2.2));\n}\nvec4 czm_linearToSrgb(vec4 linearIn)\n{\nvec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));\nreturn vec4(srgbOut, linearIn.a);\n}\n",czm_lineDistance="float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\nreturn abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n",czm_luminance="float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n",czm_metersPerPixel="float czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\nfloat width = czm_viewport.z;\nfloat height = czm_viewport.w;\nfloat pixelWidth;\nfloat pixelHeight;\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nif (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n{\nfloat frustumWidth = right - left;\nfloat frustumHeight = top - bottom;\npixelWidth = frustumWidth / width;\npixelHeight = frustumHeight / height;\n}\nelse\n{\nfloat distanceToPixel = -positionEC.z;\nfloat inverseNear = 1.0 / czm_currentFrustum.x;\nfloat tanTheta = top * inverseNear;\npixelHeight = 2.0 * distanceToPixel * tanTheta / height;\ntanTheta = right * inverseNear;\npixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n}\nreturn max(pixelWidth, pixelHeight) * pixelRatio;\n}\nfloat czm_metersPerPixel(vec4 positionEC)\n{\nreturn czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n",czm_modelToWindowCoordinates="vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_multiplyWithColorBalance="vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n",czm_nearFarScalar="float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\nfloat valueAtMin = nearFarScalar.y;\nfloat valueAtMax = nearFarScalar.w;\nfloat nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\nfloat farDistanceSq = nearFarScalar.z * nearFarScalar.z;\nfloat t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(clamp(t, 0.0, 1.0), 0.2);\nreturn mix(valueAtMin, valueAtMax, t);\n}\n",czm_octDecode="vec3 czm_octDecode(vec2 encoded, float range)\n{\nif (encoded.x == 0.0 && encoded.y == 0.0) {\nreturn vec3(0.0, 0.0, 0.0);\n}\nencoded = encoded / range * 2.0 - 1.0;\nvec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\nif (v.z < 0.0)\n{\nv.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n}\nreturn normalize(v);\n}\nvec3 czm_octDecode(vec2 encoded)\n{\nreturn czm_octDecode(encoded, 255.0);\n}\nvec3 czm_octDecode(float encoded)\n{\nfloat temp = encoded / 256.0;\nfloat x = floor(temp);\nfloat y = (temp - x) * 256.0;\nreturn czm_octDecode(vec2(x, y));\n}\nvoid czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n{\nfloat temp = encoded.x / 65536.0;\nfloat x = floor(temp);\nfloat encodedFloat1 = (temp - x) * 65536.0;\ntemp = encoded.y / 65536.0;\nfloat y = floor(temp);\nfloat encodedFloat2 = (temp - y) * 65536.0;\nvector1 = czm_octDecode(encodedFloat1);\nvector2 = czm_octDecode(encodedFloat2);\nvector3 = czm_octDecode(vec2(x, y));\n}\n",czm_packDepth="vec4 czm_packDepth(float depth)\n{\nvec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\nenc = fract(enc);\nenc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\nreturn enc;\n}\n",czm_pbrLighting="vec3 lambertianDiffuse(vec3 diffuseColor)\n{\nreturn diffuseColor / czm_pi;\n}\nvec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)\n{\nreturn f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\nfloat smithVisibilityG1(float NdotV, float roughness)\n{\nfloat k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n{\nreturn (\nsmithVisibilityG1(NdotL, roughness) *\nsmithVisibilityG1(NdotV, roughness)\n);\n}\nfloat GGX(float roughness, float NdotH)\n{\nfloat roughnessSquared = roughness * roughness;\nfloat f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\nreturn roughnessSquared / (czm_pi * f * f);\n}\nvec3 czm_pbrLighting(\nvec3 positionEC,\nvec3 normalEC,\nvec3 lightDirectionEC,\nvec3 lightColorHdr,\nczm_pbrParameters pbrParameters\n)\n{\nvec3 v = -normalize(positionEC);\nvec3 l = normalize(lightDirectionEC);\nvec3 h = normalize(v + l);\nvec3 n = normalEC;\nfloat NdotL = clamp(dot(n, l), 0.001, 1.0);\nfloat NdotV = abs(dot(n, v)) + 0.001;\nfloat NdotH = clamp(dot(n, h), 0.0, 1.0);\nfloat LdotH = clamp(dot(l, h), 0.0, 1.0);\nfloat VdotH = clamp(dot(v, h), 0.0, 1.0);\nvec3 f0 = pbrParameters.f0;\nfloat reflectance = max(max(f0.r, f0.g), f0.b);\nvec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\nvec3 F = fresnelSchlick2(f0, f90, VdotH);\nfloat alpha = pbrParameters.roughness;\nfloat G = smithVisibilityGGX(alpha, NdotL, NdotV);\nfloat D = GGX(alpha, NdotH);\nvec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\nvec3 diffuseColor = pbrParameters.diffuseColor;\nvec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\nreturn (diffuseContribution + specularContribution) * NdotL * lightColorHdr;\n}\n",czm_pbrMetallicRoughnessMaterial="czm_pbrParameters czm_pbrMetallicRoughnessMaterial(\nvec3 baseColor,\nfloat metallic,\nfloat roughness\n)\n{\nczm_pbrParameters results;\nroughness = clamp(roughness, 0.0, 1.0);\nresults.roughness = roughness * roughness;\nmetallic = clamp(metallic, 0.0, 1.0);\nconst vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\nvec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);\nresults.f0 = f0;\nresults.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);\nreturn results;\n}\n",czm_pbrSpecularGlossinessMaterial="czm_pbrParameters czm_pbrSpecularGlossinessMaterial(\nvec3 diffuse,\nvec3 specular,\nfloat glossiness\n)\n{\nczm_pbrParameters results;\nfloat roughness = 1.0 - glossiness;\nresults.roughness = roughness * roughness;\nresults.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\nresults.f0 = specular;\nreturn results;\n}\n",czm_phong="float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n}\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\nvec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);\nfloat specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_planeDistance="float czm_planeDistance(vec4 plane, vec3 point) {\nreturn (dot(plane.xyz, point) + plane.w);\n}\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\nreturn (dot(planeNormal, point) + planeDistance);\n}\n",czm_pointAlongRay="vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n",czm_rayEllipsoidIntersectionInterval="czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\nvec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n",czm_readDepth="float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\nreturn czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);\n}\n",czm_readNonPerspective="float czm_readNonPerspective(float value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec2 czm_readNonPerspective(vec2 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec3 czm_readNonPerspective(vec3 value, float oneOverW) {\nreturn value * oneOverW;\n}\nvec4 czm_readNonPerspective(vec4 value, float oneOverW) {\nreturn value * oneOverW;\n}\n",czm_reverseLogDepth="float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nreturn far * (1.0 - near / (depthFromNear + near)) / (far - near);\n#endif\nreturn logZ;\n}\n",czm_RGBToHSB="const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec3 czm_RGBToHSB(vec3 rgb)\n{\nvec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\nvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\nfloat d = q.x - min(q.w, q.y);\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n",czm_RGBToHSL="vec3 RGBtoHCV(vec3 rgb)\n{\nvec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\nvec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\nfloat c = q.x - min(q.w, q.y);\nfloat h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\nreturn vec3(h, c, q.x);\n}\nvec3 czm_RGBToHSL(vec3 rgb)\n{\nvec3 hcv = RGBtoHCV(rgb);\nfloat l = hcv.z - hcv.y * 0.5;\nfloat s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\nreturn vec3(hcv.x, s, l);\n}\n",czm_RGBToXYZ="vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n",czm_sampleOctahedralProjection="vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\ndirection /= dot(vec3(1.0), abs(direction));\nvec2 rev = abs(direction.zx) - vec2(1.0);\nvec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\ndirection.z < 0.0 ? rev.y : -rev.y);\nvec2 uv = direction.y < 0.0 ? neg : direction.xz;\nvec2 coord = 0.5 * uv + vec2(0.5);\nvec2 pixel = 1.0 / textureSize;\nif (lod > 0.0)\n{\nfloat scale = 1.0 / pow(2.0, lod);\nfloat offset = ((textureSize.y + 1.0) / textureSize.x);\ncoord.x *= offset;\ncoord *= scale;\ncoord.x += offset + pixel.x;\ncoord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n}\nelse\n{\ncoord.x *= (textureSize.y / textureSize.x);\n}\n#ifndef OES_texture_float_linear\nvec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\nvec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\nvec3 color3 = texture2D(projectedMap, coord + pixel).rgb;\nvec3 color4 = texture2D(projectedMap, coord).rgb;\nvec2 texturePosition = coord * textureSize;\nfloat fu = fract(texturePosition.x);\nfloat fv = fract(texturePosition.y);\nvec3 average1 = mix(color4, color2, fu);\nvec3 average2 = mix(color1, color3, fu);\nvec3 color = mix(average1, average2, fv);\n#else\nvec3 color = texture2D(projectedMap, coord).rgb;\n#endif\nreturn color;\n}\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\nfloat currentLod = floor(lod + 0.5);\nfloat nextLod = min(currentLod + 1.0, maxLod);\nvec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\nvec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\nreturn mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n",czm_saturation="vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n",czm_shadowDepthCompare="float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)\n{\nreturn czm_unpackDepth(textureCube(shadowMap, d));\n}\nfloat czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\nreturn texture2D(shadowMap, uv).r;\n#else\nreturn czm_unpackDepth(texture2D(shadowMap, uv));\n#endif\n}\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n",czm_shadowVisibility="float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\nfloat strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\nfloat strength = step(0.0, nDotL);\n#endif\nvisibility *= strength;\n#endif\nvisibility = max(visibility, darkness);\nreturn visibility;\n}\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec3 uvw = shadowParameters.texCoords;\ndepth -= depthBias;\nfloat visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec2 uv = shadowParameters.texCoords;\ndepth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\nvec2 texelStepSize = shadowParameters.texelStepSize;\nfloat radius = 1.0;\nfloat dx0 = -texelStepSize.x * radius;\nfloat dy0 = -texelStepSize.y * radius;\nfloat dx1 = texelStepSize.x * radius;\nfloat dy1 = texelStepSize.y * radius;\nfloat visibility = (\nczm_shadowDepthCompare(shadowMap, uv, depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n) * (1.0 / 9.0);\n#else\nfloat visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n",czm_signNotZero="float czm_signNotZero(float value)\n{\nreturn value >= 0.0 ? 1.0 : -1.0;\n}\nvec2 czm_signNotZero(vec2 value)\n{\nreturn vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\nvec3 czm_signNotZero(vec3 value)\n{\nreturn vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\nvec4 czm_signNotZero(vec4 value)\n{\nreturn vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n",czm_sphericalHarmonics="vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\nvec3 L00 = coefficients[0];\nvec3 L1_1 = coefficients[1];\nvec3 L10 = coefficients[2];\nvec3 L11 = coefficients[3];\nvec3 L2_2 = coefficients[4];\nvec3 L2_1 = coefficients[5];\nvec3 L20 = coefficients[6];\nvec3 L21 = coefficients[7];\nvec3 L22 = coefficients[8];\nfloat x = normal.x;\nfloat y = normal.y;\nfloat z = normal.z;\nreturn\nL00\n+ L1_1 * y\n+ L10 * z\n+ L11 * x\n+ L2_2 * (y * x)\n+ L2_1 * (y * z)\n+ L20 * (3.0 * z * z - 1.0)\n+ L21 * (z * x)\n+ L22 * (x * x - y * y);\n}\n",czm_srgbToLinear="vec3 czm_srgbToLinear(vec3 srgbIn)\n{\nreturn pow(srgbIn, vec3(2.2));\n}\nvec4 czm_srgbToLinear(vec4 srgbIn)\n{\nvec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\nreturn vec4(linearOut, srgbIn.a);\n}\n",czm_tangentToEyeSpaceMatrix="mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 bitangent = normalize(bitangentEC);\nreturn mat3(tangent.x , tangent.y , tangent.z,\nbitangent.x, bitangent.y, bitangent.z,\nnormal.x , normal.y , normal.z);\n}\n",czm_transformPlane="vec4 czm_transformPlane(vec4 plane, mat4 transform) {\nvec4 transformedPlane = transform * plane;\nfloat normalMagnitude = length(transformedPlane.xyz);\nreturn transformedPlane / normalMagnitude;\n}\n",czm_translateRelativeToEye="vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n",czm_translucentPhong="vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\nfloat diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n}\ndiffuse = clamp(diffuse, 0.0, 1.0);\nfloat specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse * czm_lightColor;\ncolor += material.specular * specular * czm_lightColor;\nreturn vec4(color, material.alpha);\n}\n",czm_transpose="mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n",czm_unpackDepth="float czm_unpackDepth(vec4 packedDepth)\n{\nreturn dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\n",czm_unpackFloat="float czm_unpackFloat(vec4 packedFloat)\n{\npackedFloat = floor(packedFloat * 255.0 + 0.5);\nfloat sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;\nfloat exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;\nif (exponent == -127.0)\n{\nreturn 0.0;\n}\nfloat mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);\nfloat result = sign * exp2(exponent - 23.0) * mantissa;\nreturn result;\n}\n",czm_vertexLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef SHADOW_MAP\nvarying vec3 v_logPositionEC;\n#endif\n#endif\nvec4 czm_updatePositionDepth(vec4 coords) {\n#if defined(LOG_DEPTH)\n#ifdef SHADOW_MAP\nvec3 logPositionEC = (czm_inverseProjection * coords).xyz;\nv_logPositionEC = logPositionEC;\n#endif\ncoords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n#endif\nreturn coords;\n}\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;\ngl_Position = czm_updatePositionDepth(gl_Position);\n#endif\n}\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;\nczm_updatePositionDepth(clipCoords);\n#endif\n}\n",czm_windowToEyeCoordinates="vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nif (!(czm_inverseProjection == mat4(0.0)))\n{\nq = czm_inverseProjection * q;\n}\nelse\n{\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nq.x = (q.x * (right - left) + left + right) * 0.5;\nq.y = (q.y * (top - bottom) + bottom + top) * 0.5;\nq.z = (q.z * (near - far) - near - far) * 0.5;\nq.w = 1.0;\n}\nreturn q;\n}\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\nfloat depthFromNear = pow(2.0, log2Depth) - 1.0;\nfloat depthFromCamera = depthFromNear + near;\nvec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\neyeCoordinate.w = 1.0 / depthFromCamera;\nreturn eyeCoordinate;\n#else\nvec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n#endif\nreturn eyeCoordinate;\n}\n",czm_writeDepthClamp="#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\nvoid czm_writeDepthClamp()\n{\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\ngl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n#endif\n}\n",czm_writeLogDepth="#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\nuniform vec2 u_polygonOffset;\n#endif\n#endif\nvoid czm_writeLogDepth(float depth)\n{\n#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)\nif (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {\ndiscard;\n}\n#ifdef POLYGON_OFFSET\nfloat factor = u_polygonOffset[0];\nfloat units = u_polygonOffset[1];\n#ifdef GL_OES_standard_derivatives\nfloat x = dFdx(depth);\nfloat y = dFdy(depth);\nfloat m = sqrt(x * x + y * y);\ndepth += m * factor;\n#endif\n#endif\ngl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;\n#ifdef POLYGON_OFFSET\ngl_FragDepthEXT += czm_epsilon7 * units;\n#endif\n#endif\n}\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\nczm_writeLogDepth(v_depthFromNearPlusOne);\n#endif\n}\n",czm_writeNonPerspective="float czm_writeNonPerspective(float value, float w) {\nreturn value * w;\n}\nvec2 czm_writeNonPerspective(vec2 value, float w) {\nreturn value * w;\n}\nvec3 czm_writeNonPerspective(vec3 value, float w) {\nreturn value * w;\n}\nvec4 czm_writeNonPerspective(vec4 value, float w) {\nreturn value * w;\n}\n",czm_XYZToRGB="vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n-1.5371, 1.8760, -0.2040,\n-0.4985, 0.0416, 1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n",CzmBuiltins={czm_degreesPerRadian:czm_degreesPerRadian,czm_depthRange:czm_depthRange,czm_epsilon1:czm_epsilon1,czm_epsilon2:czm_epsilon2,czm_epsilon3:czm_epsilon3,czm_epsilon4:czm_epsilon4,czm_epsilon5:czm_epsilon5,czm_epsilon6:czm_epsilon6,czm_epsilon7:czm_epsilon7,czm_infinity:czm_infinity,czm_oneOverPi:czm_oneOverPi,czm_oneOverTwoPi:czm_oneOverTwoPi,czm_passCesium3DTile:czm_passCesium3DTile,czm_passCesium3DTileClassification:czm_passCesium3DTileClassification,czm_passCesium3DTileClassificationIgnoreShow:czm_passCesium3DTileClassificationIgnoreShow,czm_passClassification:czm_passClassification,czm_passCompute:czm_passCompute,czm_passEnvironment:czm_passEnvironment,czm_passGlobe:czm_passGlobe,czm_passOpaque:czm_passOpaque,czm_passOverlay:czm_passOverlay,czm_passTerrainClassification:czm_passTerrainClassification,czm_passTranslucent:czm_passTranslucent,czm_pi:czm_pi,czm_piOverFour:czm_piOverFour,czm_piOverSix:czm_piOverSix,czm_piOverThree:czm_piOverThree,czm_piOverTwo:czm_piOverTwo,czm_radiansPerDegree:czm_radiansPerDegree,czm_sceneMode2D:czm_sceneMode2D,czm_sceneMode3D:czm_sceneMode3D,czm_sceneModeColumbusView:czm_sceneModeColumbusView,czm_sceneModeMorphing:czm_sceneModeMorphing,czm_solarRadius:czm_solarRadius,czm_threePiOver2:czm_threePiOver2,czm_twoPi:czm_twoPi,czm_webMercatorMaxLatitude:czm_webMercatorMaxLatitude,czm_depthRangeStruct:czm_depthRangeStruct,czm_material:czm_material,czm_materialInput:czm_materialInput,czm_modelMaterial:czm_modelMaterial,czm_modelVertexOutput:czm_modelVertexOutput,czm_pbrParameters:czm_pbrParameters,czm_ray:czm_ray,czm_raySegment:czm_raySegment,czm_shadowParameters:czm_shadowParameters,czm_acesTonemapping:czm_acesTonemapping,czm_alphaWeight:czm_alphaWeight,czm_antialias:czm_antialias,czm_approximateSphericalCoordinates:czm_approximateSphericalCoordinates,czm_backFacing:czm_backFacing,czm_branchFreeTernary:czm_branchFreeTernary,czm_cascadeColor:czm_cascadeColor,czm_cascadeDistance:czm_cascadeDistance,czm_cascadeMatrix:czm_cascadeMatrix,czm_cascadeWeights:czm_cascadeWeights,czm_columbusViewMorph:czm_columbusViewMorph,czm_computePosition:czm_computePosition,czm_cosineAndSine:czm_cosineAndSine,czm_decompressTextureCoordinates:czm_decompressTextureCoordinates,czm_defaultPbrMaterial:czm_defaultPbrMaterial,czm_depthClamp:czm_depthClamp,czm_eastNorthUpToEyeCoordinates:czm_eastNorthUpToEyeCoordinates,czm_ellipsoidContainsPoint:czm_ellipsoidContainsPoint,czm_ellipsoidWgs84TextureCoordinates:czm_ellipsoidWgs84TextureCoordinates,czm_equalsEpsilon:czm_equalsEpsilon,czm_eyeOffset:czm_eyeOffset,czm_eyeToWindowCoordinates:czm_eyeToWindowCoordinates,czm_fastApproximateAtan:czm_fastApproximateAtan,czm_fog:czm_fog,czm_gammaCorrect:czm_gammaCorrect,czm_geodeticSurfaceNormal:czm_geodeticSurfaceNormal,czm_getDefaultMaterial:czm_getDefaultMaterial,czm_getLambertDiffuse:czm_getLambertDiffuse,czm_getSpecular:czm_getSpecular,czm_getWaterNoise:czm_getWaterNoise,czm_HSBToRGB:czm_HSBToRGB,czm_HSLToRGB:czm_HSLToRGB,czm_hue:czm_hue,czm_inverseGamma:czm_inverseGamma,czm_isEmpty:czm_isEmpty,czm_isFull:czm_isFull,czm_latitudeToWebMercatorFraction:czm_latitudeToWebMercatorFraction,czm_linearToSrgb:czm_linearToSrgb,czm_lineDistance:czm_lineDistance,czm_luminance:czm_luminance,czm_metersPerPixel:czm_metersPerPixel,czm_modelToWindowCoordinates:czm_modelToWindowCoordinates,czm_multiplyWithColorBalance:czm_multiplyWithColorBalance,czm_nearFarScalar:czm_nearFarScalar,czm_octDecode:czm_octDecode,czm_packDepth:czm_packDepth,czm_pbrLighting:czm_pbrLighting,czm_pbrMetallicRoughnessMaterial:czm_pbrMetallicRoughnessMaterial,czm_pbrSpecularGlossinessMaterial:czm_pbrSpecularGlossinessMaterial,czm_phong:czm_phong,czm_planeDistance:czm_planeDistance,czm_pointAlongRay:czm_pointAlongRay,czm_rayEllipsoidIntersectionInterval:czm_rayEllipsoidIntersectionInterval,czm_readDepth:czm_readDepth,czm_readNonPerspective:czm_readNonPerspective,czm_reverseLogDepth:czm_reverseLogDepth,czm_RGBToHSB:czm_RGBToHSB,czm_RGBToHSL:czm_RGBToHSL,czm_RGBToXYZ:czm_RGBToXYZ,czm_sampleOctahedralProjection:czm_sampleOctahedralProjection,czm_saturation:czm_saturation,czm_shadowDepthCompare:czm_shadowDepthCompare,czm_shadowVisibility:czm_shadowVisibility,czm_signNotZero:czm_signNotZero,czm_sphericalHarmonics:czm_sphericalHarmonics,czm_srgbToLinear:czm_srgbToLinear,czm_tangentToEyeSpaceMatrix:czm_tangentToEyeSpaceMatrix,czm_transformPlane:czm_transformPlane,czm_translateRelativeToEye:czm_translateRelativeToEye,czm_translucentPhong:czm_translucentPhong,czm_transpose:czm_transpose,czm_unpackDepth:czm_unpackDepth,czm_unpackFloat:czm_unpackFloat,czm_vertexLogDepth:czm_vertexLogDepth,czm_windowToEyeCoordinates:czm_windowToEyeCoordinates,czm_writeDepthClamp:czm_writeDepthClamp,czm_writeLogDepth:czm_writeLogDepth,czm_writeNonPerspective:czm_writeNonPerspective,czm_XYZToRGB:czm_XYZToRGB};function removeComments(e){return(e=e.replace(/\/\/.*/g,"")).replace(/\/\*\*[\s\S]*?\*\//gm,(function(e){const t=e.match(/\n/gm).length;let n="";for(let e=0;e<t;++e)n+="\n";return n}))}function getDependencyNode(e,t,n){let i;for(let t=0;t<n.length;++t)n[t].name===e&&(i=n[t]);return defined(i)||(i={name:e,glslSource:t=removeComments(t),dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function generateDependencies(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);defined(n)&&null!==n&&(n=n.filter((function(e,t){return n.indexOf(e)===t})),n.forEach((function(n){if(n!==e.name&&ShaderSource._czmBuiltinsAndUniforms.hasOwnProperty(n)){const i=getDependencyNode(n,ShaderSource._czmBuiltinsAndUniforms[n],t);e.dependsOn.push(i),i.requiredBy.push(e),generateDependencies(i,t)}})))}function sortDependencies(e){const t=[],n=[];for(;e.length>0;){const i=e.pop();n.push(i),0===i.requiredBy.length&&t.push(i)}for(;t.length>0;){const n=t.shift();e.push(n);for(let e=0;e<n.dependsOn.length;++e){const i=n.dependsOn[e],r=i.requiredBy.indexOf(n);i.requiredBy.splice(r,1),0===i.requiredBy.length&&t.push(i)}}for(let e=0;e<n.length;++e)n[e].requiredBy.length}function getBuiltinsAndAutomaticUniforms(e){const t=[],n=getDependencyNode("main",e,t);generateDependencies(n,t),sortDependencies(t);let i="";for(let e=t.length-1;e>=0;--e)i=i+t[e].glslSource+"\n";return i.replace(n.glslSource,"")}function combineShader(e,t,n){let i,r,o="";const a=e.sources;if(defined(a))for(i=0,r=a.length;i<r;++i)o+="\n#line 0\n"+a[i];let s;o=removeComments(o),o=o.replace(/#version\s+(.*?)\n/gm,(function(e,t){return s=t,"\n"}));const c=[];o=o.replace(/#extension.*\n/gm,(function(e){return c.push(e),"\n"})),o=o.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const l=e.pickColorQualifier;defined(l)&&(o=ShaderSource.createPickFragmentShaderSource(o,l));let u="";defined(s)&&(u="#version "+s+"\n");const d=c.length;for(i=0;i<d;i++)u+=c[i];t&&(u+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n #define highp mediump\n#endif\n\n");const h=e.defines;if(defined(h))for(i=0,r=h.length;i<r;++i){const e=h[i];0!==e.length&&(u+="#define "+e+"\n")}return n.webgl2&&(u+="#define OUTPUT_DECLARATION\n\n"),n.textureFloatLinear&&(u+="#define OES_texture_float_linear\n\n"),n.floatingPointTexture&&(u+="#define OES_texture_float\n\n"),e.includeBuiltIns&&(u+=getBuiltinsAndAutomaticUniforms(o)),u+="\n#line 0\n",u+=o,n.webgl2&&(u=modernizeShader(u,t)),u}function ShaderSource(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).pickColorQualifier;this.defines=defined(e.defines)?e.defines.slice(0):[],this.sources=defined(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=defaultValue(e.includeBuiltIns,!0)}ShaderSource.prototype.clone=function(){return new ShaderSource({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},ShaderSource.replaceMain=function(e,t){return t="void "+t+"()",e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)},ShaderSource.prototype.createCombinedVertexShader=function(e){return combineShader(this,!1,e)},ShaderSource.prototype.createCombinedFragmentShader=function(e){return combineShader(this,!0,e)},ShaderSource._czmBuiltinsAndUniforms={};for(const e in CzmBuiltins)CzmBuiltins.hasOwnProperty(e)&&(ShaderSource._czmBuiltinsAndUniforms[e]=CzmBuiltins[e]);for(const e in AutomaticUniforms)if(AutomaticUniforms.hasOwnProperty(e)){const t=AutomaticUniforms[e];"function"==typeof t.getDeclaration&&(ShaderSource._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}ShaderSource.createPickVertexShaderSource=function(e){return ShaderSource.replaceMain(e,"czm_old_main")+"\nattribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}"},ShaderSource.createPickFragmentShaderSource=function(e,t){return ShaderSource.replaceMain(e,"czm_old_main")+"\n"+(t+" vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = czm_pickColor; \n}")},ShaderSource.findVarying=function(e,t){const n=e.sources,i=t.length;for(let e=0;e<i;++e){const i=t[e],r=n.length;for(let e=0;e<r;++e)if(-1!==n[e].indexOf(i))return i}};const normalVaryingNames=["v_normalEC","v_normal"];ShaderSource.findNormalVarying=function(e){return ShaderSource.findVarying(e,normalVaryingNames)};const positionVaryingNames=["v_positionEC"];ShaderSource.findPositionVarying=function(e){return ShaderSource.findVarying(e,positionVaryingNames)};var ShadowVolumeAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n#ifdef EXTRUDED_GEOMETRY\nattribute vec3 extrudeDirection;\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\nvoid main()\n{\nvec4 position = czm_computePosition();\n#ifdef EXTRUDED_GEOMETRY\nfloat delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\ndelta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\nposition = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nv_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\nv_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\nvec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\nvec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\nvec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\nbool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\nplanes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\nplanes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\nidlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\nidlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\nplanes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\nplanes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\nvec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\nvec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\nvec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\nvec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // COLUMBUS_VIEW_2D\nvec3 eastWard = southEastCorner - southWestCorner;\nfloat eastExtent = length(eastWard);\neastWard /= eastExtent;\nvec3 northWard = northWestCorner - southWestCorner;\nfloat northExtent = length(northWard);\nnorthWard /= northExtent;\nv_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\nv_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\nv_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\nvec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\nvec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\nv_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\nv_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\nv_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif\ngl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n}\n",ShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvoid main(void)\n{\n#ifdef VECTOR_TILE\ngl_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\ngl_FragColor = vec4(1.0);\n#endif\nczm_writeDepthClamp();\n}\n";const ClassificationType={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2,NUMBER_OF_CLASSIFICATION_TYPES:3};var ClassificationType$1=Object.freeze(ClassificationType);const DepthFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS};var DepthFunction$1=Object.freeze(DepthFunction);const BufferUsage={STREAM_DRAW:WebGLConstants$1.STREAM_DRAW,STATIC_DRAW:WebGLConstants$1.STATIC_DRAW,DYNAMIC_DRAW:WebGLConstants$1.DYNAMIC_DRAW,validate:function(e){return e===BufferUsage.STREAM_DRAW||e===BufferUsage.STATIC_DRAW||e===BufferUsage.DYNAMIC_DRAW}};var BufferUsage$1=Object.freeze(BufferUsage);function Buffer$1(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl,n=e.bufferTarget,i=e.typedArray;let r=e.sizeInBytes;const o=e.usage,a=defined(i);a&&(r=i.byteLength);const s=t.createBuffer();t.bindBuffer(n,s),t.bufferData(n,a?i:r,o),t.bindBuffer(n,null),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=r,this._usage=o,this._buffer=s,this.vertexArrayDestroyable=!0}function addAttribute(e,t,n,i){const r=defined(t.vertexBuffer),o=defined(t.value),a=t.value?t.value.length:t.componentsPerAttribute,s={index:defaultValue(t.index,n),enabled:defaultValue(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:o?t.value.slice(0):void 0,componentsPerAttribute:a,componentDatatype:defaultValue(t.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(t.normalize,!1),offsetInBytes:defaultValue(t.offsetInBytes,0),strideInBytes:defaultValue(t.strideInBytes,0),instanceDivisor:defaultValue(t.instanceDivisor,0)};if(r)s.vertexAttrib=function(e){const t=this.index;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),e.vertexAttribPointer(t,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),e.enableVertexAttribArray(t),this.instanceDivisor>0&&(i.glVertexAttribDivisor(t,this.instanceDivisor),i._vertexAttribDivisors[t]=this.instanceDivisor,i._previousDrawInstanced=!0)},s.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(s.componentsPerAttribute){case 1:s.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:s.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:s.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:s.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}s.disableVertexAttribArray=function(e){}}e.push(s)}function bind(e,t,n){for(let n=0;n<t.length;++n){const i=t[n];i.enabled&&i.vertexAttrib(e)}defined(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function VertexArray(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=t._gl,i=e.attributes,r=e.indexBuffer;let o;const a=[];let s,c=1,l=!1,u=!1,d=i.length;for(o=0;o<d;++o)addAttribute(a,i[o],o,t);for(d=a.length,o=0;o<d;++o){const e=a[o];if(defined(e.vertexBuffer)&&0===e.instanceDivisor){const t=e.strideInBytes||e.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(e.componentDatatype);c=e.vertexBuffer.sizeInBytes/t;break}}for(o=0;o<d;++o)a[o].instanceDivisor>0&&(l=!0),defined(a[o].value)&&(u=!0);t.vertexArrayObject&&(s=t.glCreateVertexArray(),t.glBindVertexArray(s),bind(n,a,r),t.glBindVertexArray(null)),this._numberOfVertices=c,this._hasInstancedAttributes=l,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=s,this._attributes=a,this._indexBuffer=r}function computeNumberOfVertices(e){return e.values.length/e.componentsPerAttribute}function computeAttributeSizeInBytes(e){return ComponentDatatype$1.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function interleaveAttributes(e){let t,n,i;const r=[];for(n in e)e.hasOwnProperty(n)&&defined(e[n])&&defined(e[n].values)&&(r.push(n),e[n].componentDatatype===ComponentDatatype$1.DOUBLE&&(e[n].componentDatatype=ComponentDatatype$1.FLOAT,e[n].values=ComponentDatatype$1.createTypedArray(ComponentDatatype$1.FLOAT,e[n].values)));let o;const a=r.length;if(a>0)for(o=computeNumberOfVertices(e[r[0]]),t=1;t<a;++t){const n=computeNumberOfVertices(e[r[t]]);if(n!==o)throw new RuntimeError("Each attribute list must have the same number of vertices. Attribute "+r[t]+" has a different number of vertices ("+n.toString()+") than attribute "+r[0]+" ("+o.toString()+").")}r.sort((function(t,n){return ComponentDatatype$1.getSizeInBytes(e[n].componentDatatype)-ComponentDatatype$1.getSizeInBytes(e[t].componentDatatype)}));let s=0;const c={};for(t=0;t<a;++t)n=r[t],i=e[n],c[n]=s,s+=computeAttributeSizeInBytes(i);if(s>0){const l=ComponentDatatype$1.getSizeInBytes(e[r[0]].componentDatatype),u=s%l;0!==u&&(s+=l-u);const d=new ArrayBuffer(o*s),h={};for(t=0;t<a;++t){n=r[t];const i=ComponentDatatype$1.getSizeInBytes(e[n].componentDatatype);h[n]={pointer:ComponentDatatype$1.createTypedArray(e[n].componentDatatype,d),index:c[n]/i,strideInComponentType:s/i}}for(t=0;t<o;++t)for(let o=0;o<a;++o){n=r[o],i=e[n];const a=i.values,s=h[n],c=s.pointer,l=i.componentsPerAttribute;for(let e=0;e<l;++e)c[s.index+e]=a[t*l+e];s.index+=s.strideInComponentType}return{buffer:d,offsetsInBytes:c,vertexSizeInBytes:s}}}function setVertexAttribDivisor(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,r=e._attributes,o=ContextLimits.maximumVertexAttributes;let a;if(n){const e=r.length;for(a=0;a<e;++a){const e=r[a];if(e.enabled){const n=e.instanceDivisor,r=e.index;n!==i[r]&&(t.glVertexAttribDivisor(r,n),i[r]=n)}}}else for(a=0;a<o;++a)i[a]>0&&(t.glVertexAttribDivisor(a,0),i[a]=0)}function setConstantAttributes(e,t){const n=e._attributes,i=n.length;for(let e=0;e<i;++e){const i=n[e];i.enabled&&defined(i.value)&&i.vertexAttrib(t)}}function BatchTable(e,t,n){if(this._attributes=t,this._numberOfInstances=n,0===t.length)return;const i=getDatatype(t),r=e.floatingPointTexture,o=i===PixelDatatype$1.FLOAT&&!r,a=createOffsets(t,o),s=getStride(a,t,o),c=Math.floor(ContextLimits.maximumTextureSize/s),l=Math.min(n,c),u=s*l,d=Math.ceil(n/l),h=1/u,p=.5*h,f=1/d,m=.5*f;this._textureDimensions=new Cartesian2(u,d),this._textureStep=new Cartesian4(h,p,f,m),this._pixelDatatype=o?PixelDatatype$1.UNSIGNED_BYTE:i,this._packFloats=o,this._offsets=a,this._stride=s,this._texture=void 0;const g=4*u*d;this._batchValues=i!==PixelDatatype$1.FLOAT||o?new Uint8Array(g):new Float32Array(g),this._batchValuesDirty=!1}function getDatatype(e){let t=!1;const n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE){t=!0;break}return t?PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE}function getAttributeType(e,t){const n=e[t].componentsPerAttribute;return 2===n?Cartesian2:3===n?Cartesian3:4===n?Cartesian4:Number}function createOffsets(e,t){const n=new Array(e.length);let i=0;const r=e.length;for(let o=0;o<r;++o){const r=e[o].componentDatatype;n[o]=i,r!==ComponentDatatype$1.UNSIGNED_BYTE&&t?i+=4:++i}return n}function getStride(e,t,n){const i=e.length,r=e[i-1];return t[i-1].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE&&n?r+4:r+1}Buffer$1.createVertexBuffer=function(e){return new Buffer$1({context:e.context,bufferTarget:WebGLConstants$1.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},Buffer$1.createIndexBuffer=function(e){const t=e.context,n=e.indexDatatype,i=IndexDatatype$1.getSizeInBytes(n),r=new Buffer$1({context:t,bufferTarget:WebGLConstants$1.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),o=r.sizeInBytes/i;return Object.defineProperties(r,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return o}}}),r},Object.defineProperties(Buffer$1.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),Buffer$1.prototype._getBuffer=function(){return this._buffer},Buffer$1.prototype.copyFromArrayView=function(e,t){t=defaultValue(t,0);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)},Buffer$1.prototype.copyFromBuffer=function(e,t,n,i){const r=WebGLConstants$1.COPY_READ_BUFFER,o=WebGLConstants$1.COPY_WRITE_BUFFER,a=this._gl;a.bindBuffer(o,this._buffer),a.bindBuffer(r,e._buffer),a.copyBufferSubData(r,o,t,n,i),a.bindBuffer(o,null),a.bindBuffer(r,null)},Buffer$1.prototype.getBufferData=function(e,t,n,i){t=defaultValue(t,0),n=defaultValue(n,0);const r=this._gl,o=WebGLConstants$1.COPY_READ_BUFFER;r.bindBuffer(o,this._buffer),r.getBufferSubData(o,t,e,n,i),r.bindBuffer(o,null)},Buffer$1.prototype.isDestroyed=function(){return!1},Buffer$1.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),destroyObject(this)},VertexArray.fromGeometry=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=defaultValue(e.geometry,defaultValue.EMPTY_OBJECT),i=defaultValue(e.bufferUsage,BufferUsage$1.DYNAMIC_DRAW),r=defaultValue(e.attributeLocations,defaultValue.EMPTY_OBJECT),o=defaultValue(e.interleave,!1),a=e.vertexArrayAttributes;let s,c,l;const u=defined(a)?a:[],d=n.attributes;if(o){const e=interleaveAttributes(d);if(defined(e)){l=Buffer$1.createVertexBuffer({context:t,typedArray:e.buffer,usage:i});const n=e.offsetsInBytes,o=e.vertexSizeInBytes;for(s in d)d.hasOwnProperty(s)&&defined(d[s])&&(c=d[s],defined(c.values)?u.push({index:r[s],vertexBuffer:l,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:n[s],strideInBytes:o}):u.push({index:r[s],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(s in d)if(d.hasOwnProperty(s)&&defined(d[s])){c=d[s];let e=c.componentDatatype;e===ComponentDatatype$1.DOUBLE&&(e=ComponentDatatype$1.FLOAT),l=void 0,defined(c.values)&&(l=Buffer$1.createVertexBuffer({context:t,typedArray:ComponentDatatype$1.createTypedArray(e,c.values),usage:i})),u.push({index:r[s],vertexBuffer:l,value:c.value,componentDatatype:e,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let h;const p=n.indices;return defined(p)&&(h=Geometry.computeNumberOfVertices(n)>=CesiumMath.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?Buffer$1.createIndexBuffer({context:t,typedArray:new Uint32Array(p),usage:i,indexDatatype:IndexDatatype$1.UNSIGNED_INT}):Buffer$1.createIndexBuffer({context:t,typedArray:new Uint16Array(p),usage:i,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})),new VertexArray({context:t,attributes:u,indexBuffer:h})},Object.defineProperties(VertexArray.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}}),VertexArray.prototype.getAttribute=function(e){return this._attributes[e]},VertexArray.prototype._bind=function(){defined(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&setVertexAttribDivisor(this),this._hasConstantAttributes&&setConstantAttributes(this,this._gl)):bind(this._gl,this._attributes,this._indexBuffer)},VertexArray.prototype._unBind=function(){if(defined(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){const i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}},VertexArray.prototype.isDestroyed=function(){return!1},VertexArray.prototype.destroy=function(){const e=this._attributes;for(let t=0;t<e.length;++t){const n=e[t].vertexBuffer;defined(n)&&!n.isDestroyed()&&n.vertexArrayDestroyable&&n.destroy()}const t=this._indexBuffer;return defined(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),defined(this._vao)&&this._context.glDeleteVertexArray(this._vao),destroyObject(this)},Object.defineProperties(BatchTable.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});const scratchPackedFloatCartesian4=new Cartesian4;function getPackedFloat(e,t,n){let i=Cartesian4.unpack(e,t,scratchPackedFloatCartesian4);const r=Cartesian4.unpackFloat(i);i=Cartesian4.unpack(e,t+4,scratchPackedFloatCartesian4);const o=Cartesian4.unpackFloat(i);i=Cartesian4.unpack(e,t+8,scratchPackedFloatCartesian4);const a=Cartesian4.unpackFloat(i);i=Cartesian4.unpack(e,t+12,scratchPackedFloatCartesian4);const s=Cartesian4.unpackFloat(i);return Cartesian4.fromElements(r,o,a,s,n)}function setPackedAttribute(e,t,n){let i=Cartesian4.packFloat(e.x,scratchPackedFloatCartesian4);Cartesian4.pack(i,t,n),i=Cartesian4.packFloat(e.y,i),Cartesian4.pack(i,t,n+4),i=Cartesian4.packFloat(e.z,i),Cartesian4.pack(i,t,n+8),i=Cartesian4.packFloat(e.w,i),Cartesian4.pack(i,t,n+12)}const scratchGetAttributeCartesian4$1=new Cartesian4;BatchTable.prototype.getBatchedAttribute=function(e,t,n){const i=this._attributes,r=this._offsets[t],o=4*this._stride*e+4*r;let a;a=this._packFloats&&i[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?getPackedFloat(this._batchValues,o,scratchGetAttributeCartesian4$1):Cartesian4.unpack(this._batchValues,o,scratchGetAttributeCartesian4$1);const s=getAttributeType(i,t);return defined(s.fromCartesian4)?s.fromCartesian4(a,n):defined(s.clone)?s.clone(a,n):a.x};const setAttributeScratchValues=[void 0,void 0,new Cartesian2,new Cartesian3,new Cartesian4],setAttributeScratchCartesian4=new Cartesian4;function createTexture$5(e,t){const n=e._textureDimensions;e._texture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:Sampler.NEAREST,flipY:!1})}function updateTexture(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}function getGlslComputeSt$1(e){const t=e._stride;return 1===e._textureDimensions.y?"uniform vec4 batchTextureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float numberOfAttributes = float("+t+"); \n return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); \n} \n":"uniform vec4 batchTextureStep; \nuniform vec2 batchTextureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float stepY = batchTextureStep.z; \n float centerY = batchTextureStep.w; \n float numberOfAttributes = float("+t+"); \n float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); \n float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getComponentType(e){return 1===e?"float":"vec"+e}function getComponentSwizzle(e){return 1===e?".x":2===e?".xy":3===e?".xyz":""}function getGlslAttributeFunction(e,t){const n=e._attributes[t],i=n.componentsPerAttribute,r=n.functionName,o=getComponentType(i),a=getComponentSwizzle(i);let s=o+" "+r+"(float batchId) \n{ \n vec2 st = computeSt(batchId); \n st.x += batchTextureStep.x * float("+e._offsets[t]+"); \n";return e._packFloats&&n.componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?s+="vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture2D(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n":s+=" vec4 textureValue = texture2D(batchTexture, st); \n",s+=" "+o+" value = textureValue"+a+"; \n",e._pixelDatatype!==PixelDatatype$1.UNSIGNED_BYTE||n.componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE||n.normalize?e._pixelDatatype===PixelDatatype$1.FLOAT&&n.componentDatatype===ComponentDatatype$1.UNSIGNED_BYTE&&n.normalize&&(s+="value /= 255.0; \n"):s+="value *= 255.0; \n",s+=" return value; \n} \n",s}function transformToWorldCoordinates(e,t,n){let i=!n;const r=e.length;let o;if(!i&&r>1){const t=e[0].modelMatrix;for(o=1;o<r;++o)if(!Matrix4.equals(t,e[o].modelMatrix)){i=!0;break}}if(i)for(o=0;o<r;++o)defined(e[o].geometry)&&GeometryPipeline.transformToWorldCoordinates(e[o]);else Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function addGeometryBatchId(e,t){const n=e.attributes,i=n.position,r=i.values.length/i.componentsPerAttribute;n.batchId=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,values:new Float32Array(r)});const o=n.batchId.values;for(let e=0;e<r;++e)o[e]=t}function addBatchIds(e){const t=e.length;for(let n=0;n<t;++n){const t=e[n];defined(t.geometry)?addGeometryBatchId(t.geometry,n):defined(t.westHemisphereGeometry)&&defined(t.eastHemisphereGeometry)&&(addGeometryBatchId(t.westHemisphereGeometry,n),addGeometryBatchId(t.eastHemisphereGeometry,n))}}function geometryPipeline(e){const t=e.instances,n=e.projection,i=e.elementIndexUintSupported,r=e.scene3DOnly,o=e.vertexCacheOptimize,a=e.compressVertices,s=e.modelMatrix;let c,l,u=t.length;for(c=0;c<u;++c)if(defined(t[c].geometry)){t[c].geometry.primitiveType;break}if(transformToWorldCoordinates(t,s,r),!r)for(c=0;c<u;++c)defined(t[c].geometry)&&GeometryPipeline.splitLongitude(t[c]);if(addBatchIds(t),o)for(c=0;c<u;++c){const e=t[c];defined(e.geometry)?(GeometryPipeline.reorderForPostVertexCache(e.geometry),GeometryPipeline.reorderForPreVertexCache(e.geometry)):defined(e.westHemisphereGeometry)&&defined(e.eastHemisphereGeometry)&&(GeometryPipeline.reorderForPostVertexCache(e.westHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(e.westHemisphereGeometry),GeometryPipeline.reorderForPostVertexCache(e.eastHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(e.eastHemisphereGeometry))}let d=GeometryPipeline.combineInstances(t);for(u=d.length,c=0;c<u;++c){l=d[c];const e=l.attributes;if(r)for(const t in e)e.hasOwnProperty(t)&&e[t].componentDatatype===ComponentDatatype$1.DOUBLE&&GeometryPipeline.encodeAttribute(l,t,t+"3DHigh",t+"3DLow");else for(const t in e)if(e.hasOwnProperty(t)&&e[t].componentDatatype===ComponentDatatype$1.DOUBLE){const e=t+"3D",i=t+"2D";GeometryPipeline.projectTo2D(l,t,e,i,n),defined(l.boundingSphere)&&"position"===t&&(l.boundingSphereCV=BoundingSphere.fromVertices(l.attributes.position2D.values)),GeometryPipeline.encodeAttribute(l,e,e+"High",e+"Low"),GeometryPipeline.encodeAttribute(l,i,i+"High",i+"Low")}a&&GeometryPipeline.compressVertices(l)}if(!i){let e=[];for(u=d.length,c=0;c<u;++c)l=d[c],e=e.concat(GeometryPipeline.fitToUnsignedShortIndices(l));d=e}return d}function createPickOffsets(e,t,n,i){let r,o,a;const s=i.length-1;if(s>=0){const e=i[s];r=e.offset+e.count,a=e.index,o=n[a].indices.length}else r=0,a=0,o=n[a].indices.length;const c=e.length;for(let s=0;s<c;++s){const c=e[s][t];if(!defined(c))continue;const l=c.indices.length;r+l>o&&(r=0,o=n[++a].indices.length),i.push({index:a,offset:r,count:l}),r+=l}}function createInstancePickOffsets(e,t){const n=[];return createPickOffsets(e,"geometry",t,n),createPickOffsets(e,"westHemisphereGeometry",t,n),createPickOffsets(e,"eastHemisphereGeometry",t,n),n}BatchTable.prototype.setBatchedAttribute=function(e,t,n){const i=this._attributes,r=setAttributeScratchValues[i[t].componentsPerAttribute],o=this.getBatchedAttribute(e,t,r),a=getAttributeType(this._attributes,t);if(defined(a.equals)?a.equals(o,n):o===n)return;const s=setAttributeScratchCartesian4;s.x=defined(n.x)?n.x:n,s.y=defined(n.y)?n.y:0,s.z=defined(n.z)?n.z:0,s.w=defined(n.w)?n.w:0;const c=this._offsets[t],l=4*this._stride*e+4*c;this._packFloats&&i[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?setPackedAttribute(s,this._batchValues,l):Cartesian4.pack(s,this._batchValues,l),this._batchValuesDirty=!0},BatchTable.prototype.update=function(e){defined(this._texture)&&!this._batchValuesDirty||0===this._attributes.length||(this._batchValuesDirty=!1,defined(this._texture)||createTexture$5(this,e.context),updateTexture(this))},BatchTable.prototype.getUniformMapCallback=function(){const e=this;return function(t){if(0===e._attributes.length)return t;return combine$2(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}},BatchTable.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(0===e.length)return function(e){return e};let t="uniform highp sampler2D batchTexture; \n";t+=getGlslComputeSt$1(this)+"\n";const n=e.length;for(let e=0;e<n;++e)t+=getGlslAttributeFunction(this,e);return function(e){const n=e.indexOf("void main"),i=e.substring(0,n),r=e.substring(n);return i+"\n"+t+"\n"+r}},BatchTable.prototype.isDestroyed=function(){return!1},BatchTable.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const PrimitivePipeline={};function transferGeometry(e,t){const n=e.attributes;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e];defined(i)&&defined(i.values)&&t.push(i.values.buffer)}defined(e.indices)&&t.push(e.indices.buffer)}function transferGeometries(e,t){const n=e.length;for(let i=0;i<n;++i)transferGeometry(e[i],t)}function countCreateGeometryResults(e){let t=1;const n=e.length;for(let i=0;i<n;i++){const n=e[i];if(++t,!defined(n))continue;const r=n.attributes;t+=7+2*BoundingSphere.packedLength+(defined(n.indices)?n.indices.length:0);for(const e in r)if(r.hasOwnProperty(e)&&defined(r[e])){t+=5+r[e].values.length}}return t}function packInstancesForCombine(e,t){const n=e.length,i=new Float64Array(1+19*n);let r=0;i[r++]=n;for(let t=0;t<n;t++){const n=e[t];if(Matrix4.pack(n.modelMatrix,i,r),r+=Matrix4.packedLength,defined(n.attributes)&&defined(n.attributes.offset)){const e=n.attributes.offset.value;i[r]=e[0],i[r+1]=e[1],i[r+2]=e[2]}r+=3}return t.push(i.buffer),i}function unpackInstancesForCombine(e){const t=e,n=new Array(t[0]);let i=0,r=1;for(;r<t.length;){const e=Matrix4.unpack(t,r);let o;r+=Matrix4.packedLength,defined(t[r])&&(o={offset:new OffsetGeometryInstanceAttribute(t[r],t[r+1],t[r+2])}),r+=3,n[i++]={modelMatrix:e,attributes:o}}return n}function packBoundingSpheres(e){const t=e.length,n=1+(BoundingSphere.packedLength+1)*t,i=new Float32Array(n);let r=0;i[r++]=t;for(let n=0;n<t;++n){defined(e[n])?(i[r++]=1,BoundingSphere.pack(e[n],i,r)):i[r++]=0,r+=BoundingSphere.packedLength}return i}function unpackBoundingSpheres(e){const t=new Array(e[0]);let n=0,i=1;for(;i<e.length;)1===e[i++]&&(t[n]=BoundingSphere.unpack(e,i)),++n,i+=BoundingSphere.packedLength;return t}PrimitivePipeline.combineGeometry=function(e){let t,n;const i=e.instances,r=i.length;let o,a,s=!1;r>0&&(t=geometryPipeline(e),t.length>0&&(n=GeometryPipeline.createAttributeLocations(t[0]),e.createPickOffsets&&(o=createInstancePickOffsets(i,t))),defined(i[0].attributes)&&defined(i[0].attributes.offset)&&(a=new Array(r),s=!0));const c=new Array(r),l=new Array(r);for(let e=0;e<r;++e){const t=i[e],n=t.geometry;defined(n)&&(c[e]=n.boundingSphere,l[e]=n.boundingSphereCV,s&&(a[e]=t.geometry.offsetAttribute));const r=t.eastHemisphereGeometry,o=t.westHemisphereGeometry;defined(r)&&defined(o)&&(defined(r.boundingSphere)&&defined(o.boundingSphere)&&(c[e]=BoundingSphere.union(r.boundingSphere,o.boundingSphere)),defined(r.boundingSphereCV)&&defined(o.boundingSphereCV)&&(l[e]=BoundingSphere.union(r.boundingSphereCV,o.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:o,offsetInstanceExtend:a,boundingSpheres:c,boundingSpheresCV:l}},PrimitivePipeline.packCreateGeometryResults=function(e,t){const n=new Float64Array(countCreateGeometryResults(e)),i=[],r={},o=e.length;let a=0;n[a++]=o;for(let t=0;t<o;t++){const o=e[t],s=defined(o);if(n[a++]=s?1:0,!s)continue;n[a++]=o.primitiveType,n[a++]=o.geometryType,n[a++]=defaultValue(o.offsetAttribute,-1);const c=defined(o.boundingSphere)?1:0;n[a++]=c,c&&BoundingSphere.pack(o.boundingSphere,n,a),a+=BoundingSphere.packedLength;const l=defined(o.boundingSphereCV)?1:0;n[a++]=l,l&&BoundingSphere.pack(o.boundingSphereCV,n,a),a+=BoundingSphere.packedLength;const u=o.attributes,d=[];for(const e in u)u.hasOwnProperty(e)&&defined(u[e])&&(d.push(e),defined(r[e])||(r[e]=i.length,i.push(e)));n[a++]=d.length;for(let e=0;e<d.length;e++){const t=d[e],i=u[t];n[a++]=r[t],n[a++]=i.componentDatatype,n[a++]=i.componentsPerAttribute,n[a++]=i.normalize?1:0,n[a++]=i.values.length,n.set(i.values,a),a+=i.values.length}const h=defined(o.indices)?o.indices.length:0;n[a++]=h,h>0&&(n.set(o.indices,a),a+=h)}return t.push(n.buffer),{stringTable:i,packedData:n}},PrimitivePipeline.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const r=new Array(n[0]);let o=0,a=1;for(;a<n.length;){if(!(1===n[a++])){r[o++]=void 0;continue}const e=n[a++],s=n[a++];let c,l,u=n[a++];-1===u&&(u=void 0);1===n[a++]&&(c=BoundingSphere.unpack(n,a)),a+=BoundingSphere.packedLength;let d,h,p;1===n[a++]&&(l=BoundingSphere.unpack(n,a)),a+=BoundingSphere.packedLength;const f=new GeometryAttributes,m=n[a++];for(i=0;i<m;i++){const e=t[n[a++]],i=n[a++];p=n[a++];const r=0!==n[a++];d=n[a++],h=ComponentDatatype$1.createTypedArray(i,d);for(let e=0;e<d;e++)h[e]=n[a++];f[e]=new GeometryAttribute({componentDatatype:i,componentsPerAttribute:p,normalize:r,values:h})}let g;if(d=n[a++],d>0){const e=h.length/p;for(g=IndexDatatype$1.createTypedArray(e,d),i=0;i<d;i++)g[i]=n[a++]}r[o++]=new Geometry({primitiveType:e,geometryType:s,boundingSphere:c,boundingSphereCV:l,indices:g,attributes:f,offsetAttribute:u})}return r},PrimitivePipeline.packCombineGeometryParameters=function(e,t){const n=e.createGeometryResults,i=n.length;for(let e=0;e<i;e++)t.push(n[e].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:packInstancesForCombine(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof GeographicProjection,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},PrimitivePipeline.unpackCombineGeometryParameters=function(e){const t=unpackInstancesForCombine(e.packedInstances),n=e.createGeometryResults,i=n.length;let r=0;for(let e=0;e<i;e++){const i=PrimitivePipeline.unpackCreateGeometryResults(n[e]),o=i.length;for(let e=0;e<o;e++){const n=i[e];t[r].geometry=n,++r}}const o=Ellipsoid.clone(e.ellipsoid);return{instances:t,ellipsoid:o,projection:e.isGeographic?new GeographicProjection(o):new WebMercatorProjection(o),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:Matrix4.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},PrimitivePipeline.packCombineGeometryResults=function(e,t){defined(e.geometries)&&transferGeometries(e.geometries,t);const n=packBoundingSpheres(e.boundingSpheres),i=packBoundingSpheres(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:i}},PrimitivePipeline.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:unpackBoundingSpheres(e.boundingSpheres),boundingSpheresCV:unpackBoundingSpheres(e.boundingSpheresCV)}};const PrimitiveState={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6};var PrimitiveState$1=Object.freeze(PrimitiveState);const SceneMode={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3,getMorphTime:function(e){return e===SceneMode.SCENE3D?1:e!==SceneMode.MORPHING?0:void 0}};var SceneMode$1=Object.freeze(SceneMode);const ShadowMode={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3,NUMBER_OF_SHADOW_MODES:4,castShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.CAST_ONLY},receiveShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.RECEIVE_ONLY},fromCastReceive:function(e,t){return e&&t?ShadowMode.ENABLED:e?ShadowMode.CAST_ONLY:t?ShadowMode.RECEIVE_ONLY:ShadowMode.DISABLED}};var ShadowMode$1=Object.freeze(ShadowMode);function Primitive$3(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this._vertexCacheOptimize=defaultValue(e.vertexCacheOptimize,!1),this._interleave=defaultValue(e.interleave,!1),this._releaseGeometryInstances=defaultValue(e.releaseGeometryInstances,!0),this._allowPicking=defaultValue(e.allowPicking,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this._compressVertices=defaultValue(e.compressVertices,!0),this.cull=defaultValue(e.cull,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,this.shadows=defaultValue(e.shadows,ShadowMode$1.DISABLED),this._translucent=void 0,this._state=PrimitiveState$1.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._readyPromise=when.defer(),this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}function getCommonPerInstanceAttributeNames(e){const t=e.length,n=[],i=e[0].attributes;let r;for(r in i)if(i.hasOwnProperty(r)&&defined(i[r])){const o=i[r];let a=!0;for(let n=1;n<t;++n){const t=e[n].attributes[r];if(!defined(t)||o.componentDatatype!==t.componentDatatype||o.componentsPerAttribute!==t.componentsPerAttribute||o.normalize!==t.normalize){a=!1;break}}a&&n.push(r)}return n}Object.defineProperties(Primitive$3.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}});const scratchGetAttributeCartesian2=new Cartesian2,scratchGetAttributeCartesian3=new Cartesian3,scratchGetAttributeCartesian4=new Cartesian4;function getAttributeValue(e){const t=e.length;return 1===t?e[0]:2===t?Cartesian2.unpack(e,0,scratchGetAttributeCartesian2):3===t?Cartesian3.unpack(e,0,scratchGetAttributeCartesian3):4===t?Cartesian4.unpack(e,0,scratchGetAttributeCartesian4):void 0}function createBatchTable$1(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],r=i.length;if(0===r)return;const o=getCommonPerInstanceAttributeNames(i),a=o.length,s=[],c={},l={};let u;let d,h,p,f=i[0].attributes;for(d=0;d<a;++d)h=o[d],p=f[h],c[h]=d,s.push({functionName:"czm_batchTable_"+h,componentDatatype:p.componentDatatype,componentsPerAttribute:p.componentsPerAttribute,normalize:p.normalize});-1!==o.indexOf("distanceDisplayCondition")&&(s.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1}),l.center3DHigh=s.length-5,l.center3DLow=s.length-4,l.center2DHigh=s.length-3,l.center2DLow=s.length-2,l.radius=s.length-1),-1!==o.indexOf("offset")&&(s.push({functionName:"czm_batchTable_offset2D",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3}),u=s.length-1),s.push({functionName:"czm_batchTable_pickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const m=s.length,g=new BatchTable(t,s,r);for(d=0;d<r;++d){const n=i[d];f=n.attributes;for(let e=0;e<a;++e){h=o[e],p=f[h];const t=getAttributeValue(p.value),n=c[h];g.setBatchedAttribute(d,n,t)}const r={primitive:defaultValue(n.pickPrimitive,e)};defined(n.id)&&(r.id=n.id);const s=t.createPickId(r);e._pickIds.push(s);const l=s.color,u=scratchGetAttributeCartesian4;u.x=Color.floatToByte(l.red),u.y=Color.floatToByte(l.green),u.z=Color.floatToByte(l.blue),u.w=Color.floatToByte(l.alpha),g.setBatchedAttribute(d,m-1,u)}e._batchTable=g,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=l,e._batchTableOffsetAttribute2DIndex=u}function cloneAttribute(e){let t;return t=Array.isArray(e.values)?e.values.slice(0):new e.values.constructor(e.values),new GeometryAttribute({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function cloneGeometry(e){const t=e.attributes,n=new GeometryAttributes;for(const e in t)t.hasOwnProperty(e)&&defined(t[e])&&(n[e]=cloneAttribute(t[e]));let i;if(defined(e.indices)){const t=e.indices;i=Array.isArray(t)?t.slice(0):new t.constructor(t)}return new Geometry({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:BoundingSphere.clone(e.boundingSphere)})}function cloneInstance(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:Matrix4.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const positionRegex=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;function appendPickToVertexShader(e){return ShaderSource.replaceMain(e,"czm_non_pick_main")+"\nvarying vec4 v_pickColor; \nvoid main() \n{ \n czm_non_pick_main(); \n v_pickColor = czm_batchTable_pickColor(batchId); \n}"}function appendPickToFragmentShader(e){return"varying vec4 v_pickColor;\n"+e}function modifyForEncodedNormals$1(e,t){if(!e.compressVertices)return t;const n=-1!==t.search(/attribute\s+vec3\s+normal;/g),i=-1!==t.search(/attribute\s+vec2\s+st;/g);if(!n&&!i)return t;const r=-1!==t.search(/attribute\s+vec3\s+tangent;/g),o=-1!==t.search(/attribute\s+vec3\s+bitangent;/g);let a=i&&n?2:1;a+=r||o?1:0;const s="compressedAttributes",c="attribute "+(a>1?"vec"+a:"float")+" "+s+";";let l="",u="";if(i){l+="vec2 st;\n";u+=" st = czm_decompressTextureCoordinates("+(a>1?s+".x":s)+");\n"}n&&r&&o?(l+="vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n",u+=" czm_octDecode("+s+"."+(i?"yz":"xy")+", normal, tangent, bitangent);\n"):(n&&(l+="vec3 normal;\n",u+=" normal = czm_octDecode("+s+(a>1?"."+(i?"y":"x"):"")+");\n"),r&&(l+="vec3 tangent;\n",u+=" tangent = czm_octDecode("+s+"."+(i&&n?"z":"y")+");\n"),o&&(l+="vec3 bitangent;\n",u+=" bitangent = czm_octDecode("+s+"."+(i&&n?"z":"y")+");\n"));let d=t;d=d.replace(/attribute\s+vec3\s+normal;/g,""),d=d.replace(/attribute\s+vec2\s+st;/g,""),d=d.replace(/attribute\s+vec3\s+tangent;/g,""),d=d.replace(/attribute\s+vec3\s+bitangent;/g,""),d=ShaderSource.replaceMain(d,"czm_non_compressed_main");return[c,l,d,"void main() \n{ \n"+u+" czm_non_compressed_main(); \n}"].join("\n")}function depthClampVS(e){let t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n gl_Position = czm_depthClamp(gl_Position);}\n",t}function depthClampFS(e){let t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n#if defined(GL_EXT_frag_depth)\n #if defined(LOG_DEPTH)\n czm_writeLogDepth();\n #else\n czm_writeDepthClamp();\n #endif\n#endif\n}\n",t="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n"+t,t}function validateShaderMatching(e,t){e.vertexAttributes}function getUniformFunction(e,t){return function(){return e[t]}}Primitive$3._modifyShaderPosition=function(e,t,n){let i,r="",o="",a="";for(;null!==(i=positionRegex.exec(t));){const s=i[1],c="vec4 czm_compute"+s[0].toUpperCase()+s.substr(1)+"()";"vec4 czm_computePosition()"!==c&&(r+=c+";\n"),defined(e.rtcCenter)?(r+="uniform mat4 u_modifiedModelView;\n",o+="attribute vec4 position;\n",a+=c+"\n{\n return u_modifiedModelView * position;\n}\n\n",t=(t=(t=(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,"")).replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,"")).replace(/czm_modelViewRelativeToEye\s+\*\s+/g,"")).replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?a+=c+"\n{\n return czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n}\n\n":(o+="attribute vec3 "+s+"2DHigh;\nattribute vec3 "+s+"2DLow;\n",a+=c+"\n{\n vec4 p;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy),\n czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow),\n czm_morphTime);\n }\n return p;\n}\n\n")}return[r,o,t,a].join("\n")},Primitive$3._appendShowToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.show))return t;return ShaderSource.replaceMain(t,"czm_non_show_main")+"\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= czm_batchTable_show(batchId); \n}"},Primitive$3._updateColorAttribute=function(e,t,n){if(!defined(e._batchTableAttributeIndices.color)&&!defined(e._batchTableAttributeIndices.depthFailColor))return t;if(-1===t.search(/attribute\s+vec4\s+color;/g))return t;let i=t;return i=i.replace(/attribute\s+vec4\s+color;/g,""),i=n?i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i},Primitive$3._updatePickColorAttribute=function(e){let t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t},Primitive$3._appendOffsetToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.offset))return t;let n="attribute float batchId;\n";n+="attribute float applyOffset;";let i=t.replace(/attribute\s+float\s+batchId;/g,"attribute float batchId;\nattribute float applyOffset;"),r="vec4 $1 = czm_computePosition();\n";return r+=" if (czm_sceneMode == czm_sceneMode3D)\n",r+=" {\n",r+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",r+=" }\n",r+=" else\n",r+=" {\n",r+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",r+=" }\n",i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,"vec4 $1 = czm_computePosition();\n if (czm_sceneMode == czm_sceneMode3D)\n {\n $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0); }\n else\n {\n $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0); }\n"),i},Primitive$3._appendDistanceDisplayConditionToShader=function(e,t,n){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i="void main() \n{ \n czm_non_distanceDisplayCondition_main(); \n vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);\n vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);\n vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);\n float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);\n";return i+=n?" vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n":" vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);\n vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);\n vec4 centerRTE;\n if (czm_morphTime == 1.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);\n }\n else\n {\n centerRTE = czm_columbusViewMorph(\n czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),\n czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),\n czm_morphTime);\n }\n",i+=" float radiusSq = boundingSphereRadius * boundingSphereRadius; \n float distanceSq; \n if (czm_sceneMode == czm_sceneMode2D) \n { \n distanceSq = czm_eyeHeight2D.y - radiusSq; \n } \n else \n { \n distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; \n } \n distanceSq = max(distanceSq, 0.0); \n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; \n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; \n float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; \n gl_Position *= show; \n}",ShaderSource.replaceMain(t,"czm_non_distanceDisplayCondition_main")+"\n"+i};const numberOfCreationWorkers=Math.max(FeatureDetection.hardwareConcurrency-1,1);let createGeometryTaskProcessors;const combineGeometryTaskProcessor=new TaskProcessor("combineGeometry");function loadAsynchronous(e,t){let n,i,r,o;const a=e._instanceIds;if(e._state===PrimitiveState$1.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const s=e._numberOfInstances=n.length,c=[];let l,u=[];for(r=0;r<s;++r)i=n[r].geometry,a.push(n[r].id),u.push({moduleName:i._workerName,geometry:i});if(!defined(createGeometryTaskProcessors))for(createGeometryTaskProcessors=new Array(numberOfCreationWorkers),r=0;r<numberOfCreationWorkers;r++)createGeometryTaskProcessors[r]=new TaskProcessor("createGeometry");for(u=subdivideArray(u,numberOfCreationWorkers),r=0;r<u.length;r++){let e=0;const t=u[r],n=t.length;for(o=0;o<n;++o)l=t[o],i=l.geometry,defined(i.constructor.pack)&&(l.offset=e,e+=defaultValue(i.constructor.packedLength,i.packedLength));let a;if(e>0){const r=new Float64Array(e);for(a=[r.buffer],o=0;o<n;++o)l=t[o],i=l.geometry,defined(i.constructor.pack)&&(i.constructor.pack(i,r,l.offset),l.geometry=r)}c.push(createGeometryTaskProcessors[r].scheduleTask({subTasks:u[r]},a))}e._state=PrimitiveState$1.CREATING,when.all(c,(function(t){e._createGeometryResults=t,e._state=PrimitiveState$1.CREATED})).otherwise((function(n){setReady(e,t,PrimitiveState$1.FAILED,n)}))}else if(e._state===PrimitiveState$1.CREATED){const i=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const r=t.scene3DOnly,o=t.mapProjection,a=combineGeometryTaskProcessor.scheduleTask(PrimitivePipeline.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:o.ellipsoid,projection:o,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:r,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},i),i);e._createGeometryResults=void 0,e._state=PrimitiveState$1.COMBINING,when(a,(function(n){const i=PrimitivePipeline.unpackCombineGeometryResults(n);e._geometries=i.geometries,e._attributeLocations=i.attributeLocations,e.modelMatrix=Matrix4.clone(i.modelMatrix,e.modelMatrix),e._pickOffsets=i.pickOffsets,e._offsetInstanceExtend=i.offsetInstanceExtend,e._instanceBoundingSpheres=i.boundingSpheres,e._instanceBoundingSpheresCV=i.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)})).otherwise((function(n){setReady(e,t,PrimitiveState$1.FAILED,n)}))}}function loadSynchronous(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,r=new Array(i),o=e._instanceIds;let a,s,c=0;for(s=0;s<i;s++){a=n[s];const e=a.geometry;let t;t=defined(e.attributes)&&defined(e.primitiveType)?cloneGeometry(e):e.constructor.createGeometry(e),r[c++]=cloneInstance(a,t),o.push(a.id)}r.length=c;const l=t.scene3DOnly,u=t.mapProjection,d=PrimitivePipeline.combineGeometry({instances:r,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=d.geometries,e._attributeLocations=d.attributeLocations,e.modelMatrix=Matrix4.clone(d.modelMatrix,e.modelMatrix),e._pickOffsets=d.pickOffsets,e._offsetInstanceExtend=d.offsetInstanceExtend,e._instanceBoundingSpheres=d.boundingSpheres,e._instanceBoundingSpheresCV=d.boundingSpheresCV,defined(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)}function recomputeBoundingSpheres(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!defined(n))return void(e._recomputeBoundingSpheres=!1);let i;const r=e._offsetInstanceExtend,o=e._instanceBoundingSpheres,a=o.length;let s=e._tempBoundingSpheres;if(!defined(s)){for(s=new Array(a),i=0;i<a;i++)s[i]=new BoundingSphere;e._tempBoundingSpheres=s}for(i=0;i<a;++i){let t=s[i];const a=e._batchTable.getBatchedAttribute(i,n,new Cartesian3);t=o[i].clone(t),transformBoundingSphere(t,a,r[i])}const c=[],l=[],u=[];for(i=0;i<a;++i){const e=s[i];e.center.x-e.radius>0||BoundingSphere.intersectPlane(e,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING?c.push(e):(l.push(e),u.push(e))}let d=c[0],h=u[0],p=l[0];for(i=1;i<c.length;i++)d=BoundingSphere.union(d,c[i]);for(i=1;i<u.length;i++)h=BoundingSphere.union(h,u[i]);for(i=1;i<l.length;i++)p=BoundingSphere.union(p,l[i]);const f=[];for(defined(d)&&f.push(d),defined(h)&&f.push(h),defined(p)&&f.push(p),i=0;i<f.length;i++){const n=f[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=n,e._boundingSphereCV[i]=BoundingSphere.projectTo2D(n,t.mapProjection,e._boundingSphereCV[i])}Primitive$3._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const scratchBoundingSphereCenterEncoded=new EncodedCartesian3,scratchBoundingSphereCartographic=new Cartographic,scratchBoundingSphereCenter2D=new Cartesian3,scratchBoundingSphere$2=new BoundingSphere;function updateBatchTableBoundingSpheres(e,t){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const n=e._batchTableBoundingSphereAttributeIndices,i=n.center3DHigh,r=n.center3DLow,o=n.center2DHigh,a=n.center2DLow,s=n.radius,c=t.mapProjection,l=c.ellipsoid,u=e._batchTable,d=e._instanceBoundingSpheres,h=d.length;for(let n=0;n<h;++n){let h=d[n];if(!defined(h))continue;const p=e.modelMatrix;defined(p)&&(h=BoundingSphere.transform(h,p,scratchBoundingSphere$2));const f=h.center,m=h.radius;let g=EncodedCartesian3.fromCartesian(f,scratchBoundingSphereCenterEncoded);if(u.setBatchedAttribute(n,i,g.high),u.setBatchedAttribute(n,r,g.low),!t.scene3DOnly){const e=l.cartesianToCartographic(f,scratchBoundingSphereCartographic),t=c.project(e,scratchBoundingSphereCenter2D);g=EncodedCartesian3.fromCartesian(t,scratchBoundingSphereCenterEncoded),u.setBatchedAttribute(n,o,g.high),u.setBatchedAttribute(n,a,g.low)}u.setBatchedAttribute(n,s,m)}e._batchTableBoundingSpheresUpdated=!0}const offsetScratchCartesian=new Cartesian3,offsetCenterScratch=new Cartesian3;function updateBatchTableOffsets(e,t){if(!defined(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const n=e._batchTableOffsetAttribute2DIndex,i=t.mapProjection,r=i.ellipsoid,o=e._batchTable,a=e._instanceBoundingSpheres,s=a.length;for(let t=0;t<s;++t){let s=a[t];if(!defined(s))continue;const c=o.getBatchedAttribute(t,e._batchTableAttributeIndices.offset);if(Cartesian3.equals(c,Cartesian3.ZERO)){o.setBatchedAttribute(t,n,Cartesian3.ZERO);continue}const l=e.modelMatrix;defined(l)&&(s=BoundingSphere.transform(s,l,scratchBoundingSphere$2));let u=s.center;u=r.scaleToGeodeticSurface(u,offsetCenterScratch);let d=r.cartesianToCartographic(u,scratchBoundingSphereCartographic);const h=i.project(d,scratchBoundingSphereCenter2D),p=Cartesian3.add(c,u,offsetScratchCartesian);d=r.cartesianToCartographic(p,d);const f=i.project(d,offsetScratchCartesian),m=Cartesian3.subtract(f,h,offsetScratchCartesian),g=m.x;m.x=m.z,m.z=m.y,m.y=g,o.setBatchedAttribute(t,n,m)}e._batchTableOffsetsUpdated=!0}function createVertexArray$6(e,t){const n=e._attributeLocations,i=e._geometries,r=t.scene3DOnly,o=t.context,a=[],s=i.length;for(let c=0;c<s;++c){const s=i[c];if(a.push(VertexArray.fromGeometry({context:o,geometry:s,attributeLocations:n,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:e._interleave})),defined(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,s);else if(e._boundingSpheres.push(BoundingSphere.clone(s.boundingSphere)),e._boundingSphereWC.push(new BoundingSphere),!r){const t=s.boundingSphereCV.center,n=t.x,i=t.y,r=t.z;t.x=r,t.y=n,t.z=i,e._boundingSphereCV.push(BoundingSphere.clone(s.boundingSphereCV)),e._boundingSphere2D.push(new BoundingSphere),e._boundingSphereMorph.push(new BoundingSphere)}}e._va=a,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,setReady(e,t,PrimitiveState$1.COMPLETE,void 0)}function createRenderStates$6(e,t,n,i){let r,o=n.getRenderState();i?(r=clone$1(o,!1),r.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceRS=RenderState.fromCache(r),r.cull.face=CullFace$1.FRONT,e._backFaceRS=RenderState.fromCache(r)):(e._frontFaceRS=RenderState.fromCache(o),e._backFaceRS=e._frontFaceRS),r=clone$1(o,!1),defined(e._depthFailAppearance)&&(r.depthTest.enabled=!1),defined(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=clone$1(o,!1),r.depthTest.func=DepthFunction$1.GREATER,i?(r.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceDepthFailRS=RenderState.fromCache(r),r.cull.face=CullFace$1.FRONT,e._backFaceDepthFailRS=RenderState.fromCache(r)):(e._frontFaceDepthFailRS=RenderState.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function createShaderProgram$3(e,t,n){const i=t.context,r=e._attributeLocations;let o=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);o=Primitive$3._appendOffsetToShader(e,o),o=Primitive$3._appendShowToShader(e,o),o=Primitive$3._appendDistanceDisplayConditionToShader(e,o,t.scene3DOnly),o=appendPickToVertexShader(o),o=Primitive$3._updateColorAttribute(e,o,!1),o=modifyForEncodedNormals$1(e,o),o=Primitive$3._modifyShaderPosition(e,o,t.scene3DOnly);let a=n.getFragmentShaderSource();a=appendPickToFragmentShader(a),e._sp=ShaderProgram.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:r}),validateShaderMatching(e._sp),defined(e._depthFailAppearance)&&(o=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),o=Primitive$3._appendShowToShader(e,o),o=Primitive$3._appendDistanceDisplayConditionToShader(e,o,t.scene3DOnly),o=appendPickToVertexShader(o),o=Primitive$3._updateColorAttribute(e,o,!0),o=modifyForEncodedNormals$1(e,o),o=Primitive$3._modifyShaderPosition(e,o,t.scene3DOnly),o=depthClampVS(o),a=e._depthFailAppearance.getFragmentShaderSource(),a=appendPickToFragmentShader(a),a=depthClampFS(a),e._spDepthFail=ShaderProgram.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:r}),validateShaderMatching(e._spDepthFail))}const modifiedModelViewScratch$4=new Matrix4,rtcScratch$4=new Cartesian3;function getUniforms(e,t,n,i){const r=defined(n)?n._uniforms:void 0,o={},a=t.uniforms;if(defined(a))for(const e in a)a.hasOwnProperty(e)&&(o[e]=getUniformFunction(a,e));let s=combine$2(o,r);return s=e._batchTable.getUniformMapCallback()(s),defined(e.rtcCenter)&&(s.u_modifiedModelView=function(){const t=i.context.uniformState.view;return Matrix4.multiply(t,e._modelMatrix,modifiedModelViewScratch$4),Matrix4.multiplyByPoint(modifiedModelViewScratch$4,e.rtcCenter,rtcScratch$4),Matrix4.setTranslation(modifiedModelViewScratch$4,rtcScratch$4,modifiedModelViewScratch$4),modifiedModelViewScratch$4}),s}function createCommands$5(e,t,n,i,r,o,a,s){const c=getUniforms(e,t,n,s);let l;defined(e._depthFailAppearance)&&(l=getUniforms(e,e._depthFailAppearance,e._depthFailAppearance.material,s));const u=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE;let d=r?2:1;d*=defined(e._depthFailAppearance)?2:1,o.length=e._va.length*d;const h=o.length;let p=0;for(let t=0;t<h;++t){let n;r&&(n=o[t],defined(n)||(n=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),n.vertexArray=e._va[p],n.renderState=e._backFaceRS,n.shaderProgram=e._sp,n.uniformMap=c,n.pass=u,++t),n=o[t],defined(n)||(n=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),n.vertexArray=e._va[p],n.renderState=e._frontFaceRS,n.shaderProgram=e._sp,n.uniformMap=c,n.pass=u,defined(e._depthFailAppearance)&&(r&&(++t,n=o[t],defined(n)||(n=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),n.vertexArray=e._va[p],n.renderState=e._backFaceDepthFailRS,n.shaderProgram=e._spDepthFail,n.uniformMap=l,n.pass=u),++t,n=o[t],defined(n)||(n=o[t]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),n.vertexArray=e._va[p],n.renderState=e._frontFaceDepthFailRS,n.shaderProgram=e._spDepthFail,n.uniformMap=l,n.pass=u),++p}}function updateAndQueueCommands$3(e,t,n,i,r,o,a,s){let c;Primitive$3._updateBoundingVolumes(e,t,r),t.mode===SceneMode$1.SCENE3D?c=e._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(e._boundingSphere2D)?c=e._boundingSphere2D:defined(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);const l=t.commandList,u=t.passes;if(u.render||u.pick){const t=e.allowPicking,i=ShadowMode$1.castShadows(e.shadows),u=ShadowMode$1.receiveShadows(e.shadows),d=n.length;let h=s?2:1;h*=defined(e._depthFailAppearance)?2:1;for(let e=0;e<d;++e){const s=Math.floor(e/h),d=n[e];d.modelMatrix=r,d.boundingVolume=c[s],d.cull=o,d.debugShowBoundingVolume=a,d.castShadows=i,d.receiveShadows=u,d.pickId=t?"v_pickColor":void 0,l.push(d)}}}Primitive$3._updateBoundingVolumes=function(e,t,n,i){let r,o,a;if(i||!Matrix4.equals(n,e._modelMatrix))for(Matrix4.clone(n,e._modelMatrix),o=e._boundingSpheres.length,r=0;r<o;++r)a=e._boundingSpheres[r],defined(a)&&(e._boundingSphereWC[r]=BoundingSphere.transform(a,n,e._boundingSphereWC[r]),t.scene3DOnly||(e._boundingSphere2D[r]=BoundingSphere.clone(e._boundingSphereCV[r],e._boundingSphere2D[r]),e._boundingSphere2D[r].center.x=0,e._boundingSphereMorph[r]=BoundingSphere.union(e._boundingSphereWC[r],e._boundingSphereCV[r])));const s=e.appearance.pixelSize;if(defined(s))for(o=e._boundingSpheres.length,r=0;r<o;++r){a=e._boundingSpheres[r];const n=e._boundingSphereWC[r],i=t.camera.getPixelSize(a,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*s;n.radius=a.radius+i}},Primitive$3.prototype.update=function(e){if(!defined(this.geometryInstances)&&0===this._va.length||defined(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&0===this.geometryInstances.length||!defined(this.appearance)||e.mode!==SceneMode$1.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(defined(this._error))throw this._error;if(this._state===PrimitiveState$1.FAILED)return;const t=e.context;if(defined(this._batchTable)||createBatchTable$1(this,t),this._batchTable.attributes.length>0){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==PrimitiveState$1.COMPLETE&&this._state!==PrimitiveState$1.COMBINED&&(this.asynchronous?loadAsynchronous(this,e):loadSynchronous(this,e)),this._state===PrimitiveState$1.COMBINED&&(updateBatchTableBoundingSpheres(this,e),updateBatchTableOffsets(this,e),createVertexArray$6(this,e)),!this.show||this._state!==PrimitiveState$1.COMPLETE)return;this._batchTableOffsetsUpdated||updateBatchTableOffsets(this,e),this._recomputeBoundingSpheres&&recomputeBoundingSpheres(this,e);const n=this.appearance,i=n.material;let r=!1,o=!1;this._appearance!==n?(this._appearance=n,this._material=i,r=!0,o=!0):this._material!==i&&(this._material=i,o=!0);const a=this.depthFailAppearance,s=defined(a)?a.material:void 0;this._depthFailAppearance!==a?(this._depthFailAppearance=a,this._depthFailMaterial=s,r=!0,o=!0):this._depthFailMaterial!==s&&(this._depthFailMaterial=s,o=!0);const c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,r=!0),defined(this._material)&&this._material.update(t);const l=n.closed&&c;if(r){defaultValue(this._createRenderStatesFunction,createRenderStates$6)(this,t,n,l)}if(o){defaultValue(this._createShaderProgramFunction,createShaderProgram$3)(this,e,n)}if(r||o){defaultValue(this._createCommandsFunction,createCommands$5)(this,n,i,c,l,this._colorCommands,this._pickCommands,e)}defaultValue(this._updateAndQueueCommandsFunction,updateAndQueueCommands$3)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,l)};const offsetBoundingSphereScratch1=new BoundingSphere,offsetBoundingSphereScratch2=new BoundingSphere;function transformBoundingSphere(e,t,n){if(n===GeometryOffsetAttribute$1.TOP){const n=BoundingSphere.clone(e,offsetBoundingSphereScratch1),i=BoundingSphere.clone(e,offsetBoundingSphereScratch2);i.center=Cartesian3.add(i.center,t,i.center),e=BoundingSphere.union(n,i,e)}else n===GeometryOffsetAttribute$1.ALL&&(e.center=Cartesian3.add(e.center,t,e.center));return e}function createGetFunction(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),r=e.attributes[n],o=r.componentsPerAttribute,a=ComponentDatatype$1.createTypedArray(r.componentDatatype,o);return defined(i.constructor.pack)?i.constructor.pack(i,a,0):a[0]=i,a}}function createSetFunction(e,t,n,i,r){return function(o){const a=getAttributeValue(o);e.setBatchedAttribute(t,n,a),"offset"===r&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const offsetScratch$a=new Cartesian3;function createBoundingSphereProperties(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(defined(i)){i=i.clone();const r=e.modelMatrix,o=t.offset;defined(o)&&transformBoundingSphere(i,Cartesian3.fromArray(o.get(),0,offsetScratch$a),e._offsetInstanceExtend[n]),defined(r)&&(i=BoundingSphere.transform(i,r))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function createPickIdProperty(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}function setReady(e,t,n,i){e._error=i,e._state=n,t.afterRender.push((function(){e._ready=e._state===PrimitiveState$1.COMPLETE||e._state===PrimitiveState$1.FAILED,defined(i)?e._readyPromise.reject(i):e._readyPromise.resolve(e)}))}Primitive$3.prototype.getGeometryInstanceAttributes=function(e){let t=-1;const n=this._lastPerInstanceAttributeIndex,i=this._instanceIds,r=i.length;for(let o=0;o<r;++o){const a=(n+o)%r;if(e===i[a]){t=a;break}}if(-1===t)return;let o=this._perInstanceAttributeCache[t];if(defined(o))return o;const a=this._batchTable,s=this._batchTableAttributeIndices;o={};const c={};for(const e in s)if(s.hasOwnProperty(e)){const n=s[e];c[e]={get:createGetFunction(a,t,n),set:createSetFunction(a,t,n,this,e)}}return createBoundingSphereProperties(this,c,t),createPickIdProperty(this,c,t),Object.defineProperties(o,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=o,o},Primitive$3.prototype.isDestroyed=function(){return!1},Primitive$3.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;const i=this._pickIds;for(e=i.length,t=0;t<e;++t)i[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,destroyObject(this)};var ShadowVolumeAppearanceFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\nreturn eyeCoordinate.xyz / eyeCoordinate.w;\n}\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {\nvec2 glFragCoordXY = gl_FragCoord.xy;\nfloat upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\nfloat downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\nbvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\nfloat useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\nfloat useDownOrLeft = float(useUpOrRight == 0.0);\nvec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\nvec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\nreturn (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\nvoid main(void)\n{\n#ifdef REQUIRES_EC\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n#ifdef REQUIRES_WC\nvec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\nvec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n#ifdef TEXTURE_COORDINATES\nvec2 uv;\n#ifdef SPHERICAL\nvec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\nsphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\nsphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\nuv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\nuv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\nuv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\nuv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\nif (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {\ngl_FragColor.a = 1.0;\nczm_writeDepthClamp();\n}\n#else // CULL_FRAGMENTS\ngl_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n#ifdef CULL_FRAGMENTS\nif (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {\ndiscard;\n}\n#endif\n#ifdef NORMAL_EC\nvec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\nvec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\nvec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n#ifdef PER_INSTANCE_COLOR\nvec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\ngl_FragColor = color;\n#else // FLAT\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#else // PER_INSTANCE_COLOR\nczm_materialInput materialInput;\n#ifdef USES_NORMAL_EC\nmaterialInput.normalEC = normalEC;\n#endif\n#ifdef USES_POSITION_TO_EYE_EC\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n#ifdef USES_TANGENT_TO_EYE\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n#ifdef USES_ST\nmaterialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\nmaterialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\ngl_FragColor.rgb *= gl_FragColor.a;\n#endif // PER_INSTANCE_COLOR\nczm_writeDepthClamp();\n#endif // PICK\n}\n";function ShadowVolumeAppearance(e,t,n){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new ShaderDependencies;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const r=new ShaderDependencies;if(r.requiresTextureCoordinates=e,n instanceof PerInstanceColorAppearance)i.requiresNormalEC=!n.flat;else{const e=n.material.shaderSource+"\n"+n.fragmentShaderSource;i.normalEC=-1!==e.indexOf("materialInput.normalEC")||-1!==e.indexOf("czm_getDefaultMaterial"),i.positionToEyeEC=-1!==e.indexOf("materialInput.positionToEyeEC"),i.tangentToEyeMatrix=-1!==e.indexOf("materialInput.tangentToEyeMatrix"),i.st=-1!==e.indexOf("materialInput.st")}this._colorShaderDependencies=i,this._pickShaderDependencies=r,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}ShadowVolumeAppearance.prototype.createFragmentShader=function(e){const t=this._appearance,n=this._colorShaderDependencies,i=[];e||this._planarExtents||i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof PerInstanceColorAppearance&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let r="";return t instanceof PerInstanceColorAppearance||(r=t.material.shaderSource),new ShaderSource({defines:i,sources:[r,ShadowVolumeAppearanceFS]})},ShadowVolumeAppearance.prototype.createPickFragmentShader=function(e){const t=this._pickShaderDependencies,n=["PICK"];return e||this._planarExtents||n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new ShaderSource({defines:n,sources:[ShadowVolumeAppearanceFS],pickColorQualifier:"varying"})},ShadowVolumeAppearance.prototype.createVertexShader=function(e,t,n,i){return createShadowVolumeAppearanceVS(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)},ShadowVolumeAppearance.prototype.createPickVertexShader=function(e,t,n,i){return createShadowVolumeAppearanceVS(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const longitudeExtentsCartesianScratch=new Cartesian3,longitudeExtentsCartographicScratch=new Cartographic,longitudeExtentsEncodeScratch={high:0,low:0};function createShadowVolumeAppearanceVS(e,t,n,i,r,o,a,s){const c=i.slice();if(""===s.eastMostYhighDefine){const e=longitudeExtentsCartographicScratch;e.longitude=CesiumMath.PI,e.latitude=0,e.height=0;const t=a.project(e,longitudeExtentsCartesianScratch);let n=EncodedCartesian3.encode(t.x,longitudeExtentsEncodeScratch);s.eastMostYhighDefine="EAST_MOST_X_HIGH "+n.high.toFixed((n.high+"").length+1),s.eastMostYlowDefine="EAST_MOST_X_LOW "+n.low.toFixed((n.low+"").length+1);const i=longitudeExtentsCartographicScratch;i.longitude=-CesiumMath.PI,i.latitude=0,i.height=0;const r=a.project(i,longitudeExtentsCartesianScratch);n=EncodedCartesian3.encode(r.x,longitudeExtentsEncodeScratch),s.westMostYhighDefine="WEST_MOST_X_HIGH "+n.high.toFixed((n.high+"").length+1),s.westMostYlowDefine="WEST_MOST_X_LOW "+n.low.toFixed((n.low+"").length+1)}return n&&(c.push(s.eastMostYhighDefine),c.push(s.eastMostYlowDefine),c.push(s.westMostYhighDefine),c.push(s.westMostYlowDefine)),defined(o)&&o instanceof PerInstanceColorAppearance&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new ShaderSource({defines:c,sources:[r]})}function ShaderDependencies(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}function pointLineDistance(e,t,n){return Math.abs((t.y-e.y)*n.x-(t.x-e.x)*n.y+t.x*e.y-t.y*e.x)/Cartesian2.distance(t,e)}Object.defineProperties(ShaderDependencies.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});const points2DScratch=[new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2];function addTextureCoordinateRotationAttributes(e,t){const n=points2DScratch,i=Cartesian2.unpack(t,0,n[0]),r=Cartesian2.unpack(t,2,n[1]),o=Cartesian2.unpack(t,4,n[2]);e.uMaxVmax=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r.x,r.y,o.x,o.y]});const a=1/pointLineDistance(i,r,o),s=1/pointLineDistance(i,o,r);e.uvMinAndExtents=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,a,s]})}const cartographicScratch$3=new Cartographic,cornerScratch=new Cartesian3,northWestScratch=new Cartesian3,southEastScratch=new Cartesian3,highLowScratch={high:0,low:0};function add2DTextureCoordinateAttributes(e,t,n){const i=cartographicScratch$3;i.height=0,i.longitude=e.west,i.latitude=e.south;const r=t.project(i,cornerScratch);i.latitude=e.north;const o=t.project(i,northWestScratch);i.longitude=e.east,i.latitude=e.south;const a=t.project(i,southEastScratch),s=[0,0,0,0],c=[0,0,0,0];let l=EncodedCartesian3.encode(r.x,highLowScratch);s[0]=l.high,c[0]=l.low,l=EncodedCartesian3.encode(r.y,highLowScratch),s[1]=l.high,c[1]=l.low,l=EncodedCartesian3.encode(o.y,highLowScratch),s[2]=l.high,c[2]=l.low,l=EncodedCartesian3.encode(a.x,highLowScratch),s[3]=l.high,c[3]=l.low,n.planes2D_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:s}),n.planes2D_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const enuMatrixScratch=new Matrix4,inverseEnuScratch=new Matrix4,rectanglePointCartesianScratch=new Cartesian3,rectangleCenterScratch$1=new Cartographic,pointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic];function computeRectangleBounds(e,t,n,i,r,o){const a=Rectangle.center(e,rectangleCenterScratch$1);a.height=n;const s=Cartographic.toCartesian(a,t,rectanglePointCartesianScratch),c=Transforms.eastNorthUpToFixedFrame(s,t,enuMatrixScratch),l=Matrix4.inverse(c,inverseEnuScratch),u=e.west,d=e.east,h=e.north,p=e.south,f=pointsCartographicScratch;f[0].latitude=p,f[0].longitude=u,f[1].latitude=h,f[1].longitude=u,f[2].latitude=h,f[2].longitude=d,f[3].latitude=p,f[3].longitude=d;const m=.5*(u+d),g=.5*(h+p);f[4].latitude=p,f[4].longitude=m,f[5].latitude=h,f[5].longitude=m,f[6].latitude=g,f[6].longitude=u,f[7].latitude=g,f[7].longitude=d;let _=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(let e=0;e<8;e++){f[e].height=n;const i=Cartographic.toCartesian(f[e],t,rectanglePointCartesianScratch);Matrix4.multiplyByPoint(l,i,i),i.z=0,_=Math.min(_,i.x),y=Math.max(y,i.x),C=Math.min(C,i.y),T=Math.max(T,i.y)}const S=i;S.x=_,S.y=C,S.z=0,Matrix4.multiplyByPoint(c,S,S);const A=r;A.x=y,A.y=C,A.z=0,Matrix4.multiplyByPoint(c,A,A),Cartesian3.subtract(A,S,r);const v=o;v.x=_,v.y=T,v.z=0,Matrix4.multiplyByPoint(c,v,v),Cartesian3.subtract(v,S,o)}const eastwardScratch=new Cartesian3,northwardScratch=new Cartesian3,encodeScratch=new EncodedCartesian3;ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes=function(e,t,n,i,r){const o=cornerScratch,a=eastwardScratch,s=northwardScratch;computeRectangleBounds(e,n,defaultValue(r,0),o,a,s);const c={};addTextureCoordinateRotationAttributes(c,t);const l=EncodedCartesian3.fromCartesian(o,encodeScratch);return c.southWest_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(l.high,[0,0,0])}),c.southWest_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(l.low,[0,0,0])}),c.eastward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(a,[0,0,0])}),c.northward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(s,[0,0,0])}),add2DTextureCoordinateAttributes(e,i,c),c};const spherePointScratch=new Cartesian3;function latLongToSpherical(e,t,n,i){const r=cartographicScratch$3;r.latitude=e,r.longitude=t,r.height=0;const o=Cartographic.toCartesian(r,n,spherePointScratch),a=Math.sqrt(o.x*o.x+o.y*o.y),s=CesiumMath.fastApproximateAtan2(a,o.z),c=CesiumMath.fastApproximateAtan2(o.x,o.y);return i.x=s,i.y=c,i}const sphericalScratch=new Cartesian2;function shouldUseSpherical(e){return Math.max(e.width,e.height)>ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS}ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){const r=latLongToSpherical(e.south,e.west,n,sphericalScratch);let o=r.x,a=r.y;const s=latLongToSpherical(e.north,e.east,n,sphericalScratch);let c=s.x,l=s.y,u=0;a>l&&(u=CesiumMath.PI-a,a=-CesiumMath.PI,l+=u),o-=CesiumMath.EPSILON5,a-=CesiumMath.EPSILON5,c+=CesiumMath.EPSILON5,l+=CesiumMath.EPSILON5;const d=1/(l-a),h=1/(c-o),p={sphericalExtents:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o,a,h,d]}),longitudeRotation:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,normalize:!1,value:[u]})};return addTextureCoordinateRotationAttributes(p,t),add2DTextureCoordinateAttributes(e,i,p),p},ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes=function(e){return defined(e.southWest_HIGH)&&defined(e.southWest_LOW)&&defined(e.northward)&&defined(e.eastward)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.hasAttributesForSphericalExtents=function(e){return defined(e.sphericalExtents)&&defined(e.longitudeRotation)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents)},ShadowVolumeAppearance.shouldUseSphericalCoordinates=function(e){return shouldUseSpherical(e)},ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS=CesiumMath.toRadians(1);const StencilFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS};var StencilFunction$1=Object.freeze(StencilFunction);const StencilOperation={ZERO:WebGLConstants$1.ZERO,KEEP:WebGLConstants$1.KEEP,REPLACE:WebGLConstants$1.REPLACE,INCREMENT:WebGLConstants$1.INCR,DECREMENT:WebGLConstants$1.DECR,INVERT:WebGLConstants$1.INVERT,INCREMENT_WRAP:WebGLConstants$1.INCR_WRAP,DECREMENT_WRAP:WebGLConstants$1.DECR_WRAP};var StencilOperation$1=Object.freeze(StencilOperation);const StencilConstants={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15,setCesium3DTileBit:function(){return{enabled:!0,frontFunction:StencilFunction$1.ALWAYS,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},backFunction:StencilFunction$1.ALWAYS,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},reference:StencilConstants.CESIUM_3D_TILE_MASK,mask:StencilConstants.CESIUM_3D_TILE_MASK}}};var StencilConstants$1=Object.freeze(StencilConstants);function ClassificationPrimitive(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometryInstances;this.geometryInstances=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=defaultValue(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}function getStencilDepthRenderState$1(e,t){const n=t?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:n,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}function getColorRenderState(e){return{stencilTest:{enabled:e,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND}}Object.defineProperties(ClassificationPrimitive.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}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}}),ClassificationPrimitive.isSupported=function(e){return e.context.stencilBuffer};const pickRenderState$1={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$5(e,t,n,i){if(defined(e._rsStencilDepthPass))return;const r=!e.debugShowShadowVolume;e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(r,!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(r,!0)),e._rsColorPass=RenderState.fromCache(getColorRenderState(r)),e._rsPickPass=RenderState.fromCache(pickRenderState$1)}function modifyForEncodedNormals(e,t){if(!e.compressVertices)return t;if(-1!==t.search(/attribute\s+vec3\s+extrudeDirection;/g)){const e="compressedAttributes",n="attribute vec2 "+e+";",i="vec3 extrudeDirection;\n",r=" extrudeDirection = czm_octDecode("+e+", 65535.0);\n";let o=t;o=o.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),o=ShaderSource.replaceMain(o,"czm_non_compressed_main");return[n,i,o,"void main() \n{ \n"+r+" czm_non_compressed_main(); \n}"].join("\n")}}function createShaderProgram$2(e,t){const n=t.context,i=e._primitive;let r=ShadowVolumeAppearanceVS;r=e._primitive._batchTable.getVertexShaderCallback()(r),r=Primitive$3._appendDistanceDisplayConditionToShader(i,r),r=Primitive$3._modifyShaderPosition(e,r,t.scene3DOnly),r=Primitive$3._updateColorAttribute(i,r);const o=e._hasPlanarExtentsAttributes,a=o||e._hasSphericalExtentsAttribute;e._extruded&&(r=modifyForEncodedNormals(i,r));const s=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new ShaderSource({defines:[s],sources:[r]});const l=new ShaderSource({sources:[ShadowVolumeFS]}),u=e._primitive._attributeLocations,d=new ShadowVolumeAppearance(a,o,e.appearance);if(e._spStencil=ShaderProgram.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u}),e._primitive.allowPicking){let o=ShaderSource.createPickVertexShaderSource(r);o=Primitive$3._appendShowToShader(i,o),o=Primitive$3._updatePickColorAttribute(o);const c=d.createPickFragmentShader(!1),l=d.createPickVertexShader([s],o,!1,t.mapProjection);if(e._spPick=ShaderProgram.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u}),a){let i=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!defined(i)){const r=d.createPickFragmentShader(!0),a=d.createPickVertexShader([s],o,!0,t.mapProjection);i=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:a,fragmentShaderSource:r,attributeLocations:u})}e._spPick2D=i}}else e._spPick=ShaderProgram.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});r=Primitive$3._appendShowToShader(i,r),c=new ShaderSource({defines:[s],sources:[r]}),e._sp=ShaderProgram.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});const h=d.createFragmentShader(!1),p=d.createVertexShader([s],r,!1,t.mapProjection);if(e._spColor=ShaderProgram.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:p,fragmentShaderSource:h,attributeLocations:u}),a){let i=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!defined(i)){const o=d.createFragmentShader(!0),a=d.createVertexShader([s],r,!0,t.mapProjection);i=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:u})}e._spColor2D=i}}function createColorCommands$1(e,t){const n=e._primitive;let i,r,o,a=2*n._va.length;t.length=a;let s=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap);const l=e._needs2DShader;for(i=0;i<a;i+=2){const a=n._va[s++];r=t[i],defined(r)||(r=t[i]=new DrawCommand({owner:e,primitiveType:n._primitiveType})),r.vertexArray=a,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Pass$1.TERRAIN_CLASSIFICATION,o=DrawCommand.shallowClone(r,r.derivedCommands.tileset),o.renderState=e._rsStencilDepthPass3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=o,r=t[i+1],defined(r)||(r=t[i+1]=new DrawCommand({owner:e,primitiveType:n._primitiveType})),r.vertexArray=a,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Pass$1.TERRAIN_CLASSIFICATION;const u=e.appearance.material;if(defined(u)&&(c=combine$2(c,u._uniforms)),r.uniformMap=c,o=DrawCommand.shallowClone(r,r.derivedCommands.tileset),o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=o,l){let t=DrawCommand.shallowClone(r,r.derivedCommands.appearance2D);t.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=t,t=DrawCommand.shallowClone(o,o.derivedCommands.appearance2D),t.shaderProgram=e._spColor2D,o.derivedCommands.appearance2D=t}}const u=e._commandsIgnoreShow,d=e._spStencil;let h=0;a=u.length=a/2;for(let e=0;e<a;++e){const n=u[e]=DrawCommand.shallowClone(t[h],u[e]);n.shaderProgram=d,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,h+=2}}function createPickCommands$1(e,t){const n=e._usePickOffsets,i=e._primitive;let r,o,a,s,c,l=2*i._va.length,u=0;n&&(r=i._pickOffsets,l=2*r.length),t.length=l;let d=0;const h=i._batchTable.getUniformMapCallback()(e._uniformMap),p=e._needs2DShader;for(a=0;a<l;a+=2){let l=i._va[d++];if(n&&(o=r[u++],l=i._va[o.index]),s=t[a],defined(s)||(s=t[a]=new DrawCommand({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),s.vertexArray=l,s.renderState=e._rsStencilDepthPass,s.shaderProgram=e._sp,s.uniformMap=h,s.pass=Pass$1.TERRAIN_CLASSIFICATION,n&&(s.offset=o.offset,s.count=o.count),c=DrawCommand.shallowClone(s,s.derivedCommands.tileset),c.renderState=e._rsStencilDepthPass3DTiles,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.derivedCommands.tileset=c,s=t[a+1],defined(s)||(s=t[a+1]=new DrawCommand({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),s.vertexArray=l,s.renderState=e._rsPickPass,s.shaderProgram=e._spPick,s.uniformMap=h,s.pass=Pass$1.TERRAIN_CLASSIFICATION,n&&(s.offset=o.offset,s.count=o.count),c=DrawCommand.shallowClone(s,s.derivedCommands.tileset),c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.derivedCommands.tileset=c,p){let t=DrawCommand.shallowClone(s,s.derivedCommands.pick2D);t.shaderProgram=e._spPick2D,s.derivedCommands.pick2D=t,t=DrawCommand.shallowClone(c,c.derivedCommands.pick2D),t.shaderProgram=e._spPick2D,c.derivedCommands.pick2D=t}}}function createCommands$4(e,t,n,i,r,o,a){createColorCommands$1(e,o),createPickCommands$1(e,a)}function boundingVolumeIndex$1(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand$1(e,t,n,i,r,o){e.modelMatrix=n,e.boundingVolume=r,e.cull=i,e.debugShowBoundingVolume=o,t.commandList.push(e)}function updateAndQueuePickCommand$1(e,t,n,i,r){e.modelMatrix=n,e.boundingVolume=r,e.cull=i,t.commandList.push(e)}function updateAndQueueCommands$2(e,t,n,i,r,o,a,s){const c=e._primitive;let l;Primitive$3._updateBoundingVolumes(c,t,r),t.mode===SceneMode$1.SCENE3D?l=c._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=c._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(c._boundingSphere2D)?l=c._boundingSphere2D:defined(c._boundingSphereMorph)&&(l=c._boundingSphereMorph);const u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN,p=t.passes;let f,m,g;if(p.render){const i=n.length;for(f=0;f<i;++f)m=l[boundingVolumeIndex$1(f,i)],d&&(g=n[f],updateAndQueueRenderCommand$1(g,t,r,o,m,a)),h&&(g=n[f].derivedCommands.tileset,updateAndQueueRenderCommand$1(g,t,r,o,m,a));if(t.invertClassification){const n=e._commandsIgnoreShow,i=n.length;for(f=0;f<i;++f)m=l[f],g=n[f],updateAndQueueRenderCommand$1(g,t,r,o,m,a)}}if(p.pick){const e=i.length,n=c._pickOffsets;for(f=0;f<e;++f){m=l[n[boundingVolumeIndex$1(f,e)].index],d&&(g=i[f],updateAndQueuePickCommand$1(g,t,r,o,m)),h&&(g=i[f].derivedCommands.tileset,updateAndQueuePickCommand$1(g,t,r,o,m))}}}ClassificationPrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;let t=this.appearance;defined(t)&&defined(t.material)&&t.material.update(e.context);const n=this,i=this._primitiveOptions;if(!defined(this._primitive)){const e=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=e.length;let o,a,s,c,l=!1,u=!0,d=!1,h=!1;for(r>0&&(s=e[0].attributes,d=ShadowVolumeAppearance.hasAttributesForSphericalExtents(s),h=ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes(s),c=s.color),o=0;o<r;o++){a=e[o];const t=a.attributes.color;defined(t)&&(l=!0),u=u&&defined(t)&&ColorGeometryInstanceAttribute.equals(c,t)}if(!u&&!d&&!h)throw new DeveloperError("All GeometryInstances must have the same color attribute except via GroundPrimitives");l&&!defined(t)&&(t=new PerInstanceColorAppearance({flat:!0}),this.appearance=t),this._usePickOffsets=!d&&!h,this._hasSphericalExtentsAttribute=d,this._hasPlanarExtentsAttributes=h,this._hasPerColorAttribute=l;const p=new Array(r);for(o=0;o<r;++o)a=e[o],p[o]=new GeometryInstance({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:defaultValue(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=p,defined(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(e,t){n._createBoundingVolumeFunction(e,t)}),i._createRenderStatesFunction=function(e,t,i,r){createRenderStates$5(n)},i._createShaderProgramFunction=function(e,t,i){createShaderProgram$2(n,t)},i._createCommandsFunction=function(e,t,i,r,o,a,s){createCommands$4(n,void 0,void 0,!0,!1,a,s)},defined(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(e,t,i,r,o,a,s,c){n._updateAndQueueCommandsFunction(e,t,i,r,o,a,s,c)}:i._updateAndQueueCommandsFunction=function(e,t,i,r,o,a,s,c){updateAndQueueCommands$2(n,t,i,r,o,a,s)},this._primitive=new Primitive$3(i),this._primitive.readyPromise.then((function(e){n._ready=!0,n.releaseGeometryInstances&&(n.geometryInstances=void 0);const t=e._error;defined(t)?n._readyPromise.reject(t):n._readyPromise.resolve(n)}))}this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!1,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!1,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!0,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!0,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!0))),this._primitive.appearance!==t&&(this._primitive.appearance=t),this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},ClassificationPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},ClassificationPrimitive.prototype.isDestroyed=function(){return!1},ClassificationPrimitive.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(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,destroyObject(this)};const GroundPrimitiveUniformMap={u_globeMinimumAltitude:function(){return 55e3}};function GroundPrimitive(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).appearance;const n=e.geometryInstances;if(!defined(t)&&defined(n)){const e=Array.isArray(n)?n:[n],i=e.length;for(let n=0;n<i;n++){const i=e[n].attributes;if(defined(i)&&defined(i.color)){t=new PerInstanceColorAppearance({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=ApproximateTerrainHeights._defaultMaxTerrainHeight,this._minTerrainHeight=ApproximateTerrainHeights._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:this,_extruded:!0,_uniformMap:GroundPrimitiveUniformMap}}function getComputeMaximumHeightFunction(e){return function(t,n){const i=n.maximumRadius,r=i/Math.cos(.5*t)-i;return e._maxHeight+r}}function getComputeMinimumHeightFunction(e){return function(t,n){return e._minHeight}}Object.defineProperties(GroundPrimitive.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),GroundPrimitive.isSupported=ClassificationPrimitive.isSupported;const scratchBVCartesianHigh=new Cartesian3,scratchBVCartesianLow=new Cartesian3,scratchBVCartesian=new Cartesian3,scratchBVCartographic=new Cartographic,scratchBVRectangle=new Rectangle;function getRectangle(e,t){const n=e.mapProjection.ellipsoid;if(!defined(t.attributes)||!defined(t.attributes.position3DHigh))return defined(t.rectangle)?t.rectangle:void 0;const i=t.attributes.position3DHigh.values,r=t.attributes.position3DLow.values,o=i.length;let a=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let e=0;e<o;e+=3){const t=Cartesian3.unpack(i,e,scratchBVCartesianHigh),o=Cartesian3.unpack(r,e,scratchBVCartesianLow),u=Cartesian3.add(t,o,scratchBVCartesian),d=n.cartesianToCartographic(u,scratchBVCartographic),h=d.latitude,p=d.longitude;a=Math.min(a,h),s=Math.min(s,p),c=Math.max(c,h),l=Math.max(l,p)}const u=scratchBVRectangle;return u.north=c,u.south=a,u.east=l,u.west=s,u}function setMinMaxTerrainHeights(e,t,n){const i=ApproximateTerrainHeights.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function createBoundingVolume(e,t,n){const i=t.mapProjection.ellipsoid,r=getRectangle(t,n),o=OrientedBoundingBox.fromRectangle(r,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(o),!t.scene3DOnly){const n=t.mapProjection,i=BoundingSphere.fromRectangleWithHeights2D(r,n,e._maxHeight,e._minHeight);Cartesian3.fromElements(i.center.z,i.center.x,i.center.y,i.center),e._boundingVolumes2D.push(i)}}function boundingVolumeIndex(e,t){return Math.floor(e%t/2)}function updateAndQueueRenderCommand(e,t,n,i,r,o,a){const s=e._primitive;n.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===s._spColor&&s._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=o,t.cull=r,t.debugShowBoundingVolume=a,n.commandList.push(t)}function updateAndQueuePickCommand(e,t,n,i,r,o){const a=e._primitive;n.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===a._spPick&&a._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=o,t.cull=r,n.commandList.push(t)}function updateAndQueueCommands$1(e,t,n,i,r,o,a,s){let c;c=t.mode===SceneMode$1.SCENE3D?e._boundingVolumes:e._boundingVolumes2D;const l=e.classificationType,u=l!==ClassificationType$1.CESIUM_3D_TILE,d=l!==ClassificationType$1.TERRAIN,h=t.passes,p=e._primitive;let f,m,g;if(h.render){const i=n.length;for(f=0;f<i;++f)m=c[boundingVolumeIndex(f,i)],u&&(g=n[f],updateAndQueueRenderCommand(e,g,t,r,o,m,a)),d&&(g=n[f].derivedCommands.tileset,updateAndQueueRenderCommand(e,g,t,r,o,m,a));if(t.invertClassification){const n=p._commandsIgnoreShow,i=n.length;for(f=0;f<i;++f)m=c[f],g=n[f],updateAndQueueRenderCommand(e,g,t,r,o,m,a)}}if(h.pick){const n=i.length;let a;for(e._useFragmentCulling||(a=p._primitive._pickOffsets),f=0;f<n;++f){if(m=c[boundingVolumeIndex(f,n)],!e._useFragmentCulling){m=c[a[boundingVolumeIndex(f,n)].index]}u&&(g=i[f],updateAndQueuePickCommand(e,g,t,r,o,m)),d&&(g=i[f].derivedCommands.tileset,updateAndQueuePickCommand(e,g,t,r,o,m))}}}function MaterialProperty(){DeveloperError.throwInstantiationError()}function DynamicGeometryUpdater$1(e,t,n){this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}GroundPrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;if(!ApproximateTerrainHeights.initialized)return void GroundPrimitive.initializeTerrainHeights();const t=this,n=this._classificationPrimitiveOptions;if(!defined(this._primitive)){const i=e.mapProjection.ellipsoid;let r,o,a;const s=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=s.length,l=new Array(c);let u,d;for(u=0;u<c;++u){r=s[u],o=r.geometry;const t=getRectangle(e,o);defined(d)?defined(t)&&Rectangle.union(d,t,d):d=Rectangle.clone(t);const n=r.id;if(defined(n)&&defined(t)){const e=ApproximateTerrainHeights.getBoundingSphere(t,i);this._boundingSpheresKeys.push(n),this._boundingSpheres.push(e)}a=o.constructor,!defined(a)||defined(a.createShadowVolume)}setMinMaxTerrainHeights(this,d,i);const h=e.terrainExaggeration,p=e.terrainExaggerationRelativeHeight;this._minHeight=TerrainExaggeration.getHeight(this._minTerrainHeight,h,p),this._maxHeight=TerrainExaggeration.getHeight(this._maxTerrainHeight,h,p);const f=GroundPrimitive._supportsMaterials(e.context);if(this._useFragmentCulling=f,f){let t,n=!0;for(u=0;u<c;++u)if(r=s[u],o=r.geometry,d=getRectangle(e,o),ShadowVolumeAppearance.shouldUseSphericalCoordinates(d)){n=!1;break}for(u=0;u<c;++u){r=s[u],o=r.geometry,a=o.constructor;const c=getRectangle(e,o),d=o.textureCoordinateRotationPoints;t=n?ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes(c,d,i,e.mapProjection,this._maxHeight):ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes(c,d,i,e.mapProjection);const h=r.attributes;for(const e in h)h.hasOwnProperty(e)&&(t[e]=h[e]);l[u]=new GeometryInstance({geometry:a.createShadowVolume(o,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:t,id:r.id})}}else for(u=0;u<c;++u)r=s[u],o=r.geometry,a=o.constructor,l[u]=new GeometryInstance({geometry:a.createShadowVolume(o,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:r.attributes,id:r.id});n.geometryInstances=l,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(e,n){createBoundingVolume(t,e,n)},n._updateAndQueueCommandsFunction=function(e,n,i,r,o,a,s,c){updateAndQueueCommands$1(t,n,i,r,o,a,s)},this._primitive=new ClassificationPrimitive(n),this._primitive.readyPromise.then((function(e){t._ready=!0,t.releaseGeometryInstances&&(t.geometryInstances=void 0);const n=e._error;defined(n)?t._readyPromise.reject(n):t._readyPromise.resolve(t)}))}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},GroundPrimitive.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(-1!==t)return this._boundingSpheres[t]},GroundPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPrimitive.prototype.isDestroyed=function(){return!1},GroundPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},GroundPrimitive._supportsMaterials=function(e){return e.depthTexture},GroundPrimitive.supportsMaterials=function(e){return GroundPrimitive._supportsMaterials(e.frameState.context)},Object.defineProperties(MaterialProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),MaterialProperty.prototype.getType=DeveloperError.throwInstantiationError,MaterialProperty.prototype.getValue=DeveloperError.throwInstantiationError,MaterialProperty.prototype.equals=DeveloperError.throwInstantiationError,MaterialProperty.getValue=function(e,t,n){let i;return defined(t)&&(i=t.getType(e),defined(i))?(defined(n)&&n.type===i||(n=Material$4.fromType(i)),t.getValue(e,n.uniforms),n):(defined(n)&&n.type===Material$4.ColorType||(n=Material$4.fromType(Material$4.ColorType)),Color.clone(Color.WHITE,n.uniforms.color),n)},DynamicGeometryUpdater$1.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!Property.getValueOrDefault(t.show,n,!0)},DynamicGeometryUpdater$1.prototype._setOptions=DeveloperError.throwInstantiationError,DynamicGeometryUpdater$1.prototype.update=function(e){const t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,r=this._orderedGroundPrimitives;n?r.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const o=this._entity,a=o[this._geometryUpdater._geometryPropertyName];if(this._setOptions(o,a,e),this._isHidden(o,a,e))return;const s=this._geometryUpdater.shadowsProperty.getValue(e),c=this._options;if(!defined(a.fill)||a.fill.getValue(e)){const o=t.fillMaterialProperty,a=o instanceof ColorMaterialProperty;let l;const u=t._getIsClosed(c);if(a)l=new PerInstanceColorAppearance({closed:u,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const t=MaterialProperty.getValue(e,o,this._material);this._material=t,l=new MaterialAppearance({material:t,translucent:t.isTranslucent(),closed:u})}if(n)c.vertexFormat=PerInstanceColorAppearance.VERTEX_FORMAT,this._primitive=r.add(new GroundPrimitive({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:l,asynchronous:!1,shadows:s,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Property.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=l.vertexFormat;const t=this._geometryUpdater.createFillGeometryInstance(e);a&&(l.translucent=255!==t.attributes.color.value[3]),this._primitive=i.add(new Primitive$3({geometryInstances:t,appearance:l,asynchronous:!1,shadows:s}))}}if(!n&&defined(a.outline)&&a.outline.getValue(e)){const n=this._geometryUpdater.createOutlineGeometryInstance(e),r=Property.getValueOrDefault(a.outlineWidth,e,1);this._outlinePrimitive=i.add(new Primitive$3({geometryInstances:n,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==n.attributes.color.value[3],renderState:{lineWidth:t._scene.clampLineWidth(r)}}),asynchronous:!1,shadows:s}))}},DynamicGeometryUpdater$1.prototype.getBoundingSphere=function(e){const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let r;return defined(n)&&n.show&&n.ready&&(r=n.getGeometryInstanceAttributes(t),defined(r)&&defined(r.boundingSphere))||defined(i)&&i.show&&i.ready&&(r=i.getGeometryInstanceAttributes(t),defined(r)&&defined(r.boundingSphere))?(BoundingSphere.clone(r.boundingSphere,e),BoundingSphereState$1.DONE):defined(n)&&!n.ready||defined(i)&&!i.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},DynamicGeometryUpdater$1.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater$1.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),destroyObject(this)};var PolylineShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main(void)\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nvec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec3 alignedPlaneNormal;\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\ns = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\nfloat t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, t);\nmaterialInput.str = vec3(s, t, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\ngl_FragColor.rgb *= gl_FragColor.a;\nczm_writeDepthClamp();\n}\n",PolylineShadowVolumeMorphFS="varying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\nreturn (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\nvoid main(void)\n{\nvec4 eyeCoordinate = gl_FragCoord;\neyeCoordinate /= eyeCoordinate.w;\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\nfloat distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\ndistanceFromStart = max(0.0, distanceFromStart);\ndistanceFromEnd = max(0.0, distanceFromEnd);\nfloat s = distanceFromStart / (distanceFromStart + distanceFromEnd);\ns = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, v_texcoordT);\nmaterialInput.str = vec3(s, v_texcoordT, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n",PolylineShadowVolumeMorphVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\nattribute float batchId;\nvarying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nvoid main()\n{\nv_batchId = batchId;\nvec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));\nvec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);\nvec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nvec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nvec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec4 startPlane2D;\nvec4 startPlane3D;\nstartPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlane2D.w = -dot(startPlane2D.xyz, posEc2D);\nstartPlane3D.w = -dot(startPlane3D.xyz, posEc3D);\nvec4 rightPlane2D;\nvec4 rightPlane3D;\nrightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nrightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nrightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);\nrightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);\nposRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);\nposRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);\nposRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nposEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nposEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));\nvec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));\nvec4 endPlane2D;\nvec4 endPlane3D;\nendPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlane2D.w = -dot(endPlane2D.xyz, posEc2D);\nendPlane3D.w = -dot(endPlane3D.xyz, posEc3D);\nv_forwardDirectionEC = normalize(endEC - startEC);\nvec2 cleanTexcoordNormalization2D;\ncleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);\ncleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));\nvec2 cleanTexcoordNormalization3D;\ncleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\ncleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;\ncleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));\nv_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#else // PER_INSTANCE_COLOR\nv_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);\nv_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);\n#endif // PER_INSTANCE_COLOR\n#ifdef WIDTH_VARYING\nfloat width = czm_batchTable_width(batchId);\nfloat halfWidth = width * 0.5;\nv_width = width;\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#else\nfloat halfWidth = 0.5 * czm_batchTable_width(batchId);\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#endif\nvec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);\nvec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nvec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));\ngeodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc3D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\npositionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;\nvec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nabsStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));\nabsEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));\nplaneDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);\nupOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));\nnormalEC = normalize(cross(planeDirection, upOrDown));\ngeodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));\ngeodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc2D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(texcoordNormalization2D.x);\n#ifndef PER_INSTANCE_COLOR\nv_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);\n#endif\npositionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;\ngl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineShadowVolumeVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\n#ifndef COLUMBUS_VIEW_2D\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\n#endif\nattribute float batchId;\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\nvec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\nvec3 ecEnd = forwardDirectionEC + ecStart;\nforwardDirectionEC = normalize(forwardDirectionEC);\nv_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\nv_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n#else // COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\nvec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\nvec3 ecEnd = ecStart + offset;\nvec3 forwardDirectionEC = normalize(offset);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nv_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\nv_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n#endif // COLUMBUS_VIEW_2D\nv_endEcAndStartEcX.xyz = ecEnd;\nv_endEcAndStartEcX.w = ecStart.x;\nv_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\nvec4 positionRelativeToEye = czm_computePosition();\nvec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\nvec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nupOrDown = cross(forwardDirectionEC, normalEC);\nupOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\nupOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\nupOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\npositionEC.xyz += upOrDown;\nv_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\nfloat width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\nv_width = width;\n#endif\nv_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\nv_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\nv_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\nv_endPlaneNormalEcAndBatchId.w = batchId;\nwidth = width * max(0.0, czm_metersPerPixel(positionEC));\nwidth = width / dot(normalEC, v_rightPlaneEC.xyz);\n#ifdef COLUMBUS_VIEW_2D\nnormalEC *= sign(texcoordNormalization2D.x);\n#else\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\npositionEC.xyz += width * normalEC;\ngl_Position = czm_depthClamp(czm_projection * positionEC);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nattribute float batchId;\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();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_color = color;\n}\n",PolylineCommon="void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane,\nout vec4 clippedPositionEC)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p0ToP1 = p1 - p0;\nfloat magnitude = length(p0ToP1);\nvec3 direction = normalize(p0ToP1);\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)\n{\nfloat t = endPoint0Distance / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\np0.z = min(p0.z, -czm_currentFrustum.x);\nclipped = true;\n}\n}\nclippedPositionEC = vec4(p0, 1.0);\npositionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n}\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\n#ifdef POLYLINE_DASH\nvec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\nvec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\nvec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\nvec2 lineDir;\nif (usePrevious) {\nlineDir = normalize(positionWindow.xy - previousWindow.xy);\n}\nelse {\nlineDir = normalize(nextWindow.xy - positionWindow.xy);\n}\nangle = atan(lineDir.x, lineDir.y) - 1.570796327;\nangle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\nvec4 clippedPrevWC, clippedPrevEC;\nbool prevSegmentClipped, prevSegmentCulled;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\nvec4 clippedNextWC, clippedNextEC;\nbool nextSegmentClipped, nextSegmentCulled;\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\nbool segmentClipped, segmentCulled;\nvec4 clippedPositionWC, clippedPositionEC;\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\nif (segmentCulled)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\nvec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\nif (prevSegmentCulled)\n{\ndirectionToPrevWC = -directionToNextWC;\n}\nelse if (nextSegmentCulled)\n{\ndirectionToNextWC = -directionToPrevWC;\n}\nvec2 thisSegmentForwardWC, otherSegmentForwardWC;\nif (usePrevious)\n{\nthisSegmentForwardWC = -directionToPrevWC;\notherSegmentForwardWC = directionToNextWC;\n}\nelse\n{\nthisSegmentForwardWC = directionToNextWC;\notherSegmentForwardWC = -directionToPrevWC;\n}\nvec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\nvec2 leftWC = thisSegmentLeftWC;\nfloat expandWidth = width * 0.5;\nif (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n{\nvec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\nvec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\nfloat leftSumLength = length(leftSumWC);\nleftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\nvec2 u = -thisSegmentForwardWC;\nvec2 v = leftWC;\nfloat sinAngle = abs(u.x * v.y - u.y * v.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\nreturn vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nreturn getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n";let defaultVertexShaderSource$1=PolylineCommon+"\n"+PolylineColorAppearanceVS;const defaultFragmentShaderSource$1=PerInstanceFlatColorAppearanceFS;function PolylineColorAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),n=PolylineColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource$1),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource$1),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=n}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource$1="#define CLIP_POLYLINE \n"+defaultVertexShaderSource$1),Object.defineProperties(PolylineColorAppearance.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}}}),PolylineColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PolylineColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var PolylineMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nattribute float batchId;\nvarying float v_width;\nvarying vec2 v_st;\nvarying float v_polylineAngle;\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();\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\nv_width = width;\nv_st.s = st.s;\nv_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\nv_polylineAngle = angle;\n}\n",PolylineFS$1="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec2 st = v_st;\nst.t = czm_readNonPerspective(st.t, gl_FragCoord.w);\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = vec3(st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\ngl_FragColor *= u_highlightColor;\n#endif\nczm_writeLogDepth();\n}\n";let defaultVertexShaderSource=PolylineCommon+"\n"+PolylineMaterialAppearanceVS;const defaultFragmentShaderSource=PolylineFS$1;function PolylineMaterialAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),n=PolylineMaterialAppearance.VERTEX_FORMAT;this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,false,e.renderState),this._closed=false,this._vertexFormat=n}function GroundPolylinePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;defined(t)||(t=new PolylineMaterialAppearance),this.appearance=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=getRenderState$1(!1),this._renderState3DTiles=getRenderState$1(!0),this._renderStateMorph=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}function createShaderProgram$1(e,t,n){const i=t.context,r=e._primitive,o=r._attributeLocations;let a=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeVS);a=Primitive$3._appendShowToShader(r,a),a=Primitive$3._appendDistanceDisplayConditionToShader(r,a),a=Primitive$3._modifyShaderPosition(e,a,t.scene3DOnly);let s=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphVS);s=Primitive$3._appendShowToShader(r,s),s=Primitive$3._appendDistanceDisplayConditionToShader(r,s),s=Primitive$3._modifyShaderPosition(e,s,t.scene3DOnly);let c=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeFS);const l=["GLOBE_MINIMUM_ALTITUDE "+t.mapProjection.ellipsoid.minimumRadius.toFixed(1)];let u="",d="";defined(n.material)?(d=defined(n.material)?n.material.shaderSource:"",-1!==d.search(/varying\s+float\s+v_polylineAngle;/g)&&l.push("ANGLE_VARYING"),-1!==d.search(/varying\s+float\s+v_width;/g)&&l.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",l.push(u);const h=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],p=new ShaderSource({defines:l,sources:[a]}),f=new ShaderSource({defines:h,sources:[d,c]});e._sp=ShaderProgram.replaceCache({context:i,shaderProgram:r._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:o});let m=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!defined(m)){const t=new ShaderSource({defines:l.concat(["COLUMBUS_VIEW_2D"]),sources:[a]});m=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:t,fragmentShaderSource:f,attributeLocations:o})}e._sp2D=m;let g=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!defined(g)){const t=new ShaderSource({defines:l.concat(["MAX_TERRAIN_HEIGHT "+ApproximateTerrainHeights._defaultMaxTerrainHeight.toFixed(1)]),sources:[s]});c=r._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphFS);const n=new ShaderSource({defines:h,sources:[d,c]});g=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:t,fragmentShaderSource:n,attributeLocations:o})}e._spMorph=g}function getRenderState$1(e){return RenderState.fromCache({cull:{enabled:!0},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createCommands$3(e,t,n,i,r,o){const a=e._primitive,s=a._va.length;r.length=s,o.length=s;const c=t instanceof PolylineColorAppearance?{}:n._uniforms,l=a._batchTable.getUniformMapCallback()(c);for(let t=0;t<s;t++){const n=a._va[t];let i=r[t];defined(i)||(i=r[t]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),i.vertexArray=n,i.renderState=e._renderState,i.shaderProgram=e._sp,i.uniformMap=l,i.pass=Pass$1.TERRAIN_CLASSIFICATION,i.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const o=DrawCommand.shallowClone(i,i.derivedCommands.tileset);o.renderState=e._renderState3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,i.derivedCommands.tileset=o;const s=DrawCommand.shallowClone(i,i.derivedCommands.color2D);s.shaderProgram=e._sp2D,i.derivedCommands.color2D=s;const c=DrawCommand.shallowClone(o,o.derivedCommands.color2D);c.shaderProgram=e._sp2D,o.derivedCommands.color2D=c;const u=DrawCommand.shallowClone(i,i.derivedCommands.colorMorph);u.renderState=e._renderStateMorph,u.shaderProgram=e._spMorph,u.pickId="czm_batchTable_pickColor(v_batchId)",i.derivedCommands.colorMorph=u}}function updateAndQueueCommand(e,t,n,i,r,o,a){n.mode===SceneMode$1.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==SceneMode$1.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=o,t.cull=r,t.debugShowBoundingVolume=a,n.commandList.push(t)}function updateAndQueueCommands(e,t,n,i,r,o,a){const s=e._primitive;let c;Primitive$3._updateBoundingVolumes(s,t,r),t.mode===SceneMode$1.SCENE3D?c=s._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?c=s._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(s._boundingSphere2D)?c=s._boundingSphere2D:defined(s._boundingSphereMorph)&&(c=s._boundingSphereMorph);const l=t.mode===SceneMode$1.MORPHING,u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN&&!l;let p;const f=t.passes;if(f.render||f.pick&&s.allowPicking){const i=n.length;for(let s=0;s<i;++s){const i=c[s];d&&(p=n[s],updateAndQueueCommand(e,p,t,r,o,i,a)),h&&(p=n[s].derivedCommands.tileset,updateAndQueueCommand(e,p,t,r,o,i,a))}}}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource="#define CLIP_POLYLINE \n"+defaultVertexShaderSource),Object.defineProperties(PolylineMaterialAppearance.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&(e="#define POLYLINE_DASH\n"+e),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),PolylineMaterialAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,PolylineMaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineMaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineMaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,Object.defineProperties(GroundPolylinePrimitive.prototype,{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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}}),GroundPolylinePrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPolylinePrimitive.prototype.update=function(e){if(!defined(this._primitive)&&!defined(this.geometryInstances))return;if(!ApproximateTerrainHeights.initialized)return void GroundPolylinePrimitive.initializeTerrainHeights();let t;const n=this,i=this._primitiveOptions;if(!defined(this._primitive)){const r=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],o=r.length,a=new Array(o);let s;for(t=0;t<o;++t)if(s=r[t].attributes,!defined(s)||!defined(s.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<o;++t){const i=r[t];s={};const o=i.attributes;for(const e in o)o.hasOwnProperty(e)&&(s[e]=o[e]);defined(s.width)||(s.width=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,value:[i.geometry.width]})),i.geometry._scene3DOnly=e.scene3DOnly,GroundPolylineGeometry.setProjectionAndEllipsoid(i.geometry,e.mapProjection),a[t]=new GeometryInstance({geometry:i.geometry,attributes:s,id:i.id,pickPrimitive:n})}i.geometryInstances=a,i.appearance=this.appearance,i._createShaderProgramFunction=function(e,t,i){createShaderProgram$1(n,t,i)},i._createCommandsFunction=function(e,t,i,r,o,a,s){createCommands$3(n,t,i,r,a,s)},i._updateAndQueueCommandsFunction=function(e,t,i,r,o,a,s,c){updateAndQueueCommands(n,t,i,r,o,a,s)},this._primitive=new Primitive$3(i),this._primitive.readyPromise.then((function(e){n._ready=!0,n.releaseGeometryInstances&&(n.geometryInstances=void 0);const t=e._error;defined(t)?n._readyPromise.reject(t):n._readyPromise.resolve(n)}))}if(this.appearance instanceof PolylineColorAppearance&&!this._hasPerInstanceColors)throw new DeveloperError("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)},GroundPolylinePrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPolylinePrimitive.isSupported=function(e){return e.frameState.context.depthTexture},GroundPolylinePrimitive.prototype.isDestroyed=function(){return!1},GroundPolylinePrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,destroyObject(this)};const defaultRepeat$2=new Cartesian2(1,1),defaultTransparent=!1,defaultColor$7=Color.WHITE;function ImageMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}function createMaterialProperty(e){if(e instanceof Color)return new ColorMaterialProperty(e);if("string"==typeof e||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new ImageMaterialProperty;return t.image=e,t}}function createMaterialPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createMaterialProperty)}function BoxGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PositionProperty(){DeveloperError.throwInstantiationError()}Object.defineProperties(ImageMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._image)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:createPropertyDescriptor("image"),repeat:createPropertyDescriptor("repeat"),color:createPropertyDescriptor("color"),transparent:createPropertyDescriptor("transparent")}),ImageMaterialProperty.prototype.getType=function(e){return"Image"},ImageMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.image=Property.getValueOrUndefined(this._image,e),t.repeat=Property.getValueOrClonedDefault(this._repeat,e,defaultRepeat$2,t.repeat),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$7,t.color),Property.getValueOrDefault(this._transparent,e,defaultTransparent)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t},ImageMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ImageMaterialProperty&&Property.equals(this._image,e._image)&&Property.equals(this._repeat,e._repeat)&&Property.equals(this._color,e._color)&&Property.equals(this._transparent,e._transparent)},Object.defineProperties(BoxGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),dimensions:createPropertyDescriptor("dimensions"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),BoxGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new BoxGraphics(this)},BoxGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PositionProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError},referenceFrame:{get:DeveloperError.throwInstantiationError}}),PositionProperty.prototype.getValue=DeveloperError.throwInstantiationError,PositionProperty.prototype.getValueInReferenceFrame=DeveloperError.throwInstantiationError,PositionProperty.prototype.equals=DeveloperError.throwInstantiationError;const scratchMatrix3$1=new Matrix3;function ConstantPositionProperty(e,t){this._definitionChanged=new Event,this._value=Cartesian3.clone(e),this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED)}function CorridorGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createRawProperty(e){return e}function createRawPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createRawProperty)}function CylinderGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipseGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipsoidGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function LabelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}PositionProperty.convertToReferenceFrame=function(e,t,n,i,r){if(!defined(t))return t;if(defined(r)||(r=new Cartesian3),n===i)return Cartesian3.clone(t,r);let o=Transforms.computeIcrfToFixedMatrix(e,scratchMatrix3$1);return defined(o)||(o=Transforms.computeTemeToPseudoFixedMatrix(e,scratchMatrix3$1)),n===ReferenceFrame$1.INERTIAL?Matrix3.multiplyByVector(o,t,r):n===ReferenceFrame$1.FIXED?Matrix3.multiplyByVector(Matrix3.transpose(o,scratchMatrix3$1),t,r):void 0},Object.defineProperties(ConstantPositionProperty.prototype,{isConstant:{get:function(){return!defined(this._value)||this._referenceFrame===ReferenceFrame$1.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),ConstantPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ConstantPositionProperty.prototype.setValue=function(e,t){let n=!1;Cartesian3.equals(this._value,e)||(n=!0,this._value=Cartesian3.clone(e)),defined(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)},ConstantPositionProperty.prototype.getValueInReferenceFrame=function(e,t,n){return PositionProperty.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)},ConstantPositionProperty.prototype.equals=function(e){return this===e||e instanceof ConstantPositionProperty&&Cartesian3.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame},Object.defineProperties(CorridorGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),CorridorGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new CorridorGraphics(this)},CorridorGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(CylinderGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),length:createPropertyDescriptor("length"),topRadius:createPropertyDescriptor("topRadius"),bottomRadius:createPropertyDescriptor("bottomRadius"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),slices:createPropertyDescriptor("slices"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),CylinderGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new CylinderGraphics(this)},CylinderGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.length=defaultValue(this.length,e.length),this.topRadius=defaultValue(this.topRadius,e.topRadius),this.bottomRadius=defaultValue(this.bottomRadius,e.bottomRadius),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=defaultValue(this.slices,e.slices),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(EllipseGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),semiMajorAxis:createPropertyDescriptor("semiMajorAxis"),semiMinorAxis:createPropertyDescriptor("semiMinorAxis"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),EllipseGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new EllipseGraphics(this)},EllipseGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.semiMajorAxis=defaultValue(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=defaultValue(this.semiMinorAxis,e.semiMinorAxis),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(EllipsoidGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),radii:createPropertyDescriptor("radii"),innerRadii:createPropertyDescriptor("innerRadii"),minimumClock:createPropertyDescriptor("minimumClock"),maximumClock:createPropertyDescriptor("maximumClock"),minimumCone:createPropertyDescriptor("minimumCone"),maximumCone:createPropertyDescriptor("maximumCone"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),stackPartitions:createPropertyDescriptor("stackPartitions"),slicePartitions:createPropertyDescriptor("slicePartitions"),subdivisions:createPropertyDescriptor("subdivisions"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),EllipsoidGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new EllipsoidGraphics(this)},EllipsoidGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.radii=defaultValue(this.radii,e.radii),this.innerRadii=defaultValue(this.innerRadii,e.innerRadii),this.minimumClock=defaultValue(this.minimumClock,e.minimumClock),this.maximumClock=defaultValue(this.maximumClock,e.maximumClock),this.minimumCone=defaultValue(this.minimumCone,e.minimumCone),this.maximumCone=defaultValue(this.maximumCone,e.maximumCone),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.stackPartitions=defaultValue(this.stackPartitions,e.stackPartitions),this.slicePartitions=defaultValue(this.slicePartitions,e.slicePartitions),this.subdivisions=defaultValue(this.subdivisions,e.subdivisions),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(LabelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),text:createPropertyDescriptor("text"),font:createPropertyDescriptor("font"),style:createPropertyDescriptor("style"),scale:createPropertyDescriptor("scale"),showBackground:createPropertyDescriptor("showBackground"),backgroundColor:createPropertyDescriptor("backgroundColor"),backgroundPadding:createPropertyDescriptor("backgroundPadding"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),fillColor:createPropertyDescriptor("fillColor"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),LabelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new LabelGraphics(this)},LabelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.text=defaultValue(this.text,e.text),this.font=defaultValue(this.font,e.font),this.style=defaultValue(this.style,e.style),this.scale=defaultValue(this.scale,e.scale),this.showBackground=defaultValue(this.showBackground,e.showBackground),this.backgroundColor=defaultValue(this.backgroundColor,e.backgroundColor),this.backgroundPadding=defaultValue(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=defaultValue(this.pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this.verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fillColor=defaultValue(this.fillColor,e.fillColor),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=defaultValue(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)};const defaultNodeTransformation=new TranslationRotationScale;function NodeTransformationProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}function PropertyBag(e,t){this._propertyNames=[],this._definitionChanged=new Event,defined(e)&&this.merge(e,t)}function createConstantProperty(e){return new ConstantProperty(e)}function propertiesEqual(e,t){const n=e._propertyNames,i=t._propertyNames,r=n.length;if(r!==i.length)return!1;for(let o=0;o<r;++o){const r=n[o];if(-1===i.indexOf(r))return!1;if(!Property.equals(e[r],t[r]))return!1}return!0}function createNodeTransformationProperty(e){return new NodeTransformationProperty(e)}function createNodeTransformationPropertyBag(e){return new PropertyBag(e,createNodeTransformationProperty)}function createArticulationStagePropertyBag(e){return new PropertyBag(e)}function ModelGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function Cesium3DTilesetGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PathGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PlaneGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PointGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createPolygonHierarchyProperty(e){return Array.isArray(e)&&(e=new PolygonHierarchy(e)),new ConstantProperty(e)}function PolygonGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineVolumeGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function RectangleGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function WallGraphics(e){this._definitionChanged=new Event,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}Object.defineProperties(NodeTransformationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._translation)&&Property.isConstant(this._rotation)&&Property.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:createPropertyDescriptor("translation"),rotation:createPropertyDescriptor("rotation"),scale:createPropertyDescriptor("scale")}),NodeTransformationProperty.prototype.getValue=function(e,t){return defined(t)||(t=new TranslationRotationScale),t.translation=Property.getValueOrClonedDefault(this._translation,e,defaultNodeTransformation.translation,t.translation),t.rotation=Property.getValueOrClonedDefault(this._rotation,e,defaultNodeTransformation.rotation,t.rotation),t.scale=Property.getValueOrClonedDefault(this._scale,e,defaultNodeTransformation.scale,t.scale),t},NodeTransformationProperty.prototype.equals=function(e){return this===e||e instanceof NodeTransformationProperty&&Property.equals(this._translation,e._translation)&&Property.equals(this._rotation,e._rotation)&&Property.equals(this._scale,e._scale)},Object.defineProperties(PropertyBag.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!Property.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyBag.prototype.hasProperty=function(e){return-1!==this._propertyNames.indexOf(e)},PropertyBag.prototype.addProperty=function(e,t,n){this._propertyNames.push(e),Object.defineProperty(this,e,createPropertyDescriptor(e,!0,defaultValue(n,createConstantProperty))),defined(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e],this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.getValue=function(e,t){defined(t)||(t={});const n=this._propertyNames;for(let i=0,r=n.length;i<r;i++){const r=n[i];t[r]=Property.getValueOrUndefined(this[r],e,t[r])}return t},PropertyBag.prototype.merge=function(e,t){const n=this._propertyNames,i=defined(e._propertyNames)?e._propertyNames:Object.keys(e);for(let r=0,o=i.length;r<o;r++){const o=i[r],a=this[o],s=e[o];void 0===a&&-1===n.indexOf(o)&&this.addProperty(o,void 0,t),void 0!==s&&(void 0!==a?defined(a)&&defined(a.merge)&&a.merge(s):defined(s)&&defined(s.merge)&&defined(s.clone)?this[o]=s.clone():this[o]=s)}},PropertyBag.prototype.equals=function(e){return this===e||e instanceof PropertyBag&&propertiesEqual(this,e)},Object.defineProperties(ModelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),scale:createPropertyDescriptor("scale"),minimumPixelSize:createPropertyDescriptor("minimumPixelSize"),maximumScale:createPropertyDescriptor("maximumScale"),incrementallyLoadTextures:createPropertyDescriptor("incrementallyLoadTextures"),runAnimations:createPropertyDescriptor("runAnimations"),clampAnimations:createPropertyDescriptor("clampAnimations"),shadows:createPropertyDescriptor("shadows"),heightReference:createPropertyDescriptor("heightReference"),silhouetteColor:createPropertyDescriptor("silhouetteColor"),silhouetteSize:createPropertyDescriptor("silhouetteSize"),color:createPropertyDescriptor("color"),colorBlendMode:createPropertyDescriptor("colorBlendMode"),colorBlendAmount:createPropertyDescriptor("colorBlendAmount"),imageBasedLightingFactor:createPropertyDescriptor("imageBasedLightingFactor"),lightColor:createPropertyDescriptor("lightColor"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),nodeTransformations:createPropertyDescriptor("nodeTransformations",void 0,createNodeTransformationPropertyBag),articulations:createPropertyDescriptor("articulations",void 0,createArticulationStagePropertyBag),clippingPlanes:createPropertyDescriptor("clippingPlanes")}),ModelGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e):new ModelGraphics(this)},ModelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.scale=defaultValue(this.scale,e.scale),this.minimumPixelSize=defaultValue(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=defaultValue(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=defaultValue(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=defaultValue(this.runAnimations,e.runAnimations),this.clampAnimations=defaultValue(this.clampAnimations,e.clampAnimations),this.shadows=defaultValue(this.shadows,e.shadows),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.silhouetteColor=defaultValue(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=defaultValue(this.silhouetteSize,e.silhouetteSize),this.color=defaultValue(this.color,e.color),this.colorBlendMode=defaultValue(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=defaultValue(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=defaultValue(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=defaultValue(this.lightColor,e.lightColor),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=defaultValue(this.clippingPlanes,e.clippingPlanes);const t=e.nodeTransformations;if(defined(t)){const e=this.nodeTransformations;defined(e)?e.merge(t):this.nodeTransformations=new PropertyBag(t,createNodeTransformationProperty)}const n=e.articulations;if(defined(n)){const e=this.articulations;defined(e)?e.merge(n):this.articulations=new PropertyBag(n)}},Object.defineProperties(Cesium3DTilesetGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),maximumScreenSpaceError:createPropertyDescriptor("maximumScreenSpaceError")}),Cesium3DTilesetGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new Cesium3DTilesetGraphics(this)},Cesium3DTilesetGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.maximumScreenSpaceError=defaultValue(this.maximumScreenSpaceError,e.maximumScreenSpaceError)},Object.defineProperties(PathGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),leadTime:createPropertyDescriptor("leadTime"),trailTime:createPropertyDescriptor("trailTime"),width:createPropertyDescriptor("width"),resolution:createPropertyDescriptor("resolution"),material:createMaterialPropertyDescriptor("material"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PathGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PathGraphics(this)},PathGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.leadTime=defaultValue(this.leadTime,e.leadTime),this.trailTime=defaultValue(this.trailTime,e.trailTime),this.width=defaultValue(this.width,e.width),this.resolution=defaultValue(this.resolution,e.resolution),this.material=defaultValue(this.material,e.material),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PlaneGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),plane:createPropertyDescriptor("plane"),dimensions:createPropertyDescriptor("dimensions"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PlaneGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PlaneGraphics(this)},PlaneGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.plane=defaultValue(this.plane,e.plane),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(PointGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),pixelSize:createPropertyDescriptor("pixelSize"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),PointGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new PointGraphics(this)},PointGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.pixelSize=defaultValue(this.pixelSize,e.pixelSize),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.color=defaultValue(this.color,e.color),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)},Object.defineProperties(PolygonGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),hierarchy:createPropertyDescriptor("hierarchy",void 0,createPolygonHierarchyProperty),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),perPositionHeight:createPropertyDescriptor("perPositionHeight"),closeTop:createPropertyDescriptor("closeTop"),closeBottom:createPropertyDescriptor("closeBottom"),arcType:createPropertyDescriptor("arcType"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolygonGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolygonGraphics(this)},PolygonGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.hierarchy=defaultValue(this.hierarchy,e.hierarchy),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.perPositionHeight=defaultValue(this.perPositionHeight,e.perPositionHeight),this.closeTop=defaultValue(this.closeTop,e.closeTop),this.closeBottom=defaultValue(this.closeBottom,e.closeBottom),this.arcType=defaultValue(this.arcType,e.arcType),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),granularity:createPropertyDescriptor("granularity"),material:createMaterialPropertyDescriptor("material"),depthFailMaterial:createMaterialPropertyDescriptor("depthFailMaterial"),arcType:createPropertyDescriptor("arcType"),clampToGround:createPropertyDescriptor("clampToGround"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolylineGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new PolylineGraphics(this)},PolylineGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.granularity=defaultValue(this.granularity,e.granularity),this.material=defaultValue(this.material,e.material),this.depthFailMaterial=defaultValue(this.depthFailMaterial,e.depthFailMaterial),this.arcType=defaultValue(this.arcType,e.arcType),this.clampToGround=defaultValue(this.clampToGround,e.clampToGround),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(PolylineVolumeGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),shape:createPropertyDescriptor("shape"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PolylineVolumeGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new PolylineVolumeGraphics(this)},PolylineVolumeGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.shape=defaultValue(this.shape,e.shape),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(RectangleGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),coordinates:createPropertyDescriptor("coordinates"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),RectangleGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new RectangleGraphics(this)},RectangleGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.coordinates=defaultValue(this.coordinates,e.coordinates),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},Object.defineProperties(WallGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),minimumHeights:createPropertyDescriptor("minimumHeights"),maximumHeights:createPropertyDescriptor("maximumHeights"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),WallGraphics.prototype.clone=function(e){return defined(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new WallGraphics(this)},WallGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.minimumHeights=defaultValue(this.minimumHeights,e.minimumHeights),this.maximumHeights=defaultValue(this.maximumHeights,e.maximumHeights),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)};const cartoScratch$1=new Cartographic;function createConstantPositionProperty(e){return new ConstantPositionProperty(e)}function createPositionPropertyDescriptor(e){return createPropertyDescriptor(e,void 0,createConstantPositionProperty)}function createPropertyTypeDescriptor(e,t){return createPropertyDescriptor(e,void 0,(function(e){return e instanceof t?e:new t(e)}))}function Entity(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id;defined(t)||(t=createGuid()),this._availability=void 0,this._id=t,this._definitionChanged=new Event,this._name=e.name,this._show=defaultValue(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall"],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function updateShow(e,t,n){const i=t.length;for(let e=0;e<i;e++){const i=t[e],r=i._show;(!n&&r)!==(n&&r)&&updateShow(i,i._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(Entity.prototype,{availability:createRawPropertyDescriptor("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:createRawPropertyDescriptor("name"),show:{get:function(){return this._show},set:function(e){if(e===this._show)return;const t=this.isShowing;this._show=e;const n=this.isShowing;t!==n&&updateShow(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!defined(this.entityCollection)||this.entityCollection.show)&&(!defined(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const n=this.isShowing;if(defined(t)){const e=t._children.indexOf(this);t._children.splice(e,1)}this._parent=e,defined(e)&&e._children.push(this);const i=this.isShowing;n!==i&&updateShow(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:createPropertyTypeDescriptor("billboard",BillboardGraphics),box:createPropertyTypeDescriptor("box",BoxGraphics),corridor:createPropertyTypeDescriptor("corridor",CorridorGraphics),cylinder:createPropertyTypeDescriptor("cylinder",CylinderGraphics),description:createPropertyDescriptor("description"),ellipse:createPropertyTypeDescriptor("ellipse",EllipseGraphics),ellipsoid:createPropertyTypeDescriptor("ellipsoid",EllipsoidGraphics),label:createPropertyTypeDescriptor("label",LabelGraphics),model:createPropertyTypeDescriptor("model",ModelGraphics),tileset:createPropertyTypeDescriptor("tileset",Cesium3DTilesetGraphics),orientation:createPropertyDescriptor("orientation"),path:createPropertyTypeDescriptor("path",PathGraphics),plane:createPropertyTypeDescriptor("plane",PlaneGraphics),point:createPropertyTypeDescriptor("point",PointGraphics),polygon:createPropertyTypeDescriptor("polygon",PolygonGraphics),polyline:createPropertyTypeDescriptor("polyline",PolylineGraphics),polylineVolume:createPropertyTypeDescriptor("polylineVolume",PolylineVolumeGraphics),properties:createPropertyTypeDescriptor("properties",PropertyBag),position:createPositionPropertyDescriptor("position"),rectangle:createPropertyTypeDescriptor("rectangle",RectangleGraphics),viewFrom:createPropertyDescriptor("viewFrom"),wall:createPropertyTypeDescriptor("wall",WallGraphics)}),Entity.prototype.isAvailable=function(e){const t=this._availability;return!defined(t)||t.contains(e)},Entity.prototype.addProperty=function(e){this._propertyNames.push(e),Object.defineProperty(this,e,createRawPropertyDescriptor(e,!0))},Entity.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e]},Entity.prototype.merge=function(e){this.name=defaultValue(this.name,e.name),this.availability=defaultValue(this.availability,e.availability);const t=this._propertyNames,n=defined(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let r=0;r<i;r++){const i=n[r];if("parent"===i||"name"===i||"availability"===i)continue;const o=this[i],a=e[i];defined(o)||-1!==t.indexOf(i)||this.addProperty(i),defined(a)&&(defined(o)?defined(o.merge)&&o.merge(a):defined(a.merge)&&defined(a.clone)?this[i]=a.clone():this[i]=a)}};const matrix3Scratch=new Matrix3,positionScratch$7=new Cartesian3,orientationScratch=new Quaternion;Entity.prototype.computeModelMatrix=function(e,t){const n=Property.getValueOrUndefined(this._position,e,positionScratch$7);if(!defined(n))return;const i=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return t=defined(i)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(i,matrix3Scratch),n,t):Transforms.eastNorthUpToFixedFrame(n,void 0,t)},Entity.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,r){const o=Property.getValueOrDefault(t,e,HeightReference$1.NONE);let a=Property.getValueOrUndefined(this._position,e,positionScratch$7);if(o===HeightReference$1.NONE||!defined(a)||Cartesian3.equalsEpsilon(a,Cartesian3.ZERO,CesiumMath.EPSILON8))return this.computeModelMatrix(e,r);const s=i.cartesianToCartographic(a,cartoScratch$1);o===HeightReference$1.CLIP_TO_GROUND?s.height<n&&(s.height=n):o===HeightReference$1.CLAMP_TO_GROUND?s.height=n:s.height+=n,a=i.cartographicToCartesian(s,a);const c=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return r=defined(c)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(c,matrix3Scratch),a,r):Transforms.eastNorthUpToFixedFrame(a,void 0,r)},Entity.supportsMaterialsforEntitiesOnTerrain=function(e){return GroundPrimitive.supportsMaterials(e)},Entity.supportsPolylinesOnTerrain=function(e){return GroundPolylinePrimitive.isSupported(e)};const defaultMaterial$2=new ColorMaterialProperty(Color.WHITE),defaultShow$1=new ConstantProperty(!0),defaultFill$1=new ConstantProperty(!0),defaultOutline=new ConstantProperty(!1),defaultOutlineColor$3=new ConstantProperty(Color.BLACK),defaultShadows$2=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$7=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType$1=new ConstantProperty(ClassificationType$1.BOTH);function GeometryUpdater(e){const t=e.entity,n=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=n+"-"+t.id,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Entity.supportsMaterialsforEntitiesOnTerrain(e.scene)}function CallbackProperty(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Event,this.setCallback(e,t)}Object.defineProperties(GeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}}),GeometryUpdater.prototype.isOutlineVisible=function(e){const t=this._entity;return defaultValue(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e),!1)},GeometryUpdater.prototype.isFilled=function(e){const t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e),!1)},GeometryUpdater.prototype.createFillGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.createOutlineGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.isDestroyed=function(){return!1},GeometryUpdater.prototype.destroy=function(){destroyObject(this)},GeometryUpdater.prototype._isHidden=function(e,t){const n=t.show;return defined(n)&&n.isConstant&&!n.getValue(Iso8601.MINIMUM_VALUE)},GeometryUpdater.prototype._isOnTerrain=function(e,t){return!1},GeometryUpdater.prototype._getIsClosed=function(e){return!0},GeometryUpdater.prototype._isDynamic=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._setStaticOptions=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,n,i){if(-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const o=r.fill,a=!defined(o)||!o.isConstant||o.getValue(Iso8601.MINIMUM_VALUE),s=r.outline;let c=defined(s);if(c&&s.isConstant&&(c=s.getValue(Iso8601.MINIMUM_VALUE)),!a&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const l=r.show;if(this._isHidden(e,r))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));this._materialProperty=defaultValue(r.material,defaultMaterial$2),this._fillProperty=defaultValue(o,defaultFill$1),this._showProperty=defaultValue(l,defaultShow$1),this._showOutlineProperty=defaultValue(r.outline,defaultOutline),this._outlineColorProperty=c?defaultValue(r.outlineColor,defaultOutlineColor$3):void 0,this._shadowsProperty=defaultValue(r.shadows,defaultShadows$2),this._distanceDisplayConditionProperty=defaultValue(r.distanceDisplayCondition,defaultDistanceDisplayCondition$7),this._classificationTypeProperty=defaultValue(r.classificationType,defaultClassificationType$1),this._fillEnabled=a;const u=this._isOnTerrain(e,r)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof ColorMaterialProperty);if(c&&u&&(oneTimeWarning(oneTimeWarning.geometryOutlines),c=!1),this._onTerrain=u,this._outlineEnabled=c,this._isDynamic(e,r))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,r),this._isClosed=this._getIsClosed(this._options);const t=r.outlineWidth;this._outlineWidth=defined(t)?t.getValue(Iso8601.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}},GeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new this.constructor.DynamicGeometryUpdater(this,e,t)},Object.defineProperties(CallbackProperty.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),CallbackProperty.prototype.getValue=function(e,t){return this._callback(e,t)},CallbackProperty.prototype.setCallback=function(e,t){const n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)},CallbackProperty.prototype.equals=function(e){return this===e||e instanceof CallbackProperty&&this._callback===e._callback&&this._isConstant===e._isConstant};const scratchPosition$8=new Cartesian3,scratchCarto$1=new Cartographic;function TerrainOffsetProperty(e,t,n,i){this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new Cartesian3,this._cartographicPosition=new Cartographic,this._normal=new Cartesian3,this._definitionChanged=new Event,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const r=this;if(defined(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener((function(){r._updateClamping()})),this._removeModeListener=e.morphComplete.addEventListener((function(){r._updateClamping()}))),t.isConstant){const n=t.getValue(Iso8601.MINIMUM_VALUE,scratchPosition$8);if(!defined(n)||Cartesian3.equals(n,Cartesian3.ZERO)||!defined(e.globe))return;this._position=Cartesian3.clone(n,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(n,this._normal)}}function heightReferenceOnEntityPropertyChanged(e,t,n,i){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,n,i),-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return;defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const o=r.heightReference;if(defined(o)){const e=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,e,o)}}Object.defineProperties(TerrainOffsetProperty.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),TerrainOffsetProperty.prototype._updateClamping=function(){defined(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(!defined(t)||Cartesian3.equals(n,Cartesian3.ZERO))return void(this._terrainHeight=0);const i=t.ellipsoid,r=t._surface,o=this,a=i.cartesianToCartographic(n,this._cartographicPosition),s=t.getHeight(a);defined(s)?this._terrainHeight=s:this._terrainHeight=0,this._removeCallbackFunc=r.updateHeight(a,(function(t){if(e.mode===SceneMode$1.SCENE3D){const e=i.cartesianToCartographic(t,scratchCarto$1);o._terrainHeight=e.height}else o._terrainHeight=t.x;o.definitionChanged.raiseEvent()}))},TerrainOffsetProperty.prototype.getValue=function(e,t){const n=Property.getValueOrDefault(this._heightReference,e,HeightReference$1.NONE),i=Property.getValueOrDefault(this._extrudedHeightReference,e,HeightReference$1.NONE);if(n===HeightReference$1.NONE&&i!==HeightReference$1.RELATIVE_TO_GROUND)return this._position=Cartesian3.clone(Cartesian3.ZERO,this._position),Cartesian3.clone(Cartesian3.ZERO,t);if(this._positionProperty.isConstant&&n!==HeightReference$1.CLIP_TO_GROUND)return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);const r=this._scene,o=this._positionProperty.getValue(e,scratchPosition$8);if(!defined(o)||Cartesian3.equals(o,Cartesian3.ZERO)||!defined(r.globe))return Cartesian3.clone(Cartesian3.ZERO,t);if(Cartesian3.equalsEpsilon(this._position,o,CesiumMath.EPSILON10)&&n!==HeightReference$1.CLIP_TO_GROUND)return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=Cartesian3.clone(o,this._position),this._updateClamping();const a=r.globe.ellipsoid.geodeticSurfaceNormal(o,this._normal);if(n===HeightReference$1.CLIP_TO_GROUND){const e=r.globe.ellipsoid.cartesianToCartographic(o,scratchCarto$1);return this._terrainHeight>=e.height?Cartesian3.multiplyByScalar(a,this._terrainHeight-e.height,t):Cartesian3.clone(Cartesian3.ZERO,t)}return Cartesian3.multiplyByScalar(a,this._terrainHeight,t)},TerrainOffsetProperty.prototype.isDestroyed=function(){return!1},TerrainOffsetProperty.prototype.destroy=function(){return defined(this._removeEventListener)&&this._removeEventListener(),defined(this._removeModeListener)&&this._removeModeListener(),defined(this._removeCallbackFunc)&&this._removeCallbackFunc(),destroyObject(this)};const defaultOffset$a=Cartesian3.ZERO,offsetScratch$9=new Cartesian3,positionScratch$6=new Cartesian3,scratchColor$o=new Color;function BoxGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function BoxGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new BoxGeometryOptions(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}function DynamicBoxGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}function ClearCommand(e){e=defaultValue(e,defaultValue.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,this.pass=e.pass}defined(Object.create)&&(BoxGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),BoxGeometryUpdater.prototype.constructor=BoxGeometryUpdater),Object.defineProperties(BoxGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),BoxGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:i,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$o)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:t,geometry:BoxGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$o),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$a,offsetScratch$9))),new GeometryInstance({id:t,geometry:BoxOutlineGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},BoxGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},BoxGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},BoxGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},BoxGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,BoxGeometryUpdater.DynamicGeometryUpdater=DynamicBoxGeometryUpdater,defined(Object.create)&&(DynamicBoxGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicBoxGeometryUpdater.prototype.constructor=DynamicBoxGeometryUpdater),DynamicBoxGeometryUpdater.prototype._isHidden=function(e,t,n){const i=Property.getValueOrUndefined(e.position,n,positionScratch$6),r=this._options.dimensions;return!defined(i)||!defined(r)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicBoxGeometryUpdater.prototype._setOptions=function(e,t,n){const i=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE),r=this._options;r.dimensions=Property.getValueOrUndefined(t.dimensions,n,r.dimensions),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},ClearCommand.ALL=Object.freeze(new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0})),ClearCommand.prototype.execute=function(e,t){e.clear(this,t)};const Axis={X:0,Y:1,Z:2};Axis.Y_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Z_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO)),Axis.Z_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO)),Axis.X_UP_TO_Y_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO)),Axis.Y_UP_TO_X_UP=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO)),Axis.fromName=function(e){return Axis[e]};var Axis$1=Object.freeze(Axis);const B3dmParser={};B3dmParser._deprecationWarning=deprecationWarning;const sizeOfUint32$6=Uint32Array.BYTES_PER_ELEMENT;function BatchTexture(e){const t=e.featuresLength;let n,i;if(this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[],t>0){const e=Math.min(t,ContextLimits.maximumTextureSize),r=Math.ceil(t/ContextLimits.maximumTextureSize),o=1/e,a=.5*o,s=1/r,c=.5*s;n=new Cartesian2(e,r),i=new Cartesian4(o,a,s,c)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}function getByteLength(e){const t=e._textureDimensions;return t.x*t.y*4}function getBatchValues(e){if(!defined(e._batchValues)){const t=getByteLength(e),n=new Uint8Array(t);arrayFill(n,255),e._batchValues=n}return e._batchValues}function getShowAlphaProperties(e){if(!defined(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t);arrayFill(n,255),e._showAlphaProperties=n}return e._showAlphaProperties}B3dmParser.parse=function(e,t){const n=defaultValue(t,0);t=n;const i=new Uint8Array(e),r=new DataView(e);t+=sizeOfUint32$6;const o=r.getUint32(t,!0);if(1!==o)throw new RuntimeError("Only Batched 3D Model version 1 is supported. Version "+o+" is not.");t+=sizeOfUint32$6;const a=r.getUint32(t,!0);t+=sizeOfUint32$6;let s=r.getUint32(t,!0);t+=sizeOfUint32$6;let c=r.getUint32(t,!0);t+=sizeOfUint32$6;let l=r.getUint32(t,!0);t+=sizeOfUint32$6;let u,d,h=r.getUint32(t,!0);t+=sizeOfUint32$6,l>=570425344?(t-=2*sizeOfUint32$6,u=s,l=c,h=0,s=0,c=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):h>=570425344&&(t-=sizeOfUint32$6,u=l,l=s,h=c,s=0,c=0,B3dmParser._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")),0===s?d={BATCH_LENGTH:defaultValue(u,0)}:(d=getJsonFromTypedArray(i,t,s),t+=s);const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=getJsonFromTypedArray(i,t,l),t+=l,h>0&&(m=new Uint8Array(e,t,h),m=new Uint8Array(m),t+=h));const g=n+a-t;if(0===g)throw new RuntimeError("glTF byte length must be greater than 0.");let _;return t%4==0?_=new Uint8Array(e,t,g):(B3dmParser._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),_=new Uint8Array(i.subarray(t,t+g))),{batchLength:u,featureTableJson:d,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:_}},Object.defineProperties(BatchTexture.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},memorySizeInBytes:{get:function(){let e=0;return defined(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),defined(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}}),BatchTexture.DEFAULT_COLOR_VALUE=Color.WHITE,BatchTexture.DEFAULT_SHOW_VALUE=!0,BatchTexture.prototype.setShow=function(e,t){if(t&&!defined(this._showAlphaProperties))return;const n=getShowAlphaProperties(this),i=2*e,r=t?255:0;if(n[i]!==r){n[i]=r;getBatchValues(this)[4*e+3]=t?n[i+1]:0,this._batchValuesDirty=!0}},BatchTexture.prototype.setAllShow=function(e){const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)},BatchTexture.prototype.getShow=function(e){if(!defined(this._showAlphaProperties))return!0;const t=2*e;return 255===this._showAlphaProperties[t]};const scratchColorBytes$1=new Array(4);function createTexture$4(e,t,n){const i=e._textureDimensions;return new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:Sampler.NEAREST})}function createPickTexture(e,t){const n=e._featuresLength;if(!defined(e._pickTexture)&&n>0){const i=e._pickIds,r=getByteLength(e),o=new Uint8Array(r),a=e._owner,s=e._statistics;for(let e=0;e<n;++e){const n=t.createPickId(a.getFeature(e));i.push(n);const r=n.color,s=4*e;o[s]=Color.floatToByte(r.red),o[s+1]=Color.floatToByte(r.green),o[s+2]=Color.floatToByte(r.blue),o[s+3]=Color.floatToByte(r.alpha)}e._pickTexture=createTexture$4(e,t,o),defined(s)&&(s.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function updateBatchTexture(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}BatchTexture.prototype.setColor=function(e,t){if(Color.equals(t,BatchTexture.DEFAULT_COLOR_VALUE)&&!defined(this._batchValues))return;const n=t.toBytes(scratchColorBytes$1),i=n[3],r=getBatchValues(this),o=4*e,a=getShowAlphaProperties(this),s=2*e;if(r[o]!==n[0]||r[o+1]!==n[1]||r[o+2]!==n[2]||a[s+1]!==i){r[o]=n[0],r[o+1]=n[1],r[o+2]=n[2];const c=255!==a[s+1],l=0!==a[s];r[o+3]=l?i:0,a[s+1]=i;const u=255!==i;u&&!c?++this._translucentFeaturesLength:!u&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,defined(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}},BatchTexture.prototype.setAllColor=function(e){const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)},BatchTexture.prototype.getColor=function(e,t){if(!defined(this._batchValues))return Color.clone(BatchTexture.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=4*e,r=this._showAlphaProperties,o=2*e;return Color.fromBytes(n[i],n[i+1],n[i+2],r[o+1],t)},BatchTexture.prototype.getPickColor=function(e){return this._pickIds[e]},BatchTexture.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&createPickTexture(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,defined(this._batchTexture)||(this._batchTexture=createTexture$4(this,n,this._batchValues),defined(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),updateBatchTexture(this))},BatchTexture.prototype.isDestroyed=function(){return!1},BatchTexture.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return destroyObject(this)};const ComponentsPerAttribute={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ClassPerType={SCALAR:void 0,VEC2:Cartesian2,VEC3:Cartesian3,VEC4:Cartesian4,MAT2:Matrix2,MAT3:Matrix3,MAT4:Matrix4};function getBinaryAccessor(e){const t=e.componentType;let n;n="string"==typeof t?ComponentDatatype$1.fromName(t):t;const i=ComponentsPerAttribute[e.type],r=ClassPerType[e.type];return{componentsPerAttribute:i,classType:r,createArrayBufferView:function(e,t,r){return ComponentDatatype$1.createArrayBufferView(n,e,t,i*r)}}}function BatchTableHierarchy(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,initialize$d(this,e.extension,e.binaryBody)}function initialize$d(e,t,n){let i,r,o;const a=t.instancesLength,s=t.classes;let c,l=t.classIds,u=t.parentCounts,d=t.parentIds,h=a;if(defined(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,ComponentDatatype$1.UNSIGNED_SHORT),l.type=AttributeType$1.SCALAR,o=getBinaryAccessor(l),l=o.createArrayBufferView(n.buffer,n.byteOffset+l.byteOffset,a)),defined(u))for(defined(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,ComponentDatatype$1.UNSIGNED_SHORT),u.type=AttributeType$1.SCALAR,o=getBinaryAccessor(u),u=o.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,a)),c=new Uint16Array(a),h=0,i=0;i<a;++i)c[i]=h,h+=u[i];defined(d)&&defined(d.byteOffset)&&(d.componentType=defaultValue(d.componentType,ComponentDatatype$1.UNSIGNED_SHORT),d.type=AttributeType$1.SCALAR,o=getBinaryAccessor(d),d=o.createArrayBufferView(n.buffer,n.byteOffset+d.byteOffset,h));const p=s.length;for(i=0;i<p;++i){const e=s[i].length,t=s[i].instances,r=getBinaryProperties$1(e,t,n);s[i].instances=combine$2(r,t)}const f=arrayFill(new Array(p),0),m=new Uint16Array(a);for(i=0;i<a;++i)r=l[i],m[i]=f[r],++f[r];e._classes=s,e._classIds=l,e._classIndexes=m,e._parentCounts=u,e._parentIndexes=c,e._parentIds=d}function getBinaryProperties$1(e,t,n){let i;for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],a=o.byteOffset;if(defined(a)){const t=o.componentType,s=o.type;if(!defined(t))throw new RuntimeError("componentType is required.");if(!defined(s))throw new RuntimeError("type is required.");if(!defined(n))throw new RuntimeError("Property "+r+" requires a batch table binary.");const c=getBinaryAccessor(o),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(n.buffer,n.byteOffset+a,e);defined(i)||(i={}),i[r]={typedArray:d,componentCount:l,type:u}}}return i}const scratchVisited=[],scratchStack$1=[];let marker=0;function traverseHierarchyMultipleParents(e,t,n){const i=e._classIds,r=e._parentCounts,o=e._parentIds,a=e._parentIndexes,s=i.length,c=scratchVisited;c.length=Math.max(c.length,s);const l=++marker,u=scratchStack$1;for(u.length=0,u.push(t);u.length>0;){if(c[t=u.pop()]===l)continue;c[t]=l;const i=n(e,t);if(defined(i))return i;const s=r[t],d=a[t];for(let e=0;e<s;++e){const n=o[d+e];n!==t&&u.push(n)}}}function traverseHierarchySingleParent(e,t,n){let i=!0;for(;i;){const r=n(e,t);if(defined(r))return r;const o=e._parentIds[t];i=o!==t,t=o}}function traverseHierarchy(e,t,n){const i=e._parentCounts;return defined(e._parentIds)?defined(i)?traverseHierarchyMultipleParents(e,t,n):traverseHierarchySingleParent(e,t,n):n(e,t)}function getBinaryProperty$1(e,t){const n=e.typedArray,i=e.componentCount;return 1===i?n[t]:e.type.unpack(n,t*i)}function setBinaryProperty$1(e,t,n){const i=e.typedArray,r=e.componentCount;1===r?i[t]=n:e.type.pack(n,i,t*r)}BatchTableHierarchy.prototype.hasProperty=function(e,t){const n=traverseHierarchy(this,e,(function(e,n){const i=e._classIds[n];if(defined(e._classes[i].instances[t]))return!0}));return defined(n)},BatchTableHierarchy.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i<n;++i){if(defined(t[i].instances[e]))return!0}return!1},BatchTableHierarchy.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,traverseHierarchy(this,e,(function(e,n){const i=e._classIds[n],r=e._classes[i].instances;for(const e in r)r.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})),t},BatchTableHierarchy.prototype.getProperty=function(e,t){return traverseHierarchy(this,e,(function(e,n){const i=e._classIds[n],r=e._classes[i],o=e._classIndexes[n],a=r.instances[t];if(defined(a))return defined(a.typedArray)?getBinaryProperty$1(a,o):clone$1(a[o],!0)}))},BatchTableHierarchy.prototype.setProperty=function(e,t,n){const i=traverseHierarchy(this,e,(function(e,i){const r=e._classIds[i],o=e._classes[r],a=e._classIndexes[i],s=o.instances[t];if(defined(s))return defined(s.typedArray)?setBinaryProperty$1(s,a,n):s[a]=clone$1(n,!0),!0}));return defined(i)},BatchTableHierarchy.prototype.isClass=function(e,t){return defined(traverseHierarchy(this,e,(function(e,n){const i=e._classIds[n];if(e._classes[i].name===t)return!0})))},BatchTableHierarchy.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const Cesium3DTileColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2};var Cesium3DTileColorBlendMode$1=Object.freeze(Cesium3DTileColorBlendMode);const DEFAULT_COLOR_VALUE$3=BatchTexture.DEFAULT_COLOR_VALUE,DEFAULT_SHOW_VALUE$3=BatchTexture.DEFAULT_SHOW_VALUE;function Cesium3DTileBatchTable(e,t,n,i,r){let o;this.featuresLength=t,defined(n)&&(o=n.extensions),this._extensions=defaultValue(o,{});const a=initializeProperties(n);this._properties=a,this._batchTableHierarchy=initializeHierarchy$1(this,n,i),this._batchTableBinaryProperties=getBinaryProperties(t,a,i),this._content=e,this._batchTexture=new BatchTexture({featuresLength:t,colorChangedCallback:r,owner:e,statistics:e.tileset.statistics})}function initializeProperties(e){const t={};if(!defined(e))return t;for(const n in e)e.hasOwnProperty(n)&&"HIERARCHY"!==n&&"extensions"!==n&&"extras"!==n&&(t[n]=clone$1(e[n],!0));return t}function initializeHierarchy$1(e,t,n){if(!defined(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const r=t.HIERARCHY;return defined(r)&&(Cesium3DTileBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=r,i=r),defined(i)?new BatchTableHierarchy({extension:i,binaryBody:n}):void 0}function getBinaryProperties(e,t,n){let i;for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],a=o.byteOffset;if(defined(a)){const t=o.componentType,s=o.type;if(!defined(t))throw new RuntimeError("componentType is required.");if(!defined(s))throw new RuntimeError("type is required.");if(!defined(n))throw new RuntimeError("Property "+r+" requires a batch table binary.");const c=getBinaryAccessor(o),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(n.buffer,n.byteOffset+a,e);defined(i)||(i={}),i[r]={typedArray:d,componentCount:l,type:u}}}return i}Cesium3DTileBatchTable._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTileBatchTable.prototype,{memorySizeInBytes:{get:function(){return this._batchTexture.memorySizeInBytes}}}),Cesium3DTileBatchTable.getBinaryProperties=function(e,t,n){return getBinaryProperties(e,t,n)},Cesium3DTileBatchTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},Cesium3DTileBatchTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},Cesium3DTileBatchTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},Cesium3DTileBatchTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},Cesium3DTileBatchTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},Cesium3DTileBatchTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},Cesium3DTileBatchTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const scratchColor$n=new Color;function getBinaryProperty(e,t){const n=e.typedArray,i=e.componentCount;return 1===i?n[t]:e.type.unpack(n,t*i)}function setBinaryProperty(e,t,n){const i=e.typedArray,r=e.componentCount;1===r?i[t]=n:e.type.pack(n,i,t*r)}function getGlslComputeSt(e){return 1===e._batchTexture.textureDimensions.y?"uniform vec4 tile_textureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n return vec2(centerX + (batchId * stepX), 0.5); \n} \n":"uniform vec4 tile_textureStep; \nuniform vec2 tile_textureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n float stepY = tile_textureStep.z; \n float centerY = tile_textureStep.w; \n float xId = mod(batchId, tile_textureDimensions.x); \n float yId = floor(batchId / tile_textureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getDefaultShader(e,t){return e=ShaderSource.replaceMain(e,"tile_main"),t?e+"uniform float tile_colorBlend; \nvoid tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n} \n":e+"void tile_color(vec4 tile_featureColor) \n{ \n tile_main(); \n} \n"}function replaceDiffuseTextureCalls(e,t){const n="texture2D("+t;let i,r=0,o=e.indexOf(n,r);for(;o>-1;){let t=0;for(let n=o;n<e.length;++n){const r=e.charAt(n);if("("===r)++t;else if(")"===r&&(--t,0===t)){i=n+1;break}}const a="tile_diffuse_final("+e.slice(o,i)+", tile_diffuse)";e=e.slice(0,o)+a+e.slice(i),r=o+a.length,o=e.indexOf(n,r)}return e}function modifyDiffuse(e,t,n){if(!defined(t))return getDefaultShader(e,n);let i=new RegExp("(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+"+t+";");const r=e.match(i);if(!defined(r))return getDefaultShader(e,n);const o=r[0],a=r[2];e=(e=ShaderSource.replaceMain(e,"tile_main")).replace(o,"");let s;if("vec3"===a||"vec4"===a){const n="vec3"===a?"vec4("+t+", 1.0)":t,r="vec3"===a?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,r),s=" vec4 source = "+n+"; \n tile_diffuse = tile_diffuse_final(source, tile_featureColor); \n tile_main(); \n"}else"sampler2D"===a&&(e=replaceDiffuseTextureCalls(e,t),s=" tile_diffuse = tile_featureColor; \n tile_main(); \n");return e="uniform float tile_colorBlend; \nvec4 tile_diffuse = vec4(1.0); \nbool isWhite(vec3 color) \n{ \n return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); \n} \nvec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) \n{ \n vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); \n vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; \n return vec4(diffuse.rgb, sourceDiffuse.a); \n} \n"+o+"\n"+e+"\nvoid tile_color(vec4 tile_featureColor) \n{ \n"+s,n&&(e+=" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n"),e+="} \n"}function getColorBlend(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;return n===Cesium3DTileColorBlendMode$1.HIGHLIGHT?0:n===Cesium3DTileColorBlendMode$1.REPLACE?1:n===Cesium3DTileColorBlendMode$1.MIX?CesiumMath.clamp(i,CesiumMath.EPSILON4,1):void 0}Cesium3DTileBatchTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(DEFAULT_COLOR_VALUE$3),void this.setAllShow(DEFAULT_SHOW_VALUE$3);const t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){const n=t.getFeature(i),r=defined(e.color)?defaultValue(e.color.evaluateColor(n,scratchColor$n),DEFAULT_COLOR_VALUE$3):DEFAULT_COLOR_VALUE$3,o=defined(e.show)?defaultValue(e.show.evaluate(n),DEFAULT_SHOW_VALUE$3):DEFAULT_SHOW_VALUE$3;this.setColor(i,r),this.setShow(i,o)}},Cesium3DTileBatchTable.prototype.isClass=function(e,t){const n=this._batchTableHierarchy;return!!defined(n)&&n.isClass(e,t)},Cesium3DTileBatchTable.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t},Cesium3DTileBatchTable.prototype.getExactClassName=function(e){const t=this._batchTableHierarchy;if(defined(t))return t.getClassName(e)},Cesium3DTileBatchTable.prototype.hasProperty=function(e,t){return defined(this._properties[t])||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)},Cesium3DTileBatchTable.prototype.getPropertyNames=function(e,t){(t=defined(t)?t:[]).length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t},Cesium3DTileBatchTable.prototype.getPropertyBySemantic=function(e,t){},Cesium3DTileBatchTable.prototype.getProperty=function(e,t){if(defined(this._batchTableBinaryProperties)){const n=this._batchTableBinaryProperties[t];if(defined(n))return getBinaryProperty(n,e)}const n=this._properties[t];if(defined(n))return clone$1(n[e],!0);if(defined(this._batchTableHierarchy)){const n=this._batchTableHierarchy.getProperty(e,t);if(defined(n))return n}},Cesium3DTileBatchTable.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(defined(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(defined(i))return void setBinaryProperty(i,e,n)}if(defined(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let r=this._properties[t];defined(r)||(this._properties[t]=new Array(i),r=this._properties[t]),r[e]=clone$1(n,!0)},Cesium3DTileBatchTable.prototype.getVertexShaderCallback=function(e,t,n){if(0===this.featuresLength)return;const i=this;return function(r){const o=modifyDiffuse(r,n,!1);let a;return ContextLimits.maximumVertexTextureImageUnits>0?(a="",e&&(a+="uniform bool tile_translucentCommand; \n"),a+="uniform sampler2D tile_batchTexture; \nvarying vec4 tile_featureColor; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec2 st = computeSt("+t+"); \n vec4 featureProperties = texture2D(tile_batchTexture, st); \n tile_color(featureProperties); \n float show = ceil(featureProperties.a); \n gl_Position *= show; \n",e&&(a+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n gl_Position *= 0.0; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n gl_Position *= 0.0; \n } \n } \n"),a+=" tile_featureColor = featureProperties; \n tile_featureSt = st; \n}"):a="varying vec2 tile_featureSt; \nvoid main() \n{ \n tile_color(vec4(1.0)); \n tile_featureSt = computeSt("+t+"); \n}",o+"\n"+getGlslComputeSt(i)+a}},Cesium3DTileBatchTable.prototype.getFragmentShaderCallback=function(e,t,n){if(0!==this.featuresLength)return function(i){return i=modifyDiffuse(i,t,!0),ContextLimits.maximumVertexTextureImageUnits>0?(i+="uniform sampler2D tile_pickTexture; \nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_color(tile_featureColor); \n",n&&(i+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),i+="}"):(e&&(i+="uniform bool tile_translucentCommand; \n"),i+="uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n",e&&(i+=" bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n discard; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n discard; \n } \n } \n"),i+=" tile_color(featureProperties); \n",n&&(i+=" gl_FragColor.rgb *= gl_FragColor.a; \n"),i+="} \n"),i}},Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback=function(){if(0!==this.featuresLength)return function(e){return e=ShaderSource.replaceMain(e,"tile_main"),ContextLimits.maximumVertexTextureImageUnits>0?e+="uniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_main(); \n gl_FragColor = tile_featureColor; \n gl_FragColor.rgb *= gl_FragColor.a; \n}":e+="uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvoid main() \n{ \n tile_main(); \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n gl_FragColor = featureProperties; \n gl_FragColor.rgb *= gl_FragColor.a; \n} \n",e}},Cesium3DTileBatchTable.prototype.getUniformMapCallback=function(){if(0===this.featuresLength)return;const e=this;return function(t){return combine$2(t,{tile_batchTexture:function(){return defaultValue(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return getColorBlend(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}},Cesium3DTileBatchTable.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};const StyleCommandsNeeded$2={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};function getStyleCommandsNeeded(e){const t=e._batchTexture.translucentFeaturesLength;return 0===t?StyleCommandsNeeded$2.ALL_OPAQUE:t===e.featuresLength?StyleCommandsNeeded$2.ALL_TRANSLUCENT:StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT}function deriveCommand(e){const t=DrawCommand.shallowClone(e),n=t.pass===Pass$1.TRANSLUCENT;return t.uniformMap=defined(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function deriveTranslucentCommand$2(e){const t=DrawCommand.shallowClone(e);return t.pass=Pass$1.TRANSLUCENT,t.renderState=getTranslucentRenderState$2(e.renderState),t}function deriveOpaqueCommand(e){const t=DrawCommand.shallowClone(e);return t.renderState=getOpaqueRenderState(e.renderState),t}function getLogDepthPolygonOffsetFragmentShaderProgram(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!defined(n)){const i=t.fragmentShaderSource.clone();i.defines=defined(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),i.sources.unshift("#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function deriveZBackfaceCommand(e,t){const n=DrawCommand.shallowClone(t),i=clone$1(n.renderState,!0);i.cull.enabled=!0,i.cull.face=CullFace$1.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=StencilConstants$1.setCesium3DTileBit(),i.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,n.renderState=RenderState.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=clone$1(t.uniformMap);const r=new Cartesian2(5,5);return n.uniformMap.u_polygonOffset=function(){return r},n.shaderProgram=getLogDepthPolygonOffsetFragmentShaderProgram(e,t.shaderProgram),n}function deriveStencilCommand(e,t){const n=DrawCommand.shallowClone(e),i=clone$1(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=StencilConstants$1.SKIP_LOD_MASK,i.stencilTest.reference=StencilConstants$1.CESIUM_3D_TILE_MASK|t<<StencilConstants$1.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=StencilFunction$1.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=StencilOperation$1.REPLACE,i.stencilTest.backFunction=StencilFunction$1.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=StencilOperation$1.REPLACE,i.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK|StencilConstants$1.SKIP_LOD_MASK,n.renderState=RenderState.fromCache(i),n}function getLastSelectionDepth(e){return(e.renderState.stencilTest.reference&StencilConstants$1.SKIP_LOD_MASK)>>>StencilConstants$1.SKIP_LOD_BIT_SHIFT}function getTranslucentRenderState$2(e){const t=clone$1(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND,t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function getOpaqueRenderState(e){const t=clone$1(e,!0);return t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function Cesium3DTileFeature(e,t){this._content=e,this._batchId=t,this._color=void 0}function Cesium3DTileFeatureTable(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function getTypedArrayFromBinary(e,t,n,i,r,o){const a=e._cachedTypedArrays;let s=a[t];return defined(s)||(s=ComponentDatatype$1.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+o,r*i),a[t]=s),s}function getTypedArrayFromArray(e,t,n,i){const r=e._cachedTypedArrays;let o=r[t];return defined(o)||(o=ComponentDatatype$1.createTypedArray(n,i),r[t]=o),o}function addToArray(e,t,n){if(n=defaultValue(n,!1)){const n=e.indexOf(t);if(n>-1)return n}return e.push(t),e.length-1}function usesExtension(e,t){return defined(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function ForEach(){}function numberOfComponentsForType(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}function getAccessorByteStride(e,t){const n=t.bufferView;if(defined(n)){const t=e.bufferViews[n];if(defined(t.byteStride)&&t.byteStride>0)return t.byteStride}return ComponentDatatype$1.getSizeInBytes(t.componentType)*numberOfComponentsForType(t.type)}function addDefaults(e){ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.byteOffset=defaultValue(e.byteOffset,0))})),ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){if(t.mode=defaultValue(t.mode,WebGLConstants$1.TRIANGLES),!defined(t.material)){defined(e.materials)||(e.materials=[]);const n={name:"default"};t.material=addToArray(e.materials,n)}}))})),ForEach.accessorContainingVertexAttributeData(e,(function(t){const n=e.accessors[t],i=n.bufferView;if(n.normalized=defaultValue(n.normalized,!1),defined(i)){const t=e.bufferViews[i];t.byteStride=getAccessorByteStride(e,n),t.target=WebGLConstants$1.ARRAY_BUFFER}})),ForEach.accessorContainingIndexData(e,(function(t){const n=e.accessors[t].bufferView;if(defined(n)){e.bufferViews[n].target=WebGLConstants$1.ELEMENT_ARRAY_BUFFER}})),ForEach.material(e,(function(e){const t=defaultValue(e.extensions,defaultValue.EMPTY_OBJECT),n=t.KHR_materials_common;if(defined(n)){const e=n.technique,t=defined(n.values)?n.values:{};return n.values=t,t.ambient=defined(t.ambient)?t.ambient:[0,0,0,1],t.emission=defined(t.emission)?t.emission:[0,0,0,1],t.transparency=defaultValue(t.transparency,1),t.transparent=defaultValue(t.transparent,!1),t.doubleSided=defaultValue(t.doubleSided,!1),void("CONSTANT"!==e&&(t.diffuse=defined(t.diffuse)?t.diffuse:[0,0,0,1],"LAMBERT"!==e&&(t.specular=defined(t.specular)?t.specular:[0,0,0,1],t.shininess=defaultValue(t.shininess,0))))}e.emissiveFactor=defaultValue(e.emissiveFactor,[0,0,0]),e.alphaMode=defaultValue(e.alphaMode,"OPAQUE"),e.doubleSided=defaultValue(e.doubleSided,!1),"MASK"===e.alphaMode&&(e.alphaCutoff=defaultValue(e.alphaCutoff,.5));defined(t.KHR_techniques_webgl)&&ForEach.materialValue(e,(function(e){defined(e.index)&&addTextureDefaults(e)})),addTextureDefaults(e.emissiveTexture),addTextureDefaults(e.normalTexture),addTextureDefaults(e.occlusionTexture);const i=e.pbrMetallicRoughness;defined(i)&&(i.baseColorFactor=defaultValue(i.baseColorFactor,[1,1,1,1]),i.metallicFactor=defaultValue(i.metallicFactor,1),i.roughnessFactor=defaultValue(i.roughnessFactor,1),addTextureDefaults(i.baseColorTexture),addTextureDefaults(i.metallicRoughnessTexture));const r=t.KHR_materials_pbrSpecularGlossiness;defined(r)&&(r.diffuseFactor=defaultValue(r.diffuseFactor,[1,1,1,1]),r.specularFactor=defaultValue(r.specularFactor,[1,1,1]),r.glossinessFactor=defaultValue(r.glossinessFactor,1),addTextureDefaults(r.specularGlossinessTexture))})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){e.interpolation=defaultValue(e.interpolation,"LINEAR")}))}));const t=getAnimatedNodes(e);return ForEach.node(e,(function(e,n){defined(t[n])||defined(e.translation)||defined(e.rotation)||defined(e.scale)?(e.translation=defaultValue(e.translation,[0,0,0]),e.rotation=defaultValue(e.rotation,[0,0,0,1]),e.scale=defaultValue(e.scale,[1,1,1])):e.matrix=defaultValue(e.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])})),ForEach.sampler(e,(function(e){e.wrapS=defaultValue(e.wrapS,WebGLConstants$1.REPEAT),e.wrapT=defaultValue(e.wrapT,WebGLConstants$1.REPEAT)})),defined(e.scenes)&&!defined(e.scene)&&(e.scene=0),e}function getAnimatedNodes(e){const t={};return ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){const n=e.target,i=n.node,r=n.path;"translation"!==r&&"rotation"!==r&&"scale"!==r||(t[i]=!0)}))})),t}function addTextureDefaults(e){defined(e)&&(e.texCoord=defaultValue(e.texCoord,0))}function addPipelineExtras(e){return ForEach.shader(e,(function(e){addExtras(e)})),ForEach.buffer(e,(function(e){addExtras(e)})),ForEach.image(e,(function(e){addExtras(e)})),addExtras(e),e}function addExtras(e){e.extras=defined(e.extras)?e.extras:{},e.extras._pipeline=defined(e.extras._pipeline)?e.extras._pipeline:{}}function removeExtensionsRequired(e,t){const n=e.extensionsRequired;if(defined(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),0===n.length&&delete e.extensionsRequired}}function removeExtensionsUsed(e,t){const n=e.extensionsUsed;if(defined(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),removeExtensionsRequired(e,t),0===n.length&&delete e.extensionsUsed}}Cesium3DTileBatchTable.prototype.addDerivedCommands=function(e,t){const n=e.commandList,i=n.length,r=this._content._tile,o=r._finalResolution,a=r.tileset,s=a._skipLevelOfDetail&&a._hasMixedContent&&e.context.stencilBuffer,c=getStyleCommandsNeeded(this);for(let l=t;l<i;++l){const t=n[l];let i=t.derivedCommands.tileset;defined(i)&&!t.dirty||(i={},t.derivedCommands.tileset=i,i.originalCommand=deriveCommand(t),t.dirty=!1);const u=i.originalCommand;c!==StyleCommandsNeeded$2.ALL_OPAQUE&&t.pass!==Pass$1.TRANSLUCENT&&(defined(i.translucent)||(i.translucent=deriveTranslucentCommand$2(u))),c!==StyleCommandsNeeded$2.ALL_TRANSLUCENT&&t.pass!==Pass$1.TRANSLUCENT&&(defined(i.opaque)||(i.opaque=deriveOpaqueCommand(u)),s&&(o||(defined(i.zback)||(i.zback=deriveZBackfaceCommand(e.context,u)),a._backfaceCommands.push(i.zback)),defined(i.stencil)&&r._selectionDepth===getLastSelectionDepth(i.stencil)||(t.renderState.depthMask?i.stencil=deriveStencilCommand(u,r._selectionDepth):i.stencil=i.opaque)));const d=s?i.stencil:i.opaque,h=i.translucent;t.pass!==Pass$1.TRANSLUCENT?(c===StyleCommandsNeeded$2.ALL_OPAQUE&&(n[l]=d),c===StyleCommandsNeeded$2.ALL_TRANSLUCENT&&(n[l]=h),c===StyleCommandsNeeded$2.OPAQUE_AND_TRANSLUCENT&&(n[l]=d,n.push(h))):n[l]=u}},Cesium3DTileBatchTable.prototype.update=function(e,t){this._batchTexture.update(e,t)},Cesium3DTileBatchTable.prototype.isDestroyed=function(){return!1},Cesium3DTileBatchTable.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileFeature.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(defined(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}}),Cesium3DTileFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTileFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTileFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTileFeature.getPropertyInherited=function(e,t,n){let i;const r=e.batchTable;if(defined(r)){if(i=r.getPropertyBySemantic(t,n),defined(i))return i;if(i=r.getProperty(t,n),defined(i))return i}const o=e.tile.metadata;if(defined(o)){if(i=o.getPropertyBySemantic(n),defined(i))return i;if(i=o.getProperty(n),defined(i))return i}const a=e.groupMetadata;if(defined(a)){if(i=a.getPropertyBySemantic(n),defined(i))return i;if(i=a.getProperty(n),defined(i))return i}let s=e.tileset.metadata;if(defined(s)&&defined(s.tileset)){if(s=s.tileset,i=s.getPropertyBySemantic(n),defined(i))return i;if(i=s.getProperty(n),defined(i))return i}},Cesium3DTileFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTileFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTileFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTileFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTileFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)},Cesium3DTileFeatureTable.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(defined(i))return defined(i.byteOffset)?getTypedArrayFromBinary(this,e,t=defaultValue(t,ComponentDatatype$1.UNSIGNED_INT),n=defaultValue(n,1),1,i.byteOffset):i},Cesium3DTileFeatureTable.prototype.hasProperty=function(e){return defined(this.json[e])},Cesium3DTileFeatureTable.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(defined(i))return defined(i.byteOffset)?(defined(i.componentType)&&(t=ComponentDatatype$1.fromName(i.componentType)),getTypedArrayFromBinary(this,e,t,n,this.featuresLength,i.byteOffset)):getTypedArrayFromArray(this,e,t,i)},Cesium3DTileFeatureTable.prototype.getProperty=function(e,t,n,i,r){if(!defined(this.json[e]))return;const o=this.getPropertyArray(e,t,n);if(1===n)return o[i];for(let e=0;e<n;++e)r[e]=o[n*i+e];return r},ForEach.objectLegacy=function(e,t){if(defined(e))for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t(e[n],n);if(defined(i))return i}},ForEach.object=function(e,t){if(defined(e)){const n=e.length;for(let i=0;i<n;i++){const n=t(e[i],i);if(defined(n))return n}}},ForEach.topLevel=function(e,t,n){const i=e[t];return defined(i)&&!Array.isArray(i)?ForEach.objectLegacy(i,n):ForEach.object(i,n)},ForEach.accessor=function(e,t){return ForEach.topLevel(e,"accessors",t)},ForEach.accessorWithSemantic=function(e,t,n){const i={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const r=ForEach.meshPrimitiveAttribute(e,(function(e,r){if(0===r.indexOf(t)&&!defined(i[e])){i[e]=!0;const t=n(e);if(defined(t))return t}}));return defined(r)?r:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e,r){if(0===r.indexOf(t)&&!defined(i[e])){i[e]=!0;const t=n(e);if(defined(t))return t}}))}))}))}))},ForEach.accessorContainingVertexAttributeData=function(e,t){const n={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const i=ForEach.meshPrimitiveAttribute(e,(function(e){if(!defined(n[e])){n[e]=!0;const i=t(e);if(defined(i))return i}}));return defined(i)?i:ForEach.meshPrimitiveTarget(e,(function(e){return ForEach.meshPrimitiveTargetAttribute(e,(function(e){if(!defined(n[e])){n[e]=!0;const i=t(e);if(defined(i))return i}}))}))}))}))},ForEach.accessorContainingIndexData=function(e,t){const n={};return ForEach.mesh(e,(function(e){return ForEach.meshPrimitive(e,(function(e){const i=e.indices;if(defined(i)&&!defined(n[i])){n[i]=!0;const e=t(i);if(defined(e))return e}}))}))},ForEach.animation=function(e,t){return ForEach.topLevel(e,"animations",t)},ForEach.animationChannel=function(e,t){const n=e.channels;return ForEach.object(n,t)},ForEach.animationSampler=function(e,t){const n=e.samplers;return ForEach.object(n,t)},ForEach.buffer=function(e,t){return ForEach.topLevel(e,"buffers",t)},ForEach.bufferView=function(e,t){return ForEach.topLevel(e,"bufferViews",t)},ForEach.camera=function(e,t){return ForEach.topLevel(e,"cameras",t)},ForEach.image=function(e,t){return ForEach.topLevel(e,"images",t)},ForEach.material=function(e,t){return ForEach.topLevel(e,"materials",t)},ForEach.materialValue=function(e,t){let n=e.values;defined(e.extensions)&&defined(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=t(n[e],e);if(defined(i))return i}},ForEach.mesh=function(e,t){return ForEach.topLevel(e,"meshes",t)},ForEach.meshPrimitive=function(e,t){const n=e.primitives;if(defined(n)){const e=n.length;for(let i=0;i<e;i++){const e=t(n[i],i);if(defined(e))return e}}},ForEach.meshPrimitiveAttribute=function(e,t){const n=e.attributes;for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=t(n[e],e);if(defined(i))return i}},ForEach.meshPrimitiveTarget=function(e,t){const n=e.targets;if(defined(n)){const e=n.length;for(let i=0;i<e;++i){const e=t(n[i],i);if(defined(e))return e}}},ForEach.meshPrimitiveTargetAttribute=function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t(e[n],n);if(defined(i))return i}},ForEach.node=function(e,t){return ForEach.topLevel(e,"nodes",t)},ForEach.nodeInTree=function(e,t,n){const i=e.nodes;if(defined(i)){const r=t.length;for(let o=0;o<r;o++){const r=t[o],a=i[r];if(defined(a)){let t=n(a,r);if(defined(t))return t;const i=a.children;if(defined(i)&&(t=ForEach.nodeInTree(e,i,n),defined(t)))return t}}}},ForEach.nodeInScene=function(e,t,n){const i=t.nodes;if(defined(i))return ForEach.nodeInTree(e,i,n)},ForEach.program=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.programs,t):ForEach.topLevel(e,"programs",t)},ForEach.sampler=function(e,t){return ForEach.topLevel(e,"samplers",t)},ForEach.scene=function(e,t){return ForEach.topLevel(e,"scenes",t)},ForEach.shader=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.shaders,t):ForEach.topLevel(e,"shaders",t)},ForEach.skin=function(e,t){return ForEach.topLevel(e,"skins",t)},ForEach.skinJoint=function(e,t){const n=e.joints;if(defined(n)){const e=n.length;for(let i=0;i<e;i++){const e=t(n[i]);if(defined(e))return e}}},ForEach.techniqueAttribute=function(e,t){const n=e.attributes;for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=t(n[e],e);if(defined(i))return i}},ForEach.techniqueUniform=function(e,t){const n=e.uniforms;for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=t(n[e],e);if(defined(i))return i}},ForEach.techniqueParameter=function(e,t){const n=e.parameters;for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=t(n[e],e);if(defined(i))return i}},ForEach.technique=function(e,t){return usesExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.techniques,t):ForEach.topLevel(e,"techniques",t)},ForEach.texture=function(e,t){return ForEach.topLevel(e,"textures",t)};const sizeOfUint32$5=4;function parseGlb(e){if("glTF"!==getMagic(e))throw new RuntimeError("File is not valid binary glTF");const t=readHeader(e,0,5),n=t[1];if(1!==n&&2!==n)throw new RuntimeError("Binary glTF version is not 1 or 2");return 1===n?parseGlbVersion1(e,t):parseGlbVersion2(e,t)}function readHeader(e,t,n){const i=new DataView(e.buffer),r=new Array(n);for(let o=0;o<n;++o)r[o]=i.getUint32(e.byteOffset+t+o*sizeOfUint32$5,!0);return r}function parseGlbVersion1(e,t){const n=t[2],i=t[3];if(0!==t[4])throw new RuntimeError("Binary glTF scene format is not JSON");const r=20+i,o=getStringFromTypedArray(e,20,i),a=JSON.parse(o);addPipelineExtras(a);const s=e.subarray(r,n),c=a.buffers;if(defined(c)&&Object.keys(c).length>0){const e=defaultValue(c.binary_glTF,c.KHR_binary_glTF);defined(e)&&(e.extras._pipeline.source=s,delete e.uri)}return removeExtensionsUsed(a,"KHR_binary_glTF"),a}function parseGlbVersion2(e,t){const n=t[2];let i,r,o=12;for(;o<n;){const t=readHeader(e,o,2),n=t[0],a=t[1];o+=8;const s=e.subarray(o,o+n);if(o+=n,1313821514===a){const e=getStringFromTypedArray(s);i=JSON.parse(e),addPipelineExtras(i)}else 5130562===a&&(r=s)}if(defined(i)&&defined(r)){const e=i.buffers;if(defined(e)&&e.length>0){e[0].extras._pipeline.source=r}}return i}function addExtensionsUsed(e,t){let n=e.extensionsUsed;defined(n)||(n=[],e.extensionsUsed=n),addToArray(n,t,!0)}function getComponentReader(e){switch(e){case ComponentDatatype$1.BYTE:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getInt8(t+o*i)};case ComponentDatatype$1.UNSIGNED_BYTE:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getUint8(t+o*i)};case ComponentDatatype$1.SHORT:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getInt16(t+o*i,!0)};case ComponentDatatype$1.UNSIGNED_SHORT:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getUint16(t+o*i,!0)};case ComponentDatatype$1.INT:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getInt32(t+o*i,!0)};case ComponentDatatype$1.UNSIGNED_INT:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getUint32(t+o*i,!0)};case ComponentDatatype$1.FLOAT:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getFloat32(t+o*i,!0)};case ComponentDatatype$1.DOUBLE:return function(e,t,n,i,r){for(let o=0;o<n;++o)r[o]=e.getFloat64(t+o*i,!0)}}}function findAccessorMinMax(e,t){const n=e.bufferViews,i=e.buffers,r=t.bufferView,o=numberOfComponentsForType(t.type);if(!defined(t.bufferView))return{min:arrayFill(new Array(o),0),max:arrayFill(new Array(o),0)};const a=arrayFill(new Array(o),Number.POSITIVE_INFINITY),s=arrayFill(new Array(o),Number.NEGATIVE_INFINITY),c=n[r],l=i[c.buffer].extras._pipeline.source,u=t.count,d=getAccessorByteStride(e,t);let h=t.byteOffset+c.byteOffset+l.byteOffset;const p=t.componentType,f=ComponentDatatype$1.getSizeInBytes(p),m=new DataView(l.buffer),g=new Array(o),_=getComponentReader(p);for(let e=0;e<u;e++){_(m,h,o,f,g);for(let e=0;e<o;e++){const t=g[e];a[e]=Math.min(a[e],t),s[e]=Math.max(s[e],t)}h+=d}return{min:a,max:s}}const defaultBlendEquation=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],defaultBlendFactors=[WebGLConstants$1.ONE,WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.ZERO];function isStateEnabled(e,t){const n=e.enable;return!!defined(n)&&n.indexOf(t)>-1}const supportedBlendFactors=[WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.SRC_COLOR,WebGLConstants$1.ONE_MINUS_SRC_COLOR,WebGLConstants$1.SRC_ALPHA,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.DST_ALPHA,WebGLConstants$1.ONE_MINUS_DST_ALPHA,WebGLConstants$1.DST_COLOR,WebGLConstants$1.ONE_MINUS_DST_COLOR];function getSupportedBlendFactors(e,t){if(!defined(e))return t;for(let n=0;n<4;n++)if(-1===supportedBlendFactors.indexOf(e[n]))return t;return e}function moveTechniqueRenderStates(e){const t={},n={};return defined(e.techniques)?(ForEach.technique(e,(function(e,i){const r=e.states;if(defined(r)){const o=n[i]={};if(isStateEnabled(r,WebGLConstants$1.BLEND)){o.alphaMode="BLEND";const e=r.functions;defined(e)&&(defined(e.blendEquationSeparate)||defined(e.blendFuncSeparate))&&(t[i]={blendEquation:defaultValue(e.blendEquationSeparate,defaultBlendEquation),blendFactors:getSupportedBlendFactors(e.blendFuncSeparate,defaultBlendFactors)})}isStateEnabled(r,WebGLConstants$1.CULL_FACE)||(o.doubleSided=!0),delete e.states}})),Object.keys(t).length>0&&(defined(e.extensions)||(e.extensions={}),addExtensionsUsed(e,"KHR_blend")),ForEach.material(e,(function(e){if(defined(e.technique)){const i=n[e.technique];ForEach.objectLegacy(i,(function(t,n){e[n]=t}));const r=t[e.technique];defined(r)&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_blend=r)}})),e):e}function addExtensionsRequired(e,t){let n=e.extensionsRequired;defined(n)||(n=[],e.extensionsRequired=n),addToArray(n,t,!0),addExtensionsUsed(e,t)}function moveTechniquesToExtension(e){const t=e.techniques,n={},i={},r={};if(defined(t)){const t={programs:[],shaders:[],techniques:[]},o=e.glExtensionsUsed;delete e.glExtensionsUsed,ForEach.technique(e,(function(a,s){const c={name:a.name,program:void 0,attributes:{},uniforms:{}};let l;if(ForEach.techniqueAttribute(a,(function(e,t){l=a.parameters[e],c.attributes[t]={semantic:l.semantic}})),ForEach.techniqueUniform(a,(function(e,t){l=a.parameters[e],c.uniforms[t]={count:l.count,node:l.node,type:l.type,semantic:l.semantic,value:l.value},defined(n[s])||(n[s]={}),n[s][e]=t})),defined(r[a.program]))c.program=r[a.program];else{const n=e.programs[a.program],i={name:n.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:o},s=e.shaders[n.fragmentShader];i.fragmentShader=addToArray(t.shaders,s,!0);const l=e.shaders[n.vertexShader];i.vertexShader=addToArray(t.shaders,l,!0),c.program=addToArray(t.programs,i),r[a.program]=c.program}i[s]=addToArray(t.techniques,c)})),t.techniques.length>0&&(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t,addExtensionsUsed(e,"KHR_techniques_webgl"),addExtensionsRequired(e,"KHR_techniques_webgl"))}return ForEach.material(e,(function(e){if(defined(e.technique)){const t={technique:i[e.technique]};ForEach.objectLegacy(e.values,(function(i,r){defined(t.values)||(t.values={});const o=n[e.technique][r];t.values[o]=i})),defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t}delete e.technique,delete e.values})),delete e.techniques,delete e.programs,delete e.shaders,e}function forEachTextureInMaterial(e,t){Check.typeOf.object("material",e),Check.defined("handler",t);const n=e.pbrMetallicRoughness;if(defined(n)){if(defined(n.baseColorTexture)){const e=n.baseColorTexture,i=t(e.index,e);if(defined(i))return i}if(defined(n.metallicRoughnessTexture)){const e=n.metallicRoughnessTexture,i=t(e.index,e);if(defined(i))return i}}if(defined(e.extensions)){const n=e.extensions.KHR_materials_pbrSpecularGlossiness;if(defined(n)){if(defined(n.diffuseTexture)){const e=n.diffuseTexture,i=t(e.index,e);if(defined(i))return i}if(defined(n.specularGlossinessTexture)){const e=n.specularGlossinessTexture,i=t(e.index,e);if(defined(i))return i}}const i=e.extensions.KHR_materials_common;if(defined(i)){const e=i.values.diffuse,n=i.values.ambient,r=i.values.emission,o=i.values.specular;if(defined(e)&&defined(e.index)){const n=t(e.index,e);if(defined(n))return n}if(defined(n)&&defined(n.index)){const e=t(n.index,n);if(defined(e))return e}if(defined(r)&&defined(r.index)){const e=t(r.index,r);if(defined(e))return e}if(defined(o)&&defined(o.index)){const e=t(o.index,o);if(defined(e))return e}}}const i=ForEach.materialValue(e,(function(e){if(defined(e.index)){const n=t(e.index,e);if(defined(n))return n}}));if(defined(i))return i;if(defined(e.emissiveTexture)){const n=e.emissiveTexture,i=t(n.index,n);if(defined(i))return i}if(defined(e.normalTexture)){const n=e.normalTexture,i=t(n.index,n);if(defined(i))return i}if(defined(e.occlusionTexture)){const n=e.occlusionTexture,i=t(n.index,n);if(defined(i))return i}}const allElementTypes=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function removeUnusedElements(e,t){return t=defaultValue(t,allElementTypes),allElementTypes.forEach((function(n){t.indexOf(n)>-1&&removeUnusedElementsByType(e,n)})),e}const TypeToGltfElementName={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function removeUnusedElementsByType(e,t){const n=e[TypeToGltfElementName[t]];if(defined(n)){let i=0;const r=getListOfElementsIdsInUse[t](e),o=n.length;for(let n=0;n<o;++n)r[n]||(Remove[t](e,n-i),i++)}}function Remove(){}function getListOfElementsIdsInUse(){}function nodeIsEmpty(e,t,n){const i=e.nodes[t];return!(defined(i.mesh)||defined(i.camera)||defined(i.skin)||defined(i.weights)||defined(i.extras)||defined(i.extensions)&&0!==Object.keys(i.extensions).length||defined(n[t]))&&(!defined(i.children)||0===i.children.filter((function(t){return!nodeIsEmpty(e,t,n)})).length)}function addBuffer(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},i={buffer:addToArray(e.buffers,n),byteOffset:0,byteLength:t.length};return addToArray(e.bufferViews,i)}function readAccessorPacked(e,t){const n=getAccessorByteStride(e,t),i=ComponentDatatype$1.getSizeInBytes(t.componentType),r=numberOfComponentsForType(t.type),o=t.count,a=new Array(r*o);if(!defined(t.bufferView))return arrayFill(a,0),a;const s=e.bufferViews[t.bufferView],c=e.buffers[s.buffer].extras._pipeline.source;let l=t.byteOffset+s.byteOffset+c.byteOffset;const u=new DataView(c.buffer),d=new Array(r),h=getComponentReader(t.componentType);for(let e=0;e<o;++e){h(u,l,r,i,d);for(let t=0;t<r;++t)a[e*r+t]=d[t];l+=n}return a}function updateAccessorComponentTypes(e){let t;return ForEach.accessorWithSemantic(e,"JOINTS_0",(function(n){const i=e.accessors[n];t=i.componentType,t===WebGLConstants$1.BYTE?convertType(e,i,ComponentDatatype$1.UNSIGNED_BYTE):t!==WebGLConstants$1.UNSIGNED_BYTE&&t!==WebGLConstants$1.UNSIGNED_SHORT&&convertType(e,i,ComponentDatatype$1.UNSIGNED_SHORT)})),ForEach.accessorWithSemantic(e,"WEIGHTS_0",(function(n){const i=e.accessors[n];t=i.componentType,t===WebGLConstants$1.BYTE?convertType(e,i,ComponentDatatype$1.UNSIGNED_BYTE):t===WebGLConstants$1.SHORT&&convertType(e,i,ComponentDatatype$1.UNSIGNED_SHORT)})),e}function convertType(e,t,n){const i=ComponentDatatype$1.createTypedArray(n,readAccessorPacked(e,t)),r=new Uint8Array(i.buffer);t.bufferView=addBuffer(e,r),t.componentType=n,t.byteOffset=0}Remove.accessor=function(e,t){e.accessors.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(n,i){n>t&&e.attributes[i]--})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(n,i){n>t&&e[i]--}))}));const n=e.indices;defined(n)&&n>t&&e.indices--}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&e.inverseBindMatrices>t&&e.inverseBindMatrices--})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&e.input>t&&e.input--,defined(e.output)&&e.output>t&&e.output--}))}))},Remove.buffer=function(e,t){e.buffers.splice(t,1),ForEach.bufferView(e,(function(e){defined(e.buffer)&&e.buffer>t&&e.buffer--,defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&e.extensions.EXT_meshopt_compression.buffer--}))},Remove.bufferView=function(e,t){if(e.bufferViews.splice(t,1),ForEach.accessor(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.shader(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ForEach.image(e,(function(e){defined(e.bufferView)&&e.bufferView>t&&e.bufferView--})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&e.extensions.KHR_draco_mesh_compression.bufferView>t&&e.extensions.KHR_draco_mesh_compression.bufferView--}))})),usesExtension(e,"EXT_feature_metadata")){const n=e.extensions.EXT_feature_metadata.featureTables;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(defined(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e];defined(n.bufferView)&&n.bufferView>t&&n.bufferView--,defined(n.arrayOffsetBufferView)&&n.arrayOffsetBufferView>t&&n.arrayOffsetBufferView--,defined(n.stringOffsetBufferView)&&n.stringOffsetBufferView>t&&n.stringOffsetBufferView--}}}},Remove.image=function(e,t){e.images.splice(t,1),ForEach.texture(e,(function(e){defined(e.source)&&e.source>t&&--e.source;const n=e.extensions;defined(n)&&defined(n.EXT_texture_webp)&&n.EXT_texture_webp.source>t?--e.extensions.EXT_texture_webp.source:defined(n)&&defined(n.KHR_texture_basisu)&&n.KHR_texture_basisu.source>t&&--e.extensions.KHR_texture_basisu.source}))},Remove.mesh=function(e,t){e.meshes.splice(t,1),ForEach.node(e,(function(e){defined(e.mesh)&&(e.mesh>t?e.mesh--:e.mesh===t&&delete e.mesh)}))},Remove.node=function(e,t){e.nodes.splice(t,1),ForEach.skin(e,(function(e){defined(e.skeleton)&&e.skeleton>t&&e.skeleton--,e.joints=e.joints.map((function(e){return e>t?e-1:e}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&e.target.node>t&&e.target.node--}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&e.node>t&&e.node--}))})),ForEach.node(e,(function(e){defined(e.children)&&(e.children=e.children.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e})))})),ForEach.scene(e,(function(e){e.nodes=e.nodes.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e}))}))},Remove.material=function(e,t){e.materials.splice(t,1),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&e.material>t&&e.material--}))}))},Remove.sampler=function(e,t){e.samplers.splice(t,1),ForEach.texture(e,(function(e){defined(e.sampler)&&e.sampler>t&&--e.sampler}))},Remove.texture=function(e,t){if(e.textures.splice(t,1),ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e,n){n.index>t&&--n.index}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const n=e.extensions;if(defined(n)&&defined(n.EXT_feature_metadata)){const e=n.EXT_feature_metadata.featureIdTextures;if(defined(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i].featureIds.texture;n.index>t&&--n.index}}}}))}));const n=e.extensions.EXT_feature_metadata.featureTextures;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(defined(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].texture;n.index>t&&--n.index}}}},getListOfElementsIdsInUse.accessor=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e){t[e]=!0})),ForEach.meshPrimitiveTarget(e,(function(e){ForEach.meshPrimitiveTargetAttribute(e,(function(e){t[e]=!0}))}));const n=e.indices;defined(n)&&(t[n]=!0)}))})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(t[e.inverseBindMatrices]=!0)})),ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){defined(e.input)&&(t[e.input]=!0),defined(e.output)&&(t[e.output]=!0)}))})),usesExtension(e,"EXT_mesh_gpu_instancing")&&ForEach.node(e,(function(e){defined(e.extensions)&&defined(e.extensions.EXT_mesh_gpu_instancing)&&Object.keys(e.extensions.EXT_mesh_gpu_instancing.attributes).forEach((function(n){const i=e.extensions.EXT_mesh_gpu_instancing.attributes[n];t[i]=!0}))})),t},getListOfElementsIdsInUse.buffer=function(e){const t={};return ForEach.bufferView(e,(function(e){defined(e.buffer)&&(t[e.buffer]=!0),defined(e.extensions)&&defined(e.extensions.EXT_meshopt_compression)&&(t[e.extensions.EXT_meshopt_compression.buffer]=!0)})),t},getListOfElementsIdsInUse.bufferView=function(e){const t={};if(ForEach.accessor(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.shader(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),ForEach.image(e,(function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})),usesExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&(t[e.extensions.KHR_draco_mesh_compression.bufferView]=!0)}))})),usesExtension(e,"EXT_feature_metadata")){const n=e.extensions.EXT_feature_metadata.featureTables;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(defined(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e];defined(n.bufferView)&&(t[n.bufferView]=!0),defined(n.arrayOffsetBufferView)&&(t[n.arrayOffsetBufferView]=!0),defined(n.stringOffsetBufferView)&&(t[n.stringOffsetBufferView]=!0)}}}return t},getListOfElementsIdsInUse.image=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.source)&&(t[e.source]=!0),defined(e.extensions)&&defined(e.extensions.EXT_texture_webp)?t[e.extensions.EXT_texture_webp.source]=!0:defined(e.extensions)&&defined(e.extensions.KHR_texture_basisu)&&(t[e.extensions.KHR_texture_basisu.source]=!0)})),t},getListOfElementsIdsInUse.mesh=function(e){const t={};return ForEach.node(e,(function(n){if(defined(n.mesh&&defined(e.meshes))){const i=e.meshes[n.mesh];defined(i)&&defined(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}})),t},getListOfElementsIdsInUse.node=function(e){const t={};return ForEach.skin(e,(function(e){defined(e.skeleton)&&(t[e.skeleton]=!0),ForEach.skinJoint(e,(function(e){t[e]=!0}))})),ForEach.animation(e,(function(e){ForEach.animationChannel(e,(function(e){defined(e.target)&&defined(e.target.node)&&(t[e.target.node]=!0)}))})),ForEach.technique(e,(function(e){ForEach.techniqueUniform(e,(function(e){defined(e.node)&&(t[e.node]=!0)}))})),ForEach.node(e,(function(n,i){nodeIsEmpty(e,i,t)||(t[i]=!0)})),t},getListOfElementsIdsInUse.material=function(e){const t={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.material)&&(t[e.material]=!0)}))})),t},getListOfElementsIdsInUse.texture=function(e){const t={};if(ForEach.material(e,(function(e){forEachTextureInMaterial(e,(function(e){t[e]=!0}))})),usesExtension(e,"EXT_feature_metadata")){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){const n=e.extensions;if(defined(n)&&defined(n.EXT_feature_metadata)){const e=n.EXT_feature_metadata.featureIdTextures;if(defined(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i].featureIds.texture;t[n.index]=!0}}}}))}));const n=e.extensions.EXT_feature_metadata.featureTextures;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(defined(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].texture;t[n.index]=!0}}}return t},getListOfElementsIdsInUse.sampler=function(e){const t={};return ForEach.texture(e,(function(e){defined(e.sampler)&&(t[e.sampler]=!0)})),t};const updateFunctions={.8:glTF08to10,"1.0":glTF10to20,"2.0":void 0};function updateVersion(e,t){const n=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).targetVersion;let i=e.version;e.asset=defaultValue(e.asset,{version:"1.0"}),e.asset.version=defaultValue(e.asset.version,"1.0"),i=defaultValue(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(updateFunctions,i)||(defined(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(updateFunctions,i)||(i="1.0"));let r=updateFunctions[i];for(;defined(r)&&i!==n;)r(e,t),i=e.asset.version,r=updateFunctions[i];return e}function updateInstanceTechniques(e){const t=e.materials;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e],i=n.instanceTechnique;defined(i)&&(n.technique=i.technique,n.values=i.values,delete n.instanceTechnique)}}function setPrimitiveModes(e){const t=e.meshes;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e].primitives;if(defined(n)){const e=n.length;for(let t=0;t<e;++t){const e=n[t],i=defaultValue(e.primitive,WebGLConstants$1.TRIANGLES);e.mode=defaultValue(e.mode,i),delete e.primitive}}}}function updateNodes(e){const t=e.nodes,n=new Cartesian3,i=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];if(defined(r.rotation)){const e=r.rotation;Cartesian3.fromArray(e,0,n),Quaternion.fromAxisAngle(n,e[3],i),r.rotation=[i.x,i.y,i.z,i.w]}const o=r.instanceSkin;defined(o)&&(r.skeletons=o.skeletons,r.skin=o.skin,r.meshes=o.meshes,delete r.instanceSkin)}}function updateAnimations(e){const t=e.animations,n=e.accessors,i=e.bufferViews,r=e.buffers,o={},a=new Cartesian3,s=new Quaternion;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const c=t[e],l=c.channels,u=c.parameters,d=c.samplers;if(defined(l)){const e=l.length;for(let t=0;t<e;++t){const e=l[t];if("rotation"===e.target.path){const t=u[d[e.sampler].output];if(defined(o[t]))continue;o[t]=!0;const c=n[t],l=i[c.bufferView],h=r[l.buffer].extras._pipeline.source,p=h.byteOffset+l.byteOffset+c.byteOffset,f=c.componentType,m=c.count,g=numberOfComponentsForType(c.type),_=c.count*g,y=ComponentDatatype$1.createArrayBufferView(f,h.buffer,p,_);for(let e=0;e<m;e++){const t=e*g;Cartesian3.unpack(y,t,a);const n=y[t+3];Quaternion.fromAxisAngle(a,n,s),Quaternion.pack(s,y,t)}}}}}}function removeTechniquePasses(e){const t=e.techniques;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e],i=n.passes;if(defined(i)){const e=defaultValue(n.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(i,e)){const t=i[e],r=t.instanceProgram;n.attributes=defaultValue(n.attributes,r.attributes),n.program=defaultValue(n.program,r.program),n.uniforms=defaultValue(n.uniforms,r.uniforms),n.states=defaultValue(n.states,t.states)}delete n.passes,delete n.pass}}}function glTF08to10(e){defined(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0","string"==typeof t.profile){const e=t.profile.split(" ");t.profile={api:e[0],version:e[1]}}else t.profile={};if(defined(e.version)&&delete e.version,updateInstanceTechniques(e),setPrimitiveModes(e),updateNodes(e),updateAnimations(e),removeTechniquePasses(e),defined(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),defined(e.lights)){const t=defaultValue(e.extensions,{});e.extensions=t;const n=defaultValue(t.KHR_materials_common,{});t.KHR_materials_common=n,n.lights=e.lights,delete e.lights,addExtensionsUsed(e,"KHR_materials_common")}}function removeAnimationSamplersIndirection(e){const t=e.animations;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e],i=n.parameters;if(defined(i)){const e=n.samplers;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];n.input=i[n.input],n.output=i[n.output]}delete n.parameters}}}function objectToArray(e,t){const n=[];for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const r=e[i];t[i]=n.length,n.push(r),defined(r.name)||(r.name=i)}return n}function objectsToArrays(e){let t;const n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let i;const r={},o=e.nodes;for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&(i=o[e].jointName,defined(i)&&(r[i]=e));for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&defined(n[t])){const i={},r=e[t];e[t]=objectToArray(r,i),n[t]=i}for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n.nodes[r[i]]);defined(e.scene)&&(e.scene=n.scenes[e.scene]),ForEach.bufferView(e,(function(e){defined(e.buffer)&&(e.buffer=n.buffers[e.buffer])})),ForEach.accessor(e,(function(e){defined(e.bufferView)&&(e.bufferView=n.bufferViews[e.bufferView])})),ForEach.shader(e,(function(e){const t=e.extensions;if(defined(t)){const i=t.KHR_binary_glTF;defined(i)&&(e.bufferView=n.bufferViews[i.bufferView],delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.program(e,(function(e){defined(e.vertexShader)&&(e.vertexShader=n.shaders[e.vertexShader]),defined(e.fragmentShader)&&(e.fragmentShader=n.shaders[e.fragmentShader])})),ForEach.technique(e,(function(e){defined(e.program)&&(e.program=n.programs[e.program]),ForEach.techniqueParameter(e,(function(e){defined(e.node)&&(e.node=n.nodes[e.node]);const t=e.value;"string"==typeof t&&(e.value={index:n.textures[t]})}))})),ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){defined(e.indices)&&(e.indices=n.accessors[e.indices]),ForEach.meshPrimitiveAttribute(e,(function(t,i){e.attributes[i]=n.accessors[t]})),defined(e.material)&&(e.material=n.materials[e.material])}))})),ForEach.node(e,(function(i){let r=i.children;if(defined(r)){const e=r.length;for(t=0;t<e;++t)r[t]=n.nodes[r[t]]}if(defined(i.meshes)){const o=i.meshes,a=o.length;if(a>0)for(i.mesh=n.meshes[o[0]],t=1;t<a;++t){const a={mesh:n.meshes[o[t]]},s=addToArray(e.nodes,a);defined(r)||(r=[],i.children=r),r.push(s)}delete i.meshes}if(defined(i.camera)&&(i.camera=n.cameras[i.camera]),defined(i.skin)&&(i.skin=n.skins[i.skin]),defined(i.skeletons)){const t=i.skeletons;if(t.length>0&&defined(i.skin)){e.skins[i.skin].skeleton=n.nodes[t[0]]}delete i.skeletons}defined(i.jointName)&&delete i.jointName})),ForEach.skin(e,(function(e){defined(e.inverseBindMatrices)&&(e.inverseBindMatrices=n.accessors[e.inverseBindMatrices]);const i=e.jointNames;if(defined(i)){const n=[],o=i.length;for(t=0;t<o;++t)n[t]=r[i[t]];e.joints=n,delete e.jointNames}})),ForEach.scene(e,(function(e){const i=e.nodes;if(defined(i)){const e=i.length;for(t=0;t<e;++t)i[t]=n.nodes[i[t]]}})),ForEach.animation(e,(function(e){const t={};e.samplers=objectToArray(e.samplers,t),ForEach.animationSampler(e,(function(e){e.input=n.accessors[e.input],e.output=n.accessors[e.output]})),ForEach.animationChannel(e,(function(e){e.sampler=t[e.sampler];const i=e.target;defined(i)&&(i.node=n.nodes[i.id],delete i.id)}))})),ForEach.material(e,(function(e){defined(e.technique)&&(e.technique=n.techniques[e.technique]),ForEach.materialValue(e,(function(t,i){"string"==typeof t&&(e.values[i]={index:n.textures[t]})}));const t=e.extensions;if(defined(t)){const e=t.KHR_materials_common;defined(e)&&ForEach.materialValue(e,(function(t,i){"string"==typeof t&&(e.values[i]={index:n.textures[t]})}))}})),ForEach.image(e,(function(e){const t=e.extensions;if(defined(t)){const i=t.KHR_binary_glTF;defined(i)&&(e.bufferView=n.bufferViews[i.bufferView],e.mimeType=i.mimeType,delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),ForEach.texture(e,(function(e){defined(e.sampler)&&(e.sampler=n.samplers[e.sampler]),defined(e.source)&&(e.source=n.images[e.source])}))}function removeAnimationSamplerNames(e){ForEach.animation(e,(function(e){ForEach.animationSampler(e,(function(e){delete e.name}))}))}function removeEmptyArrays(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];Array.isArray(n)&&0===n.length&&delete e[t]}ForEach.node(e,(function(e){defined(e.children)&&0===e.children.length&&delete e.children}))}function stripAsset(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const knownExtensions={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function requireKnownExtensions(e){const t=e.extensionsUsed;if(e.extensionsRequired=defaultValue(e.extensionsRequired,[]),defined(t)){const n=t.length;for(let i=0;i<n;++i){const n=t[i];defined(knownExtensions[n])&&e.extensionsRequired.push(n)}}}function removeBufferType(e){ForEach.buffer(e,(function(e){delete e.type}))}function removeTextureProperties(e){ForEach.texture(e,(function(e){delete e.format,delete e.internalFormat,delete e.target,delete e.type}))}function requireAttributeSetIndex(e){ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(t,n){"TEXCOORD"===n?e.attributes.TEXCOORD_0=t:"COLOR"===n&&(e.attributes.COLOR_0=t)})),delete e.attributes.TEXCOORD,delete e.attributes.COLOR}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const t=e.semantic;defined(t)&&("TEXCOORD"===t?e.semantic="TEXCOORD_0":"COLOR"===t&&(e.semantic="COLOR_0"))}))}))}const knownSemantics={POSITION:!0,NORMAL:!0,TANGENT:!0},indexedSemantics={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function underscoreApplicationSpecificSemantics(e){const t={};ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){ForEach.meshPrimitiveAttribute(e,(function(e,n){if("_"!==n.charAt(0)){const e=n.search(/_[0-9]+/g);let i,r=n,o="_0";e>=0&&(r=n.substring(0,e),o=n.substring(e));const a=indexedSemantics[r];defined(a)?(i=a+o,t[n]=i):defined(knownSemantics[r])||(i="_"+n,t[n]=i)}}));for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],r=e.attributes[n];defined(r)&&(delete e.attributes[n],e.attributes[i]=r)}}))})),ForEach.technique(e,(function(e){ForEach.techniqueParameter(e,(function(e){const n=t[e.semantic];defined(n)&&(e.semantic=n)}))}))}function clampCameraParameters(e){ForEach.camera(e,(function(e){const t=e.perspective;if(defined(t)){const e=t.aspectRatio;defined(e)&&0===e&&delete t.aspectRatio;const n=t.yfov;defined(n)&&0===n&&(t.yfov=1)}}))}function computeAccessorByteStride(e,t){return defined(t.byteStride)&&0!==t.byteStride?t.byteStride:getAccessorByteStride(e,t)}function requireByteLength(e){ForEach.buffer(e,(function(e){defined(e.byteLength)||(e.byteLength=e.extras._pipeline.source.length)})),ForEach.accessor(e,(function(t){const n=t.bufferView;if(defined(n)){const i=e.bufferViews[n],r=computeAccessorByteStride(e,t),o=t.byteOffset+t.count*r;i.byteLength=Math.max(defaultValue(i.byteLength,0),o)}}))}function moveByteStrideToBufferView(e){let t,n,i;const r=e.bufferViews,o={};ForEach.accessorContainingVertexAttributeData(e,(function(t){const n=e.accessors[t];defined(n.bufferView)&&(o[n.bufferView]=!0)}));const a={};ForEach.accessor(e,(function(e){defined(e.bufferView)&&(a[e.bufferView]=defaultValue(a[e.bufferView],[]),a[e.bufferView].push(e))}));for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){i=r[s];const c=a[s];c.sort((function(e,t){return e.byteOffset-t.byteOffset}));let l=0,u=0;const d=c.length;for(t=0;t<d;++t){let a=c[t];const h=computeAccessorByteStride(e,a),p=a.byteOffset,f=a.count*h;delete a.byteStride;const m=t<d-1;if(h!==(m?computeAccessorByteStride(e,c[t+1]):void 0)){const e=clone$1(i,!0);o[s]&&(e.byteStride=h),e.byteOffset+=l,e.byteLength=p+f-l;const d=addToArray(r,e);for(n=u;n<=t;++n)a=c[n],a.bufferView=d,a.byteOffset=a.byteOffset-l;l=m?c[t+1].byteOffset:void 0,u=t+1}}}removeUnusedElements(e,["accessor","bufferView","buffer"])}function requirePositionAccessorMinMax(e){ForEach.accessorWithSemantic(e,"POSITION",(function(t){const n=e.accessors[t];if(!defined(n.min)||!defined(n.max)){const t=findAccessorMinMax(e,n);n.min=t.min,n.max=t.max}}))}function isNodeEmpty(e){return(!defined(e.children)||0===e.children.length)&&(!defined(e.meshes)||0===e.meshes.length)&&!defined(e.camera)&&!defined(e.skin)&&!defined(e.skeletons)&&!defined(e.jointName)&&(!defined(e.translation)||Cartesian3.fromArray(e.translation).equals(Cartesian3.ZERO))&&(!defined(e.scale)||Cartesian3.fromArray(e.scale).equals(new Cartesian3(1,1,1)))&&(!defined(e.rotation)||Cartesian4.fromArray(e.rotation).equals(new Cartesian4(0,0,0,1)))&&(!defined(e.matrix)||Matrix4.fromColumnMajorArray(e.matrix).equals(Matrix4.IDENTITY))&&!defined(e.extensions)&&!defined(e.extras)}function deleteNode(e,t){ForEach.scene(e,(function(e){const n=e.nodes;if(defined(n)){for(let e=n.length;e>=0;--e)if(n[e]===t)return void n.splice(e,1)}})),ForEach.node(e,(function(n,i){if(defined(n.children)){const r=n.children.indexOf(t);r>-1&&(n.children.splice(r,1),isNodeEmpty(n)&&deleteNode(e,i))}})),delete e.nodes[t]}function removeEmptyNodes(e){return ForEach.node(e,(function(t,n){isNodeEmpty(t)&&deleteNode(e,n)})),e}function requireAnimationAccessorMinMax(e){ForEach.animation(e,(function(t){ForEach.animationSampler(t,(function(t){const n=e.accessors[t.input];if(!defined(n.min)||!defined(n.max)){const t=findAccessorMinMax(e,n);n.min=t.min,n.max=t.max}}))}))}function glTF10to20(e){e.asset=defaultValue(e.asset,{}),e.asset.version="2.0",updateInstanceTechniques(e),removeAnimationSamplersIndirection(e),removeEmptyNodes(e),objectsToArrays(e),removeAnimationSamplerNames(e),stripAsset(e),requireKnownExtensions(e),requireByteLength(e),moveByteStrideToBufferView(e),requirePositionAccessorMinMax(e),requireAnimationAccessorMinMax(e),removeBufferType(e),removeTextureProperties(e),requireAttributeSetIndex(e),underscoreApplicationSpecificSemantics(e),updateAccessorComponentTypes(e),clampCameraParameters(e),moveTechniqueRenderStates(e),moveTechniquesToExtension(e),removeEmptyArrays(e)}function ModelLoadResources(){this.initialized=!1,this.resourcesParsed=!1,this.vertexBuffersToCreate=new Queue,this.indexBuffersToCreate=new Queue,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new Queue,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new Queue,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new Queue,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.createdBufferViews={},this.primitivesToDecode=new Queue,this.activeDecodingTasks=0,this.pendingDecodingCache=!1,this.skinnedNodesIds=[]}function getSubarray(e,t,n){return e.subarray(t,t+n)}ModelLoadResources.prototype.getBuffer=function(e){return getSubarray(this.buffers[e.buffer],e.byteOffset,e.byteLength)},ModelLoadResources.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},ModelLoadResources.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length},ModelLoadResources.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},ModelLoadResources.prototype.finishedTextureCreation=function(){const e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},ModelLoadResources.prototype.finishedEverythingButTextureCreation=function(){const e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return this.finishedDecoding()&&e&&t},ModelLoadResources.prototype.finishedDecoding=function(){return 0===this.primitivesToDecode.length&&0===this.activeDecodingTasks&&!this.pendingDecodingCache},ModelLoadResources.prototype.finished=function(){return this.finishedDecoding()&&this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()};const ModelUtility={updateForwardAxis:function(e){const t=e.gltf.extras.sourceVersion;(defined(t)&&"2.0"!==t||"2.0"!==ModelUtility.getAssetVersion(e.gltf))&&(e._gltfForwardAxis=Axis$1.X)},getAssetVersion:function(e){return defined(e.asset)&&defined(e.asset.version)?e.asset.version:"1.0"},splitIncompatibleMaterials:function(e){const t=e.accessors,n=e.materials,i={};return ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){let r=e.material;const o=n[r],a=e.attributes.JOINTS_0;let s,c;if(defined(a)){const e=t[a];s=e.componentType,c=e.type}const l=defined(a)&&"VEC4"===c,u=defined(e.attributes.COLOR_0),d=defined(e.targets),h=defined(e.attributes.NORMAL),p=defined(e.attributes.TANGENT),f=defined(e.attributes.TEXCOORD_0),m=f&&defined(e.attributes.TEXCOORD_1),g=defined(e.extensions)&&defined(e.extensions.CESIUM_primitive_outline),_=i[r];if(defined(_)){if(_.skinning.skinned!==l||_.hasVertexColors!==u||_.hasMorphTargets!==d||_.hasNormals!==h||_.hasTangents!==p||_.hasTexCoords!==f||_.hasTexCoord1!==m||_.hasOutline!==g){const t=clone$1(o,!0);r=addToArray(n,t),e.material=r,i[r]={skinning:{skinned:l,componentType:s},hasVertexColors:u,hasMorphTargets:d,hasNormals:h,hasTangents:p,hasTexCoords:f,hasTexCoord1:m,hasOutline:g}}}else i[r]={skinning:{skinned:l,componentType:s},hasVertexColors:u,hasMorphTargets:d,hasNormals:h,hasTangents:p,hasTexCoords:f,hasTexCoord1:m,hasOutline:g}}))})),i},getShaderVariable:function(e){return"SCALAR"===e?"float":e.toLowerCase()},ModelState:{NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},getFailedLoadFunction:function(e,t,n){return function(i){e._state=ModelUtility.ModelState.FAILED;let r="Failed to load "+t+": "+n;defined(i)&&(r+="\n"+i.message),e._readyPromise.reject(new RuntimeError(r))}},parseBuffers:function(e,t){const n=e._loadResources;ForEach.buffer(e.gltf,(function(i,r){if(defined(i.extras._pipeline.source))n.buffers[r]=i.extras._pipeline.source;else if(defined(t)){const o=e._resource.getDerivedResource({url:i.uri});++n.pendingBufferLoads,o.fetchArrayBuffer().then(t(e,r)).otherwise(ModelUtility.getFailedLoadFunction(e,"buffer",o.url))}}))}},aMinScratch=new Cartesian3,aMaxScratch=new Cartesian3;function techniqueAttributeForSemantic(e,t){return ForEach.techniqueAttribute(e,(function(e,n){if(e.semantic===t)return n}))}function ensureSemanticExistenceForPrimitive(e,t){const n=e.accessors,i=e.materials,r=e.extensions.KHR_techniques_webgl,o=r.techniques,a=r.programs,s=r.shaders,c=t.targets,l=t.attributes;for(const e in c)if(c.hasOwnProperty(e)){const t=c[e];for(const n in t)"extras"!==n&&(l[n+"_"+e]=t[n])}const u=o[i[t.material].extensions.KHR_techniques_webgl.technique],d=s[a[u.program].vertexShader];for(const e in l)if(l.hasOwnProperty(e)&&!defined(techniqueAttributeForSemantic(u,e))){const t=n[l[e]];let i=e.toLowerCase();"_"===i.charAt(0)&&(i=i.slice(1));const r="a_"+i;u.attributes[r]={semantic:e,type:t.componentType};const o=d.extras._pipeline;let a=o.source;a="attribute "+ModelUtility.getShaderVariable(t.type)+" "+r+";\n"+a,o.source=a}}function getTechniqueAttributeOrUniformFunction(e,t,n,i){return usesExtension(e,"KHR_techniques_webgl")?function(e,t){if(!(e.semantic!==n||i&&defined(e.node)))return t}:function(e,r){const o=t.parameters[e];if(!(o.semantic!==n||i&&defined(o.node)))return r}}ModelUtility.computeBoundingSphere=function(e){const t=e.gltf,n=t.nodes,i=t.meshes,r=t.scenes[t.scene].nodes,o=r.length,a=[],s=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),c=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let e=0;e<o;++e){let o=n[r[e]];for(o._transformToRoot=ModelUtility.getTransform(o),a.push(o);a.length>0;){o=a.pop();const e=o._transformToRoot,r=o.mesh;if(defined(r)){const n=i[r].primitives,o=n.length;for(let i=0;i<o;++i){const r=n[i].attributes.POSITION;if(defined(r)){const n=ModelUtility.getAccessorMinMax(t,r);if(defined(n.min)&&defined(n.max)){const t=Cartesian3.fromArray(n.min,0,aMinScratch),i=Cartesian3.fromArray(n.max,0,aMaxScratch);Matrix4.multiplyByPoint(e,t,t),Matrix4.multiplyByPoint(e,i,i),Cartesian3.minimumByComponent(s,t,s),Cartesian3.maximumByComponent(c,i,c)}}}}const l=o.children;if(defined(l)){const t=l.length;for(let i=0;i<t;++i){const t=n[l[i]];t._transformToRoot=ModelUtility.getTransform(t),Matrix4.multiplyTransformation(e,t._transformToRoot,t._transformToRoot),a.push(t)}}delete o._transformToRoot}}const l=BoundingSphere.fromCornerPoints(s,c);return e._forwardAxis===Axis$1.Z&&BoundingSphere.transformWithoutScale(l,Axis$1.Z_UP_TO_X_UP,l),e._upAxis===Axis$1.Y?BoundingSphere.transformWithoutScale(l,Axis$1.Y_UP_TO_Z_UP,l):e._upAxis===Axis$1.X&&BoundingSphere.transformWithoutScale(l,Axis$1.X_UP_TO_Z_UP,l),l},ModelUtility.ensureSemanticExistence=function(e){return ForEach.mesh(e,(function(t){ForEach.meshPrimitive(t,(function(t){ensureSemanticExistenceForPrimitive(e,t)}))})),e},ModelUtility.createAttributeLocations=function(e,t){const n={};let i=!1,r=1;if(ForEach.techniqueAttribute(e,(function(e,t){/pos/i.test(t)&&!i?(n[t]=0,i=!0):n[t]=r++})),defined(t))for(const e in t)t.hasOwnProperty(e)&&(n[e]=r++);return n},ModelUtility.getAccessorMinMax=function(e,t){const n=e.accessors[t],i=n.extensions;let r=n.min,o=n.max;if(defined(i)){const e=i.WEB3D_quantized_attributes;defined(e)&&(r=e.decodedMin,o=e.decodedMax)}return{min:r,max:o}},ModelUtility.getAttributeOrUniformBySemantic=function(e,t,n,i){return ForEach.technique(e,(function(r){if(defined(n)&&r.program!==n)return;const o=ForEach.techniqueAttribute(r,getTechniqueAttributeOrUniformFunction(e,r,t,i));return defined(o)?o:ForEach.techniqueUniform(r,getTechniqueAttributeOrUniformFunction(e,r,t,i))}))},ModelUtility.getDiffuseAttributeOrUniform=function(e,t){let n=ModelUtility.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return defined(n)||(n=ModelUtility.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),n};const nodeTranslationScratch=new Cartesian3,nodeQuaternionScratch=new Quaternion,nodeScaleScratch=new Cartesian3;function replaceAllButFirstInString(e,t,n){t+="(?!\\w)",t=new RegExp(t,"g");const i=e.search(t);return e.replace(t,(function(e,t){return i===t?e:n}))}function getQuantizedAttributes(e,t){const n=e.accessors[t].extensions;if(defined(n))return n.WEB3D_quantized_attributes}function getAttributeVariableName(e,t,n){const i=t.material,r=e.materials[i];if(!usesExtension(e,"KHR_techniques_webgl")||!defined(r.extensions)||!defined(r.extensions.KHR_techniques_webgl))return;const o=r.extensions.KHR_techniques_webgl.technique,a=e.extensions.KHR_techniques_webgl.techniques[o];return ForEach.techniqueAttribute(a,(function(e,t){if(e.semantic===n)return t}))}function getScalarUniformFunction(e){const t={value:e,clone:function(e,t){return e},func:function(){return t.value}};return t}function getVec2UniformFunction(e){const t={value:Cartesian2.fromArray(e),clone:Cartesian2.clone,func:function(){return t.value}};return t}function getVec3UniformFunction(e){const t={value:Cartesian3.fromArray(e),clone:Cartesian3.clone,func:function(){return t.value}};return t}function getVec4UniformFunction(e){const t={value:Cartesian4.fromArray(e),clone:Cartesian4.clone,func:function(){return t.value}};return t}function getMat2UniformFunction(e){const t={value:Matrix2.fromColumnMajorArray(e),clone:Matrix2.clone,func:function(){return t.value}};return t}function getMat3UniformFunction(e){const t={value:Matrix3.fromColumnMajorArray(e),clone:Matrix3.clone,func:function(){return t.value}};return t}function getMat4UniformFunction(e){const t={value:Matrix4.fromColumnMajorArray(e),clone:Matrix4.clone,func:function(){return t.value}};return t}function DelayLoadedTextureUniform(e,t,n){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=n}function getTextureUniformFunction(e,t,n){const i=new DelayLoadedTextureUniform(e,t,n);return i.func=function(){return i.value},i}ModelUtility.getTransform=function(e,t){return defined(e.matrix)?Matrix4.fromColumnMajorArray(e.matrix,t):Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.fromArray(e.translation,0,nodeTranslationScratch),Quaternion.unpack(e.rotation,0,nodeQuaternionScratch),Cartesian3.fromArray(e.scale,0,nodeScaleScratch),t)},ModelUtility.getUsedExtensions=function(e){const t=e.extensionsUsed,n={};if(defined(t)){const e=t.length;for(let i=0;i<e;i++){n[t[i]]=!0}}return n},ModelUtility.getRequiredExtensions=function(e){const t=e.extensionsRequired,n={};if(defined(t)){const e=t.length;for(let i=0;i<e;i++){n[t[i]]=!0}}return n},ModelUtility.supportedExtensions={AGI_articulations:!0,CESIUM_RTC:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_binary_glTF:!0,KHR_texture_basisu:!0,KHR_draco_mesh_compression:!0,KHR_materials_common:!0,KHR_techniques_webgl:!0,KHR_materials_unlit:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0},ModelUtility.checkSupportedExtensions=function(e,t){for(const n in e)if(e.hasOwnProperty(n)){if(!ModelUtility.supportedExtensions[n])throw new RuntimeError("Unsupported glTF Extension: "+n);if("EXT_texture_webp"===n&&!1===t)throw new RuntimeError("Loaded model requires WebP but browser does not support it.")}},ModelUtility.checkSupportedGlExtensions=function(e,t){if(defined(e)){const n=e.length;for(let i=0;i<n;i++){const n=e[i];if("OES_element_index_uint"!==n)throw new RuntimeError("Unsupported WebGL Extension: "+n);if(!t.elementIndexUint)throw new RuntimeError("OES_element_index_uint WebGL extension is not enabled.")}}},ModelUtility.modifyShaderForDracoQuantizedAttributes=function(e,t,n,i){const r={};for(let o in i)if(i.hasOwnProperty(o)){const a=i[o],s=a.quantization;if(!defined(s))continue;const c=getAttributeVariableName(e,t,o);"_"===o.charAt(0)&&(o=o.substring(1));const l="gltf_u_dec_"+o.toLowerCase();if(!defined(r[l])){const e="gltf_decoded_"+o,t=c.replace("a_","gltf_a_dec_"),i=a.componentsPerAttribute;let r;n=replaceAllButFirstInString(n,c,t),r=s.octEncoded?"vec3":i>1?"vec"+i:"float",n=r+" "+t+";\n"+n;const u=3===i&&"COLOR_0"===o;u&&(n=replaceAllButFirstInString(n,t,"vec4("+t+", 1.0)"));let d="";if(s.octEncoded){const i=l+"_rangeConstant";n="uniform float "+i+";\n"+n,d="\nvoid main() {\n "+t+" = czm_octDecode("+c+".xy, "+i+").zxy;\n "+e+"();\n}\n"}else{const i=l+"_normConstant",o=l+"_min";n="uniform float "+i+";\nuniform "+r+" "+o+";\n"+n;d="\nvoid main() {\n "+t+" = "+o+" + "+c+(u?".xyz":"")+" * "+i+";\n "+e+"();\n}\n"}n=ShaderSource.replaceMain(n,e),n+=d}}return{shader:n}},ModelUtility.modifyShaderForQuantizedAttributes=function(e,t,n){const i={},r=t.attributes;for(let o in r)if(r.hasOwnProperty(o)){const r=getAttributeVariableName(e,t,o),a=t.attributes[o];"_"===o.charAt(0)&&(o=o.substring(1));const s="gltf_u_dec_"+o.toLowerCase(),c=s+"_scale",l=s+"_translate";if(!defined(i[s])&&!defined(i[c])){const t=getQuantizedAttributes(e,a);if(defined(t)){const e=t.decodeMatrix,a="gltf_decoded_"+o,u=r.replace("a_","gltf_a_dec_"),d=Math.floor(Math.sqrt(e.length));let h;n=replaceAllButFirstInString(n,r,u),h=d>2?"vec"+(d-1):"float",n=h+" "+u+";\n"+n;let p="";5===d?(n="uniform vec4 "+l+";\n"+(n="uniform mat4 "+c+";\n"+n),p="\nvoid main() {\n "+u+" = "+c+" * "+r+" + "+l+";\n "+a+"();\n}\n",i[c]={mat:4},i[l]={vec:4}):(n="uniform mat"+d+" "+s+";\n"+n,p="\nvoid main() {\n "+u+" = "+h+"("+s+" * vec"+d+"("+r+",1.0));\n "+a+"();\n}\n",i[s]={mat:d}),n=ShaderSource.replaceMain(n,a),n+=p}}}return{shader:n,uniforms:i}},Object.defineProperties(DelayLoadedTextureUniform.prototype,{value:{get:function(){if(!defined(this._value)){const e=this._textures[this._textureId];if(!defined(e))return this._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),DelayLoadedTextureUniform.prototype.clone=function(e){return e},DelayLoadedTextureUniform.prototype.func=void 0;const gltfUniformFunctions={};function scaleFromMatrix5Array(e){return[e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]]}function translateFromMatrix5Array(e){return[e[20],e[21],e[22],e[23]]}gltfUniformFunctions[WebGLConstants$1.FLOAT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT2]=getMat2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT3]=getMat3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT4]=getMat4UniformFunction,gltfUniformFunctions[WebGLConstants$1.SAMPLER_2D]=getTextureUniformFunction,ModelUtility.createUniformFunction=function(e,t,n,i){return gltfUniformFunctions[e](t,n,i)},ModelUtility.createUniformsForDracoQuantizedAttributes=function(e){const t={};for(let n in e)if(e.hasOwnProperty(n)){const i=e[n],r=i.quantization;if(!defined(r))continue;"_"===n.charAt(0)&&(n=n.substring(1));const o="gltf_u_dec_"+n.toLowerCase();if(r.octEncoded){const e=o+"_rangeConstant",n=(1<<r.quantizationBits)-1;t[e]=getScalarUniformFunction(n).func;continue}const a=o+"_normConstant",s=r.range/(1<<r.quantizationBits);t[a]=getScalarUniformFunction(s).func;const c=o+"_min";switch(i.componentsPerAttribute){case 1:t[c]=getScalarUniformFunction(r.minValues).func;break;case 2:t[c]=getVec2UniformFunction(r.minValues).func;break;case 3:t[c]=getVec3UniformFunction(r.minValues).func;break;case 4:t[c]=getVec4UniformFunction(r.minValues).func}}return t},ModelUtility.createUniformsForQuantizedAttributes=function(e,t,n){const i=e.accessors,r={},o={},a=t.attributes;for(let e in a)if(a.hasOwnProperty(e)){const t=i[a[e]],n=t.extensions;if("_"===e.charAt(0)&&(e=e.substring(1)),defined(n)){const i=n.WEB3D_quantized_attributes;if(defined(i)){const n=i.decodeMatrix,a="gltf_u_dec_"+e.toLowerCase();let s,c;switch(t.type){case AttributeType$1.SCALAR:o[a]=getMat2UniformFunction(n).func,r[a]=!0;break;case AttributeType$1.VEC2:o[a]=getMat3UniformFunction(n).func,r[a]=!0;break;case AttributeType$1.VEC3:o[a]=getMat4UniformFunction(n).func,r[a]=!0;break;case AttributeType$1.VEC4:s=a+"_scale",c=a+"_translate",o[s]=getMat4UniformFunction(scaleFromMatrix5Array(n)).func,o[c]=getVec4UniformFunction(translateFromMatrix5Array(n)).func,r[s]=!0,r[c]=!0}}}}for(const e in n)if(n.hasOwnProperty(e)&&!r[e]){const t=n[e];defined(t.mat)&&(2===t.mat?o[e]=getMat2UniformFunction(Matrix2.IDENTITY).func:3===t.mat?o[e]=getMat3UniformFunction(Matrix3.IDENTITY).func:4===t.mat&&(o[e]=getMat4UniformFunction(Matrix4.IDENTITY).func)),defined(t.vec)&&4===t.vec&&(o[e]=getVec4UniformFunction([0,0,0,0]).func)}return o};const scratchTranslationRtc=new Cartesian3,gltfSemanticUniforms$1={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){const n=new Matrix4;return function(){return defined(t._rtcCenter)?(Matrix4.getTranslation(e.model,scratchTranslationRtc),Cartesian3.add(scratchTranslationRtc,t._rtcCenter,scratchTranslationRtc),Matrix4.multiplyByPoint(e.view,scratchTranslationRtc,scratchTranslationRtc),Matrix4.setTranslation(e.modelView,scratchTranslationRtc,n)):e.modelView}},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.inverseTransposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};function processModelMaterialsCommon(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),!defined(e))return;if(!usesExtension(e,"KHR_materials_common"))return;usesExtension(e,"KHR_techniques_webgl")||(defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl"));const n=e.extensions.KHR_techniques_webgl;lightDefaults(e);const i=generateLightParameters(e),r=ModelUtility.splitIncompatibleMaterials(e),o={};let a=!1;return ForEach.material(e,(function(s,c){if(defined(s.extensions)&&defined(s.extensions.KHR_materials_common)){const l=s.extensions.KHR_materials_common,u=r[c],d=getTechniqueKey(l,u);let h=o[d];defined(h)||(h=generateTechnique$1(e,n,u,l,i,t.addBatchIdToGeneratedShaders),o[d]=h,a=!0);const p={},f=l.values;let m;for(const e in f)f.hasOwnProperty(e)&&"transparent"!==e&&"doubleSided"!==e&&(m="u_"+e.toLowerCase(),p[m]=f[e]);s.extensions.KHR_techniques_webgl={technique:h,values:p},s.alphaMode="OPAQUE",l.transparent&&(s.alphaMode="BLEND"),l.doubleSided&&(s.doubleSided=!0)}})),a?(ModelUtility.ensureSemanticExistence(e),e):e}function generateLightParameters(e){const t={};let n;if(defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(n=e.extensions.KHR_materials_common.lights),defined(n)){const i=e.nodes;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];if(defined(t.extensions)&&defined(t.extensions.KHR_materials_common)){const i=t.extensions.KHR_materials_common.light;defined(i)&&defined(n[i])&&(n[i].node=e),delete t.extensions.KHR_materials_common}}let r=0;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e],o=i.type;if("ambient"!==o&&!defined(i.node)){delete n[e];continue}const a="light"+r.toString();let s,c,l,u;switch(i.baseName=a,o){case"ambient":s=i.ambient,t[a+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:s.color};break;case"directional":c=i.directional,t[a+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:c.color},defined(i.node)&&(t[a+"Transform"]={node:i.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4});break;case"point":l=i.point,t[a+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:l.color},defined(i.node)&&(t[a+"Transform"]={node:i.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4}),t[a+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[l.constantAttenuation,l.linearAttenuation,l.quadraticAttenuation]};break;case"spot":u=i.spot,t[a+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:u.color},defined(i.node)&&(t[a+"Transform"]={node:i.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},t[a+"InverseTransform"]={node:i.node,semantic:"MODELVIEWINVERSE",type:WebGLConstants$1.FLOAT_MAT4,useInFragment:!0}),t[a+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[u.constantAttenuation,u.linearAttenuation,u.quadraticAttenuation]},t[a+"FallOff"]={type:WebGLConstants$1.FLOAT_VEC2,value:[u.fallOffAngle,u.fallOffExponent]}}++r}}return t}function generateTechnique$1(e,t,n,i,r,o){defined(i)||(i={}),o=defaultValue(o,!1);const a=t.techniques,s=t.shaders,c=t.programs,l=i.technique.toUpperCase();let u;defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(u=e.extensions.KHR_materials_common.lights);const d=i.values,h=defaultValue(i.jointCount,0);let p,f=!1,m=!1;defined(n)&&(p=n.skinning,f=p.skinned,m=n.hasVertexColors);let g="precision highp float;\n",_="precision highp float;\n";const y="CONSTANT"!==l,C={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};let T;y&&(C.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),f&&(C.u_jointMatrix={count:h,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4});let S=!1;for(const e in d)if(d.hasOwnProperty(e)&&"transparent"!==e&&"doubleSided"!==e){const t=getKHRMaterialsCommonValueType(e,d[e]);T="u_"+e.toLowerCase(),S||t!==WebGLConstants$1.SAMPLER_2D||(S=!0),C[T]={type:t}}if(defined(C.u_diffuse)&&(C.u_diffuse.semantic="_3DTILESDIFFUSE"),defined(r))for(const e in r)r.hasOwnProperty(e)&&(T="u_"+e,C[T]=r[e]);for(T in C)if(C.hasOwnProperty(T)){const e=C[T],t=defined(e.count)?"["+e.count+"]":"";e.type!==WebGLConstants$1.FLOAT_MAT3&&e.type!==WebGLConstants$1.FLOAT_MAT4||e.useInFragment?(_+="uniform "+webGLConstantToGlslType(e.type)+" "+T+t+";\n",delete e.useInFragment):g+="uniform "+webGLConstantToGlslType(e.type)+" "+T+t+";\n"}let A="";f&&(A+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");const v={a_position:{semantic:"POSITION"}};let E;g+="attribute vec3 a_position;\n",g+="varying vec3 v_positionEC;\n",A+=f?" vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",A+=" v_positionEC = pos.xyz;\n",A+=" gl_Position = u_projectionMatrix * pos;\n",_+="varying vec3 v_positionEC;\n",y&&(v.a_normal={semantic:"NORMAL"},g+="attribute vec3 a_normal;\n",g+="varying vec3 v_normal;\n",A+=f?" v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",_+="varying vec3 v_normal;\n"),S&&(v.a_texcoord_0={semantic:"TEXCOORD_0"},E="v_texcoord_0",g+="attribute vec2 a_texcoord_0;\n",g+="varying vec2 "+E+";\n",A+=" "+E+" = a_texcoord_0;\n",_+="varying vec2 "+E+";\n"),f&&(v.a_joint={semantic:"JOINTS_0"},v.a_weight={semantic:"WEIGHTS_0"},g+="attribute vec4 a_joint;\n",g+="attribute vec4 a_weight;\n"),m&&(v.a_vertexColor={semantic:"COLOR_0"},g+="attribute vec4 a_vertexColor;\n",g+="varying vec4 v_vertexColor;\n",A+=" v_vertexColor = a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n"),o&&(v.a_batchId={semantic:"_BATCHID"},g+="attribute float a_batchId;\n");const b=y&&("BLINN"===l||"PHONG"===l)&&defined(C.u_specular)&&defined(C.u_shininess)&&C.u_shininess>0;let x=!1,P=!1,D="";for(const e in u)if(u.hasOwnProperty(e)){const t=u[e],n=t.type.toLowerCase(),i=t.baseName;D+=" {\n";const r="u_"+i+"Color";if("ambient"===n)P=!0,D+=" ambientLight += "+r+";\n";else if(y){x=!0;const e="v_"+i+"Direction",t="v_"+i+"Position";"point"!==n&&(g+="varying vec3 "+e+";\n",_+="varying vec3 "+e+";\n",A+=" "+e+" = mat3(u_"+i+"Transform) * vec3(0.,0.,1.);\n","directional"===n&&(D+=" vec3 l = normalize("+e+");\n")),"directional"!==n?(g+="varying vec3 "+t+";\n",_+="varying vec3 "+t+";\n",A+=" "+t+" = u_"+i+"Transform[3].xyz;\n",D+=" vec3 VP = "+t+" - v_positionEC;\n",D+=" vec3 l = normalize(VP);\n",D+=" float range = length(VP);\n",D+=" float attenuation = 1.0 / (u_"+i+"Attenuation.x + ",D+="(u_"+i+"Attenuation.y * range) + ",D+="(u_"+i+"Attenuation.z * range * range));\n"):D+=" float attenuation = 1.0;\n","spot"===n&&(D+=" float spotDot = dot(l, normalize("+e+"));\n",D+=" if (spotDot < cos(u_"+i+"FallOff.x * 0.5))\n",D+=" {\n",D+=" attenuation = 0.0;\n",D+=" }\n",D+=" else\n",D+=" {\n",D+=" attenuation *= max(0.0, pow(spotDot, u_"+i+"FallOff.y));\n",D+=" }\n"),D+=" diffuseLight += "+r+"* max(dot(normal,l), 0.) * attenuation;\n",b&&("BLINN"===l?(D+=" vec3 h = normalize(l + viewDir);\n",D+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(D+=" vec3 reflectDir = reflect(-l, normal);\n",D+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),D+=" specularLight += "+r+" * specularIntensity;\n")}D+=" }\n"}if(P||(D+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),!x&&"CONSTANT"!==l){_+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",_+="uniform vec3 gltf_lightColor; \n",_+="#endif \n",D+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",D+=" vec3 lightColor = czm_lightColor;\n",D+="#else \n",D+=" vec3 lightColor = gltf_lightColor;\n",D+="#endif \n",D+=" vec3 l = normalize(czm_lightDirectionEC);\n";D+=" diffuseLight += lightColor * max(dot(normal,l), "+"0.2"+");\n",b&&("BLINN"===l?(D+=" vec3 h = normalize(l + viewDir);\n",D+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(D+=" vec3 reflectDir = reflect(-l, normal);\n",D+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),D+=" specularLight += lightColor * specularIntensity;\n")}g+="void main(void) {\n",g+=A,g+="}\n",_+="void main(void) {\n";let w,M=" vec3 color = vec3(0.0, 0.0, 0.0);\n";y&&(_+=" vec3 normal = normalize(v_normal);\n",i.doubleSided&&(_+=" if (czm_backFacing())\n",_+=" {\n",_+=" normal = -normal;\n",_+=" }\n")),"CONSTANT"!==l?(defined(C.u_diffuse)&&(C.u_diffuse.type===WebGLConstants$1.SAMPLER_2D?_+=" vec4 diffuse = texture2D(u_diffuse, "+E+");\n":_+=" vec4 diffuse = u_diffuse;\n",_+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",M+=" color += diffuse.rgb * diffuseLight;\n"),b&&(C.u_specular.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 specular = texture2D(u_specular, "+E+").rgb;\n":_+=" vec3 specular = u_specular.rgb;\n",_+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",M+=" color += specular * specularLight;\n"),w=defined(C.u_transparency)?" gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):w=defined(C.u_transparency)?" gl_FragColor = vec4(color * u_transparency, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",m&&(M+=" color *= v_vertexColor.rgb;\n"),defined(C.u_emission)&&(C.u_emission.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 emission = texture2D(u_emission, "+E+").rgb;\n":_+=" vec3 emission = u_emission.rgb;\n",M+=" color += emission;\n"),(defined(C.u_ambient)||"CONSTANT"!==l)&&(defined(C.u_ambient)?C.u_ambient.type===WebGLConstants$1.SAMPLER_2D?_+=" vec3 ambient = texture2D(u_ambient, "+E+").rgb;\n":_+=" vec3 ambient = u_ambient.rgb;\n":_+=" vec3 ambient = diffuse.rgb;\n",M+=" color += ambient * ambientLight;\n"),_+=" vec3 viewDir = -normalize(v_positionEC);\n",_+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",_+=D,_+=M,_+=w,_+="}\n";const I=addToArray(s,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:g,extension:".glsl"}}}),R=addToArray(s,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}}),O=addToArray(c,{fragmentShader:R,vertexShader:I});return addToArray(a,{attributes:v,program:O,uniforms:C})}function getKHRMaterialsCommonValueType(e,t){let n;switch(n=defined(t.value)?t.value:defined(t.index)?[t.index]:t,e){case"ambient":case"diffuse":case"emission":case"specular":return 1===n.length?WebGLConstants$1.SAMPLER_2D:WebGLConstants$1.FLOAT_VEC4;case"shininess":case"transparency":return WebGLConstants$1.FLOAT;case"transparent":case"doubleSided":return WebGLConstants$1.BOOL}}function getTechniqueKey(e,t){let n="";n+="technique:"+e.technique+";";const i=e.values,r=Object.keys(i).sort(),o=r.length;for(let e=0;e<o;++e){const t=r[e];i.hasOwnProperty(t)&&(n+=t+":"+getKHRMaterialsCommonValueType(t,i[t]),n+=";")}const a=defaultValue(e.jointCount,0);if(n+=a.toString()+";",defined(t)){const e=t.skinning;a>0&&(n+=e.type+";"),n+=t.hasVertexColors}return n}function lightDefaults(e){const t=e.extensions.KHR_materials_common;if(!defined(t)||!defined(t.lights))return;const n=t.lights,i=n.length;for(let e=0;e<i;e++){const t=n[e];if("ambient"===t.type){defined(t.ambient)||(t.ambient={});const e=t.ambient;defined(e.color)||(e.color=[1,1,1])}else if("directional"===t.type){defined(t.directional)||(t.directional={});const e=t.directional;defined(e.color)||(e.color=[1,1,1])}else if("point"===t.type){defined(t.point)||(t.point={});const e=t.point;defined(e.color)||(e.color=[1,1,1]),e.constantAttenuation=defaultValue(e.constantAttenuation,1),e.linearAttenuation=defaultValue(e.linearAttenuation,0),e.quadraticAttenuation=defaultValue(e.quadraticAttenuation,0)}else if("spot"===t.type){defined(t.spot)||(t.spot={});const e=t.spot;defined(e.color)||(e.color=[1,1,1]),e.constantAttenuation=defaultValue(e.constantAttenuation,1),e.fallOffAngle=defaultValue(e.fallOffAngle,3.14159265),e.fallOffExponent=defaultValue(e.fallOffExponent,0),e.linearAttenuation=defaultValue(e.linearAttenuation,0),e.quadraticAttenuation=defaultValue(e.quadraticAttenuation,0)}}}function processPbrMaterials(e,t){if(t=defaultValue(t,defaultValue.EMPTY_OBJECT),usesExtension(e,"KHR_techniques_webgl"))return e;if(!defined(e.materials)||0===e.materials.length)return e;defined(e.extensions)||(e.extensions={}),defined(e.extensionsUsed)||(e.extensionsUsed=[]),defined(e.extensionsRequired)||(e.extensionsRequired=[]),e.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},e.extensionsUsed.push("KHR_techniques_webgl"),e.extensionsRequired.push("KHR_techniques_webgl");const n=ModelUtility.splitIncompatibleMaterials(e);return ForEach.material(e,(function(i,r){const o={},a=generateTechnique(e,i,r,o,n,t);defined(i.extensions)||(i.extensions={}),i.extensions.KHR_techniques_webgl={values:o,technique:a}})),ModelUtility.ensureSemanticExistence(e),e}function isSpecularGlossinessMaterial(e){return defined(e.extensions)&&defined(e.extensions.KHR_materials_pbrSpecularGlossiness)}function addTextureCoordinates(e,t,n,i,r){let o;const a=n[t];return defined(a)&&defined(a.texCoord)&&1===a.texCoord&&(i=i.replace("0","1")),defined(n[t+"Offset"])?(o=t+"Coord",r.fragmentShaderMain+=" vec2 "+o+" = computeTexCoord("+i+", "+t+"Offset, "+t+"Rotation, "+t+"Scale);\n"):o=i,o}ModelUtility.getGltfSemanticUniforms=function(){return gltfSemanticUniforms$1};const DEFAULT_TEXTURE_OFFSET=[0,0],DEFAULT_TEXTURE_ROTATION=[0],DEFAULT_TEXTURE_SCALE=[1,1];function handleKHRTextureTransform(e,t,n){if(-1===e.indexOf("Texture")||!defined(t.extensions)||!defined(t.extensions.KHR_texture_transform))return;const i="u_"+e,r=t.extensions.KHR_texture_transform;n[i+"Offset"]=defaultValue(r.offset,DEFAULT_TEXTURE_OFFSET),n[i+"Rotation"]=defaultValue(r.rotation,DEFAULT_TEXTURE_ROTATION),n[i+"Scale"]=defaultValue(r.scale,DEFAULT_TEXTURE_SCALE),defined(t.texCoord)&&defined(r.texCoord)&&(n[i].texCoord=r.texCoord)}function generateTechnique(e,t,n,i,r,o){const a=defaultValue(o.addBatchIdToGeneratedShaders,!1),s=e.extensions.KHR_techniques_webgl,c=s.techniques,l=s.shaders,u=s.programs,d=isSpecularGlossinessMaterial(t);let h,p,f;const m=t.pbrMetallicRoughness;if(defined(m)&&!d)for(p in m)m.hasOwnProperty(p)&&(f=m[p],h="u_"+p,i[h]=f,handleKHRTextureTransform(p,f,i));if(d){const e=t.extensions.KHR_materials_pbrSpecularGlossiness;for(p in e)e.hasOwnProperty(p)&&(f=e[p],h="u_"+p,i[h]=f,handleKHRTextureTransform(p,f,i))}for(const e in t)t.hasOwnProperty(e)&&(e.indexOf("Texture")>=0||e.indexOf("Factor")>=0)&&(f=t[e],h="u_"+e,i[h]=f,handleKHRTextureTransform(e,f,i));let g,_="precision highp float;\n",y="precision highp float;\n";defined(e.skins)&&(g=e.skins[0]);const C=defined(g)?g.joints:[],T=C.length,S=r[n];let A,v,E=!1,b=!1,x=!1,P=!1,D=!1,w=!1,M=!1,I=!1,R=!1;defined(S)&&(A=S.skinning,E=A.skinned&&C.length>0,b=S.hasVertexColors,x=S.hasMorphTargets,P=S.hasNormals,D=S.hasTangents,w=S.hasTexCoords,M=S.hasTexCoord1,I=S.hasOutline),x&&ForEach.mesh(e,(function(e){ForEach.meshPrimitive(e,(function(e){if(e.material===n){const t=e.targets;defined(t)&&(v=t)}}))}));const O={u_modelViewMatrix:{semantic:usesExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};defined(t.extensions)&&defined(t.extensions.KHR_materials_unlit)&&(R=!0),P&&(O.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),E&&(O.u_jointMatrix={count:T,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4}),x&&(O.u_morphWeights={count:v.length,semantic:"MORPHWEIGHTS",type:WebGLConstants$1.FLOAT});const B=t.alphaMode;for(h in defined(B)&&"MASK"===B&&(O.u_alphaCutoff={semantic:"ALPHACUTOFF",type:WebGLConstants$1.FLOAT}),i)i.hasOwnProperty(h)&&(O[h]={type:getPBRValueType(h)});const L=defaultValue(O.u_baseColorTexture,O.u_baseColorFactor);for(h in defined(L)&&(L.semantic="_3DTILESDIFFUSE"),O)if(O.hasOwnProperty(h)){const e=O[h],t=defined(e.count)?"["+e.count+"]":"";e.type!==WebGLConstants$1.FLOAT_MAT3&&e.type!==WebGLConstants$1.FLOAT_MAT4&&"u_morphWeights"!==h||e.useInFragment?(y+="uniform "+webGLConstantToGlslType(e.type)+" "+h+t+";\n",delete e.useInFragment):_+="uniform "+webGLConstantToGlslType(e.type)+" "+h+t+";\n"}I&&(y+="uniform sampler2D u_outlineTexture;\n");let F="";E&&(F+=" mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n");const N={a_position:{semantic:"POSITION"}};if(I&&(N.a_outlineCoordinates={semantic:"_OUTLINE_COORDINATES"}),_+="attribute vec3 a_position;\n",P&&(_+="varying vec3 v_positionEC;\n"),I&&(_+="attribute vec3 a_outlineCoordinates;\n",_+="varying vec3 v_outlineCoordinates;\n"),F+=" vec3 weightedPosition = a_position;\n",P&&(F+=" vec3 weightedNormal = a_normal;\n"),D&&(F+=" vec4 weightedTangent = a_tangent;\n"),x)for(let e=0;e<v.length;e++){const t=v[e];for(const n in t)if(t.hasOwnProperty(n)&&"extras"!==n){const t="a_"+n+"_"+e;N[t]={semantic:n+"_"+e},_+="attribute vec3 "+t+";\n","POSITION"===n?F+=" weightedPosition += u_morphWeights["+e+"] * "+t+";\n":"NORMAL"===n?F+=" weightedNormal += u_morphWeights["+e+"] * "+t+";\n":D&&"TANGENT"===n&&(F+=" weightedTangent.xyz += u_morphWeights["+e+"] * "+t+";\n")}}F+=E?" vec4 position = skinMatrix * vec4(weightedPosition, 1.0);\n":" vec4 position = vec4(weightedPosition, 1.0);\n",F+=" position = u_modelViewMatrix * position;\n",P&&(F+=" v_positionEC = position.xyz;\n"),F+=" gl_Position = u_projectionMatrix * position;\n",I&&(F+=" v_outlineCoordinates = a_outlineCoordinates;\n"),P&&(N.a_normal={semantic:"NORMAL"},_+="attribute vec3 a_normal;\n",R||(_+="varying vec3 v_normal;\n",F+=E?" v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;\n":" v_normal = u_normalMatrix * weightedNormal;\n",y+="varying vec3 v_normal;\n"),y+="varying vec3 v_positionEC;\n"),D&&(N.a_tangent={semantic:"TANGENT"},_+="attribute vec4 a_tangent;\n",_+="varying vec4 v_tangent;\n",F+=" v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;\n",F+=" v_tangent.w = weightedTangent.w;\n",y+="varying vec4 v_tangent;\n"),I&&(y+="varying vec3 v_outlineCoordinates;\n");let V,k,U,G,$,z,H,W,q="";if(w){if(N.a_texcoord_0={semantic:"TEXCOORD_0"},V="v_texcoord_0",_+="attribute vec2 a_texcoord_0;\n",_+="varying vec2 v_texcoord_0;\n",F+=" v_texcoord_0 = a_texcoord_0;\n",y+="varying vec2 v_texcoord_0;\n",M){N.a_texcoord_1={semantic:"TEXCOORD_1"};const e=V.replace("0","1");_+="attribute vec2 a_texcoord_1;\n",_+="varying vec2 "+e+";\n",F+=" "+e+" = a_texcoord_1;\n",y+="varying vec2 "+e+";\n"}const t={fragmentShaderMain:q};k=addTextureCoordinates(e,"u_normalTexture",i,V,t),U=addTextureCoordinates(e,"u_baseColorTexture",i,V,t),G=addTextureCoordinates(e,"u_specularGlossinessTexture",i,V,t),$=addTextureCoordinates(e,"u_diffuseTexture",i,V,t),z=addTextureCoordinates(e,"u_metallicRoughnessTexture",i,V,t),H=addTextureCoordinates(e,"u_occlusionTexture",i,V,t),W=addTextureCoordinates(e,"u_emissiveTexture",i,V,t),q=t.fragmentShaderMain}E&&(N.a_joint={semantic:"JOINTS_0"},N.a_weight={semantic:"WEIGHTS_0"},_+="attribute vec4 a_joint;\n",_+="attribute vec4 a_weight;\n"),b&&(N.a_vertexColor={semantic:"COLOR_0"},_+="attribute vec4 a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n",F+=" v_vertexColor = a_vertexColor;\n",y+="varying vec4 v_vertexColor;\n"),a&&(N.a_batchId={semantic:"_BATCHID"},_+="attribute float a_batchId;\n"),_+="void main(void) \n{\n",_+=F,_+="}\n",P&&!R&&(y+="const float M_PI = 3.141592653589793;\n",y+="vec3 lambertianDiffuse(vec3 diffuseColor) \n{\n return diffuseColor / M_PI;\n}\n\n",y+="vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n{\n return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\n",y+="vec3 fresnelSchlick(float metalness, float VdotH) \n{\n return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n}\n\n",y+="float smithVisibilityG1(float NdotV, float roughness) \n{\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\n",y+="float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n{\n return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n}\n\n",y+="float GGX(float roughness, float NdotH) \n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (M_PI * f * f);\n}\n\n"),y+="vec3 SRGBtoLINEAR3(vec3 srgbIn) \n{\n return pow(srgbIn, vec3(2.2));\n}\n\n",y+="vec4 SRGBtoLINEAR4(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n\n",y+="vec3 applyTonemapping(vec3 linearIn) \n{\n#ifndef HDR \n return czm_acesTonemapping(linearIn);\n#else \n return linearIn;\n#endif \n}\n\n",y+="vec3 LINEARtoSRGB(vec3 linearIn) \n{\n#ifndef HDR \n return pow(linearIn, vec3(1.0/2.2));\n#else \n return linearIn;\n#endif \n}\n\n",y+="vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) \n{\n rotation = -rotation; \n mat3 transform = mat3(\n cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, \n -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, \n offset.x, offset.y, 1.0); \n vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy; \n return transformedTexCoords; \n}\n\n",y+="#ifdef USE_IBL_LIGHTING \n",y+="uniform vec2 gltf_iblFactor; \n",y+="#endif \n",y+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",y+="uniform vec3 gltf_lightColor; \n",y+="#endif \n",y+="void main(void) \n{\n",y+=q,P&&!R&&(y+=" vec3 ng = normalize(v_normal);\n",y+=" vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));\n",defined(i.u_normalTexture)?D?(y+=" vec3 t = normalize(v_tangent.xyz);\n",y+=" vec3 b = normalize(cross(ng, t) * v_tangent.w);\n",y+=" mat3 tbn = mat3(t, b, ng);\n",y+=" vec3 n = texture2D(u_normalTexture, "+k+").rgb;\n",y+=" n = normalize(tbn * (2.0 * n - 1.0));\n"):(y="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"+y,y+="#ifdef GL_OES_standard_derivatives\n",y+=" vec3 pos_dx = dFdx(v_positionEC);\n",y+=" vec3 pos_dy = dFdy(v_positionEC);\n",y+=" vec3 tex_dx = dFdx(vec3("+k+",0.0));\n",y+=" vec3 tex_dy = dFdy(vec3("+k+",0.0));\n",y+=" vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n",y+=" t = normalize(t - ng * dot(ng, t));\n",y+=" vec3 b = normalize(cross(ng, t));\n",y+=" mat3 tbn = mat3(t, b, ng);\n",y+=" vec3 n = texture2D(u_normalTexture, "+k+").rgb;\n",y+=" n = normalize(tbn * (2.0 * n - 1.0));\n",y+="#else\n",y+=" vec3 n = ng;\n",y+="#endif\n"):y+=" vec3 n = ng;\n",t.doubleSided&&(y+=" if (czm_backFacing())\n",y+=" {\n",y+=" n = -n;\n",y+=" }\n")),defined(i.u_baseColorTexture)?(y+=" vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, "+U+"));\n",defined(i.u_baseColorFactor)&&(y+=" baseColorWithAlpha *= u_baseColorFactor;\n")):defined(i.u_baseColorFactor)?y+=" vec4 baseColorWithAlpha = u_baseColorFactor;\n":y+=" vec4 baseColorWithAlpha = vec4(1.0);\n",b&&(y+=" baseColorWithAlpha *= v_vertexColor;\n"),y+=" vec3 baseColor = baseColorWithAlpha.rgb;\n",P&&!R?(d?(defined(i.u_specularGlossinessTexture)?(y+=" vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, "+G+"));\n",y+=" vec3 specular = specularGlossiness.rgb;\n",y+=" float glossiness = specularGlossiness.a;\n",defined(i.u_specularFactor)&&(y+=" specular *= u_specularFactor;\n"),defined(i.u_glossinessFactor)&&(y+=" glossiness *= u_glossinessFactor;\n")):(defined(i.u_specularFactor)?y+=" vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n":y+=" vec3 specular = vec3(1.0);\n",defined(i.u_glossinessFactor)?y+=" float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n":y+=" float glossiness = 1.0;\n"),defined(i.u_diffuseTexture)?(y+=" vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, "+$+"));\n",defined(i.u_diffuseFactor)&&(y+=" diffuse *= u_diffuseFactor;\n")):defined(i.u_diffuseFactor)?y+=" vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n":y+=" vec4 diffuse = vec4(1.0);\n",y+=" baseColorWithAlpha.a = diffuse.a;\n"):defined(i.u_metallicRoughnessTexture)?(y+=" vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, "+z+").rgb;\n",y+=" float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n",y+=" float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n",defined(i.u_metallicFactor)&&(y+=" metalness *= u_metallicFactor;\n"),defined(i.u_roughnessFactor)&&(y+=" roughness *= u_roughnessFactor;\n")):(defined(i.u_metallicFactor)?y+=" float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n":y+=" float metalness = 1.0;\n",defined(i.u_roughnessFactor)?y+=" float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n":y+=" float roughness = 1.0;\n"),y+=" vec3 v = -normalize(v_positionEC);\n",y+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",y+=" vec3 lightColorHdr = czm_lightColorHdr;\n",y+="#else \n",y+=" vec3 lightColorHdr = gltf_lightColor;\n",y+="#endif \n",y+=" vec3 l = normalize(czm_lightDirectionEC);\n",y+=" vec3 h = normalize(v + l);\n",y+=" float NdotL = clamp(dot(n, l), 0.001, 1.0);\n",y+=" float NdotV = abs(dot(n, v)) + 0.001;\n",y+=" float NdotH = clamp(dot(n, h), 0.0, 1.0);\n",y+=" float LdotH = clamp(dot(l, h), 0.0, 1.0);\n",y+=" float VdotH = clamp(dot(v, h), 0.0, 1.0);\n",y+=" vec3 f0 = vec3(0.04);\n",d?(y+=" float roughness = 1.0 - glossiness;\n",y+=" vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n",y+=" vec3 specularColor = specular;\n"):(y+=" vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);\n",y+=" vec3 specularColor = mix(f0, baseColor, metalness);\n"),y+=" float alpha = roughness * roughness;\n",y+=" float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n",y+=" vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n",y+=" vec3 r0 = specularColor.rgb;\n",y+=" vec3 F = fresnelSchlick2(r0, r90, VdotH);\n",y+=" float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n",y+=" float D = GGX(alpha, NdotH);\n",y+=" vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n",y+=" vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n",y+=" vec3 color = NdotL * lightColorHdr * (diffuseContribution + specularContribution);\n",y+="#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL) \n",y+=" vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n",y+=" float vertexRadius = length(positionWC);\n",y+=" float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n",y+=" float reflectionDotNadir = dot(r, normalize(positionWC));\n",y+=" r.x = -r.x;\n",y+=" r = -normalize(czm_temeToPseudoFixed * r);\n",y+=" r.x = -r.x;\n",y+=" float inverseRoughness = 1.04 - roughness;\n",y+=" inverseRoughness *= inverseRoughness;\n",y+=" vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n",y+=" float atmosphereHeight = 0.05;\n",y+=" float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n",y+=" float blendRegionOffset = roughness * -1.0;\n",y+=" float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n",y+=" float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n",y+=" vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n",y+=" vec3 nadirColor = belowHorizonColor * 0.5;\n",y+=" vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n",y+=" vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n",y+=" vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n",y+=" vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\n",y+=" float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\n",y+=" float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n",y+=" vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n",y+=" float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n",y+=" vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n",y+=" specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n",y+=" specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n",y+="#ifdef USE_SUN_LUMINANCE \n",y+=" float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);\n",y+=" float S = acos(LdotZenith);\n",y+=" float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);\n",y+=" float gamma = acos(NdotL);\n",y+=" float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n",y+=" float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n",y+=" float luminance = gltf_luminanceAtZenith * (numerator / denominator);\n",y+="#endif \n",y+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",y+=" vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);\n",y+=" float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n",y+=" vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n",y+=" IBLColor *= lightColor;\n",y+="#ifdef USE_SUN_LUMINANCE \n",y+=" color += IBLColor * luminance;\n",y+="#else \n",y+=" color += IBLColor; \n",y+="#endif \n",y+="#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) \n",y+=" const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0); \n",y+=" vec3 cubeDir = normalize(yUpToZUp * gltf_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n",y+="#ifdef DIFFUSE_IBL \n",y+="#ifdef CUSTOM_SPHERICAL_HARMONICS \n",y+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients); \n",y+="#else \n",y+=" vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n",y+="#endif \n",y+="#else \n",y+=" vec3 diffuseIrradiance = vec3(0.0); \n",y+="#endif \n",y+="#ifdef SPECULAR_IBL \n",y+=" vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",y+="#ifdef CUSTOM_SPECULAR_IBL \n",y+=" vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir, roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);\n",y+="#else \n",y+=" vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n",y+="#endif \n",y+=" specularIBL *= F * brdfLut.x + brdfLut.y;\n",y+="#else \n",y+=" vec3 specularIBL = vec3(0.0); \n",y+="#endif \n",y+=" color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;\n",y+="#endif \n"):y+=" vec3 color = baseColor;\n",R||(defined(i.u_occlusionTexture)&&(y+=" color *= texture2D(u_occlusionTexture, "+H+").r;\n"),defined(i.u_emissiveTexture)?(y+=" vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, "+W+").rgb);\n",defined(i.u_emissiveFactor)&&(y+=" emissive *= u_emissiveFactor;\n"),y+=" color += emissive;\n"):defined(i.u_emissiveFactor)&&(y+=" color += u_emissiveFactor;\n")),R||(y+=" color = applyTonemapping(color);\n"),y+=" color = LINEARtoSRGB(color);\n",I&&(y+=" float outlineness = max(\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r,\n",y+=" max(\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r,\n",y+=" texture2D(u_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r));\n",y+=" color = mix(color, vec3(0.0, 0.0, 0.0), outlineness);\n"),defined(B)?"MASK"===B?(y+=" if (baseColorWithAlpha.a < u_alphaCutoff) {\n",y+=" discard;\n",y+=" }\n",y+=" gl_FragColor = vec4(color, 1.0);\n"):y+="BLEND"===B?" gl_FragColor = vec4(color, baseColorWithAlpha.a);\n":" gl_FragColor = vec4(color, 1.0);\n":y+=" gl_FragColor = vec4(color, 1.0);\n",y+="}\n";const j=addToArray(l,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}}),X=addToArray(l,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:y,extension:".glsl"}}}),Y=addToArray(u,{fragmentShader:X,vertexShader:j});return addToArray(c,{attributes:N,program:Y,uniforms:O})}function getPBRValueType(e){if(-1!==e.indexOf("Offset"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Rotation"))return WebGLConstants$1.FLOAT;if(-1!==e.indexOf("Scale"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Texture"))return WebGLConstants$1.SAMPLER_2D;switch(e){case"u_baseColorFactor":case"u_diffuseFactor":return WebGLConstants$1.FLOAT_VEC4;case"u_metallicFactor":case"u_roughnessFactor":case"u_glossinessFactor":return WebGLConstants$1.FLOAT;case"u_emissiveFactor":case"u_specularFactor":return WebGLConstants$1.FLOAT_VEC3}}function Vector3DTileBatch(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var VectorTileVS="attribute vec3 position;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelViewProjection;\nvoid main()\n{\ngl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n",jsep=createCommonjsModule((function(e,t){!function(n){var i="Compound",r="MemberExpression",o="Literal",a=function(e,t){var n=new Error(e+" at character "+t);throw n.index=t,n.description=e,n},s=!0,c={"-":s,"!":s,"~":s,"+":s},l={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},u=function(e){var t,n=0;for(var i in e)(t=i.length)>n&&e.hasOwnProperty(i)&&(n=t);return n},d=u(c),h=u(l),p={true:!0,false:!1,null:null},f=function(e){return l[e]||0},m=function(e,t,n){return{type:"||"===e||"&&"===e?"LogicalExpression":"BinaryExpression",operator:e,left:t,right:n}},g=function(e){return e>=48&&e<=57},_=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&!l[String.fromCharCode(e)]},y=function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e>=128&&!l[String.fromCharCode(e)]},C=function(e){for(var t,n,s=0,u=e.charAt,C=e.charCodeAt,T=function(t){return u.call(e,t)},S=function(t){return C.call(e,t)},A=e.length,v=function(){for(var e=S(s);32===e||9===e||10===e||13===e;)e=S(++s)},E=function(){var e,t,n=x();return v(),63!==S(s)?n:(s++,(e=E())||a("Expected expression",s),v(),58===S(s)?(s++,(t=E())||a("Expected expression",s),{type:"ConditionalExpression",test:n,consequent:e,alternate:t}):void a("Expected :",s))},b=function(){v();for(var t=e.substr(s,h),n=t.length;n>0;){if(l.hasOwnProperty(t)&&(!_(S(s))||s+t.length<e.length&&!y(S(s+t.length))))return s+=n,t;t=t.substr(0,--n)}return!1},x=function(){var e,t,n,i,r,o,c,l,u;if(o=P(),!(t=b()))return o;for(r={value:t,prec:f(t)},(c=P())||a("Expected expression after "+t,s),i=[o,r,c];(t=b())&&0!==(n=f(t));){for(r={value:t,prec:n},u=t;i.length>2&&n<=i[i.length-2].prec;)c=i.pop(),t=i.pop().value,o=i.pop(),e=m(t,o,c),i.push(e);(e=P())||a("Expected expression after "+u,s),i.push(r,e)}for(e=i[l=i.length-1];l>1;)e=m(i[l-1].value,i[l-2],e),l-=2;return e},P=function(){var t,n,i;if(v(),t=S(s),g(t)||46===t)return D();if(39===t||34===t)return w();if(91===t)return B();for(i=(n=e.substr(s,d)).length;i>0;){if(c.hasOwnProperty(n)&&(!_(S(s))||s+n.length<e.length&&!y(S(s+n.length))))return s+=i,{type:"UnaryExpression",operator:n,argument:P(),prefix:!0};n=n.substr(0,--i)}return!(!_(t)&&40!==t)&&R()},D=function(){for(var e,t,n="";g(S(s));)n+=T(s++);if(46===S(s))for(n+=T(s++);g(S(s));)n+=T(s++);if("e"===(e=T(s))||"E"===e){for(n+=T(s++),"+"!==(e=T(s))&&"-"!==e||(n+=T(s++));g(S(s));)n+=T(s++);g(S(s-1))||a("Expected exponent ("+n+T(s)+")",s)}return t=S(s),_(t)?a("Variable names cannot start with a number ("+n+T(s)+")",s):46===t&&a("Unexpected period",s),{type:o,value:parseFloat(n),raw:n}},w=function(){for(var e,t="",n=T(s++),i=!1;s<A;){if((e=T(s++))===n){i=!0;break}if("\\"===e)switch(e=T(s++)){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return i||a('Unclosed quote after "'+t+'"',s),{type:o,value:t,raw:n+t+n}},M=function(){var t,n=S(s),i=s;for(_(n)?s++:a("Unexpected "+T(s),s);s<A&&(n=S(s),y(n));)s++;return t=e.slice(i,s),p.hasOwnProperty(t)?{type:o,value:p[t],raw:t}:"this"===t?{type:"ThisExpression"}:{type:"Identifier",name:t}},I=function(e){for(var t,n,r=[],o=!1,c=0;s<A;){if(v(),(t=S(s))===e){o=!0,s++,41===e&&c&&c>=r.length&&a("Unexpected token "+String.fromCharCode(e),s);break}if(44===t){if(s++,++c!==r.length)if(41===e)a("Unexpected token ,",s);else if(93===e)for(var l=r.length;l<c;l++)r.push(null)}else(n=E())&&n.type!==i||a("Expected comma",s),r.push(n)}return o||a("Expected "+String.fromCharCode(e),s),r},R=function(){var e,t;for(t=40===(e=S(s))?O():M(),v(),e=S(s);46===e||91===e||40===e;)s++,46===e?(v(),t={type:r,computed:!1,object:t,property:M()}):91===e?(t={type:r,computed:!0,object:t,property:E()},v(),93!==(e=S(s))&&a("Unclosed [",s),s++):40===e&&(t={type:"CallExpression",arguments:I(41),callee:t}),v(),e=S(s);return t},O=function(){s++;var e=E();if(v(),41===S(s))return s++,e;a("Unclosed (",s)},B=function(){return s++,{type:"ArrayExpression",elements:I(93)}},L=[];s<A;)59===(t=S(s))||44===t?s++:(n=E())?L.push(n):s<A&&a('Unexpected "'+T(s)+'"',s);return 1===L.length?L[0]:{type:i,body:L}};C.version="0.3.5",C.toString=function(){return"JavaScript Expression Parser (JSEP) v"+C.version},C.addUnaryOp=function(e){return d=Math.max(e.length,d),c[e]=s,this},C.addBinaryOp=function(e,t){return h=Math.max(e.length,h),l[e]=t,this},C.addLiteral=function(e,t){return p[e]=t,this},C.removeUnaryOp=function(e){return delete c[e],e.length===d&&(d=u(c)),this},C.removeAllUnaryOps=function(){return c={},d=0,this},C.removeBinaryOp=function(e){return delete l[e],e.length===h&&(h=u(l)),this},C.removeAllBinaryOps=function(){return l={},h=0,this},C.removeLiteral=function(e){return delete p[e],this},C.removeAllLiterals=function(){return p={},this},e.exports?t=e.exports=C:t.parse=C}()}));const ExpressionNodeType={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18};var ExpressionNodeType$1=Object.freeze(ExpressionNodeType);function Expression(e,t){let n;this._expression=e,e=replaceVariables(removeBackslashes(e=replaceDefines(e,t))),jsep.addBinaryOp("=~",0),jsep.addBinaryOp("!~",0);try{n=jsep(e)}catch(e){throw new RuntimeError(e)}this._runtimeAst=createRuntimeAst(this,n)}Object.defineProperties(Expression.prototype,{expression:{get:function(){return this._expression}}});const scratchStorage={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new Cartesian2],cartesian3Array:[new Cartesian3],cartesian4Array:[new Cartesian4],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new Cartesian2),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new Cartesian3),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new Cartesian4),this.cartesian4Array[this.cartesian4Index++]}};Expression.prototype.evaluate=function(e,t){scratchStorage.reset();const n=this._runtimeAst.evaluate(e);return t instanceof Color&&n instanceof Cartesian4?Color.fromCartesian4(n,t):n instanceof Cartesian2||n instanceof Cartesian3||n instanceof Cartesian4?n.clone(t):n},Expression.prototype.evaluateColor=function(e,t){scratchStorage.reset();const n=this._runtimeAst.evaluate(e);return Color.fromCartesian4(n,t)},Expression.prototype.getShaderFunction=function(e,t,n,i){let r=this.getShaderExpression(t,n);return r=i+" "+e+"\n{\n return "+r+";\n}\n",r},Expression.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)},Expression.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter((function(e,t,n){return n.indexOf(e)===t})),e};const unaryOperators=["!","-","+"],binaryOperators=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],variableRegex=/\${(.*?)}/g,backslashRegex=/\\/g,backslashReplacement="@#%",replacementRegex=/@#%/g,scratchColor$m=new Color,unaryFunctions={abs:getEvaluateUnaryComponentwise(Math.abs),sqrt:getEvaluateUnaryComponentwise(Math.sqrt),cos:getEvaluateUnaryComponentwise(Math.cos),sin:getEvaluateUnaryComponentwise(Math.sin),tan:getEvaluateUnaryComponentwise(Math.tan),acos:getEvaluateUnaryComponentwise(Math.acos),asin:getEvaluateUnaryComponentwise(Math.asin),atan:getEvaluateUnaryComponentwise(Math.atan),radians:getEvaluateUnaryComponentwise(CesiumMath.toRadians),degrees:getEvaluateUnaryComponentwise(CesiumMath.toDegrees),sign:getEvaluateUnaryComponentwise(CesiumMath.sign),floor:getEvaluateUnaryComponentwise(Math.floor),ceil:getEvaluateUnaryComponentwise(Math.ceil),round:getEvaluateUnaryComponentwise(Math.round),exp:getEvaluateUnaryComponentwise(Math.exp),exp2:getEvaluateUnaryComponentwise(exp2),log:getEvaluateUnaryComponentwise(Math.log),log2:getEvaluateUnaryComponentwise(log2),fract:getEvaluateUnaryComponentwise(fract),length:length$1,normalize:normalize$1},binaryFunctions={atan2:getEvaluateBinaryComponentwise(Math.atan2,!1),pow:getEvaluateBinaryComponentwise(Math.pow,!1),min:getEvaluateBinaryComponentwise(Math.min,!0),max:getEvaluateBinaryComponentwise(Math.max,!0),distance:distance,dot:dot,cross:cross},ternaryFunctions={clamp:getEvaluateTernaryComponentwise(CesiumMath.clamp,!0),mix:getEvaluateTernaryComponentwise(CesiumMath.lerp,!0)};function fract(e){return e-Math.floor(e)}function exp2(e){return Math.pow(2,e)}function log2(e){return CesiumMath.log2(e)}function getEvaluateUnaryComponentwise(e){return function(t,n){if("number"==typeof n)return e(n);if(n instanceof Cartesian2)return Cartesian2.fromElements(e(n.x),e(n.y),scratchStorage.getCartesian2());if(n instanceof Cartesian3)return Cartesian3.fromElements(e(n.x),e(n.y),e(n.z),scratchStorage.getCartesian3());if(n instanceof Cartesian4)return Cartesian4.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+t+'" requires a vector or number argument. Argument is '+n+".")}}function getEvaluateBinaryComponentwise(e,t){return function(n,i,r){if(t&&"number"==typeof r){if("number"==typeof i)return e(i,r);if(i instanceof Cartesian2)return Cartesian2.fromElements(e(i.x,r),e(i.y,r),scratchStorage.getCartesian2());if(i instanceof Cartesian3)return Cartesian3.fromElements(e(i.x,r),e(i.y,r),e(i.z,r),scratchStorage.getCartesian3());if(i instanceof Cartesian4)return Cartesian4.fromElements(e(i.x,r),e(i.y,r),e(i.z,r),e(i.w,r),scratchStorage.getCartesian4())}if("number"==typeof i&&"number"==typeof r)return e(i,r);if(i instanceof Cartesian2&&r instanceof Cartesian2)return Cartesian2.fromElements(e(i.x,r.x),e(i.y,r.y),scratchStorage.getCartesian2());if(i instanceof Cartesian3&&r instanceof Cartesian3)return Cartesian3.fromElements(e(i.x,r.x),e(i.y,r.y),e(i.z,r.z),scratchStorage.getCartesian3());if(i instanceof Cartesian4&&r instanceof Cartesian4)return Cartesian4.fromElements(e(i.x,r.x),e(i.y,r.y),e(i.z,r.z),e(i.w,r.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+n+'" requires vector or number arguments of matching types. Arguments are '+i+" and "+r+".")}}function getEvaluateTernaryComponentwise(e,t){return function(n,i,r,o){if(t&&"number"==typeof o){if("number"==typeof i&&"number"==typeof r)return e(i,r,o);if(i instanceof Cartesian2&&r instanceof Cartesian2)return Cartesian2.fromElements(e(i.x,r.x,o),e(i.y,r.y,o),scratchStorage.getCartesian2());if(i instanceof Cartesian3&&r instanceof Cartesian3)return Cartesian3.fromElements(e(i.x,r.x,o),e(i.y,r.y,o),e(i.z,r.z,o),scratchStorage.getCartesian3());if(i instanceof Cartesian4&&r instanceof Cartesian4)return Cartesian4.fromElements(e(i.x,r.x,o),e(i.y,r.y,o),e(i.z,r.z,o),e(i.w,r.w,o),scratchStorage.getCartesian4())}if("number"==typeof i&&"number"==typeof r&&"number"==typeof o)return e(i,r,o);if(i instanceof Cartesian2&&r instanceof Cartesian2&&o instanceof Cartesian2)return Cartesian2.fromElements(e(i.x,r.x,o.x),e(i.y,r.y,o.y),scratchStorage.getCartesian2());if(i instanceof Cartesian3&&r instanceof Cartesian3&&o instanceof Cartesian3)return Cartesian3.fromElements(e(i.x,r.x,o.x),e(i.y,r.y,o.y),e(i.z,r.z,o.z),scratchStorage.getCartesian3());if(i instanceof Cartesian4&&r instanceof Cartesian4&&o instanceof Cartesian4)return Cartesian4.fromElements(e(i.x,r.x,o.x),e(i.y,r.y,o.y),e(i.z,r.z,o.z),e(i.w,r.w,o.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+n+'" requires vector or number arguments of matching types. Arguments are '+i+", "+r+", and "+o+".")}}function length$1(e,t){if("number"==typeof t)return Math.abs(t);if(t instanceof Cartesian2)return Cartesian2.magnitude(t);if(t instanceof Cartesian3)return Cartesian3.magnitude(t);if(t instanceof Cartesian4)return Cartesian4.magnitude(t);throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function normalize$1(e,t){if("number"==typeof t)return 1;if(t instanceof Cartesian2)return Cartesian2.normalize(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.normalize(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.normalize(t,scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function distance(e,t,n){if("number"==typeof t&&"number"==typeof n)return Math.abs(t-n);if(t instanceof Cartesian2&&n instanceof Cartesian2)return Cartesian2.distance(t,n);if(t instanceof Cartesian3&&n instanceof Cartesian3)return Cartesian3.distance(t,n);if(t instanceof Cartesian4&&n instanceof Cartesian4)return Cartesian4.distance(t,n);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+n+".")}function dot(e,t,n){if("number"==typeof t&&"number"==typeof n)return t*n;if(t instanceof Cartesian2&&n instanceof Cartesian2)return Cartesian2.dot(t,n);if(t instanceof Cartesian3&&n instanceof Cartesian3)return Cartesian3.dot(t,n);if(t instanceof Cartesian4&&n instanceof Cartesian4)return Cartesian4.dot(t,n);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+n+".")}function cross(e,t,n){if(t instanceof Cartesian3&&n instanceof Cartesian3)return Cartesian3.cross(t,n,scratchStorage.getCartesian3());throw new RuntimeError('Function "'+e+'" requires vec3 arguments. Arguments are '+t+" and "+n+".")}function Node$4(e,t,n,i,r){this._type=e,this._value=t,this._left=n,this._right=i,this._test=r,this.evaluate=void 0,setEvaluateFunction(this)}function replaceDefines(e,t){if(!defined(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp("\\$\\{"+n+"\\}","g"),r="("+t[n]+")";defined(r)&&(e=e.replace(i,r))}return e}function removeBackslashes(e){return e.replace(backslashRegex,backslashReplacement)}function replaceBackslashes(e){return e.replace(replacementRegex,"\\")}function replaceVariables(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const e=t.indexOf("'"),r=t.indexOf('"');let o;if(e>=0&&e<i)o=t.indexOf("'",e+1),n+=t.substr(0,o+1),t=t.substr(o+1),i=t.indexOf("${");else if(r>=0&&r<i)o=t.indexOf('"',r+1),n+=t.substr(0,o+1),t=t.substr(o+1),i=t.indexOf("${");else{n+=t.substr(0,i);const e=t.indexOf("}");if(e<0)throw new RuntimeError("Unmatched {.");n+="czm_"+t.substr(i+2,e-(i+2)),t=t.substr(e+1),i=t.indexOf("${")}}return n+=t,n}function parseLiteral(e){const t=typeof e.value;return null===e.value?new Node$4(ExpressionNodeType$1.LITERAL_NULL,null):"boolean"===t?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,e.value):"number"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,e.value):"string"===t?e.value.indexOf("${")>=0?new Node$4(ExpressionNodeType$1.VARIABLE_IN_STRING,e.value):new Node$4(ExpressionNodeType$1.LITERAL_STRING,replaceBackslashes(e.value)):void 0}function parseCall(e,t){const n=t.arguments,i=n.length;let r,o,a,s;if("MemberExpression"===t.callee.type){r=t.callee.property.name;const c=t.callee.object;if("test"===r||"exec"===r){if("regExp"!==c.callee.name)throw new RuntimeError(r+" is not a function.");return 0===i?"test"===r?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):new Node$4(ExpressionNodeType$1.LITERAL_NULL,null):(a=createRuntimeAst(e,c),s=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.FUNCTION_CALL,r,a,s))}if("toString"===r)return o=createRuntimeAst(e,c),new Node$4(ExpressionNodeType$1.FUNCTION_CALL,r,o);throw new RuntimeError('Unexpected function call "'+r+'".')}if(r=t.callee.name,"color"===r){if(0===i)return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r);if(o=createRuntimeAst(e,n[0]),defined(n[1])){const t=createRuntimeAst(e,n[1]);return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,[o,t])}return new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,[o])}if("rgb"===r||"hsl"===r){if(i<3)throw new RuntimeError(r+" requires three arguments.");return o=[createRuntimeAst(e,n[0]),createRuntimeAst(e,n[1]),createRuntimeAst(e,n[2])],new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,o)}if("rgba"===r||"hsla"===r){if(i<4)throw new RuntimeError(r+" requires four arguments.");return o=[createRuntimeAst(e,n[0]),createRuntimeAst(e,n[1]),createRuntimeAst(e,n[2]),createRuntimeAst(e,n[3])],new Node$4(ExpressionNodeType$1.LITERAL_COLOR,r,o)}if("vec2"===r||"vec3"===r||"vec4"===r){o=new Array(i);for(let t=0;t<i;++t)o[t]=createRuntimeAst(e,n[t]);return new Node$4(ExpressionNodeType$1.LITERAL_VECTOR,r,o)}if("isNaN"===r||"isFinite"===r)return 0===i?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,"isNaN"===r):(o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("isExactClass"===r||"isClass"===r){if(i<1||i>1)throw new RuntimeError(r+" requires exactly one argument.");return o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o)}if("getExactClassName"===r){if(i>0)throw new RuntimeError(r+" does not take any argument.");return new Node$4(ExpressionNodeType$1.UNARY,r)}if(defined(unaryFunctions[r])){if(1!==i)throw new RuntimeError(r+" requires exactly one argument.");return o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o)}if(defined(binaryFunctions[r])){if(2!==i)throw new RuntimeError(r+" requires exactly two arguments.");return a=createRuntimeAst(e,n[0]),s=createRuntimeAst(e,n[1]),new Node$4(ExpressionNodeType$1.BINARY,r,a,s)}if(defined(ternaryFunctions[r])){if(3!==i)throw new RuntimeError(r+" requires exactly three arguments.");a=createRuntimeAst(e,n[0]),s=createRuntimeAst(e,n[1]);const t=createRuntimeAst(e,n[2]);return new Node$4(ExpressionNodeType$1.TERNARY,r,a,s,t)}if("Boolean"===r)return 0===i?new Node$4(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):(o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("Number"===r)return 0===i?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,0):(o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("String"===r)return 0===i?new Node$4(ExpressionNodeType$1.LITERAL_STRING,""):(o=createRuntimeAst(e,n[0]),new Node$4(ExpressionNodeType$1.UNARY,r,o));if("regExp"===r)return parseRegex(e,t);throw new RuntimeError('Unexpected function call "'+r+'".')}function parseRegex(e,t){const n=t.arguments;if(0===n.length)return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,new RegExp);const i=createRuntimeAst(e,n[0]);let r;if(n.length>1){const t=createRuntimeAst(e,n[1]);if(isLiteralType(i)&&isLiteralType(t)){try{r=new RegExp(replaceBackslashes(String(i._value)),t._value)}catch(e){throw new RuntimeError(e)}return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$4(ExpressionNodeType$1.REGEX,i,t)}if(isLiteralType(i)){try{r=new RegExp(replaceBackslashes(String(i._value)))}catch(e){throw new RuntimeError(e)}return new Node$4(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$4(ExpressionNodeType$1.REGEX,i)}function parseKeywordsAndVariables(e){if(isVariable(e.name)){const t=getPropertyName(e.name);return"tiles3d_"===t.substr(0,8)?new Node$4(ExpressionNodeType$1.BUILTIN_VARIABLE,t):new Node$4(ExpressionNodeType$1.VARIABLE,t)}if("NaN"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,NaN);if("Infinity"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,1/0);if("undefined"===e.name)return new Node$4(ExpressionNodeType$1.LITERAL_UNDEFINED,void 0);throw new RuntimeError(e.name+" is not defined.")}function parseMathConstant(e){const t=e.property.name;return"PI"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Math.PI):"E"===t?new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Math.E):void 0}function parseNumberConstant(e){if("POSITIVE_INFINITY"===e.property.name)return new Node$4(ExpressionNodeType$1.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function parseMemberExpression(e,t){if("Math"===t.object.name)return parseMathConstant(t);if("Number"===t.object.name)return parseNumberConstant(t);let n;const i=createRuntimeAst(e,t.object);return t.computed?(n=createRuntimeAst(e,t.property),new Node$4(ExpressionNodeType$1.MEMBER,"brackets",i,n)):(n=new Node$4(ExpressionNodeType$1.LITERAL_STRING,t.property.name),new Node$4(ExpressionNodeType$1.MEMBER,"dot",i,n))}function isLiteralType(e){return e._type>=ExpressionNodeType$1.LITERAL_NULL}function isVariable(e){return"czm_"===e.substr(0,4)}function getPropertyName(e){return e.substr(4)}function createRuntimeAst(e,t){let n,i,r,o;if("Literal"===t.type)n=parseLiteral(t);else if("CallExpression"===t.type)n=parseCall(e,t);else if("Identifier"===t.type)n=parseKeywordsAndVariables(t);else if("UnaryExpression"===t.type){i=t.operator;const r=createRuntimeAst(e,t.argument);if(!(unaryOperators.indexOf(i)>-1))throw new RuntimeError('Unexpected operator "'+i+'".');n=new Node$4(ExpressionNodeType$1.UNARY,i,r)}else if("BinaryExpression"===t.type){if(i=t.operator,r=createRuntimeAst(e,t.left),o=createRuntimeAst(e,t.right),!(binaryOperators.indexOf(i)>-1))throw new RuntimeError('Unexpected operator "'+i+'".');n=new Node$4(ExpressionNodeType$1.BINARY,i,r,o)}else if("LogicalExpression"===t.type)i=t.operator,r=createRuntimeAst(e,t.left),o=createRuntimeAst(e,t.right),binaryOperators.indexOf(i)>-1&&(n=new Node$4(ExpressionNodeType$1.BINARY,i,r,o));else if("ConditionalExpression"===t.type){const i=createRuntimeAst(e,t.test);r=createRuntimeAst(e,t.consequent),o=createRuntimeAst(e,t.alternate),n=new Node$4(ExpressionNodeType$1.CONDITIONAL,"?",r,o,i)}else if("MemberExpression"===t.type)n=parseMemberExpression(e,t);else{if("ArrayExpression"!==t.type)throw"Compound"===t.type?new RuntimeError("Provide exactly one expression."):new RuntimeError("Cannot parse expression.");{const i=[];for(let n=0;n<t.elements.length;n++)i[n]=createRuntimeAst(e,t.elements[n]);n=new Node$4(ExpressionNodeType$1.ARRAY,i)}}return n}function setEvaluateFunction(e){e._type===ExpressionNodeType$1.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ExpressionNodeType$1.FUNCTION_CALL?"test"===e._value?e.evaluate=e._evaluateRegExpTest:"exec"===e._value?e.evaluate=e._evaluateRegExpExec:"toString"===e._value&&(e.evaluate=e._evaluateToString):e._type===ExpressionNodeType$1.UNARY?"!"===e._value?e.evaluate=e._evaluateNot:"-"===e._value?e.evaluate=e._evaluateNegative:"+"===e._value?e.evaluate=e._evaluatePositive:"isNaN"===e._value?e.evaluate=e._evaluateNaN:"isFinite"===e._value?e.evaluate=e._evaluateIsFinite:"isExactClass"===e._value?e.evaluate=e._evaluateIsExactClass:"isClass"===e._value?e.evaluate=e._evaluateIsClass:"getExactClassName"===e._value?e.evaluate=e._evaluateGetExactClassName:"Boolean"===e._value?e.evaluate=e._evaluateBooleanConversion:"Number"===e._value?e.evaluate=e._evaluateNumberConversion:"String"===e._value?e.evaluate=e._evaluateStringConversion:defined(unaryFunctions[e._value])&&(e.evaluate=getEvaluateUnaryFunction(e._value)):e._type===ExpressionNodeType$1.BINARY?"+"===e._value?e.evaluate=e._evaluatePlus:"-"===e._value?e.evaluate=e._evaluateMinus:"*"===e._value?e.evaluate=e._evaluateTimes:"/"===e._value?e.evaluate=e._evaluateDivide:"%"===e._value?e.evaluate=e._evaluateMod:"==="===e._value?e.evaluate=e._evaluateEqualsStrict:"!=="===e._value?e.evaluate=e._evaluateNotEqualsStrict:"<"===e._value?e.evaluate=e._evaluateLessThan:"<="===e._value?e.evaluate=e._evaluateLessThanOrEquals:">"===e._value?e.evaluate=e._evaluateGreaterThan:">="===e._value?e.evaluate=e._evaluateGreaterThanOrEquals:"&&"===e._value?e.evaluate=e._evaluateAnd:"||"===e._value?e.evaluate=e._evaluateOr:"=~"===e._value?e.evaluate=e._evaluateRegExpMatch:"!~"===e._value?e.evaluate=e._evaluateRegExpNotMatch:defined(binaryFunctions[e._value])&&(e.evaluate=getEvaluateBinaryFunction(e._value)):e._type===ExpressionNodeType$1.TERNARY?e.evaluate=getEvaluateTernaryFunction(e._value):e._type===ExpressionNodeType$1.MEMBER?"brackets"===e._value?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ExpressionNodeType$1.ARRAY?e.evaluate=e._evaluateArray:e._type===ExpressionNodeType$1.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ExpressionNodeType$1.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ExpressionNodeType$1.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ExpressionNodeType$1.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ExpressionNodeType$1.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ExpressionNodeType$1.REGEX?e.evaluate=e._evaluateRegExp:e._type===ExpressionNodeType$1.BUILTIN_VARIABLE?"tiles3d_tileset_time"===e._value&&(e.evaluate=evaluateTilesetTime):e.evaluate=e._evaluateLiteral}function evaluateTilesetTime(e){return defined(e)?e.content.tileset.timeSinceLoad:0}function getEvaluateUnaryFunction(e){const t=unaryFunctions[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function getEvaluateBinaryFunction(e){const t=binaryFunctions[e];return function(n){const i=this._left.evaluate(n),r=this._right.evaluate(n);return t(e,i,r)}}function getEvaluateTernaryFunction(e){const t=ternaryFunctions[e];return function(n){const i=this._left.evaluate(n),r=this._right.evaluate(n),o=this._test.evaluate(n);return t(e,i,r,o)}}function getFeatureProperty(e,t){if(defined(e))return e.getPropertyInherited(t)}function checkFeature(e){return"feature"===e._value}function convertHSLToRGB(e){const t=e._left,n=t.length;for(let e=0;e<n;++e)if(t[e]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;const i=t[0]._value,r=t[1]._value,o=t[2]._value,a=4===n?t[3]._value:1;return Color.fromHsl(i,r,o,a,scratchColor$m)}function convertRGBToColor(e){const t=e._left,n=t.length;for(let e=0;e<n;++e)if(t[e]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;const i=scratchColor$m;return i.red=t[0]._value/255,i.green=t[1]._value/255,i.blue=t[2]._value/255,i.alpha=4===n?t[3]._value:1,i}function numberToString(e){return e%1==0?e.toFixed(1):e.toString()}function colorToVec3(e){return"vec3("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+")"}function colorToVec4(e){return"vec4("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+", "+numberToString(e.alpha)+")"}function getExpressionArray(e,t,n,i){const r=e.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=e[a].getShaderExpression(t,n,i);return o}function getVariableName(e,t){return defined(t[e])?t[e]:Expression.NULL_SENTINEL}function Vector3DTilePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=defaultValue(e.center,Cartesian3.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};const t=this._batchIds.length;for(let e=0;e<t;++e){const t=this._batchIds[e];this._batchIdLookUp[t]=e}}Node$4.prototype._evaluateLiteral=function(){return this._value},Node$4.prototype._evaluateLiteralColor=function(e){const t=scratchColor$m,n=this._left;if("color"===this._value)defined(n)?n.length>1?(Color.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):Color.fromCssColorString(n[0].evaluate(e),t):Color.fromBytes(255,255,255,255,t);else if("rgb"===this._value)Color.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if("rgba"===this._value){const i=255*n[3].evaluate(e);Color.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else"hsl"===this._value?Color.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):"hsla"===this._value&&Color.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return Cartesian4.fromColor(t,scratchStorage.getCartesian4())},Node$4.prototype._evaluateLiteralVector=function(e){const t=scratchStorage.getArray(),n=this._value,i=this._left,r=i.length;for(let o=0;o<r;++o){const r=i[o].evaluate(e);if("number"==typeof r)t.push(r);else if(r instanceof Cartesian2)t.push(r.x,r.y);else if(r instanceof Cartesian3)t.push(r.x,r.y,r.z);else{if(!(r instanceof Cartesian4))throw new RuntimeError(n+" argument must be a vector or number. Argument is "+r+".");t.push(r.x,r.y,r.z,r.w)}}const o=t.length,a=parseInt(n.charAt(3));if(0===o)throw new RuntimeError("Invalid "+n+" constructor. No valid arguments.");if(o<a&&o>1)throw new RuntimeError("Invalid "+n+" constructor. Not enough arguments.");if(o>a&&r>1)throw new RuntimeError("Invalid "+n+" constructor. Too many arguments.");if(1===o){const e=t[0];t.push(e,e,e)}return"vec2"===n?Cartesian2.fromArray(t,0,scratchStorage.getCartesian2()):"vec3"===n?Cartesian3.fromArray(t,0,scratchStorage.getCartesian3()):"vec4"===n?Cartesian4.fromArray(t,0,scratchStorage.getCartesian4()):void 0},Node$4.prototype._evaluateLiteralString=function(){return this._value},Node$4.prototype._evaluateVariableString=function(e){let t=this._value,n=variableRegex.exec(t);for(;null!==n;){const i=n[0];let r=getFeatureProperty(e,n[1]);defined(r)||(r=""),t=t.replace(i,r),n=variableRegex.exec(t)}return t},Node$4.prototype._evaluateVariable=function(e){return getFeatureProperty(e,this._value)},Node$4.prototype._evaluateMemberDot=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!defined(t))return;const n=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if("r"===n)return t.x;if("g"===n)return t.y;if("b"===n)return t.z;if("a"===n)return t.w}return t[n]},Node$4.prototype._evaluateMemberBrackets=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!defined(t))return;const n=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if(0===n||"r"===n)return t.x;if(1===n||"g"===n)return t.y;if(2===n||"b"===n)return t.z;if(3===n||"a"===n)return t.w}return t[n]},Node$4.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t},Node$4.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "!" requires a boolean argument. Argument is '+t+".");return!t},Node$4.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof Cartesian2)return Cartesian2.negate(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.negate(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.negate(t,scratchStorage.getCartesian4());if("number"==typeof t)return-t;throw new RuntimeError('Operator "-" requires a vector or number argument. Argument is '+t+".")},Node$4.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4||"number"==typeof t))throw new RuntimeError('Operator "+" requires a vector or number argument. Argument is '+t+".");return t},Node$4.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new RuntimeError('Operator "<" requires number arguments. Arguments are '+t+" and "+n+".");return t<n},Node$4.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new RuntimeError('Operator "<=" requires number arguments. Arguments are '+t+" and "+n+".");return t<=n},Node$4.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new RuntimeError('Operator ">" requires number arguments. Arguments are '+t+" and "+n+".");return t>n},Node$4.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new RuntimeError('Operator ">=" requires number arguments. Arguments are '+t+" and "+n+".");return t>=n},Node$4.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "||" requires boolean arguments. First argument is '+t+".");if(t)return!0;const n=this._right.evaluate(e);if("boolean"!=typeof n)throw new RuntimeError('Operator "||" requires boolean arguments. Second argument is '+n+".");return t||n},Node$4.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "&&" requires boolean arguments. First argument is '+t+".");if(!t)return!1;const n=this._right.evaluate(e);if("boolean"!=typeof n)throw new RuntimeError('Operator "&&" requires boolean arguments. Second argument is '+n+".");return t&&n},Node$4.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.add(t,n,scratchStorage.getCartesian2());if(n instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.add(t,n,scratchStorage.getCartesian3());if(n instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.add(t,n,scratchStorage.getCartesian4());if("string"==typeof t||"string"==typeof n)return t+n;if("number"==typeof t&&"number"==typeof n)return t+n;throw new RuntimeError('Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.subtract(t,n,scratchStorage.getCartesian2());if(n instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.subtract(t,n,scratchStorage.getCartesian3());if(n instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.subtract(t,n,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t-n;throw new RuntimeError('Operator "-" requires vector or number arguments of matching types. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.multiplyComponents(t,n,scratchStorage.getCartesian2());if(n instanceof Cartesian2&&"number"==typeof t)return Cartesian2.multiplyByScalar(n,t,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof n)return Cartesian2.multiplyByScalar(t,n,scratchStorage.getCartesian2());if(n instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.multiplyComponents(t,n,scratchStorage.getCartesian3());if(n instanceof Cartesian3&&"number"==typeof t)return Cartesian3.multiplyByScalar(n,t,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof n)return Cartesian3.multiplyByScalar(t,n,scratchStorage.getCartesian3());if(n instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.multiplyComponents(t,n,scratchStorage.getCartesian4());if(n instanceof Cartesian4&&"number"==typeof t)return Cartesian4.multiplyByScalar(n,t,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof n)return Cartesian4.multiplyByScalar(t,n,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t*n;throw new RuntimeError('Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.divideComponents(t,n,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof n)return Cartesian2.divideByScalar(t,n,scratchStorage.getCartesian2());if(n instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.divideComponents(t,n,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof n)return Cartesian3.divideByScalar(t,n,scratchStorage.getCartesian3());if(n instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.divideComponents(t,n,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof n)return Cartesian4.divideByScalar(t,n,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t/n;throw new RuntimeError('Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.fromElements(t.x%n.x,t.y%n.y,scratchStorage.getCartesian2());if(n instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,scratchStorage.getCartesian3());if(n instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t%n;throw new RuntimeError('Operator "%" requires vector or number arguments of matching types. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof Cartesian2&&t instanceof Cartesian2||n instanceof Cartesian3&&t instanceof Cartesian3||n instanceof Cartesian4&&t instanceof Cartesian4?t.equals(n):t===n},Node$4.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof Cartesian2&&t instanceof Cartesian2||n instanceof Cartesian3&&t instanceof Cartesian3||n instanceof Cartesian4&&t instanceof Cartesian4?!t.equals(n):t!==n},Node$4.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError("Conditional argument of conditional expression must be a boolean. Argument is "+t+".");return t?this._left.evaluate(e):this._right.evaluate(e)},Node$4.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))},Node$4.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))},Node$4.prototype._evaluateIsExactClass=function(e){return!!defined(e)&&e.isExactClass(this._left.evaluate(e))},Node$4.prototype._evaluateIsClass=function(e){return!!defined(e)&&e.isClass(this._left.evaluate(e))},Node$4.prototype._evaluateGetExactClassName=function(e){if(defined(e))return e.getExactClassName()},Node$4.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))},Node$4.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))},Node$4.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))},Node$4.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n,i="";defined(this._left)&&(i=this._left.evaluate(e));try{n=new RegExp(t,i)}catch(e){throw new RuntimeError(e)}return n},Node$4.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof n))throw new RuntimeError("RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+n+".");return t.test(n)},Node$4.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof n)return t.test(n);if(n instanceof RegExp&&"string"==typeof t)return n.test(t);throw new RuntimeError('Operator "=~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof n)return!t.test(n);if(n instanceof RegExp&&"string"==typeof t)return!n.test(t);throw new RuntimeError('Operator "!~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+n+".")},Node$4.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof n))throw new RuntimeError("RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+n+".");const i=t.exec(n);return defined(i)?i[1]:null},Node$4.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4)return String(t);throw new RuntimeError('Unexpected function call "'+this._value+'".')},Expression.NULL_SENTINEL="czm_infinity",Node$4.prototype.getShaderExpression=function(e,t,n){let i,r,o,a;const s=this._type;let c,l,u,d=this._value;switch(defined(this._left)&&(r=Array.isArray(this._left)?getExpressionArray(this._left,e,t,this):this._left.getShaderExpression(e,t,this)),defined(this._right)&&(o=this._right.getShaderExpression(e,t,this)),defined(this._test)&&(a=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(d=getExpressionArray(this._value,e,t,this)),s){case ExpressionNodeType$1.VARIABLE:if(checkFeature(this))return;return getVariableName(d,e);case ExpressionNodeType$1.UNARY:if("Boolean"===d)return"bool("+r+")";if("Number"===d)return"float("+r+")";if("round"===d)return"floor("+r+" + 0.5)";if(defined(unaryFunctions[d]))return d+"("+r+")";if("isNaN"===d)return"("+r+" != "+r+")";if("isFinite"===d)return"(abs("+r+") < czm_infinity)";if("String"===d||"isExactClass"===d||"isClass"===d||"getExactClassName"===d)throw new RuntimeError('Error generating style shader: "'+d+'" is not supported.');return d+r;case ExpressionNodeType$1.BINARY:return"%"===d?"mod("+r+", "+o+")":"==="===d?"("+r+" == "+o+")":"!=="===d?"("+r+" != "+o+")":"atan2"===d?"atan("+r+", "+o+")":defined(binaryFunctions[d])?d+"("+r+", "+o+")":"("+r+" "+d+" "+o+")";case ExpressionNodeType$1.TERNARY:if(defined(ternaryFunctions[d]))return d+"("+r+", "+o+", "+a+")";break;case ExpressionNodeType$1.CONDITIONAL:return"("+a+" ? "+r+" : "+o+")";case ExpressionNodeType$1.MEMBER:return checkFeature(this._left)?getVariableName(o,e):"r"===o||"x"===o||"0.0"===o?r+"[0]":"g"===o||"y"===o||"1.0"===o?r+"[1]":"b"===o||"z"===o||"2.0"===o?r+"[2]":"a"===o||"w"===o||"3.0"===o?r+"[3]":r+"[int("+o+")]";case ExpressionNodeType$1.FUNCTION_CALL:throw new RuntimeError('Error generating style shader: "'+d+'" is not supported.');case ExpressionNodeType$1.ARRAY:if(4===d.length)return"vec4("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+")";if(3===d.length)return"vec3("+d[0]+", "+d[1]+", "+d[2]+")";if(2===d.length)return"vec2("+d[0]+", "+d[1]+")";throw new RuntimeError("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ExpressionNodeType$1.REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.VARIABLE_IN_STRING:throw new RuntimeError("Error generating style shader: Converting a variable to a string is not supported.");case ExpressionNodeType$1.LITERAL_NULL:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.LITERAL_BOOLEAN:return d?"true":"false";case ExpressionNodeType$1.LITERAL_NUMBER:return numberToString(d);case ExpressionNodeType$1.LITERAL_STRING:if(defined(n)&&n._type===ExpressionNodeType$1.MEMBER&&("r"===d||"g"===d||"b"===d||"a"===d||"x"===d||"y"===d||"z"===d||"w"===d||checkFeature(n._left)))return d;if(i=Color.fromCssColorString(d,scratchColor$m),defined(i))return colorToVec3(i);throw new RuntimeError("Error generating style shader: String literals are not supported.");case ExpressionNodeType$1.LITERAL_COLOR:if(c=r,"color"===d){if(!defined(c))return"vec4(1.0)";if(c.length>1){const e=c[0],n=c[1];return"1.0"!==n&&(t.translucent=!0),"vec4("+e+", "+n+")"}return"vec4("+c[0]+", 1.0)"}if("rgb"===d)return i=convertRGBToColor(this),defined(i)?colorToVec4(i):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, 1.0)";if("rgba"===d)return"1.0"!==c[3]&&(t.translucent=!0),i=convertRGBToColor(this),defined(i)?colorToVec4(i):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, "+c[3]+")";if("hsl"===d)return i=convertHSLToRGB(this),defined(i)?colorToVec4(i):"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), 1.0)";if("hsla"===d)return i=convertHSLToRGB(this),defined(i)?(1!==i.alpha&&(t.translucent=!0),colorToVec4(i)):("1.0"!==c[3]&&(t.translucent=!0),"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), "+c[3]+")");break;case ExpressionNodeType$1.LITERAL_VECTOR:l=r.length,u=d+"(";for(let e=0;e<l;++e)u+=r[e],e<l-1&&(u+=", ");return u+=")",u;case ExpressionNodeType$1.LITERAL_REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.LITERAL_UNDEFINED:return Expression.NULL_SENTINEL;case ExpressionNodeType$1.BUILTIN_VARIABLE:if("tiles3d_tileset_time"===d)return"u_time"}},Node$4.prototype.getVariables=function(e,t){let n,i,r;const o=this._type,a=this._value;if(defined(this._left))if(Array.isArray(this._left))for(n=this._left,i=n.length,r=0;r<i;++r)n[r].getVariables(e,this);else this._left.getVariables(e,this);if(defined(this._right)&&this._right.getVariables(e,this),defined(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(n=this._value,i=n.length,r=0;r<i;++r)n[r].getVariables(e,this);let s;switch(o){case ExpressionNodeType$1.VARIABLE:checkFeature(this)||e.push(a);break;case ExpressionNodeType$1.VARIABLE_IN_STRING:for(s=variableRegex.exec(a);null!==s;)e.push(s[1]),s=variableRegex.exec(a);break;case ExpressionNodeType$1.LITERAL_STRING:defined(t)&&t._type===ExpressionNodeType$1.MEMBER&&checkFeature(t._left)&&e.push(a)}},Object.defineProperties(Vector3DTilePrimitive.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const defaultAttributeLocations={position:0,a_batchId:1};function createVertexArray$5(e,t){if(defined(e._va))return;const n=Buffer$1.createVertexBuffer({context:t,typedArray:e._positions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createIndexBuffer({context:t,typedArray:e._indices,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:2===e._indices.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),o=[{index:0,vertexBuffer:n,componentDatatype:ComponentDatatype$1.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:ComponentDatatype$1.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:o,indexBuffer:r}),t.webgl2&&(e._vaSwap=new VertexArray({context:t,attributes:o,indexBuffer:Buffer$1.createIndexBuffer({context:t,sizeInBytes:r.sizeInBytes,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:r.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function createShaders$3(e,t){if(defined(e._sp))return;const n=e._batchTable,i=defaultValue(e._attributeLocations,defaultAttributeLocations);let r=e._pickId;const o=e._vertexShaderSource;let a=e._fragmentShaderSource;if(defined(o))return e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:i}),e._spStencil=e._sp,a=ShaderSource.replaceMain(a,"czm_non_pick_main"),a=a+"void main() \n{ \n czm_non_pick_main(); \n gl_FragColor = "+r+"; \n} \n",void(e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:i}));const s=n.getVertexShaderCallback(!1,"a_batchId",void 0)(VectorTileVS);let c=n.getFragmentShaderCallback(!1,void 0,!0)(ShadowVolumeFS);r=n.getPickId();let l=new ShaderSource({sources:[s]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[c]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:i}),l=new ShaderSource({sources:[VectorTileVS]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[ShadowVolumeFS]}),e._spStencil=ShaderProgram.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:i}),c=ShaderSource.replaceMain(c,"czm_non_pick_main"),c=c+"\nvoid main() \n{ \n czm_non_pick_main(); \n gl_FragColor = "+r+"; \n} \n";const d=new ShaderSource({sources:[s]}),h=new ShaderSource({defines:["VECTOR_TILE"],sources:[c]});e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:i})}function getStencilDepthRenderState(e){const t=e?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.KEEP},backFunction:t,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}const colorRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND},pickRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.ZERO,zFail:StencilOperation$1.ZERO,zPass:StencilOperation$1.ZERO},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$4(e){defined(e._rsStencilDepthPass)||(e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(!0)),e._rsColorPass=RenderState.fromCache(colorRenderState),e._rsPickPass=RenderState.fromCache(pickRenderState))}const modifiedModelViewScratch$3=new Matrix4,rtcScratch$3=new Cartesian3;function createUniformMap$6(e,t){if(defined(e._uniformMap))return;const n={u_modifiedModelViewProjection:function(){const n=t.uniformState.view,i=t.uniformState.projection;return Matrix4.clone(n,modifiedModelViewScratch$3),Matrix4.multiplyByPoint(modifiedModelViewScratch$3,e._center,rtcScratch$3),Matrix4.setTranslation(modifiedModelViewScratch$3,rtcScratch$3,modifiedModelViewScratch$3),Matrix4.multiply(i,modifiedModelViewScratch$3,modifiedModelViewScratch$3),modifiedModelViewScratch$3},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function copyIndicesCPU(e,t,n,i,r,o,a){const s=e.constructor.BYTES_PER_ELEMENT,c=o.length;for(let l=0;l<c;++l){const c=a[o[l]],u=i[c],d=r[c],h=new e.constructor(e.buffer,s*u,d);t.set(h,n),i[c]=n,n+=d}return n}function rebatchCPU(e,t){const n=e._indices,i=e._indexOffsets,r=e._indexCounts,o=e._batchIdLookUp,a=new n.constructor(n.length);let s=t.pop();const c=[s];let l=copyIndicesCPU(n,a,0,i,r,s.batchIds,o);for(s.offset=0,s.count=l;t.length>0;){const e=t.pop();if(Color.equals(e.color,s.color))l=copyIndicesCPU(n,a,l,i,r,e.batchIds,o),s.batchIds=s.batchIds.concat(e.batchIds),s.count=l-s.offset;else{const t=l;l=copyIndicesCPU(n,a,l,i,r,e.batchIds,o),e.offset=t,e.count=l-t,c.push(e),s=e}}e._va.indexBuffer.copyFromArrayView(a),e._indices=a,e._batchedIndices=c}function copyIndicesGPU(e,t,n,i,r,o,a){const s=e.bytesPerIndex,c=o.length;for(let l=0;l<c;++l){const c=a[o[l]],u=i[c],d=r[c];t.copyFromBuffer(e,u*s,n*s,d*s),i[c]=n,n+=d}return n}function rebatchGPU(e,t){const n=e._indexOffsets,i=e._indexCounts,r=e._batchIdLookUp;let o=t.pop();const a=[o],s=e._va.indexBuffer,c=e._vaSwap.indexBuffer;let l=copyIndicesGPU(s,c,0,n,i,o.batchIds,r);for(o.offset=0,o.count=l;t.length>0;){const e=t.pop();if(Color.equals(e.color,o.color))l=copyIndicesGPU(s,c,l,n,i,e.batchIds,r),o.batchIds=o.batchIds.concat(e.batchIds),o.count=l-o.offset;else{const t=l;l=copyIndicesGPU(s,c,l,n,i,e.batchIds,r),e.offset=t,e.count=l-t,a.push(e),o=e}}const u=e._va;e._va=e._vaSwap,e._vaSwap=u,e._batchedIndices=a}function compareColors(e,t){return t.color.toRgba()-e.color.toRgba()}function rebatchCommands(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let r=!1;const o={};for(let e=0;e<i;++e){const t=n[e].color.toRgba();if(defined(o[t])){r=!0;break}o[t]=!0}return r?r&&!e.forceRebatch&&e._framesSinceLastRebatch<120?void++e._framesSinceLastRebatch:(n.sort(compareColors),t.webgl2?rebatchGPU(e,n):rebatchCPU(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0):(e._batchDirty=!1,!1)}function createColorCommands(e,t){const n=rebatchCommands(e,t),i=e._commands,r=e._batchedIndices,o=r.length,a=2*o;if(defined(i)&&!n&&i.length===a)return;i.length=a;const s=e._va,c=e._sp,l=defaultValue(e._modelMatrix,Matrix4.IDENTITY),u=e._uniformMap,d=e._boundingVolume;for(let t=0;t<o;++t){const n=r[t].offset,o=r[t].count;let a=i[2*t];defined(a)||(a=i[2*t]=new DrawCommand({owner:e})),a.vertexArray=s,a.modelMatrix=l,a.offset=n,a.count=o,a.renderState=e._rsStencilDepthPass,a.shaderProgram=c,a.uniformMap=u,a.boundingVolume=d,a.cull=!1,a.pass=Pass$1.TERRAIN_CLASSIFICATION;const h=DrawCommand.shallowClone(a,a.derivedCommands.tileset);h.renderState=e._rsStencilDepthPass3DTiles,h.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=h;let p=i[2*t+1];defined(p)||(p=i[2*t+1]=new DrawCommand({owner:e})),p.vertexArray=s,p.modelMatrix=l,p.offset=n,p.count=o,p.renderState=e._rsColorPass,p.shaderProgram=c,p.uniformMap=u,p.boundingVolume=d,p.cull=!1,p.pass=Pass$1.TERRAIN_CLASSIFICATION;const f=DrawCommand.shallowClone(p,p.derivedCommands.tileset);f.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._commandsDirty=!0}function createColorCommandsIgnoreShow(e,t){if(e.classificationType===ClassificationType$1.TERRAIN||!t.invertClassification||defined(e._commandsIgnoreShow)&&!e._commandsDirty)return;const n=e._commands,i=e._commandsIgnoreShow,r=e._spStencil,o=n.length,a=i.length=o/2;let s=0;for(let e=0;e<a;++e){const t=i[e]=DrawCommand.shallowClone(n[s],i[e]);t.shaderProgram=r,t.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,s+=2}e._commandsDirty=!1}function createPickCommands(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,n=e._pickCommands;n.length=2*t;const i=e._va,r=e._spStencil,o=e._spPick,a=defaultValue(e._modelMatrix,Matrix4.IDENTITY),s=e._uniformMap;for(let c=0;c<t;++c){const t=e._indexOffsets[c],l=e._indexCounts[c],u=defined(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let d=n[2*c];defined(d)||(d=n[2*c]=new DrawCommand({owner:e,pickOnly:!0})),d.vertexArray=i,d.modelMatrix=a,d.offset=t,d.count=l,d.renderState=e._rsStencilDepthPass,d.shaderProgram=r,d.uniformMap=s,d.boundingVolume=u,d.pass=Pass$1.TERRAIN_CLASSIFICATION;const h=DrawCommand.shallowClone(d,d.derivedCommands.tileset);h.renderState=e._rsStencilDepthPass3DTiles,h.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,d.derivedCommands.tileset=h;let p=n[2*c+1];defined(p)||(p=n[2*c+1]=new DrawCommand({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=a,p.offset=t,p.count=l,p.renderState=e._rsPickPass,p.shaderProgram=o,p.uniformMap=s,p.boundingVolume=u,p.pass=Pass$1.TERRAIN_CLASSIFICATION;const f=DrawCommand.shallowClone(p,p.derivedCommands.tileset);f.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._pickCommandsDirty=!1}function clearStyle$3(e,t){e._updatingAllCommands=!0;const n=e._batchIds;let i,r=n.length;for(i=0;i<r;++i){const e=t[n[i]];e.show=!0,e.color=Color.WHITE}const o=e._batchedIndices;for(r=o.length,i=0;i<r;++i)o[i].color=Color.clone(Color.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}Vector3DTilePrimitive.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=n[r];t[i]=new Cesium3DTileFeature(e,i)}},Vector3DTilePrimitive.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$l=new Color,DEFAULT_COLOR_VALUE$2=Color.WHITE,DEFAULT_SHOW_VALUE$2=!0,complexExpressionReg=/\$/;function queueCommands$2(e,t,n,i){const r=e.classificationType,o=r!==ClassificationType$1.CESIUM_3D_TILE,a=r!==ClassificationType$1.TERRAIN,s=t.commandList;let c,l,u=n.length;for(l=0;l<u;++l)o&&(c=n[l],c.pass=Pass$1.TERRAIN_CLASSIFICATION,s.push(c)),a&&(c=n[l].derivedCommands.tileset,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,s.push(c));if(t.invertClassification&&defined(i))for(u=i.length,l=0;l<u;++l)s.push(i[l])}function queueWireframeCommands(e,t){const n=e.commandList,i=t.length;for(let e=0;e<i;e+=2){const i=t[e+1];i.pass=Pass$1.OPAQUE,n.push(i)}}function updateWireframe$2(e){let t,n,i=e.debugWireframe===e._debugWireframe;if(i=i&&!(e.debugWireframe&&e._wireframeDirty),i)return;defined(e._rsWireframe)||(e._rsWireframe=RenderState.fromCache({})),e.debugWireframe?(t=e._rsWireframe,n=PrimitiveType$1.LINES):(t=e._rsColorPass,n=PrimitiveType$1.TRIANGLES);const r=e._commands,o=r.length;for(let e=0;e<o;e+=2){const i=r[e+1];i.renderState=t,i.primitiveType=n}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}Vector3DTilePrimitive.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$3(this,t);const n=e.color,i=n instanceof Expression&&!complexExpressionReg.test(n.expression);this._updatingAllCommands=i;const r=this._batchIds;let o,a=r.length;for(o=0;o<a;++o){const n=t[r[o]];n.color=defined(e.color)?e.color.evaluateColor(n,scratchColor$l):DEFAULT_COLOR_VALUE$2,n.show=defined(e.show)?e.show.evaluate(n):DEFAULT_SHOW_VALUE$2}if(i){const e=this._batchedIndices;for(a=e.length,o=0;o<a;++o)e[o].color=Color.clone(Color.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}},Vector3DTilePrimitive.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const n=this._batchIdLookUp,i=n[e];if(!defined(i))return;const r=this._indexOffsets,o=this._indexCounts,a=r[i],s=o[i],c=this._batchedIndices,l=c.length;let u;for(u=0;u<l;++u){const e=c[u].offset,t=c[u].count;if(a>=e&&a<e+t)break}c.push(new Vector3DTileBatch({color:Color.clone(t),offset:a,count:s,batchIds:[e]}));const d=[],h=[],p=c[u].batchIds,f=p.length;for(let t=0;t<f;++t){const i=p[t];if(i===e)continue;r[n[i]]<a?d.push(i):h.push(i)}0!==h.length&&c.push(new Vector3DTileBatch({color:Color.clone(c[u].color),offset:a+s,count:c[u].offset+c[u].count-(a+s),batchIds:h})),0!==d.length?(c[u].count=a-c[u].offset,c[u].batchIds=d):c.splice(u,1),this._batchDirty=!0},Vector3DTilePrimitive.prototype.update=function(e){const t=e.context;createVertexArray$5(this,t),createShaders$3(this,t),createRenderStates$4(this),createUniformMap$6(this,t);const n=e.passes;n.render&&(createColorCommands(this,t),createColorCommandsIgnoreShow(this,e),updateWireframe$2(this),this._debugWireframe?queueWireframeCommands(e,this._commands):queueCommands$2(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(createPickCommands(this),queueCommands$2(this,e,this._pickCommands))},Vector3DTilePrimitive.prototype.isDestroyed=function(){return!1},Vector3DTilePrimitive.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),destroyObject(this)};const boundingSphereCartesian3Scratch$1=new Cartesian3,ModelState$1=ModelUtility.ModelState;function ClassificationModel(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw new RuntimeError("Only binary glTF is supported as a classifier.");t=parseGlb(t),updateVersion(t),addDefaults(t),processModelMaterialsCommon(t),processPbrMaterials(t),ForEach.buffer(t,(function(e){if(!defined(e.extras._pipeline.source))throw new RuntimeError("Buffer data must be embedded in the binary gltf.")}));const n=t.nodes,i=t.meshes,r=n[0].mesh;if(1!==n.length||!defined(r))throw new RuntimeError("Only one node is supported for classification and it must have a mesh.");if(1!==i.length)throw new RuntimeError("Only one mesh is supported when using b3dm for classification.");const o=i[0].primitives;if(1!==o.length)throw new RuntimeError("Only one primitive per mesh is supported when using b3dm for classification.");if(!defined(o[0].attributes.POSITION))throw new RuntimeError("The mesh must have a position attribute.");if(!defined(o[0].attributes._BATCHID))throw new RuntimeError("The mesh must have a batch id attribute.");this._gltf=t,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._ready=!1,this._readyPromise=when.defer(),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._classificationType=e.classificationType,this._vertexShaderLoaded=e.vertexShaderLoaded,this._classificationShaderLoaded=e.classificationShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._batchTable=e.batchTable,this._computedModelMatrix=new Matrix4,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState$1.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._dirty=!1,this._nodeMatrix=new Matrix4,this._primitive=void 0,this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms=void 0,this._buffers={},this._vertexArray=void 0,this._shaderProgram=void 0,this._uniformMap=void 0,this._geometryByteLength=0,this._trianglesLength=0,this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0}function addBuffersToLoadResources$1(e){const t=e.gltf,n=e._loadResources;ForEach.buffer(t,(function(e,t){n.buffers[t]=e.extras._pipeline.source}))}function parseBufferViews$1(e){const t=e.gltf.bufferViews,n=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&n.enqueue(t)}));const i=e._loadResources.indexBuffersToCreate,r={};ForEach.accessor(e.gltf,(function(e){const n=e.bufferView;t[n].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(r[n])||(r[n]=!0,i.enqueue({id:n,componentType:e.componentType}))}))}function createVertexBuffer$3(e,t){const n=t._loadResources,i=t.gltf.bufferViews[e],r=n.getBuffer(i);t._buffers[e]=r,t._geometryByteLength+=r.byteLength}function createIndexBuffer$2(e,t,n){const i=n._loadResources,r=n.gltf.bufferViews[e],o={typedArray:i.getBuffer(r),indexDatatype:t};n._buffers[e]=o,n._geometryByteLength+=o.typedArray.byteLength}function createBuffers$1(e){const t=e._loadResources;if(0!==t.pendingBufferLoads)return;const n=t.vertexBuffersToCreate,i=t.indexBuffersToCreate;for(;n.length>0;)createVertexBuffer$3(n.dequeue(),e);for(;i.length>0;){const t=i.dequeue();createIndexBuffer$2(t.id,t.componentType,e)}}function modifyShaderForQuantizedAttributes$1(e,t){const n=t.gltf.meshes[0].primitives[0],i=ModelUtility.modifyShaderForQuantizedAttributes(t.gltf,n,e);return t._quantizedUniforms=i.uniforms,i.shader}function modifyShader$1(e,t){return defined(t)&&(e=t(e)),e}function createProgram$1(e){const t=e.gltf,n=ModelUtility.getAttributeOrUniformBySemantic(t,"POSITION"),i=ModelUtility.getAttributeOrUniformBySemantic(t,"_BATCHID"),r={};r[n]=0,r[i]=1;const o=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEWPROJECTION");let a,s;if(defined(o))a="uniform mat4 "+o+";\n",s=o+" * vec4("+n+", 1.0)";else{const e=ModelUtility.getAttributeOrUniformBySemantic(t,"PROJECTION");let i=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEW");defined(i)||(i=ModelUtility.getAttributeOrUniformBySemantic(t,"CESIUM_RTC_MODELVIEW")),a="uniform mat4 "+i+";\nuniform mat4 "+e+";\n",s=e+" * "+i+" * vec4("+n+", 1.0)"}let c="attribute vec3 "+n+";\nattribute float "+i+";\n"+a+"void main() {\n"+(" vec4 positionInClipCoords = "+s+";\n")+" gl_Position = czm_depthClamp(positionInClipCoords);\n}\n";e.extensionsUsed.WEB3D_quantized_attributes&&(c=modifyShaderForQuantizedAttributes$1(c,e));const l=modifyShader$1(c,e._vertexShaderLoaded),u=modifyShader$1("#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeDepthClamp();\n}\n",e._classificationShaderLoaded);e._shaderProgram={vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:r}}function getAttributeLocations$2(){return{POSITION:0,_BATCHID:1}}function createVertexArray$4(e){if(!e._loadResources.finishedBuffersCreation()||defined(e._vertexArray))return;const t=e._buffers,n=e.gltf,i=n.accessors,r=n.meshes[0].primitives[0],o=getAttributeLocations$2(),a={};let s;if(ForEach.meshPrimitiveAttribute(r,(function(e,r){const s=o[r];if(defined(s)){const o=i[e];a[r]={index:s,vertexBuffer:t[o.bufferView],componentsPerAttribute:numberOfComponentsForType(o.type),componentDatatype:o.componentType,offsetInBytes:o.byteOffset,strideInBytes:getAccessorByteStride(n,o)}}})),defined(r.indices)){const e=i[r.indices];s=t[e.bufferView]}e._vertexArray={attributes:a,indexBuffer:s}}Object.defineProperties(ClassificationModel.prototype,{gltf:{get:function(){return this._gltf}},boundingSphere:{get:function(){const e=this.modelMatrix,t=Matrix4.getScale(e,boundingSphereCartesian3Scratch$1),n=this._scaledBoundingSphere;return n.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,n.center),n.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,n.center,n.center),n}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},dirty:{get:function(){return this._dirty}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return 0}},classificationType:{get:function(){return this._classificationType}}});const gltfSemanticUniforms={PROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function createUniformMap$5(e,t){if(defined(e._uniformMap))return;const n={};ForEach.technique(e.gltf,(function(i){ForEach.techniqueUniform(i,(function(i,r){defined(i.semantic)&&defined(gltfSemanticUniforms[i.semantic])&&(n[r]=gltfSemanticUniforms[i.semantic](t.uniformState,e))}))})),e._uniformMap=n}function createUniformsForQuantizedAttributes$1(e,t){return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function triangleCountFromPrimitiveIndices$1(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createPrimitive$2(e){const t=e._batchTable;let n=e._uniformMap;const i=e._vertexArray,r=e.gltf,o=r.accessors,a=r.meshes[0].primitives[0],s=o[a.indices],c=a.attributes.POSITION,l=ModelUtility.getAccessorMinMax(r,c),u=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(l.min),Cartesian3.fromArray(l.max));let d,h;if(defined(s))h=s.count,d=s.byteOffset/IndexDatatype$1.getSizeInBytes(s.componentType);else{h=o[a.attributes.POSITION].count,d=0}if(e._trianglesLength+=triangleCountFromPrimitiveIndices$1(a,h),defined(e._uniformMapLoaded)&&(n=e._uniformMapLoaded(n)),e.extensionsUsed.WEB3D_quantized_attributes){n=combine$2(n,createUniformsForQuantizedAttributes$1(e,a))}let p=i.attributes.POSITION,f=p.componentDatatype,m=p.vertexBuffer,g=m.byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f),y=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_);p=i.attributes._BATCHID,f=p.componentDatatype,m=p.vertexBuffer,g=m.byteOffset,_=m.byteLength/ComponentDatatype$1.getSizeInBytes(f);let C=ComponentDatatype$1.createArrayBufferView(f,m.buffer,g,_);const T=i.indexBuffer.typedArray;let S;S=i.indexBuffer.indexDatatype===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(T.buffer,T.byteOffset,T.byteLength/Uint16Array.BYTES_PER_ELEMENT):new Uint32Array(T.buffer,T.byteOffset,T.byteLength/Uint32Array.BYTES_PER_ELEMENT),y=arraySlice(y),C=arraySlice(C),S=arraySlice(S,d,d+h);const A=[],v=[],E=[],b=[];let x,P,D,w=C[S[0]];A.push(w),E.push(0);const M=S.length;for(let e=1;e<M;++e)x=C[S[e]],x!==w&&(P=E[E.length-1],D=e-P,A.push(x),v.push(D),E.push(e),b.push(new Vector3DTileBatch({offset:P,count:D,batchIds:[w],color:Color.WHITE})),w=x);P=E[E.length-1],D=M-P,v.push(D),b.push(new Vector3DTileBatch({offset:P,count:D,batchIds:[w],color:Color.WHITE}));const I=e._shaderProgram,R=I.vertexShaderSource,O=I.fragmentShaderSource,B=I.attributeLocations,L=defined(e._pickIdLoaded)?e._pickIdLoaded():void 0;e._primitive=new Vector3DTilePrimitive({classificationType:e._classificationType,positions:y,indices:S,indexOffsets:E,indexCounts:v,batchIds:A,vertexBatchIds:C,batchedIndices:b,batchTable:t,boundingVolume:new BoundingSphere,_vertexShaderSource:R,_fragmentShaderSource:O,_attributeLocations:B,_uniformMap:n,_pickId:L,_modelMatrix:new Matrix4,_boundingSphere:u}),e._buffers=void 0,e._vertexArray=void 0,e._shaderProgram=void 0,e._uniformMap=void 0}function createRuntimeNodes$1(e){if(!e._loadResources.finished())return;if(defined(e._primitive))return;const t=e.gltf.nodes[0];e._nodeMatrix=ModelUtility.getTransform(t,e._nodeMatrix),createPrimitive$2(e)}function createResources$5(e,t){const n=t.context;ModelUtility.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,n),createBuffers$1(e),createProgram$1(e),createVertexArray$4(e),createUniformMap$5(e,n),createRuntimeNodes$1(e)}const scratchComputedTranslation$2=new Cartesian4,scratchComputedMatrixIn2D$1=new Matrix4;function updateNodeModelMatrix(e,t,n,i){let r=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){const t=Matrix4.getColumn(r,3,scratchComputedTranslation$2);if(Cartesian4.equals(t,Cartesian4.UNIT_W)){const t=e.boundingSphere.center,n=Transforms.wgs84To2DModelMatrix(i,t,scratchComputedMatrixIn2D$1);r=Matrix4.multiply(n,r,scratchComputedMatrixIn2D$1),defined(e._rtcCenter)&&(Matrix4.setTranslation(r,Cartesian4.UNIT_W,r),e._rtcCenter=e._rtcCenter2D)}else r=Transforms.basisTo2D(i,r,scratchComputedMatrixIn2D$1),e._rtcCenter=e._rtcCenter3D}const o=e._primitive;(t||n)&&(Matrix4.multiplyTransformation(r,e._nodeMatrix,o._modelMatrix),BoundingSphere.transform(o._boundingSphere,o._modelMatrix,o._boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,o._boundingVolume.center,o._boundingVolume.center))}function ClippingPlane(e,t){this._distance=t,this._normal=new UpdateChangedCartesian3(e,this),this.onChangeCallback=void 0,this.index=-1}function UpdateChangedCartesian3(e,t){this._clippingPlane=t,this._cartesian3=Cartesian3.clone(e)}function ClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=defaultValue(e.enabled,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0),this.planeAdded=new Event,this.planeRemoved=new Event,this._owner=void 0;const t=defaultValue(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?unionIntersectFunction:defaultIntersectFunction,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(defined(n)){const e=n.length;for(let t=0;t<e;++t)this.add(n[t])}}function unionIntersectFunction(e){return e===Intersect$1.OUTSIDE}function defaultIntersectFunction(e){return e===Intersect$1.INSIDE}function setIndexDirty(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||-1!==e._dirtyIndex&&e._dirtyIndex!==t,e._dirtyIndex=t}function indexOf$1(e,t){const n=e.length;for(let i=0;i<n;++i)if(Plane.equals(e[i],t))return i;return-1}ClassificationModel.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},ClassificationModel.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!FeatureDetection.supportsWebP.initialized)return void FeatureDetection.supportsWebP.initialize();const t=FeatureDetection.supportsWebP();if(this._state===ModelState$1.NEEDS_LOAD&&defined(this.gltf)&&(this._state=ModelState$1.LOADING,this._state!==ModelState$1.FAILED)){const t=this.gltf.extensions;if(defined(t)&&defined(t.CESIUM_RTC)){const n=Cartesian3.fromArray(t.CESIUM_RTC.center);if(!Cartesian3.equals(n,Cartesian3.ZERO)){this._rtcCenter3D=n;const t=e.mapProjection,i=t.ellipsoid.cartesianToCartographic(this._rtcCenter3D),r=t.project(i);Cartesian3.fromElements(r.z,r.x,r.y,r),this._rtcCenter2D=r,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}this._loadResources=new ModelLoadResources,ModelUtility.parseBuffers(this)}const n=this._loadResources;let i=!1;this._state===ModelState$1.LOADING&&(0===n.pendingBufferLoads&&(ModelUtility.checkSupportedExtensions(this.extensionsRequired,t),addBuffersToLoadResources$1(this),parseBufferViews$1(this),this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,createResources$5(this,e)),n.finished()&&(this._state=ModelState$1.LOADED,i=!0)),defined(n)&&this._state===ModelState$1.LOADED&&(i||createResources$5(this,e),n.finished()&&(this._loadResources=void 0));const r=this.show;if(r&&this._state===ModelState$1.LOADED||i){this._dirty=!1;const t=this.modelMatrix,n=e.mode!==this._mode;this._mode=e.mode;const r=!Matrix4.equals(this._modelMatrix,t)||n;if(r||i){Matrix4.clone(t,this._modelMatrix);const e=this._computedModelMatrix;Matrix4.clone(t,e),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(e,Axis$1.Y_UP_TO_Z_UP,e):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(e,Axis$1.X_UP_TO_Z_UP,e)}(r||i)&&(updateNodeModelMatrix(this,r,i,e.mapProjection),this._dirty=!0)}if(i){const t=this;e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}else r&&!this._ignoreCommands&&(this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.debugWireframe=this.debugWireframe,this._primitive.update(e))},ClassificationModel.prototype.isDestroyed=function(){return!1},ClassificationModel.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(ClippingPlane.prototype,{distance:{get:function(){return this._distance},set:function(e){defined(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){defined(this.onChangeCallback)&&!Cartesian3.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),Cartesian3.clone(e,this._normal._cartesian3)}}}),ClippingPlane.fromPlane=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance):t=new ClippingPlane(e.normal,e.distance),t},ClippingPlane.clone=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance,t):new ClippingPlane(e.normal,e.distance)},Object.defineProperties(UpdateChangedCartesian3.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}}),Object.defineProperties(ClippingPlaneCollection.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?unionIntersectFunction:defaultIntersectFunction)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}}),ClippingPlaneCollection.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(e){setIndexDirty(n,e)},e.index=t,setIndexDirty(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)},ClippingPlaneCollection.prototype.get=function(e){return this._planes[e]},ClippingPlaneCollection.prototype.contains=function(e){return-1!==indexOf$1(this._planes,e)},ClippingPlaneCollection.prototype.remove=function(e){const t=this._planes,n=indexOf$1(t,e);if(-1===n)return!1;e instanceof ClippingPlane&&(e.onChangeCallback=void 0,e.index=-1);const i=t.length-1;for(let e=n;e<i;++e){const n=t[e+1];t[e]=n,n instanceof ClippingPlane&&(n.index=e)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0},ClippingPlaneCollection.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const t=e[n];t instanceof ClippingPlane&&(t.onChangeCallback=void 0,t.index=-1),this.planeRemoved.raiseEvent(t,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const distanceEncodeScratch=new Cartesian4,oct32EncodeScratch=new Cartesian4;function packPlanesAsUint8(e,t,n){const i=e._uint8View,r=e._planes;let o=0;for(let e=t;e<n;++e){const t=r[e],n=AttributeCompression.octEncodeToCartesian4(t.normal,oct32EncodeScratch);i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w;const a=Cartesian4.packFloat(t.distance,distanceEncodeScratch);i[o+4]=a.x,i[o+5]=a.y,i[o+6]=a.z,i[o+7]=a.w,o+=8}}function packPlanesAsFloats(e,t,n){const i=e._float32View,r=e._planes;let o=0;for(let e=t;e<n;++e){const t=r[e],n=t.normal;i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=t.distance,o+=4}}function computeTextureResolution(e,t){const n=ContextLimits.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const textureResolutionScratch$1=new Cartesian2;ClippingPlaneCollection.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=ClippingPlaneCollection.useFloatTexture(n),r=i?this.length:2*this.length;if(defined(t)){const e=t.width*t.height;(e<r||r<.25*e)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(0===this.length)return;if(!defined(t)){const e=computeTextureResolution(r,textureResolutionScratch$1);e.y*=2,i?(t=new Texture({context:n,width:e.x,height:e.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:Sampler.NEAREST,flipY:!1}),this._float32View=new Float32Array(e.x*e.y*4)):(t=new Texture({context:n,width:e.x,height:e.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(e.x*e.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const o=this._dirtyIndex;if(this._multipleDirtyPlanes||-1!==o){if(this._multipleDirtyPlanes)i?(packPlanesAsFloats(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(packPlanesAsUint8(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let e=0,n=0;i?(n=Math.floor(o/t.width),e=Math.floor(o-n*t.width),packPlanesAsFloats(this,o,o+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:e,yOffset:n})):(n=Math.floor(2*o/t.width),e=Math.floor(2*o-n*t.width),packPlanesAsUint8(this,o,o+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:e,yOffset:n}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const scratchMatrix$4=new Matrix4,scratchPlane=new Plane(Cartesian3.UNIT_X,0);ClippingPlaneCollection.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let r=this.modelMatrix;defined(t)&&(r=Matrix4.multiply(t,r,scratchMatrix$4));let o=Intersect$1.INSIDE;!this.unionClippingRegions&&i>0&&(o=Intersect$1.OUTSIDE);for(let t=0;t<i;++t){const i=n[t];Plane.transform(i,r,scratchPlane);const a=e.intersectPlane(scratchPlane);if(a===Intersect$1.INTERSECTING)o=a;else if(this._testIntersection(a))return a}return o},ClippingPlaneCollection.setOwner=function(e,t,n){e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),defined(e)&&(e._owner=t,t[n]=e))},ClippingPlaneCollection.useFloatTexture=function(e){return e.floatingPointTexture},ClippingPlaneCollection.getTextureResolution=function(e,t,n){const i=e.texture;if(defined(i))return n.x=i.width,n.y=i.height,n;const r=computeTextureResolution(ClippingPlaneCollection.useFloatTexture(t)?e.length:2*e.length,n);return r.y*=2,r},ClippingPlaneCollection.prototype.isDestroyed=function(){return!1},ClippingPlaneCollection.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),destroyObject(this)};const ColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2,getColorBlend:function(e,t){return e===ColorBlendMode.HIGHLIGHT?0:e===ColorBlendMode.REPLACE?1:e===ColorBlendMode.MIX?CesiumMath.clamp(t,CesiumMath.EPSILON4,1):void 0}};var ColorBlendMode$1=Object.freeze(ColorBlendMode);function DracoLoader(){}function addBufferToLoadResources(e,t){const n="runtime."+Object.keys(e.createdBufferViews).length,i=e.buffers,r=Object.keys(i).length;return i[r]=t,e.createdBufferViews[n]={buffer:r,byteOffset:0,byteLength:t.byteLength},n}function addNewVertexBuffer(e,t,n){const i=t._loadResources,r=addBufferToLoadResources(i,e);return i.vertexBuffersToCreate.enqueue(r),r}function addNewIndexBuffer(e,t,n){const i=e.typedArray,r=t._loadResources,o=addBufferToLoadResources(r,i);return r.indexBuffersToCreate.enqueue({id:o,componentType:ComponentDatatype$1.fromTypedArray(i)}),{bufferViewId:o,numberOfIndices:e.numberOfIndices}}function scheduleDecodingTask(e,t,n,i){if(!DracoLoader._taskProcessorReady)return;const r=n.primitivesToDecode.peek();if(!defined(r))return;const o=e.scheduleTask(r,[r.array.buffer]);return defined(o)?(n.activeDecodingTasks++,n.primitivesToDecode.dequeue(),o.then((function(e){n.activeDecodingTasks--;const i=addNewIndexBuffer(e.indexArray,t),o={},a=e.attributeData;for(const e in a)if(a.hasOwnProperty(e)){const n=a[e],i=addNewVertexBuffer(n.array,t),r=n.data;r.bufferView=i,o[e]=r}t._decodedData[r.mesh+".primitive."+r.primitive]={bufferView:i.bufferViewId,numberOfIndices:i.numberOfIndices,attributes:o}}))):void 0}function getClipAndStyleCode(e,t,n){return" float clipDistance = clip(gl_FragCoord, "+e+", "+t+"); \n vec4 clippingPlanesEdgeColor = vec4(1.0); \n clippingPlanesEdgeColor.rgb = "+n+".rgb; \n float clippingPlanesEdgeWidth = "+n+".a; \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n { \n gl_FragColor = clippingPlanesEdgeColor;\n } \n"}DracoLoader._maxDecodingConcurrency=Math.max(FeatureDetection.hardwareConcurrency-1,1),DracoLoader._decoderTaskProcessor=void 0,DracoLoader._taskProcessorReady=!1,DracoLoader._getDecoderTaskProcessor=function(){if(!defined(DracoLoader._decoderTaskProcessor)){const e=new TaskProcessor("decodeDraco",DracoLoader._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then((function(){DracoLoader._taskProcessorReady=!0})),DracoLoader._decoderTaskProcessor=e}return DracoLoader._decoderTaskProcessor},DracoLoader.hasExtension=function(e){return defined(e.extensionsRequired.KHR_draco_mesh_compression)||defined(e.extensionsUsed.KHR_draco_mesh_compression)},DracoLoader._decodedModelResourceCache=void 0,DracoLoader.parse=function(e,t){if(!DracoLoader.hasExtension(e))return;const n=e._loadResources,i=e.cacheKey;if(defined(i)){defined(DracoLoader._decodedModelResourceCache)||(defined(t.cache.modelDecodingCache)||(t.cache.modelDecodingCache={}),DracoLoader._decodedModelResourceCache=t.cache.modelDecodingCache);const e=DracoLoader._decodedModelResourceCache[i];if(defined(e))return e.count++,void(n.pendingDecodingCache=!0)}const r=e._dequantizeInShader,o=e.gltf;ForEach.mesh(o,(function(e,t){ForEach.meshPrimitive(e,(function(e,i){if(!defined(e.extensions))return;const a=e.extensions.KHR_draco_mesh_compression;if(!defined(a))return;const s=o.bufferViews[a.bufferView],c=arraySlice(o.buffers[s.buffer].extras._pipeline.source,s.byteOffset,s.byteOffset+s.byteLength);n.primitivesToDecode.enqueue({mesh:t,primitive:i,array:c,bufferView:s,compressedAttributes:a.attributes,dequantizeInShader:r})}))}))},DracoLoader.decodeModel=function(e,t){if(!DracoLoader.hasExtension(e))return when.resolve();const n=e._loadResources,i=e.cacheKey;if(defined(i)&&defined(DracoLoader._decodedModelResourceCache)){const t=DracoLoader._decodedModelResourceCache[i];if(defined(t)&&n.pendingDecodingCache)return when(t.ready,(function(){e._decodedData=t.data,n.pendingDecodingCache=!1}));DracoLoader._decodedModelResourceCache[i]={ready:!1,count:1,data:void 0}}if(0===n.primitivesToDecode.length)return when.resolve();const r=DracoLoader._getDecoderTaskProcessor(),o=[];let a=scheduleDecodingTask(r,e,n);for(;defined(a);)o.push(a),a=scheduleDecodingTask(r,e,n);return when.all(o)},DracoLoader.decodePointCloud=function(e){const t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])},DracoLoader.decodeBufferView=function(e){const t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])},DracoLoader.cacheDataForModel=function(e){const t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){const n=DracoLoader._decodedModelResourceCache[t];defined(n)&&(n.ready=!0,n.data=e._decodedData)}},DracoLoader.destroyCachedDataForModel=function(e){const t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){const e=DracoLoader._decodedModelResourceCache[t];defined(e)&&0==--e.count&&delete DracoLoader._decodedModelResourceCache[t]}};const textureResolutionScratch=new Cartesian2;function getClippingFunction(e,t){const n=e.unionClippingRegions,i=e.length,r=ClippingPlaneCollection.useFloatTexture(t),o=ClippingPlaneCollection.getTextureResolution(e,t,textureResolutionScratch),a=o.x,s=o.y;let c=r?getClippingPlaneFloat(a,s):getClippingPlaneUint8(a,s);return c+="\n",c+=n?clippingFunctionUnion(i):clippingFunctionIntersect(i),c}function clippingFunctionUnion(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount;\n float pixelWidth = czm_metersPerPixel(position);\n bool breakAndDiscard = false;\n for (int i = 0; i < "+e+"; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n if (amount <= 0.0)\n {\n breakAndDiscard = true;\n break;\n }\n }\n if (breakAndDiscard) {\n discard;\n }\n return clipAmount;\n}\n"}function clippingFunctionIntersect(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n bool clipped = true;\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n for (int i = 0; i < "+e+"; ++i)\n {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n clipAmount = max(amount, clipAmount);\n clipped = clipped && (amount <= 0.0);\n }\n if (clipped)\n {\n discard;\n }\n return clipAmount;\n}\n"}function getClippingPlaneFloat(e,t){const n=1/t;let i=1/e+"";-1===i.indexOf(".")&&(i+=".0");let r=n+"";-1===r.indexOf(".")&&(r+=".0");return"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / "+e+";\n int pixX = clippingPlaneNumber - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+i+";\n float v = (float(pixY) + 0.5) * "+r+";\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n"}function getClippingPlaneUint8(e,t){const n=1/t;let i=1/e+"";-1===i.indexOf(".")&&(i+=".0");let r=n+"";-1===r.indexOf(".")&&(r+=".0");return"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / "+e+";\n int pixX = clippingPlaneStartIndex - (pixY * "+e+");\n float u = (float(pixX) + 0.5) * "+i+";\n float v = (float(pixY) + 0.5) * "+r+";\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + "+i+", v)));\n return czm_transformPlane(plane, transform);\n}\n"}const JobType={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3};var JobType$1=Object.freeze(JobType);function ModelAnimationCache(){}const dataUriRegex=/^data\:/i;function getAccessorKey(e,t){const n=e.gltf,i=n.buffers,r=n.bufferViews[t.bufferView],o=i[r.buffer],a=r.byteOffset+t.byteOffset,s=t.count*numberOfComponentsForType(t.type),c=dataUriRegex.test(o.uri)?"":o.uri;return e.cacheKey+"//"+c+"/"+a+"/"+s}const cachedAnimationParameters={};ModelAnimationCache.getAnimationParameterValues=function(e,t){const n=getAccessorKey(e,t);let i=cachedAnimationParameters[n];if(!defined(i)){const r=e.gltf,o=r.buffers,a=r.bufferViews[t.bufferView],s=o[a.buffer].extras._pipeline.source,c=t.componentType,l=t.type,u=numberOfComponentsForType(l),d=t.count,h=getAccessorByteStride(r,t);i=new Array(d);const p=defaultValue(t.byteOffset,0);let f=a.byteOffset+p;for(let e=0;e<d;e++){const t=ComponentDatatype$1.createArrayBufferView(c,s.buffer,s.byteOffset+f,u);"SCALAR"===l?i[e]=t[0]:"VEC3"===l?i[e]=Cartesian3.fromArray(t):"VEC4"===l&&(i[e]=Quaternion.unpack(t)),f+=h}defined(e.cacheKey)&&(cachedAnimationParameters[n]=i)}return i};const cachedAnimationSplines={};function getAnimationSplineKey(e,t,n){return e.cacheKey+"//"+t+"/"+n}function ConstantSpline(e){this._value=e}function SteppedSpline(e){this._spline=e,this._lastTimeIndex=0}ConstantSpline.prototype.evaluate=function(e,t){return this._value},ConstantSpline.prototype.wrapTime=function(e){return 0},ConstantSpline.prototype.clampTime=function(e){return 0},SteppedSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,SteppedSpline.prototype.evaluate=function(e,t){const n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),i=this._spline.times,r=e>=i[n+1]?i[n+1]:i[n];return this._spline.evaluate(r,t)},Object.defineProperties(SteppedSpline.prototype,{times:{get:function(){return this._spline.times}}}),SteppedSpline.prototype.wrapTime=function(e){return this._spline.wrapTime(e)},SteppedSpline.prototype.clampTime=function(e){return this._spline.clampTime(e)},ModelAnimationCache.getAnimationSpline=function(e,t,n,i,r,o,a,s){const c=getAnimationSplineKey(e,t,i);let l=cachedAnimationSplines[c];if(!defined(l)){const t=o,n=s;1===t.length&&1===n.length?l=new ConstantSpline(n[0]):"LINEAR"!==r.interpolation&&"STEP"!==r.interpolation||("translation"===a||"scale"===a?l=new LinearSpline({times:t,points:n}):"rotation"===a?l=new QuaternionSpline({times:t,points:n}):"weights"===a&&(l=new WeightSpline({times:t,weights:n})),defined(l)&&"STEP"===r.interpolation&&(l=new SteppedSpline(l))),defined(e.cacheKey)&&(cachedAnimationSplines[c]=l)}return l};const cachedSkinInverseBindMatrices={};ModelAnimationCache.getSkinInverseBindMatrices=function(e,t){const n=getAccessorKey(e,t);let i=cachedSkinInverseBindMatrices[n];if(!defined(i)){const r=e.gltf,o=r.buffers,a=r.bufferViews[t.bufferView],s=o[a.buffer].extras._pipeline.source,c=t.componentType,l=t.type,u=t.count,d=getAccessorByteStride(r,t);let h=a.byteOffset+t.byteOffset;const p=numberOfComponentsForType(l);if(i=new Array(u),c===WebGLConstants$1.FLOAT&&l===AttributeType$1.MAT4)for(let e=0;e<u;++e){const t=ComponentDatatype$1.createArrayBufferView(c,s.buffer,s.byteOffset+h,p);i[e]=Matrix4.fromArray(t),h+=d}cachedSkinInverseBindMatrices[n]=i}return i};const ModelAnimationLoop={NONE:0,REPEAT:1,MIRRORED_REPEAT:2};var ModelAnimationLoop$1=Object.freeze(ModelAnimationLoop),ModelAnimationState=Object.freeze({STOPPED:0,ANIMATING:1});function ModelAnimation(e,t,n){this._name=n.name,this._startTime=JulianDate.clone(e.startTime),this._delay=defaultValue(e.delay,0),this._stopTime=e.stopTime,this.removeOnStop=defaultValue(e.removeOnStop,!1),this._multiplier=defaultValue(e.multiplier,1),this._reverse=defaultValue(e.reverse,!1),this._loop=defaultValue(e.loop,ModelAnimationLoop$1.NONE),this._startOffset=defaultValue(e.startOffset,0),this.start=new Event,this.update=new Event,this.stop=new Event,this._state=ModelAnimationState.STOPPED,this._runtimeAnimation=n,this._computedStartTime=void 0,this._duration=void 0;const i=this;this._raiseStartEvent=function(){i.start.raiseEvent(t,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(t,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(t,i)}}function ModelAnimationCollection(e){this.animationAdded=new Event,this.animationRemoved=new Event,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function add(e,t,n){const i=e._model,r=new ModelAnimation(n,i,i._runtime.animations[t]);return e._scheduledAnimations.push(r),e.animationAdded.raiseEvent(i,r),r}function animateChannels(e,t){const n=e.channelEvaluators,i=n.length;for(let e=0;e<i;++e)n[e](t)}Object.defineProperties(ModelAnimation.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}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},startOffset:{get:function(){return this._startOffset}}}),Object.defineProperties(ModelAnimationCollection.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),ModelAnimationCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=this._model._runtime.animations;if(defined(e.index))return add(this,e.index,e);let n;const i=t.length;for(let r=0;r<i;++r)if(t[r].name===e.name){n=r;break}return add(this,n,e)},ModelAnimationCollection.prototype.addAll=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=[],n=this._model._runtime.animations.length;for(let i=0;i<n;++i)t.push(add(this,i,e));return t},ModelAnimationCollection.prototype.remove=function(e){if(defined(e)){const t=this._scheduledAnimations,n=t.indexOf(e);if(-1!==n)return t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},ModelAnimationCollection.prototype.removeAll=function(){const e=this._model,t=this._scheduledAnimations,n=t.length;this._scheduledAnimations=[];for(let i=0;i<n;++i)this.animationRemoved.raiseEvent(e,t[i])},ModelAnimationCollection.prototype.contains=function(e){return!!defined(e)&&-1!==this._scheduledAnimations.indexOf(e)},ModelAnimationCollection.prototype.get=function(e){return this._scheduledAnimations[e]};const animationsToRemove=[];function createAnimationRemovedFunction(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}function ModelMaterial(e,t,n){this._name=t.name,this._id=n,this._uniformMap=e._uniformMaps[n],this._technique=void 0,this._program=void 0,this._values=void 0}function ModelMesh(e,t,n){const i=[],r=e.primitives,o=r.length;for(let e=0;e<o;++e){const n=r[e];i[e]=t[n.material]}this._name=e.name,this._materials=i,this._id=n}function ModelNode(e,t,n,i,r){this._model=e,this._runtimeNode=n,this._name=t.name,this._id=i,this.useMatrix=!1,this._show=!0,this._matrix=Matrix4.clone(r),this._originalMatrix=Matrix4.clone(r)}ModelAnimationCollection.prototype.update=function(e){const t=this._scheduledAnimations;let n=t.length;if(0===n)return this._previousTime=void 0,!1;if(JulianDate.equals(e.time,this._previousTime))return!1;this._previousTime=JulianDate.clone(e.time,this._previousTime);let i=!1;const r=e.time,o=this._model;for(let o=0;o<n;++o){const n=t[o],a=n._runtimeAnimation;defined(n._computedStartTime)||(n._computedStartTime=JulianDate.addSeconds(defaultValue(n.startTime,r),n.delay,new JulianDate)),defined(n._duration)||(n._duration=a.stopTime*(1/n.multiplier));const s=n._computedStartTime,c=n._duration,l=n.stopTime;let u=0!==c?JulianDate.secondsDifference(r,s)/c:0;0!==c&&defined(l)&&JulianDate.greaterThan(r,l)&&(u=JulianDate.secondsDifference(l,s)/c);const d=u>=0,h=n.loop===ModelAnimationLoop$1.REPEAT||n.loop===ModelAnimationLoop$1.MIRRORED_REPEAT,p=(d||h&&!defined(n.startTime))&&(u<=1||h)&&(!defined(l)||JulianDate.lessThanOrEquals(r,l));if(p||n._state===ModelAnimationState.ANIMATING){if(p&&n._state===ModelAnimationState.STOPPED&&(n._state=ModelAnimationState.ANIMATING,n.start.numberOfListeners>0&&e.afterRender.push(n._raiseStartEvent)),n.loop===ModelAnimationLoop$1.REPEAT)u-=Math.floor(u);else if(n.loop===ModelAnimationLoop$1.MIRRORED_REPEAT){const e=Math.floor(u),t=u-e;u=e%2==1?1-t:t}let t=n.startOffset;n.reverse&&(u=1-u,t=-t);let r=u*c*n.multiplier+t;r=CesiumMath.clamp(r,a.startTime,a.stopTime),animateChannels(a,r),n.update.numberOfListeners>0&&(n._updateEventTime=r,e.afterRender.push(n._raiseUpdateEvent)),i=!0,p||(n._state=ModelAnimationState.STOPPED,n.stop.numberOfListeners>0&&e.afterRender.push(n._raiseStopEvent),n.removeOnStop&&animationsToRemove.push(n))}}n=animationsToRemove.length;for(let i=0;i<n;++i){const n=animationsToRemove[i];t.splice(t.indexOf(n),1),e.afterRender.push(createAnimationRemovedFunction(this,o,n))}return animationsToRemove.length=0,i},Object.defineProperties(ModelMaterial.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),ModelMaterial.prototype.setValue=function(e,t){const n="u_"+e,i=this._uniformMap.values[n];i.value=i.clone(t,i.value)},ModelMaterial.prototype.getValue=function(e){const t="u_"+e,n=this._uniformMap.values[t];if(defined(n))return n.value},Object.defineProperties(ModelMesh.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),Object.defineProperties(ModelNode.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=Matrix4.clone(e,this._matrix),this.useMatrix=!0;const t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}},originalMatrix:{get:function(){return this._originalMatrix}}}),ModelNode.prototype.setMatrix=function(e){Matrix4.clone(e,this._matrix)};const MAX_GLTF_UINT16_INDEX=65534;function ModelOutlineLoader(){}function addOutline(e,t,n,i,r){const o=r.vertexCopies,a=r.extraVertices,s=r.outlineCoordinates,c=e.gltf,l=c.meshes[t].primitives[n],u=c.accessors,d=c.bufferViews;let h;for(const e in l.attributes)if(l.attributes.hasOwnProperty(e)){const t=u[l.attributes[e]];if(defined(t)){h=t.count;break}}if(!defined(h))return;const p=u[l.indices],f=d[p.bufferView],m=u[i],g=d[m.bufferView],_=e._loadResources,y=_.getBuffer(f),C=_.getBuffer(g);let T=5123===p.componentType?new Uint16Array(y.buffer,y.byteOffset+p.byteOffset,p.count):new Uint32Array(y.buffer,y.byteOffset+p.byteOffset,p.count);const S=5123===m.componentType?new Uint16Array(C.buffer,C.byteOffset+m.byteOffset,m.count):new Uint32Array(C.buffer,C.byteOffset+m.byteOffset,m.count),A=h,v=[A];let E;for(E=0;E<S.length;E+=2){const e=S[E],t=S[E+1];v[Math.min(e,t)*A+Math.max(e,t)]=1}for(E=0;E<T.length;E+=3){let t=T[E],n=T[E+1],i=T[E+2];const r=isHighlighted(v,t,n),l=isHighlighted(v,n,i),u=isHighlighted(v,i,t);let d=matchAndStoreCoordinates(s,t,n,i,r,l,u);for(;d>=0;){let m;if(m=d===t?o[t]:d===n?o[n]:o[i],void 0===m){m=h+a.length;let e=d;for(;e>=h;)e=a[e-h];a.push(e),o[d]=m}m>MAX_GLTF_UINT16_INDEX&&T instanceof Uint16Array&&(T=new Uint32Array(T),p.componentType=5125,f.buffer=c.buffers.push({byteLength:T.byteLength,extras:{_pipeline:{source:T.buffer}}})-1,f.byteLength=T.byteLength,f.byteOffset=0,e._loadResources.buffers[f.buffer]=new Uint8Array(T.buffer,0,T.byteLength),_.indexBuffersToCreate._array.forEach((function(e){e.id===p.bufferView&&(e.componentType=p.componentType)}))),d===t?(t=m,T[E]=m):d===n?(n=m,T[E+1]=m):(i=m,T[E+2]=m),defined(p.max)&&(p.max[0]=Math.max(p.max[0],m)),d=matchAndStoreCoordinates(s,t,n,i,r,l,u)}}}function computeOrderMask(e,t,n,i,r){const o=3*t,a=e[o],s=e[o+1],c=e[o+2];return void 0===a?63:((a===n&&s===i&&c===r)<<0)+((a===n&&s===r&&c===i)<<1)+((a===i&&s===n&&c===r)<<2)+((a===i&&s===r&&c===n)<<3)+((a===r&&s===n&&c===i)<<4)+((a===r&&s===i&&c===n)<<5)}function popcount0to63(e){return(1&e)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}function matchAndStoreCoordinates(e,t,n,i,r,o,a){const s=a?1:0,c=r?1:0,l=computeOrderMask(e,t,s,c,0);if(0===l)return t;const u=r?1:0,d=o?1:0,h=computeOrderMask(e,n,0,u,d);if(0===h)return n;const p=a?1:0,f=o?1:0,m=computeOrderMask(e,i,p,0,f);if(0===m)return i;const g=l&h&m;let _,y,C;if(1&g)_=0,y=1,C=2;else if(2&g)_=0,C=1,y=2;else if(4&g)y=0,_=1,C=2;else if(8&g)y=0,C=1,_=2;else if(16&g)C=0,_=1,y=2;else{if(!(32&g)){const e=popcount0to63(l),r=popcount0to63(h),o=popcount0to63(m);return e<r&&e<o?t:r<o?n:i}C=0,y=1,_=2}const T=3*t;e[T+_]=s,e[T+y]=c,e[T+C]=0;const S=3*n;e[S+_]=0,e[S+y]=u,e[S+C]=d;const A=3*i;return e[A+_]=p,e[A+y]=0,e[A+C]=f,-1}function isHighlighted(e,t,n){const i=e[0];return 1===e[Math.min(t,n)*i+Math.max(t,n)]}function createTexture$3(e){const t=new Uint8Array(e);return t[e-1]=192,8===e?t[e-1]=96:4===e?t[e-1]=48:2===e?t[e-1]=24:1===e&&(t[e-1]=12),t}function updateBufferViewsWithNewVertices(e,t){const n=e.gltf,i=e._loadResources;let r,o;for(r=0;r<t.length;++r){const a=t[r],s=a.extras._pipeline.vertexNumberingScope;a.extras._pipeline.vertexNumberingScope=void 0;const c=s.extraVertices,l=i.getBuffer(a),u=a.byteStride||4,d=c.length,h=new Uint8Array(l.byteLength+d*u);for(h.set(l),o=0;o<d;++o){const e=c[o]*u,t=l.length+o*u;for(let n=0;n<u;++n)h[t+n]=h[e+n]}a.byteOffset=0,a.byteLength=h.byteLength;const p=n.buffers.push({byteLength:h.byteLength,extras:{_pipeline:{source:h.buffer}}})-1;a.buffer=p,i.buffers[p]=h;const f=s.accessors;for(o=0;o<f.length;++o){const e=f[o];n.accessors[e].count+=d}if(!s.createdOutlines){const t=s.outlineCoordinates,n=new Float32Array(t),r=e.gltf.buffers.push({byteLength:n.byteLength,extras:{_pipeline:{source:n.buffer}}})-1;i.buffers[r]=new Uint8Array(n.buffer,0,n.byteLength);const a=e.gltf.bufferViews.push({buffer:r,byteLength:n.byteLength,byteOffset:0,byteStride:3*Float32Array.BYTES_PER_ELEMENT,target:34962})-1,c=e.gltf.accessors.push({bufferView:a,byteOffset:0,componentType:5126,count:n.length/3,type:"VEC3",min:[0,0,0],max:[1,1,1]})-1,l=s.primitives;for(o=0;o<l.length;++o)l[o].attributes._OUTLINE_COORDINATES=c;i.vertexBuffersToCreate.enqueue(a),s.createdOutlines=!0}}}function compactBuffers(e){const t=e.gltf,n=e._loadResources;let i;for(i=0;i<t.buffers.length;++i){const e=t.buffers[i],r=t.bufferViews.filter(usesBuffer.bind(void 0,i)),o=r.reduce((function(e,t){return e+t.byteLength}),0);if(o===e.byteLength)continue;const a=new Uint8Array(o);let s=0;for(let e=0;e<r.length;++e){const t=r[e],i=n.getBuffer(t);a.set(i,s),t.byteOffset=s,s+=i.byteLength}n.buffers[i]=a,e.extras._pipeline.source=a.buffer,e.byteLength=o}}function usesBuffer(e,t){return t.buffer===e}function getVertexNumberingScope(e,t){const n=t.attributes;if(void 0===n)return;const i=e.gltf;let r;for(const e in n){if(!n.hasOwnProperty(e))continue;const t=n[e],o=i.accessors[t].bufferView,a=i.bufferViews[o];if(defined(a.extras)||(a.extras={}),defined(a.extras._pipeline)||(a.extras._pipeline={}),defined(a.extras._pipeline.vertexNumberingScope)){if(void 0!==r&&a.extras._pipeline.vertexNumberingScope!==r)return}else a.extras._pipeline.vertexNumberingScope=r||{vertexCopies:[],extraVertices:[],outlineCoordinates:[],accessors:[],bufferViews:[],primitives:[],createdOutlines:!1};r=a.extras._pipeline.vertexNumberingScope,r.bufferViews.indexOf(a)<0&&r.bufferViews.push(a),r.accessors.indexOf(t)<0&&r.accessors.push(t)}return r.primitives.push(t),r}function ComputeCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=defaultValue(e.persists,!1),this.pass=Pass$1.COMPUTE,this.owner=e.owner}ModelOutlineLoader.hasExtension=function(e){return defined(e.extensionsRequired.CESIUM_primitive_outline)||defined(e.extensionsUsed.CESIUM_primitive_outline)},ModelOutlineLoader.outlinePrimitives=function(e){if(!ModelOutlineLoader.hasExtension(e))return;const t=e.gltf,n=[];ForEach.mesh(t,(function(t,i){ForEach.meshPrimitive(t,(function(t,r){if(!defined(t.extensions))return;const o=t.extensions.CESIUM_primitive_outline;if(!defined(o))return;const a=getVertexNumberingScope(e,t);void 0!==a&&(n.indexOf(a)<0&&n.push(a),addOutline(e,i,r,o.indices,a))}))}));for(let t=0;t<n.length;++t)updateBufferViewsWithNewVertices(e,n[t].bufferViews);compactBuffers(e)},ModelOutlineLoader.createTexture=function(e,t){let n=t.cache.modelOutliningCache;if(defined(n)||(n=t.cache.modelOutliningCache={}),defined(n.outlineTexture))return n.outlineTexture;const i=Math.min(4096,ContextLimits.maximumTextureSize);let r=i;const o=createTexture$3(r),a=[];for(;r>1;)r>>=1,a.push(createTexture$3(r));const s=new Texture({context:t,source:{arrayBufferView:o,mipLevels:a},width:i,height:1,pixelFormat:PixelFormat$1.LUMINANCE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return n.outlineTexture=s,s},ComputeCommand.prototype.execute=function(e){e.execute(this)};var OctahedralProjectionAtlasFS="varying vec2 v_textureCoordinates;\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nconst float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));\nconst float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));\nconst float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));\nconst float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));\nvoid main()\n{\nvec2 uv = v_textureCoordinates;\nvec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\nvec2 pixel = 1.0 / textureSize;\nfloat mipLevel = 0.0;\nif (uv.x - pixel.x > (textureSize.y / textureSize.x))\n{\nmipLevel = 1.0;\nif (uv.y - pixel.y > yMipLevel1)\n{\nmipLevel = 2.0;\nif (uv.y - pixel.y * 3.0 > yMipLevel2)\n{\nmipLevel = 3.0;\nif (uv.y - pixel.y * 5.0 > yMipLevel3)\n{\nmipLevel = 4.0;\nif (uv.y - pixel.y * 7.0 > yMipLevel4)\n{\nmipLevel = 5.0;\n}\n}\n}\n}\n}\nif (mipLevel > 0.0)\n{\nfloat scale = pow(2.0, mipLevel);\nuv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\nuv.x *= ((textureSize.x - 2.0) / textureSize.y);\nuv.x -= 1.0 + pixel.x;\nuv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\nuv *= scale;\n}\nelse\n{\nuv.x *= (textureSize.x / textureSize.y);\n}\nif(mipLevel == 0.0)\n{\ngl_FragColor = texture2D(texture0, uv);\n}\nelse if(mipLevel == 1.0)\n{\ngl_FragColor = texture2D(texture1, uv);\n}\nelse if(mipLevel == 2.0)\n{\ngl_FragColor = texture2D(texture2, uv);\n}\nelse if(mipLevel == 3.0)\n{\ngl_FragColor = texture2D(texture3, uv);\n}\nelse if(mipLevel == 4.0)\n{\ngl_FragColor = texture2D(texture4, uv);\n}\nelse if(mipLevel == 5.0)\n{\ngl_FragColor = texture2D(texture5, uv);\n}\nelse\n{\ngl_FragColor = vec4(0.0);\n}\n}\n",OctahedralProjectionFS="varying vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\nvoid main()\n{\nvec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);\n#ifdef RGBA_NORMALIZED\ngl_FragColor = vec4(rgba.rgb, 1.0);\n#else\nfloat m = rgba.a * 16.0;\nvec3 r = rgba.rgb * m;\ngl_FragColor = vec4(r * r, 1.0);\n#endif\n}\n",OctahedralProjectionVS="attribute vec4 position;\nattribute vec3 cubeMapCoordinates;\nvarying vec3 v_cubeMapCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_cubeMapCoordinates = cubeMapCoordinates;\n}\n";function OctahedralProjectedCubeMap(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._readyPromise=when.defer()}Object.defineProperties(OctahedralProjectedCubeMap.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),OctahedralProjectedCubeMap.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const v1=new Cartesian3(1,0,0),v2=new Cartesian3(0,0,1),v3=new Cartesian3(-1,0,0),v4=new Cartesian3(0,0,-1),v5=new Cartesian3(0,1,0),v6=new Cartesian3(0,-1,0),cubeMapCoordinates=[v5,v3,v2,v6,v1,v5,v4,v5,v5],length=cubeMapCoordinates.length,flatCubeMapCoordinates=new Float32Array(3*length);let offset=0;for(let e=0;e<length;++e,offset+=3)Cartesian3.pack(cubeMapCoordinates[e],flatCubeMapCoordinates,offset);const flatPositions=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),indices=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function createVertexArray$3(e){const t=Buffer$1.createVertexBuffer({context:e,typedArray:flatPositions,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createVertexBuffer({context:e,typedArray:flatCubeMapCoordinates,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createIndexBuffer({context:e,typedArray:indices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:i})}function createUniformTexture(e){return function(){return e}}function cleanupResources(e){let t,n;e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();const i=e._cubeMaps;if(defined(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();const r=e._mipTextures;if(defined(r))for(n=r.length,t=0;t<n;++t)r[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}OctahedralProjectedCubeMap.prototype.update=function(e){const t=e.context;if(!OctahedralProjectedCubeMap.isSupported(t))return;if(defined(this._texture)&&defined(this._va)&&cleanupResources(this),defined(this._texture))return;if(!defined(this._texture)&&!this._loading){const e=t.textureCache.getTexture(this._url);if(defined(e))return cleanupResources(this),this._texture=e,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,void this._readyPromise.resolve()}const n=this._cubeMapBuffers;if(!defined(n)&&!this._loading){const e=this;loadKTX2(this._url).then((function(t){e._cubeMapBuffers=t,e._loading=!1})).otherwise(this._readyPromise.reject),this._loading=!0}if(!defined(this._cubeMapBuffers))return;const i=[];let r=n[0].positiveX.pixelDatatype;defined(r)?i.push("RGBA_NORMALIZED"):r=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT;const o=PixelFormat$1.RGBA,a=new ShaderSource({defines:i,sources:[OctahedralProjectionFS]});this._va=createVertexArray$3(t),this._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:OctahedralProjectionVS,fragmentShaderSource:a,attributeLocations:{position:0,cubeMapCoordinates:1}});const s=Math.min(n.length,6);this._maximumMipmapLevel=s-1;const c=this._cubeMaps=new Array(s),l=this._mipTextures=new Array(s),u=2*n[0].positiveX.width,d={originalSize:function(){return u}};for(let i=0;i<s;++i){const a=n[i].positiveY;n[i].positiveY=n[i].negativeY,n[i].negativeY=a;const s=c[i]=new CubeMap({context:t,source:n[i],pixelDatatype:r}),u=2*c[i].width,h=l[i]=new Texture({context:t,width:u,height:u,pixelDatatype:r,pixelFormat:o}),p=new ComputeCommand({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:createUniformTexture(s)},outputTexture:h,persists:!0,owner:this});e.commandList.push(p),d["texture"+i]=createUniformTexture(h)}this._texture=new Texture({context:t,width:1.5*u+2,height:u,pixelDatatype:r,pixelFormat:o}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const h=new ComputeCommand({fragmentShaderSource:OctahedralProjectionAtlasFS,uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(h),this._ready=!0,this._readyPromise.resolve()},OctahedralProjectedCubeMap.prototype.isDestroyed=function(){return!1},OctahedralProjectedCubeMap.prototype.destroy=function(){return cleanupResources(this),this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const boundingSphereCartesian3Scratch=new Cartesian3,ModelState=ModelUtility.ModelState,defaultModelAccept="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",articulationEpsilon=CesiumMath.EPSILON16;function setCachedGltf(e,t){e._cachedGltf=t}function CachedGltf(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}Object.defineProperties(CachedGltf.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}}),CachedGltf.prototype.makeReady=function(e){this.gltf=e;const t=this.modelsToLoad,n=t.length;for(let e=0;e<n;++e){const n=t[e];n.isDestroyed()||setCachedGltf(n,this)}this.modelsToLoad=void 0,this.ready=!0};const gltfCache={},uriToGuid={};function Model(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).cacheKey;let n;if(this._cacheKey=t,this._cachedGltf=void 0,this._releaseGltfJson=defaultValue(e.releaseGltfJson,!1),defined(t)&&defined(gltfCache[t])&&gltfCache[t].ready)n=gltfCache[t],++n.count;else{let i=e.gltf;if(defined(i)){if(i instanceof ArrayBuffer&&(i=new Uint8Array(i)),i instanceof Uint8Array){n=new CachedGltf({gltf:parseGlb(i),ready:!0})}else n=new CachedGltf({gltf:e.gltf,ready:!0});n.count=1,defined(t)&&(gltfCache[t]=n)}}setCachedGltf(this,n);const i=defaultValue(e.basePath,"");this._resource=Resource.createIfNeeded(i);let r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._resourceCredits=[],this.show=defaultValue(e.show,!0),this.silhouetteColor=defaultValue(e.silhouetteColor,Color.RED),this._silhouetteColor=new Color,this._silhouetteColorPreviousAlpha=1,this._normalAttributeName=void 0,this.silhouetteSize=defaultValue(e.silhouetteSize,0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._clampedModelMatrix=void 0,this.scale=defaultValue(e.scale,1),this._scale=this.scale,this.minimumPixelSize=defaultValue(e.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=e.maximumScale,this._maximumScale=this.maximumScale,this.id=e.id,this._id=e.id,this.heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._heightReference=this.heightReference,this._heightChanged=!1,this._removeUpdateHeightCallback=void 0;const o=e.scene;this._scene=o,defined(o)&&defined(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener((function(){this._heightChanged=!0}),this)),this._pickObject=e.pickObject,this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this.activeAnimations=new ModelAnimationCollection(this),this.clampAnimations=defaultValue(e.clampAnimations,!0),this._defaultTexture=void 0,this._incrementallyLoadTextures=defaultValue(e.incrementallyLoadTextures,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this._colorPreviousAlpha=1,this.colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this.colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._colorShadingEnabled=!1,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._clippingPlanesState=0,this.referenceMatrix=void 0,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._addBatchIdToGeneratedShaders=e.addBatchIdToGeneratedShaders,this._precreatedAttributes=e.precreatedAttributes,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._requestType=e.requestType,this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._gltfForwardAxis=Axis$1.Z,this._forwardAxis=e.forwardAxis,this.cull=defaultValue(e.cull,!0),this.opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._computedModelMatrix=new Matrix4,this._clippingPlanesMatrix=Matrix4.clone(Matrix4.IDENTITY),this._iblReferenceFrameMatrix=Matrix3.clone(Matrix3.IDENTITY),this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,articulationsByName:void 0,articulationsByStageKey:void 0,stagesByKey: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._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms={},this._programPrimitives={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},sourceShaders:{},silhouettePrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._dequantizeInShader=defaultValue(e.dequantizeInShader,!0),this._decodedData={},this._cachedGeometryByteLength=0,this._cachedTexturesByteLength=0,this._geometryByteLength=0,this._texturesByteLength=0,this._trianglesLength=0,this._pointsLength=0,this._sourceTechniques={},this._sourcePrograms={},this._quantizedVertexShaders={},this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0,this._sourceVersion=void 0,this._sourceKHRTechniquesWebGL=void 0,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this._lightColor=Cartesian3.clone(e.lightColor),this._luminanceAtZenith=void 0,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this._sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._shouldUpdateSpecularMapAtlas=!0,this._specularEnvironmentMapAtlas=void 0,this._useDefaultSphericalHarmonics=!1,this._useDefaultSpecularMaps=!1,this._shouldRegenerateShaders=!1}function silhouetteSupported(e){return e.stencilBuffer}function isColorShadingEnabled(e){return!Color.equals(e.color,Color.WHITE)||e.colorBlendMode!==ColorBlendMode$1.HIGHLIGHT}function isClippingEnabled(e){const t=e._clippingPlanes;return defined(t)&&t.enabled&&0!==t.length}function containsGltfMagic(e){return"glTF"===getMagic(e)}function getRuntime(e,t,n){return e._runtime[t][n]}Object.defineProperties(Model.prototype,{gltf:{get:function(){return defined(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._resource.url}},boundingSphere:{get:function(){let e=this.modelMatrix;this.heightReference!==HeightReference$1.NONE&&this._clampedModelMatrix&&(e=this._clampedModelMatrix);const t=Matrix4.getScale(e,boundingSphereCartesian3Scratch),n=defined(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;Cartesian3.multiplyByScalar(t,n,t);const i=this._scaledBoundingSphere;return i.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,i.center),i.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,i.center,i.center),i}},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 defined(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition)}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},forwardAxis:{get:function(){return defined(this._forwardAxis)?this._forwardAxis:this._gltfForwardAxis}},trianglesLength:{get:function(){return this._trianglesLength}},pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return this._texturesByteLength}},cachedGeometryByteLength:{get:function(){return this._cachedGeometryByteLength}},cachedTexturesByteLength:{get:function(){return this._cachedTexturesByteLength}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},pickIds:{get:function(){return this._pickIds}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){const t=this._imageBasedLightingFactor;e===t||Cartesian2.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._imageBasedLightingFactor.x>0&&0===e.x||0===this._imageBasedLightingFactor.x&&e.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._imageBasedLightingFactor.y>0&&0===e.y||0===this._imageBasedLightingFactor.y&&e.y>0,Cartesian2.clone(e,this._imageBasedLightingFactor))}},lightColor:{get:function(){return this._lightColor},set:function(e){const t=this._lightColor;e===t||Cartesian3.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._lightColor=Cartesian3.clone(e,t))}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){const t=this._luminanceAtZenith;e!==t&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._luminanceAtZenith=e)}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){e!==this._sphericalHarmonicCoefficients&&(this._sphericalHarmonicCoefficients=e,this._shouldRegenerateShaders=!0)}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){this._shouldUpdateSpecularMapAtlas=this._shouldUpdateSpecularMapAtlas||e!==this._specularEnvironmentMaps,this._specularEnvironmentMaps=e}},credit:{get:function(){return this._credit}}}),Model.silhouetteSupported=function(e){return silhouetteSupported(e.context)},Model.fromGltf=function(e){const t=e.url;e=clone$1(e);const n=Resource.createIfNeeded(t),i=defaultValue(e.basePath,n.clone()),r=Resource.createIfNeeded(i);let o=defaultValue(e.cacheKey,uriToGuid[getAbsoluteUri(n.url)]);defined(o)||(o=createGuid(),uriToGuid[getAbsoluteUri(n.url)]=o),defined(e.basePath)&&!defined(e.cacheKey)&&(o+=r.url),e.cacheKey=o,e.basePath=r;const a=new Model(e);let s=gltfCache[o];return defined(s)?s.ready||(++s.count,s.modelsToLoad.push(a)):(s=new CachedGltf({ready:!1}),s.count=1,s.modelsToLoad.push(a),setCachedGltf(a,s),gltfCache[o]=s,defined(n.headers.Accept)||(n.headers.Accept=defaultModelAccept),n.fetchArrayBuffer().then((function(e){const t=new Uint8Array(e);if(containsGltfMagic(t)){const e=parseGlb(t);s.makeReady(e)}else{const e=getJsonFromTypedArray(t);s.makeReady(e)}const i=a._resourceCredits,r=n.credits;if(defined(r)){const e=r.length;for(let t=0;t<e;t++)i.push(r[t])}})).otherwise(ModelUtility.getFailedLoadFunction(a,"model",n.url))),a},Model._gltfCache=gltfCache,Model.prototype.getNode=function(e){const t=getRuntime(this,"nodesByName",e);return defined(t)?t.publicNode:void 0},Model.prototype.getMesh=function(e){return getRuntime(this,"meshesByName",e)},Model.prototype.getMaterial=function(e){return getRuntime(this,"materialsByName",e)},Model.prototype.setArticulationStage=function(e,t){const n=getRuntime(this,"stagesByKey",e),i=getRuntime(this,"articulationsByStageKey",e);defined(n)&&defined(i)&&(t=CesiumMath.clamp(t,n.minimumValue,n.maximumValue),CesiumMath.equalsEpsilon(n.currentValue,t,articulationEpsilon)||(n.currentValue=t,i.isDirty=!0))};const scratchArticulationCartesian=new Cartesian3,scratchArticulationRotation=new Matrix3;function applyArticulationStageMatrix(e,t){const n=e.currentValue,i=scratchArticulationCartesian;let r;switch(e.type){case"xRotate":r=Matrix3.fromRotationX(CesiumMath.toRadians(n),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"yRotate":r=Matrix3.fromRotationY(CesiumMath.toRadians(n),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"zRotate":r=Matrix3.fromRotationZ(CesiumMath.toRadians(n),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,r,t);break;case"xTranslate":i.x=n,i.y=0,i.z=0,Matrix4.multiplyByTranslation(t,i,t);break;case"yTranslate":i.x=0,i.y=n,i.z=0,Matrix4.multiplyByTranslation(t,i,t);break;case"zTranslate":i.x=0,i.y=0,i.z=n,Matrix4.multiplyByTranslation(t,i,t);break;case"xScale":i.x=n,i.y=1,i.z=1,Matrix4.multiplyByScale(t,i,t);break;case"yScale":i.x=1,i.y=n,i.z=1,Matrix4.multiplyByScale(t,i,t);break;case"zScale":i.x=1,i.y=1,i.z=n,Matrix4.multiplyByScale(t,i,t);break;case"uniformScale":Matrix4.multiplyByUniformScale(t,n,t)}return t}const scratchApplyArticulationTransform=new Matrix4;function addBuffersToLoadResources(e){const t=e.gltf,n=e._loadResources;ForEach.buffer(t,(function(e,t){n.buffers[t]=e.extras._pipeline.source}))}function bufferLoad(e,t){return function(n){const i=e._loadResources,r=new Uint8Array(n);--i.pendingBufferLoads,e.gltf.buffers[t].extras._pipeline.source=r}}function parseBufferViews(e){const t=e.gltf.bufferViews,n=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,(function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&n.enqueue(t)}));const i=e._loadResources.indexBuffersToCreate,r={};ForEach.accessor(e.gltf,(function(e){const n=e.bufferView;if(!defined(n))return;t[n].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(r[n])||(r[n]=!0,i.enqueue({id:n,componentType:e.componentType}))}))}function parseTechniques(e){const t=e.gltf;if(!usesExtension(t,"KHR_techniques_webgl"))return;const n=e._sourcePrograms,i=e._sourceTechniques,r=t.extensions.KHR_techniques_webgl.programs;ForEach.technique(t,(function(e,t){i[t]=clone$1(e);const o=e.program;defined(n[o])||(n[o]=clone$1(r[o]))}))}function shaderLoad(e,t,n){return function(i){const r=e._loadResources;r.shaders[n]={source:i,type:t,bufferView:void 0},--r.pendingShaderLoads,e._rendererResources.sourceShaders[n]=i}}function parseShaders(e){const t=e.gltf,n=t.buffers,i=t.bufferViews,r=e._rendererResources.sourceShaders;ForEach.shader(t,(function(t,o){if(defined(t.bufferView)){const e=t.bufferView,a=i[e],s=a.buffer,c=getStringFromTypedArray(n[s].extras._pipeline.source,a.byteOffset,a.byteLength);r[o]=c}else if(defined(t.extras._pipeline.source))r[o]=t.extras._pipeline.source;else{++e._loadResources.pendingShaderLoads;const n=e._resource.getDerivedResource({url:t.uri});n.fetchText().then(shaderLoad(e,t.type,o)).otherwise(ModelUtility.getFailedLoadFunction(e,"shader",n.url))}}))}function parsePrograms(e){const t=e._sourceTechniques;for(const n in t)if(t.hasOwnProperty(n)){const i=t[n];e._loadResources.programsToCreate.enqueue({programId:i.program,techniqueId:n})}}function parseArticulations(e){const t={},n={},i={};e._runtime.articulationsByName=t,e._runtime.articulationsByStageKey=n,e._runtime.stagesByKey=i;const r=e.gltf;if(!usesExtension(r,"AGI_articulations")||!defined(r.extensions)||!defined(r.extensions.AGI_articulations))return;const o=r.extensions.AGI_articulations.articulations;if(!defined(o))return;const a=o.length;for(let e=0;e<a;++e){const r=clone$1(o[e]);r.nodes=[],r.isDirty=!0,t[r.name]=r;const a=r.stages.length;for(let e=0;e<a;++e){const t=r.stages[e];t.currentValue=t.initialValue;const o=r.name+" "+t.name;n[o]=r,i[o]=t}}}function imageLoad(e,t){return function(n){const i=e._loadResources;let r;--i.pendingTextureLoads,Array.isArray(n)&&(r=n.slice(1,n.length).map((function(e){return e.bufferView})),n=n[0]),i.texturesToCreate.enqueue({id:t,image:n,bufferView:n.bufferView,width:n.width,height:n.height,internalFormat:n.internalFormat,mipLevels:r})}}Model.prototype.applyArticulations=function(){const e=this._runtime.articulationsByName;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];if(n.isDirty){n.isDirty=!1;const e=n.nodes.length;for(let t=0;t<e;++t){const e=n.nodes[t];let i=Matrix4.clone(e.originalMatrix,scratchApplyArticulationTransform);const r=n.stages.length;for(let e=0;e<r;++e){i=applyArticulationStageMatrix(n.stages[e],i)}e.matrix=i}}}};const ktx2Regex$2=/(^data:image\/ktx2)|(\.ktx2$)/i;function parseTextures(e,t,n){const i=e.gltf,r=i.images;let o;ForEach.texture(i,(function(i,a){let s=i.source;defined(i.extensions)&&defined(i.extensions.EXT_texture_webp)&&n?s=i.extensions.EXT_texture_webp.source:defined(i.extensions)&&defined(i.extensions.KHR_texture_basisu)&&t.supportsBasis&&(s=i.extensions.KHR_texture_basisu.source);const c=r[s],l=c.bufferView,u=c.mimeType;if(o=c.uri,defined(l))e._loadResources.texturesToCreateFromBufferView.enqueue({id:a,image:void 0,bufferView:l,mimeType:u});else{++e._loadResources.pendingTextureLoads;const t=e._resource.getDerivedResource({url:o});let n;n=ktx2Regex$2.test(o)?loadKTX2(t):t.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0}),n.then(imageLoad(e,a)).otherwise(ModelUtility.getFailedLoadFunction(e,"image",t.url))}}))}const scratchArticulationStageInitialTransform=new Matrix4;function parseNodes(e){const t={},n={},i=[],r=e._loadResources.skinnedNodesIds,o=e._runtime.articulationsByName;ForEach.node(e.gltf,(function(a,s){const c={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new Matrix4,computedMatrix:new Matrix4,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:a.jointName,weights:[],children:[],parents:[],publicNode:void 0};if(c.publicNode=new ModelNode(e,a,c,s,ModelUtility.getTransform(a)),t[s]=c,n[a.name]=c,defined(a.skin)&&(r.push(s),i.push(c)),defined(a.extensions)&&defined(a.extensions.AGI_articulations)){const e=a.extensions.AGI_articulations.articulationName;if(defined(e)){let t=Matrix4.clone(c.publicNode.originalMatrix,scratchArticulationStageInitialTransform);const n=o[e];n.nodes.push(c.publicNode);const i=n.stages.length;for(let e=0;e<i;++e){t=applyArticulationStageMatrix(n.stages[e],t)}c.publicNode.matrix=t}}})),e._runtime.nodes=t,e._runtime.nodesByName=n,e._runtime.skinnedNodes=i}function parseMaterials(e){const t=e.gltf,n=e._sourceTechniques,i={},r={},o=e._uniformMaps;ForEach.material(t,(function(t,a){o[a]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0,morphWeightsUniformName:void 0};const s=new ModelMaterial(e,t,a);if(defined(t.extensions)&&defined(t.extensions.KHR_techniques_webgl)){const e=t.extensions.KHR_techniques_webgl.technique;s._technique=e,s._program=n[e].program,ForEach.materialValue(t,(function(e,t){defined(s._values)||(s._values={}),s._values[t]=clone$1(e)}))}i[t.name]=s,r[a]=s})),e._runtime.materialsByName=i,e._runtime.materialsById=r}function parseMeshes(e){const t={},n=e._runtime.materialsById;ForEach.mesh(e.gltf,(function(i,r){t[i.name]=new ModelMesh(i,n,r),(defined(e.extensionsUsed.WEB3D_quantized_attributes)||e._dequantizeInShader)&&ForEach.meshPrimitive(i,(function(t,n){const i=getProgramForPrimitive(e,t);let o=e._programPrimitives[i];defined(o)||(o={},e._programPrimitives[i]=o),o[r+".primitive."+n]=t}))})),e._runtime.meshesByName=t}const CreateVertexBufferJob$1=function(){this.id=void 0,this.model=void 0,this.context=void 0};function createVertexBuffer$2(e,t,n){const i=t._loadResources;let r=t.gltf.bufferViews[e];defined(r)||(r=i.createdBufferViews[e]);const o=Buffer$1.createVertexBuffer({context:n,typedArray:i.getBuffer(r),usage:BufferUsage$1.STATIC_DRAW});o.vertexArrayDestroyable=!1,t._rendererResources.buffers[e]=o,t._geometryByteLength+=o.sizeInBytes}CreateVertexBufferJob$1.prototype.set=function(e,t,n){this.id=e,this.model=t,this.context=n},CreateVertexBufferJob$1.prototype.execute=function(){createVertexBuffer$2(this.id,this.model,this.context)};const CreateIndexBufferJob$1=function(){this.id=void 0,this.componentType=void 0,this.model=void 0,this.context=void 0};function createIndexBuffer$1(e,t,n,i){const r=n._loadResources;let o=n.gltf.bufferViews[e];defined(o)||(o=r.createdBufferViews[e]);const a=Buffer$1.createIndexBuffer({context:i,typedArray:r.getBuffer(o),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});a.vertexArrayDestroyable=!1,n._rendererResources.buffers[e]=a,n._geometryByteLength+=a.sizeInBytes}CreateIndexBufferJob$1.prototype.set=function(e,t,n,i){this.id=e,this.componentType=t,this.model=n,this.context=i},CreateIndexBufferJob$1.prototype.execute=function(){createIndexBuffer$1(this.id,this.componentType,this.model,this.context)};const scratchVertexBufferJob$1=new CreateVertexBufferJob$1,scratchIndexBufferJob$1=new CreateIndexBufferJob$1;function createBuffers(e,t){const n=e._loadResources;if(0!==n.pendingBufferLoads)return;const i=t.context,r=n.vertexBuffersToCreate,o=n.indexBuffersToCreate;let a;if(e.asynchronous){for(;r.length>0&&(scratchVertexBufferJob$1.set(r.peek(),e,i),t.jobScheduler.execute(scratchVertexBufferJob$1,JobType$1.BUFFER));)r.dequeue();for(;o.length>0&&(a=o.peek(),scratchIndexBufferJob$1.set(a.id,a.componentType,e,i),t.jobScheduler.execute(scratchIndexBufferJob$1,JobType$1.BUFFER));)o.dequeue()}else{for(;r.length>0;)createVertexBuffer$2(r.dequeue(),e,i);for(;o.length>0;)a=o.dequeue(),createIndexBuffer$1(a.id,a.componentType,e,i)}}function getProgramForPrimitive(e,t){const n=e._runtime.materialsById[t.material];if(defined(n))return n._program}function modifyShaderForQuantizedAttributes(e,t,n){let i;const r=n._programPrimitives[t];if(!defined(r))return e;let o,a;for(o in r)if(r.hasOwnProperty(o)&&(i=r[o],getProgramForPrimitive(n,i)===t))break;if(n._programPrimitives[t]=void 0,n.extensionsUsed.WEB3D_quantized_attributes)a=ModelUtility.modifyShaderForQuantizedAttributes(n.gltf,i,e),n._quantizedUniforms[t]=a.uniforms;else{const t=n._decodedData[o];if(!defined(t))return e;a=ModelUtility.modifyShaderForDracoQuantizedAttributes(n.gltf,i,e,t.attributes)}return a.shader}function modifyShaderForColor(e){return e=ShaderSource.replaceMain(e,"gltf_blend_main"),e+="uniform vec4 gltf_color; \nuniform float gltf_colorBlend; \nvoid main() \n{ \n gltf_blend_main(); \n gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend); \n float highlight = ceil(gltf_colorBlend); \n gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n gl_FragColor.a *= gltf_color.a; \n} \n"}function modifyShader(e,t,n){return defined(n)&&(e=n(e,t)),e}const CreateProgramJob=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};function createProgram(e,t,n){const i=e.programId,r=e.techniqueId,o=t._sourcePrograms[i],a=t._rendererResources.sourceShaders;let s=a[o.vertexShader];const c=a[o.fragmentShader],l=t._quantizedVertexShaders;if(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader){let e=l[i];defined(e)||(e=modifyShaderForQuantizedAttributes(s,i,t),l[i]=e),s=e}const u=modifyShader(s,i,t._vertexShaderLoaded);let d=modifyShader(c,i,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(d="uniform vec4 czm_pickColor;\n"+d);const h=t._imageBasedLightingFactor.x>0||t._imageBasedLightingFactor.y>0;if(h&&(d="#define USE_IBL_LIGHTING \n\n"+d),defined(t._lightColor)&&(d="#define USE_CUSTOM_LIGHT_COLOR \n\n"+d),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(d=ShaderSource.replaceMain(d,"non_gamma_corrected_main"),d+="\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(n)){const e=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,n=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;(e||n||h)&&(d="uniform mat3 gltf_iblReferenceFrameMatrix; \n"+d),defined(t._sphericalHarmonicCoefficients)?d="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+d:t._useDefaultSphericalHarmonics&&(d="#define DIFFUSE_IBL \n"+d),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?d="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+d:t._useDefaultSpecularMaps&&(d="#define SPECULAR_IBL \n"+d)}defined(t._luminanceAtZenith)&&(d="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+d),createAttributesAndProgram(i,r,d,u,t,n)}function recreateProgram(e,t,n){const i=e.programId,r=e.techniqueId,o=t._sourcePrograms[i],a=t._rendererResources.sourceShaders,s=t._quantizedVertexShaders,c=t.clippingPlanes,l=isClippingEnabled(t);let u=a[o.vertexShader];const d=a[o.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(u=s[i]);let h=d;isColorShadingEnabled(t)&&(h=Model._modifyShaderForColor(h)),l&&(h=modifyShaderForClippingPlanes(h,c,n));const p=modifyShader(u,i,t._vertexShaderLoaded);let f=modifyShader(h,i,t._fragmentShaderLoaded);defined(t._uniformMapLoaded)||(f="uniform vec4 czm_pickColor;\n"+f);const m=t._imageBasedLightingFactor.x>0||t._imageBasedLightingFactor.y>0;if(m&&(f="#define USE_IBL_LIGHTING \n\n"+f),defined(t._lightColor)&&(f="#define USE_CUSTOM_LIGHT_COLOR \n\n"+f),("2.0"!==t._sourceVersion||t._sourceKHRTechniquesWebGL)&&(f=ShaderSource.replaceMain(f,"non_gamma_corrected_main"),f+="\nvoid main() { \n non_gamma_corrected_main(); \n gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(n)){const e=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,n=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;(e||n||m)&&(f="uniform mat3 gltf_iblReferenceFrameMatrix; \n"+f),defined(t._sphericalHarmonicCoefficients)?f="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+f:t._useDefaultSphericalHarmonics&&(f="#define DIFFUSE_IBL \n"+f),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?f="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+f:t._useDefaultSpecularMaps&&(f="#define SPECULAR_IBL \n"+f)}defined(t._luminanceAtZenith)&&(f="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+f),createAttributesAndProgram(i,r,f,p,t,n)}function createAttributesAndProgram(e,t,n,i,r,o){const a=r._sourceTechniques[t],s=ModelUtility.createAttributeLocations(a,r._precreatedAttributes);r._rendererResources.programs[e]=ShaderProgram.fromCache({context:o,vertexShaderSource:i,fragmentShaderSource:n,attributeLocations:s})}CreateProgramJob.prototype.set=function(e,t,n){this.programToCreate=e,this.model=t,this.context=n},CreateProgramJob.prototype.execute=function(){createProgram(this.programToCreate,this.model,this.context)};const scratchCreateProgramJob=new CreateProgramJob;function createPrograms(e,t){const n=e._loadResources,i=n.programsToCreate;if(0!==n.pendingShaderLoads)return;if(0!==n.pendingBufferLoads)return;const r=t.context;if(e.asynchronous)for(;i.length>0&&(scratchCreateProgramJob.set(i.peek(),e,r),t.jobScheduler.execute(scratchCreateProgramJob,JobType$1.PROGRAM));)i.dequeue();else for(;i.length>0;)createProgram(i.dequeue(),e,r)}function getOnImageCreatedFromTypedArray(e,t){return function(n){e.texturesToCreate.enqueue({id:t.id,image:n,bufferView:void 0}),--e.pendingBufferViewToImage}}function loadTexturesFromBufferViews(e){const t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){const n=t.texturesToCreateFromBufferView.dequeue(),i=e.gltf,r=i.bufferViews[n.bufferView];i.textures[n.id].source;const o=ModelUtility.getFailedLoadFunction(e,"image","id: "+n.id+", bufferView: "+n.bufferView);if("image/ktx2"===n.mimeType){loadKTX2(new Uint8Array(t.getBuffer(r))).then(imageLoad(e,n.id)).otherwise(o),++e._loadResources.pendingTextureLoads}else{const e=getOnImageCreatedFromTypedArray(t,n);loadImageFromTypedArray({uint8Array:t.getBuffer(r),format:n.mimeType,flipY:!1,skipColorSpaceConversion:!0}).then(e).otherwise(o),++t.pendingBufferViewToImage}}}function createSamplers(e){const t=e._loadResources;if(t.createSamplers){t.createSamplers=!1;const n=e._rendererResources.samplers;ForEach.sampler(e.gltf,(function(e,t){n[t]=new Sampler({wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minFilter,magnificationFilter:e.magFilter})}))}}const CreateTextureJob$1=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};function createTexture$2(e,t,n){const i=t.gltf.textures[e.id];let r=t._rendererResources.samplers[i.sampler];defined(r)||(r=new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT}));let o=!1;const a=t.gltf.materials,s=a.length;for(let t=0;t<s;++t){const n=a[t];if(defined(n.extensions)&&defined(n.extensions.KHR_techniques_webgl)){const t=n.extensions.KHR_techniques_webgl.values;for(const n in t)if(t.hasOwnProperty(n)&&-1!==n.indexOf("Texture")){const i=t[n];if(i.index===e.id&&defined(i.extensions)&&defined(i.extensions.KHR_texture_transform)){o=!0;break}}}if(o)break}const c=r.wrapS,l=r.wrapT;let u=r.minificationFilter;o&&u!==TextureMinificationFilter$1.LINEAR&&u!==TextureMinificationFilter$1.NEAREST&&(u=u===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||u===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR,r=new Sampler({wrapS:r.wrapS,wrapT:r.wrapT,minificationFilter:u,magnificationFilter:r.magnificationFilter}));const d=e.internalFormat,h=!(defined(d)&&PixelFormat$1.isCompressedFormat(d)||u!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR),p=h||c===TextureWrap$1.REPEAT||c===TextureWrap$1.MIRRORED_REPEAT||l===TextureWrap$1.REPEAT||l===TextureWrap$1.MIRRORED_REPEAT;let f,m,g=e.image;if(defined(d)){f=!CesiumMath.isPowerOfTwo(e.width)||!CesiumMath.isPowerOfTwo(e.height),!n.webgl2&&PixelFormat$1.isCompressedFormat(d)&&f&&p&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly. See the Model.js constructor documentation for more information.");let t=r.minificationFilter;defined(e.mipLevels)||u!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?defined(e.mipLevels)||u!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&u!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR||(t=TextureMinificationFilter$1.LINEAR):t=TextureMinificationFilter$1.NEAREST,r=new Sampler({wrapS:r.wrapS,wrapT:r.wrapT,minificationFilter:t,magnificationFilter:r.magnificationFilter}),m=new Texture({context:n,source:{arrayBufferView:e.bufferView,mipLevels:e.mipLevels},width:e.width,height:e.height,pixelFormat:d,sampler:r})}else if(defined(g)){if(f=!CesiumMath.isPowerOfTwo(g.width)||!CesiumMath.isPowerOfTwo(g.height),p&&f){const e=document.createElement("canvas");e.width=CesiumMath.nextPowerOfTwo(g.width),e.height=CesiumMath.nextPowerOfTwo(g.height);e.getContext("2d").drawImage(g,0,0,g.width,g.height,0,0,e.width,e.height),g=e}m=new Texture({context:n,source:g,pixelFormat:i.internalFormat,pixelDatatype:i.type,sampler:r,flipY:!1,skipColorSpaceConversion:!0}),h&&m.generateMipmap()}defined(m)&&(t._rendererResources.textures[e.id]=m,t._texturesByteLength+=m.sizeInBytes)}CreateTextureJob$1.prototype.set=function(e,t,n){this.gltfTexture=e,this.model=t,this.context=n},CreateTextureJob$1.prototype.execute=function(){createTexture$2(this.gltfTexture,this.model,this.context)};const scratchCreateTextureJob=new CreateTextureJob$1;function createTextures(e,t){const n=t.context,i=e._loadResources.texturesToCreate;if(e.asynchronous)for(;i.length>0&&(scratchCreateTextureJob.set(i.peek(),e,n),t.jobScheduler.execute(scratchCreateTextureJob,JobType$1.TEXTURE));)i.dequeue();else for(;i.length>0;)createTexture$2(i.dequeue(),e,n)}function getAttributeLocations$1(e,t){const n=e._sourceTechniques,i={};let r,o;const a=e._runtime.materialsById[t.material];if(!defined(a))return i;const s=n[a._technique];if(!defined(s))return i;const c=s.attributes,l=e._rendererResources.programs[s.program]._attributeLocations;for(r in l)if(l.hasOwnProperty(r)){const e=c[r];defined(e)&&(o=l[r],i[e.semantic]=o)}const u=e._precreatedAttributes;if(defined(u))for(r in u)u.hasOwnProperty(r)&&(o=l[r],i[r]=o);return i}function createJoints(e,t){const n=e.gltf,i=n.skins,r=n.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length;for(let e=0;e<s;++e){const n=a[e],s=o[n],c=r[n],l=t[c.skin];s.inverseBindMatrices=l.inverseBindMatrices,s.bindShapeMatrix=l.bindShapeMatrix;const u=i[c.skin].joints,d=u.length;for(let e=0;e<d;++e){const t=o[u[e]];s.joints.push(t)}}}function createSkins(e){const t=e._loadResources;if(0!==t.pendingBufferLoads)return;if(!t.createSkins)return;t.createSkins=!1;const n=e.gltf,i=n.accessors,r={};ForEach.skin(n,(function(t,n){const o=i[t.inverseBindMatrices];let a;Matrix4.equals(t.bindShapeMatrix,Matrix4.IDENTITY)||(a=Matrix4.clone(t.bindShapeMatrix)),r[n]={inverseBindMatrices:ModelAnimationCache.getSkinInverseBindMatrices(e,o),bindShapeMatrix:a}})),createJoints(e,r)}function getChannelEvaluator(e,t,n,i){return function(r){defined(i)&&(r=e.clampAnimations?i.clampTime(r):i.wrapTime(r),t[n]=i.evaluate(r,t[n]),t.dirtyNumber=e._maxDirtyNumber)}}function createRuntimeAnimations(e){const t=e._loadResources;if(!t.finishedPendingBufferLoads())return;if(!t.createRuntimeAnimations)return;t.createRuntimeAnimations=!1,e._runtime.animations=[];const n=e._runtime.nodes,i=e.gltf.accessors;ForEach.animation(e.gltf,(function(t,r){const o=t.channels,a=t.samplers;let s=Number.MAX_VALUE,c=-Number.MAX_VALUE;const l=o.length,u=new Array(l);for(let d=0;d<l;++d){const l=o[d],h=l.target,p=h.path,f=a[l.sampler],m=ModelAnimationCache.getAnimationParameterValues(e,i[f.input]),g=ModelAnimationCache.getAnimationParameterValues(e,i[f.output]);s=Math.min(s,m[0]),c=Math.max(c,m[m.length-1]);const _=ModelAnimationCache.getAnimationSpline(e,r,t,l.sampler,f,m,p,g);u[d]=getChannelEvaluator(e,n[h.node],h.path,_)}e._runtime.animations[r]={name:t.name,startTime:s,stopTime:c,channelEvaluators:u}}))}function createVertexArrays$1(e,t){const n=e._loadResources;if(!n.finishedBuffersCreation()||!n.finishedProgramCreation()||!n.createVertexArrays)return;n.createVertexArrays=!1;const i=e._rendererResources.buffers,r=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors;ForEach.mesh(o,(function(n,s){ForEach.meshPrimitive(n,(function(n,c){const l=[];let u;const d=getAttributeLocations$1(e,n),h=e._decodedData[s+".primitive."+c];let p,f;ForEach.meshPrimitiveAttribute(n,(function(e,t){if(u=d[t],defined(u)){if(defined(h)){const e=h.attributes;if(e.hasOwnProperty(t)){const n=e[t];return void l.push({index:u,vertexBuffer:i[n.bufferView],componentsPerAttribute:n.componentsPerAttribute,componentDatatype:n.componentDatatype,normalize:n.normalized,offsetInBytes:n.byteOffset,strideInBytes:n.byteStride})}}const n=a[e],r=defined(n.normalized)&&n.normalized;l.push({index:u,vertexBuffer:i[n.bufferView],componentsPerAttribute:numberOfComponentsForType(n.type),componentDatatype:n.componentType,normalize:r,offsetInBytes:n.byteOffset,strideInBytes:getAccessorByteStride(o,n)})}}));const m=e._precreatedAttributes;if(defined(m))for(f in m)m.hasOwnProperty(f)&&(u=d[f],defined(u)&&(p=m[f],p.index=u,l.push(p)));let g;if(defined(n.indices)){let e=a[n.indices].bufferView;defined(h)&&(e=h.bufferView),g=i[e]}r[s+".primitive."+c]=new VertexArray({context:t,attributes:l,indexBuffer:g})}))}))}function createRenderStates$3(e){const t=e._loadResources;t.createRenderStates&&(t.createRenderStates=!1,ForEach.material(e.gltf,(function(t,n){createRenderStateForMaterial(e,t,n)})))}function createRenderStateForMaterial(e,t,n){const i=e._rendererResources.renderStates;let r=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],o=[WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA];defined(t.extensions)&&defined(t.extensions.KHR_blend)&&(r=t.extensions.KHR_blend.blendEquation,o=t.extensions.KHR_blend.blendFactors);const a=!t.doubleSided,s="BLEND"===t.alphaMode;i[n]=RenderState.fromCache({cull:{enabled:a},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!s,blending:{enabled:s,equationRgb:r[0],equationAlpha:r[1],functionSourceRgb:o[0],functionDestinationRgb:o[1],functionSourceAlpha:o[2],functionDestinationAlpha:o[3]}})}const gltfUniformsFromNode={MODEL:function(e,t,n){return function(){return n.computedMatrix}},VIEW:function(e,t,n){return function(){return e.view}},PROJECTION:function(e,t,n){return function(){return e.projection}},MODELVIEW:function(e,t,n){const i=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i)}},CESIUM_RTC_MODELVIEW:function(e,t,n){const i=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i),Matrix4.setTranslation(i,t._rtcCenterEye,i)}},MODELVIEWPROJECTION:function(e,t,n){const i=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i),Matrix4.multiply(e._projection,i,i)}},MODELINVERSE:function(e,t,n){const i=new Matrix4;return function(){return Matrix4.inverse(n.computedMatrix,i)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,n){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,n){const i=new Matrix4,r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i),Matrix4.inverse(i,r)}},MODELVIEWPROJECTIONINVERSE:function(e,t,n){const i=new Matrix4,r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i),Matrix4.multiply(e._projection,i,i),Matrix4.inverse(i,r)}},MODELINVERSETRANSPOSE:function(e,t,n){const i=new Matrix4,r=new Matrix3;return function(){return Matrix4.inverse(n.computedMatrix,i),Matrix4.getMatrix3(i,r),Matrix3.transpose(r,r)}},MODELVIEWINVERSETRANSPOSE:function(e,t,n){const i=new Matrix4,r=new Matrix4,o=new Matrix3;return function(){return Matrix4.multiplyTransformation(e.view,n.computedMatrix,i),Matrix4.inverse(i,r),Matrix4.getMatrix3(r,o),Matrix3.transpose(o,o)}},VIEWPORT:function(e,t,n){return function(){return e.viewportCartesian4}}};function getUniformFunctionFromSource(e,t,n,i){const r=t._runtime.nodes[e];return gltfUniformsFromNode[n](i,t,r)}function createUniformsForMaterial(e,t,n,i,r,o,a){const s={},c={};let l,u;return ForEach.techniqueUniform(n,(function(n,d){let h;if(defined(i)&&defined(i[d]))h=ModelUtility.createUniformFunction(n.type,i[d],o,a),s[d]=h.func,c[d]=h;else if(defined(n.node))s[d]=getUniformFunctionFromSource(n.node,e,n.semantic,r.uniformState);else if(defined(n.semantic))if("JOINTMATRIX"===n.semantic)l=d;else if("MORPHWEIGHTS"===n.semantic)u=d;else if("ALPHACUTOFF"===n.semantic){const e=t.alphaMode;if(defined(e)&&"MASK"===e){const e=defaultValue(t.alphaCutoff,.5);h=ModelUtility.createUniformFunction(n.type,e,o,a),s[d]=h.func,c[d]=h}}else s[d]=ModelUtility.getGltfSemanticUniforms()[n.semantic](r.uniformState,e);else if(defined(n.value)){const e=ModelUtility.createUniformFunction(n.type,n.value,o,a);s[d]=e.func,c[d]=e}})),{map:s,values:c,jointMatrixUniformName:l,morphWeightsUniformName:u}}function createUniformMaps(e,t){const n=e._loadResources;if(!n.finishedProgramCreation())return;if(!n.createUniformMaps)return;n.createUniformMaps=!1;const i=e.gltf,r=e._sourceTechniques,o=e._uniformMaps,a=e._rendererResources.textures,s=e._defaultTexture;ForEach.material(i,(function(n,i){const c=e._runtime.materialsById[i],l=r[c._technique],u=c._values,d=createUniformsForMaterial(e,n,l,u,t,a,s),h=o[i];if(h.uniformMap=d.map,h.values=d.values,h.jointMatrixUniformName=d.jointMatrixUniformName,h.morphWeightsUniformName=d.morphWeightsUniformName,defined(l.attributes.a_outlineCoordinates)){const n=ModelOutlineLoader.createTexture(e,t);h.uniformMap.u_outlineTexture=function(){return n}}}))}function createUniformsForDracoQuantizedAttributes(e){return ModelUtility.createUniformsForDracoQuantizedAttributes(e.attributes)}function createUniformsForQuantizedAttributes(e,t){const n=getProgramForPrimitive(e,t),i=e._quantizedUniforms[n];return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,i)}function createPickColorFunction$1(e){return function(){return e}}function createJointMatricesFunction(e){return function(){return e.computedJointMatrices}}function createMorphWeightsFunction(e){return function(){return e.weights}}function createSilhouetteColorFunction(e){return function(){return e.silhouetteColor}}function createSilhouetteSizeFunction(e){return function(){return e.silhouetteSize}}function createColorFunction(e){return function(){return e.color}}function createClippingPlanesMatrixFunction(e){return function(){return e._clippingPlanesMatrix}}function createIBLReferenceFrameMatrixFunction(e){return function(){return e._iblReferenceFrameMatrix}}function createClippingPlanesFunction(e){return function(){const t=e.clippingPlanes;return defined(t)&&t.enabled?t.texture:e._defaultTexture}}function createClippingPlanesEdgeStyleFunction(e){return function(){const t=e.clippingPlanes;if(!defined(t))return Color.WHITE.withAlpha(0);const n=Color.clone(t.edgeColor);return n.alpha=t.edgeWidth,n}}function createColorBlendFunction(e){return function(){return ColorBlendMode$1.getColorBlend(e.colorBlendMode,e.colorBlendAmount)}}function createIBLFactorFunction(e){return function(){return e._imageBasedLightingFactor}}function createLightColorFunction(e){return function(){return e._lightColor}}function createLuminanceAtZenithFunction(e){return function(){return e.luminanceAtZenith}}function createSphericalHarmonicCoefficientsFunction(e){return function(){return e._sphericalHarmonicCoefficients}}function createSpecularEnvironmentMapFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture}}function createSpecularEnvironmentMapSizeFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture.dimensions}}function createSpecularEnvironmentMapLOD(e){return function(){return e._specularEnvironmentMapAtlas.maximumMipmapLevel}}function triangleCountFromPrimitiveIndices(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createCommand$2(e,t,n,i,r){const o=e._nodeCommands,a=e._pickIds,s=e.allowPicking,c=e._runtime.meshesByName,l=e._rendererResources,u=l.vertexArrays,d=l.programs,h=l.renderStates,p=e._uniformMaps,f=e.gltf,m=f.accessors,g=f.meshes,_=t.mesh,y=g[_],C=y.primitives,T=C.length;for(let t=0;t<T;++t){const l=C[t],g=m[l.indices],T=e._runtime.materialsById[l.material]._program,S=e._decodedData[_+".primitive."+t];let A;const v=l.attributes.POSITION;if(defined(v)){const e=ModelUtility.getAccessorMinMax(f,v);A=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(e.min),Cartesian3.fromArray(e.max))}const E=u[_+".primitive."+t];let b,x;if(defined(S))x=S.numberOfIndices,b=0;else if(defined(g))x=g.count,b=g.byteOffset/IndexDatatype$1.getSizeInBytes(g.componentType);else{x=m[l.attributes.POSITION].count,b=0}e._trianglesLength+=triangleCountFromPrimitiveIndices(l,x),l.mode===PrimitiveType$1.POINTS&&(e._pointsLength+=x);const P=p[l.material];let D=P.uniformMap;if(defined(P.jointMatrixUniformName)){const e={};e[P.jointMatrixUniformName]=createJointMatricesFunction(n),D=combine$2(D,e)}if(defined(P.morphWeightsUniformName)){const e={};e[P.morphWeightsUniformName]=createMorphWeightsFunction(n),D=combine$2(D,e)}D=combine$2(D,{gltf_color:createColorFunction(e),gltf_colorBlend:createColorBlendFunction(e),gltf_clippingPlanes:createClippingPlanesFunction(e),gltf_clippingPlanesEdgeStyle:createClippingPlanesEdgeStyleFunction(e),gltf_clippingPlanesMatrix:createClippingPlanesMatrixFunction(e),gltf_iblReferenceFrameMatrix:createIBLReferenceFrameMatrixFunction(e),gltf_iblFactor:createIBLFactorFunction(e),gltf_lightColor:createLightColorFunction(e),gltf_sphericalHarmonicCoefficients:createSphericalHarmonicCoefficientsFunction(e),gltf_specularMap:createSpecularEnvironmentMapFunction(e),gltf_specularMapSize:createSpecularEnvironmentMapSizeFunction(e),gltf_maxSpecularLOD:createSpecularEnvironmentMapLOD(e),gltf_luminanceAtZenith:createLuminanceAtZenithFunction(e)}),defined(e._uniformMapLoaded)&&(D=e._uniformMapLoaded(D,T,n));let w={};e.extensionsUsed.WEB3D_quantized_attributes?w=createUniformsForQuantizedAttributes(e,l):e._dequantizeInShader&&defined(S)&&(w=createUniformsForDracoQuantizedAttributes(S)),D=combine$2(D,w);const M=h[l.material],I=M.blending.enabled;let R=e._pickObject;defined(R)||(R={primitive:e,id:e.id,node:n.publicNode,mesh:c[y.name]});const O=ShadowMode$1.castShadows(e._shadows),B=ShadowMode$1.receiveShadows(e._shadows);let L;if(s&&!defined(e._uniformMapLoaded)){L=i.createPickId(R),a.push(L);D=combine$2(D,{czm_pickColor:createPickColorFunction$1(L.color)})}s&&(L=defined(e._pickIdLoaded)&&defined(e._uniformMapLoaded)?e._pickIdLoaded():"czm_pickColor");const F=new DrawCommand({boundingVolume:new BoundingSphere,cull:e.cull,modelMatrix:new Matrix4,primitiveType:l.mode,vertexArray:E,count:x,offset:b,shaderProgram:d[T],castShadows:O,receiveShadows:B,uniformMap:D,renderState:M,owner:R,pass:I?Pass$1.TRANSLUCENT:e.opaquePass,pickId:L});let N;r||(N=DrawCommand.shallowClone(F),N.boundingVolume=new BoundingSphere,N.modelMatrix=new Matrix4);const V={show:!0,boundingSphere:A,command:F,command2D:N,silhouetteModelCommand:void 0,silhouetteModelCommand2D:void 0,silhouetteColorCommand:void 0,silhouetteColorCommand2D:void 0,translucentCommand:void 0,translucentCommand2D:void 0,disableCullingCommand:void 0,disableCullingCommand2D:void 0,programId:T};n.commands.push(V),o.push(V)}}function createRuntimeNodes(e,t,n){const i=e._loadResources;if(!i.finishedEverythingButTextureCreation())return;if(!i.createRuntimeNodes)return;i.createRuntimeNodes=!1;const r=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,c=a.scenes[a.scene].nodes,l=c.length,u=[],d={};for(let i=0;i<l;++i)for(u.push({parentRuntimeNode:void 0,gltfNode:s[c[i]],id:c[i]});u.length>0;){const i=u.pop();d[i.id]=!0;const a=i.parentRuntimeNode,c=i.gltfNode,l=o[i.id];if(0===l.parents.length)if(defined(c.matrix))l.matrix=Matrix4.fromColumnMajorArray(c.matrix);else{const e=c.rotation;l.translation=Cartesian3.fromArray(c.translation),l.rotation=Quaternion.unpack(e),l.scale=Cartesian3.fromArray(c.scale)}defined(a)?(a.children.push(l),l.parents.push(a)):r.push(l),defined(c.mesh)&&createCommand$2(e,c,l,t,n);const h=c.children;if(defined(h)){const e=h.length;for(let t=0;t<e;t++){const e=h[t];d[e]||u.push({parentRuntimeNode:l,gltfNode:s[e],id:h[t]})}}}e._runtime.rootNodes=r,e._runtime.nodes=o}function getGeometryByteLength(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].sizeInBytes);return t}function getTexturesByteLength(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].sizeInBytes);return t}function createResources$4(e,t){const n=t.context,i=t.scene3DOnly,r=e._quantizedVertexShaders,o=e._sourceTechniques,a=e._sourcePrograms,s=e._rendererResources;let c=s.sourceShaders;e._loadRendererResourcesFromCache&&(c=s.sourceShaders=e._cachedRendererResources.sourceShaders);for(const t in o)if(o.hasOwnProperty(t)){const i=o[t].program,s=a[i];let l=c[s.vertexShader];if(ModelUtility.checkSupportedGlExtensions(s.glExtensions,n),e.extensionsUsed.WEB3D_quantized_attributes||e._dequantizeInShader){let t=r[i];defined(t)||(t=modifyShaderForQuantizedAttributes(l,i,e),r[i]=t),l=t}l=modifyShader(l,i,e._vertexShaderLoaded)}if(e._loadRendererResourcesFromCache){const t=e._cachedRendererResources;s.buffers=t.buffers,s.vertexArrays=t.vertexArrays,s.programs=t.programs,s.silhouettePrograms=t.silhouettePrograms,s.textures=t.textures,s.samplers=t.samplers,s.renderStates=t.renderStates,defined(e._precreatedAttributes)&&createVertexArrays$1(e,n),e._cachedGeometryByteLength+=getGeometryByteLength(t.buffers),e._cachedTexturesByteLength+=getTexturesByteLength(t.textures)}else createBuffers(e,t),createPrograms(e,t),createSamplers(e),loadTexturesFromBufferViews(e),createTextures(e,t);createSkins(e),createRuntimeAnimations(e),e._loadRendererResourcesFromCache||(createVertexArrays$1(e,n),createRenderStates$3(e)),createUniformMaps(e,n),createRuntimeNodes(e,n,i)}function getNodeMatrix(e,t){const n=e.publicNode,i=n.matrix;n.useMatrix&&defined(i)?Matrix4.clone(i,t):defined(e.matrix)?Matrix4.clone(e.matrix,t):(Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),n.setMatrix(t))}const scratchNodeStack=[],scratchComputedTranslation$1=new Cartesian4,scratchComputedMatrixIn2D=new Matrix4;function updateNodeHierarchyModelMatrix(e,t,n,i){const r=e._maxDirtyNumber,o=e._runtime.rootNodes,a=o.length,s=scratchNodeStack;let c=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){const t=Matrix4.getColumn(c,3,scratchComputedTranslation$1);if(Cartesian4.equals(t,Cartesian4.UNIT_W)){const t=e.boundingSphere.center,n=Transforms.wgs84To2DModelMatrix(i,t,scratchComputedMatrixIn2D);c=Matrix4.multiply(n,c,scratchComputedMatrixIn2D),defined(e._rtcCenter)&&(Matrix4.setTranslation(c,Cartesian4.UNIT_W,c),e._rtcCenter=e._rtcCenter2D)}else c=Transforms.basisTo2D(i,c,scratchComputedMatrixIn2D),e._rtcCenter=e._rtcCenter3D}for(let l=0;l<a;++l){let a=o[l];for(getNodeMatrix(a,a.transformToRoot),s.push(a);s.length>0;){a=s.pop();const o=a.transformToRoot,l=a.commands;if(a.dirtyNumber===r||t||n){const t=Matrix4.multiplyTransformation(c,o,a.computedMatrix),n=l.length;if(n>0)for(let r=0;r<n;++r){const n=l[r];let o=n.command;Matrix4.clone(t,o.modelMatrix),BoundingSphere.transform(n.boundingSphere,o.modelMatrix,o.boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,o.boundingVolume.center,o.boundingVolume.center),o=n.command2D,defined(o)&&e._mode===SceneMode$1.SCENE2D&&(Matrix4.clone(t,o.modelMatrix),o.modelMatrix[13]-=2*CesiumMath.sign(o.modelMatrix[13])*CesiumMath.PI*i.ellipsoid.maximumRadius,BoundingSphere.transform(n.boundingSphere,o.modelMatrix,o.boundingVolume))}}const u=a.children;if(defined(u)){const e=u.length;for(let t=0;t<e;++t){const e=u[t];e.dirtyNumber=Math.max(e.dirtyNumber,a.dirtyNumber),(e.dirtyNumber===r||n)&&(getNodeMatrix(e,e.transformToRoot),Matrix4.multiplyTransformation(o,e.transformToRoot,e.transformToRoot)),s.push(e)}}}}++e._maxDirtyNumber}let scratchObjectSpace=new Matrix4;function applySkins(e){const t=e._runtime.skinnedNodes,n=t.length;for(let e=0;e<n;++e){const n=t[e];scratchObjectSpace=Matrix4.inverseTransformation(n.transformToRoot,scratchObjectSpace);const i=n.computedJointMatrices,r=n.joints,o=n.bindShapeMatrix,a=n.inverseBindMatrices,s=a.length;for(let e=0;e<s;++e)defined(i[e])||(i[e]=new Matrix4),i[e]=Matrix4.multiplyTransformation(scratchObjectSpace,r[e].transformToRoot,i[e]),i[e]=Matrix4.multiplyTransformation(i[e],a[e],i[e]),defined(o)&&(i[e]=Matrix4.multiplyTransformation(i[e],o,i[e]))}}function updatePerNodeShow(e){const t=e._runtime.rootNodes,n=t.length,i=scratchNodeStack;for(let e=0;e<n;++e){let n=t[e];for(n.computedShow=n.publicNode.show,i.push(n);i.length>0;){n=i.pop();const e=n.computedShow,t=n.commands,r=t.length;for(let n=0;n<r;++n)t[n].show=e;const o=n.children;if(defined(o)){const t=o.length;for(let n=0;n<t;++n){const t=o[n];t.computedShow=e&&t.publicNode.show,i.push(t)}}}}}function updatePickIds(e,t){const n=e.id;if(e._id!==n){e._id=n;const t=e._pickIds,i=t.length;for(let e=0;e<i;++e)t[e].object.id=n}}function updateWireframe$1(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;const t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,n=e._nodeCommands,i=n.length;for(let e=0;e<i;++e)n[e].command.primitiveType=t}}function updateShowBoundingVolume$2(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;const t=e.debugShowBoundingVolume,n=e._nodeCommands,i=n.length;for(let e=0;e<i;++e)n[e].command.debugShowBoundingVolume=t}}function updateShadows$1(e){if(e.shadows!==e._shadows){e._shadows=e.shadows;const t=ShadowMode$1.castShadows(e.shadows),n=ShadowMode$1.receiveShadows(e.shadows),i=e._nodeCommands,r=i.length;for(let e=0;e<r;e++){const r=i[e];r.command.castShadows=t,r.command.receiveShadows=n}}}function getTranslucentRenderState$1(e,t){const n=clone$1(t,!0);return n.cull.enabled=!1,n.depthTest.enabled=!0,n.depthMask=!1,n.blending=BlendingState$1.ALPHA_BLEND,e.opaquePass===Pass$1.CESIUM_3D_TILE&&(n.stencilTest=StencilConstants$1.setCesium3DTileBit(),n.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),RenderState.fromCache(n)}function deriveTranslucentCommand$1(e,t){const n=DrawCommand.shallowClone(t);return n.pass=Pass$1.TRANSLUCENT,n.renderState=getTranslucentRenderState$1(e,t.renderState),n}function updateColor(e,t,n){const i=t.scene3DOnly,r=e.color.alpha;if(r>0&&r<1){const t=e._nodeCommands,r=t.length;if(r>0&&(!defined(t[0].translucentCommand)||n))for(let n=0;n<r;++n){const r=t[n],o=r.command;if(r.translucentCommand=deriveTranslucentCommand$1(e,o),!i){const t=r.command2D;r.translucentCommand2D=deriveTranslucentCommand$1(e,t)}}}}function getDisableCullingRenderState$1(e){const t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function deriveDisableCullingCommand(e){const t=DrawCommand.shallowClone(e);return t.renderState=getDisableCullingRenderState$1(e.renderState),t}function updateBackFaceCulling$1(e,t,n){const i=t.scene3DOnly;if(!e.backFaceCulling){const t=e._nodeCommands,r=t.length;if(r>0&&(!defined(t[0].disableCullingCommand)||n))for(let e=0;e<r;++e){const n=t[e],r=n.command;if(n.disableCullingCommand=deriveDisableCullingCommand(r),!i){const e=n.command2D;n.disableCullingCommand2D=deriveDisableCullingCommand(e)}}}}function getProgramId(e,t){const n=e._rendererResources.programs;for(const e in n)if(n.hasOwnProperty(e)&&n[e]===t)return e}function createSilhouetteProgram(e,t,n){let i=t.vertexShaderSource.sources[0];const r=t._attributeLocations,o=e._normalAttributeName;i=ShaderSource.replaceMain(i,"gltf_silhouette_main"),i+="uniform float gltf_silhouetteSize; \nvoid main() \n{ \n gltf_silhouette_main(); \n vec3 n = normalize(czm_normal3D * "+o+"); \n n.x *= czm_projection[0][0]; \n n.y *= czm_projection[1][1]; \n vec4 clip = gl_Position; \n clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z; \n gl_Position = clip; \n}";return ShaderProgram.fromCache({context:n.context,vertexShaderSource:i,fragmentShaderSource:"uniform vec4 gltf_silhouetteColor; \nvoid main() \n{ \n gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor); \n}",attributeLocations:r})}function hasSilhouette(e,t){return silhouetteSupported(t.context)&&e.silhouetteSize>0&&e.silhouetteColor.alpha>0&&defined(e._normalAttributeName)}function hasTranslucentCommands(e){const t=e._nodeCommands,n=t.length;for(let e=0;e<n;++e){if(t[e].command.pass===Pass$1.TRANSLUCENT)return!0}return!1}function isTranslucent(e){return e.color.alpha>0&&e.color.alpha<1}function isInvisible(e){return 0===e.color.alpha}function alphaDirty(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}let silhouettesLength=0;function createSilhouetteCommands(e,t){const n=++silhouettesLength%255,i=hasTranslucentCommands(e)||isTranslucent(e)||e.silhouetteColor.alpha<1,r=e._rendererResources.silhouettePrograms,o=t.scene3DOnly,a=e._nodeCommands,s=a.length;for(let c=0;c<s;++c){const s=a[c],l=s.command,u=isTranslucent(e)?s.translucentCommand:l,d=DrawCommand.shallowClone(u);let h=clone$1(u.renderState);h.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.ALWAYS,backFunction:WebGLConstants$1.ALWAYS,reference:n,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE}},isInvisible(e)&&(h.colorMask={red:!1,green:!1,blue:!1,alpha:!1},h.depthMask=!1),h=RenderState.fromCache(h),d.renderState=h,s.silhouetteModelCommand=d;const p=DrawCommand.shallowClone(l);h=clone$1(l.renderState,!0),h.depthTest.enabled=!0,h.cull.enabled=!1,i&&(p.pass=Pass$1.TRANSLUCENT,h.depthMask=!1,h.blending=BlendingState$1.ALPHA_BLEND),h.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.NOTEQUAL,backFunction:WebGLConstants$1.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP}},h=RenderState.fromCache(h);const f=l.shaderProgram,m=getProgramId(e,f);let g=r[m];defined(g)||(g=createSilhouetteProgram(e,f,t),r[m]=g);const _=combine$2(l.uniformMap,{gltf_silhouetteColor:createSilhouetteColorFunction(e),gltf_silhouetteSize:createSilhouetteSizeFunction(e)});if(p.renderState=h,p.shaderProgram=g,p.uniformMap=_,p.castShadows=!1,p.receiveShadows=!1,s.silhouetteColorCommand=p,!o){const e=s.command2D,t=DrawCommand.shallowClone(d);t.boundingVolume=e.boundingVolume,t.modelMatrix=e.modelMatrix,s.silhouetteModelCommand2D=t;const n=DrawCommand.shallowClone(p);t.boundingVolume=e.boundingVolume,t.modelMatrix=e.modelMatrix,s.silhouetteColorCommand2D=n}}}function modifyShaderForClippingPlanes(e,t,n){return e=ShaderSource.replaceMain(e,"gltf_clip_main"),e+=Model._getClippingFunction(t,n)+"\n",e+="uniform highp sampler2D gltf_clippingPlanes; \nuniform mat4 gltf_clippingPlanesMatrix; \nuniform vec4 gltf_clippingPlanesEdgeStyle; \nvoid main() \n{ \n gltf_clip_main(); \n"+getClipAndStyleCode("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")+"} \n"}function updateSilhouette(e,t,n){if(!hasSilhouette(e,t))return;const i=e._nodeCommands,r=i.length>0&&(alphaDirty(e.color.alpha,e._colorPreviousAlpha)||alphaDirty(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!defined(i[0].silhouetteModelCommand));e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(r||n)&&createSilhouetteCommands(e,t)}function updateClippingPlanes$1(e,t){const n=e._clippingPlanes;defined(n)&&n.owner===e&&n.enabled&&n.update(t)}const scratchBoundingSphere$1=new BoundingSphere;function scaleInPixels(e,t,n){return scratchBoundingSphere$1.center=e,scratchBoundingSphere$1.radius=t,n.camera.getPixelSize(scratchBoundingSphere$1,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}const scratchPosition$7=new Cartesian3,scratchCartographic$d=new Cartographic;function getScale(e,t){let n=e.scale;if(0!==e.minimumPixelSize){const i=t.context,r=Math.max(i.drawingBufferWidth,i.drawingBufferHeight),o=defined(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;if(scratchPosition$7.x=o[12],scratchPosition$7.y=o[13],scratchPosition$7.z=o[14],defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,scratchPosition$7,scratchPosition$7),e._mode!==SceneMode$1.SCENE3D){const e=t.mapProjection,n=e.ellipsoid.cartesianToCartographic(scratchPosition$7,scratchCartographic$d);e.project(n,scratchPosition$7),Cartesian3.fromElements(scratchPosition$7.z,scratchPosition$7.x,scratchPosition$7.y,scratchPosition$7)}const a=e.boundingSphere.radius,s=scaleInPixels(scratchPosition$7,a,t),c=1/s;Math.min(c*(2*a),r)<e.minimumPixelSize&&(n=e.minimumPixelSize*s/(2*e._initialRadius))}return defined(e.maximumScale)?Math.min(e.maximumScale,n):n}function releaseCachedGltf(e){defined(e._cacheKey)&&defined(e._cachedGltf)&&0==--e._cachedGltf.count&&delete gltfCache[e._cacheKey],e._cachedGltf=void 0}function CachedRendererResources(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.sourceShaders=void 0,this.silhouettePrograms=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 destroy(e){for(const t in e)e.hasOwnProperty(t)&&e[t].destroy()}function destroyCachedRendererResources(e){destroy(e.buffers),destroy(e.vertexArrays),destroy(e.programs),destroy(e.silhouettePrograms),destroy(e.textures)}function getUpdateHeightCallback(e,t,n){return function(i){if(e.heightReference===HeightReference$1.RELATIVE_TO_GROUND){const e=t.cartesianToCartographic(i,scratchCartographic$d);e.height+=n.height,t.cartographicToCartesian(e,i)}else if(e.heightReference===HeightReference$1.CLIP_TO_GROUND){const e=t.cartesianToCartographic(i,scratchCartographic$d);n.height>=e.height&&(e.height=n.height),t.cartographicToCartesian(e,i)}const r=e._clampedModelMatrix;Matrix4.clone(e.modelMatrix,r),r[12]=i.x,r[13]=i.y,r[14]=i.z,e._heightChanged=!0}}function updateClamping(e){defined(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!defined(t)||!defined(t.globe)||e.heightReference===HeightReference$1.NONE)return void(e._clampedModelMatrix=void 0);const n=t.globe,i=n.ellipsoid,r=e.modelMatrix;scratchPosition$7.x=r[12],scratchPosition$7.y=r[13],scratchPosition$7.z=r[14];const o=i.cartesianToCartographic(scratchPosition$7);defined(e._clampedModelMatrix)||(e._clampedModelMatrix=Matrix4.clone(r,new Matrix4));const a=n._surface;e._removeUpdateHeightCallback=a.updateHeight(o,getUpdateHeightCallback(e,i,o));const s=n.getHeight(o);if(defined(s)){const t=getUpdateHeightCallback(e,i,o);Cartographic.clone(o,scratchCartographic$d),scratchCartographic$d.height=s,i.cartographicToCartesian(scratchCartographic$d,scratchPosition$7),t(scratchPosition$7)}}CachedRendererResources.prototype.release=function(){if(0==--this.count)return defined(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],destroyCachedRendererResources(this),destroyObject(this)};const scratchDisplayConditionCartesian=new Cartesian3,scratchDistanceDisplayConditionCartographic=new Cartographic;function distanceDisplayConditionVisible(e,t){let n;const i=e.distanceDisplayCondition,r=i.near*i.near,o=i.far*i.far;if(t.mode===SceneMode$1.SCENE2D){n=.5*(t.camera.frustum.right-t.camera.frustum.left),n*=n}else{let i=Matrix4.getTranslation(e.modelMatrix,scratchDisplayConditionCartesian);if(t.mode===SceneMode$1.COLUMBUS_VIEW){const e=t.mapProjection,n=e.ellipsoid.cartesianToCartographic(i,scratchDistanceDisplayConditionCartographic);i=e.project(n,i),Cartesian3.fromElements(i.z,i.x,i.y,i)}n=Cartesian3.distanceSquared(i,t.camera.positionWC)}return n>=r&&n<=o}const scratchClippingPlanesMatrix$2=new Matrix4,scratchIBLReferenceFrameMatrix4=new Matrix4,scratchIBLReferenceFrameMatrix3=new Matrix3;function destroyIfNotCached(e,t){e.programs!==t.programs&&destroy(e.programs),e.silhouettePrograms!==t.silhouettePrograms&&destroy(e.silhouettePrograms)}function regenerateShaders(e,t){const n=e._rendererResources,i=e._cachedRendererResources;let r;if(destroyIfNotCached(n,i),isClippingEnabled(e)||isColorShadingEnabled(e)||e._shouldRegenerateShaders){e._shouldRegenerateShaders=!1,n.programs={},n.silhouettePrograms={};const i={},o=e._sourceTechniques;let a;for(const n in o)o.hasOwnProperty(n)&&(a=o[n],r=a.program,i[r]||(i[r]=!0,recreateProgram({programId:r,techniqueId:n},e,t.context)))}else n.programs=i.programs,n.silhouettePrograms=i.silhouettePrograms;const o=n.programs,a=e._nodeCommands,s=a.length;for(let e=0;e<s;++e){const t=a[e];r=t.programId;const n=o[r];t.command.shaderProgram=n,defined(t.command2D)&&(t.command2D.shaderProgram=n)}updateColor(e,t,!0),updateBackFaceCulling$1(e,t,!0),updateSilhouette(e,t,!0)}function Batched3DModel3DTileContent(e,t,n,i,r){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._batchTable=void 0,this._features=void 0,this._classificationType=e.vectorClassificationOnly?void 0:e.classificationType,this._batchIdAttributeName=void 0,this._diffuseAttributeOrUniformName={},this._rtcCenterTransform=void 0,this._contentModelMatrix=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$c(this,i,r)}function getBatchIdAttributeName(e){let t=ModelUtility.getAttributeOrUniformBySemantic(e,"_BATCHID");return defined(t)||(t=ModelUtility.getAttributeOrUniformBySemantic(e,"BATCHID"),defined(t)&&Batched3DModel3DTileContent._deprecationWarning("b3dm-legacy-batchid","The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`.")),t}function getVertexShaderCallback$1(e){return function(t,n){const i=e._batchTable,r=!defined(e._classificationType),o=e._model.gltf;defined(o)&&(e._batchIdAttributeName=getBatchIdAttributeName(o),e._diffuseAttributeOrUniformName[n]=ModelUtility.getDiffuseAttributeOrUniform(o,n));const a=i.getVertexShaderCallback(r,e._batchIdAttributeName,e._diffuseAttributeOrUniformName[n]);return defined(a)?a(t):t}}function getFragmentShaderCallback$1(e){return function(t,n){const i=e._batchTable,r=!defined(e._classificationType),o=e._model.gltf;defined(o)&&(e._diffuseAttributeOrUniformName[n]=ModelUtility.getDiffuseAttributeOrUniform(o,n));const a=i.getFragmentShaderCallback(r,e._diffuseAttributeOrUniformName[n],!1);return defined(a)?a(t):t}}function getPickIdCallback$1(e){return function(){return e._batchTable.getPickId()}}function getClassificationFragmentShaderCallback(e){return function(t){const n=e._batchTable.getClassificationFragmentShaderCallback();return defined(n)?n(t):t}}function createColorChangedCallback$2(e){return function(t,n){e._model.updateCommands(t,n)}}function initialize$c(e,t,n){const i=e._tileset,r=e._tile,o=e._resource,a=B3dmParser.parse(t,n);let s=a.batchLength;const c=new Cesium3DTileFeatureTable(a.featureTableJson,a.featureTableBinary);s=c.getGlobalProperty("BATCH_LENGTH"),c.featuresLength=s;const l=a.batchTableJson,u=a.batchTableBinary;let d;defined(e._classificationType)&&(d=createColorChangedCallback$2(e));const h=new Cesium3DTileBatchTable(e,s,l,u,d);e._batchTable=h;const p=a.gltf,f={content:e,primitive:i};e._rtcCenterTransform=Matrix4.IDENTITY;const m=c.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(m)&&(e._rtcCenterTransform=Matrix4.fromTranslation(Cartesian3.fromArray(m))),e._contentModelMatrix=Matrix4.multiply(r.computedTransform,e._rtcCenterTransform,new Matrix4),defined(e._classificationType)?e._model=new ClassificationModel({gltf:p,cull:!1,basePath:o,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:i._gltfUpAxis,forwardAxis:Axis$1.X,debugWireframe:i.debugWireframe,vertexShaderLoaded:getVertexShaderCallback$1(e),classificationShaderLoaded:getClassificationFragmentShaderCallback(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),classificationType:e._classificationType,batchTable:h}):(e._model=new Model({gltf:p,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:o,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:i._gltfUpAxis,forwardAxis:Axis$1.X,shadows:i.shadows,debugWireframe:i.debugWireframe,incrementallyLoadTextures:!1,vertexShaderLoaded:getVertexShaderCallback$1(e),fragmentShaderLoaded:getFragmentShaderCallback$1(e),uniformMapLoaded:h.getUniformMapCallback(),pickIdLoaded:getPickIdCallback$1(e),addBatchIdToGeneratedShaders:s>0,pickObject:f,imageBasedLightingFactor:i.imageBasedLightingFactor,lightColor:i.lightColor,luminanceAtZenith:i.luminanceAtZenith,sphericalHarmonicCoefficients:i.sphericalHarmonicCoefficients,specularEnvironmentMaps:i.specularEnvironmentMaps,backFaceCulling:i.backFaceCulling,showOutline:i.showOutline}),e._model.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})})))}function createFeatures$4(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const n=new Array(t);for(let i=0;i<t;++i)n[i]=new Cesium3DTileFeature(e,i);e._features=n}}function Composite3DTileContent(e,t,n,i,r,o){this._tileset=e,this._tile=t,this._resource=n,this._contents=[],this._readyPromise=when.defer(),this._groupMetadata=void 0,initialize$b(this,i,r,o)}Model.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!FeatureDetection.supportsWebP.initialized)return void FeatureDetection.supportsWebP.initialize();const t=e.context;this._defaultTexture=t.defaultTexture;const n=FeatureDetection.supportsWebP();if(this._state===ModelState.NEEDS_LOAD&&defined(this.gltf)){let n;const i=this.cacheKey;if(defined(i)){t.cache.modelRendererResourceCache=defaultValue(t.cache.modelRendererResourceCache,{});const e=t.cache.modelRendererResourceCache;if(n=e[this.cacheKey],defined(n)){if(!n.ready)return;++n.count,this._loadRendererResourcesFromCache=!0}else n=new CachedRendererResources(t,i),n.count=1,e[this.cacheKey]=n;this._cachedRendererResources=n}else n=new CachedRendererResources(t),n.count=1,this._cachedRendererResources=n;if(this._state=ModelState.LOADING,this._state!==ModelState.FAILED){const t=this.gltf.extensions;if(defined(t)&&defined(t.CESIUM_RTC)){const n=Cartesian3.fromArray(t.CESIUM_RTC.center);if(!Cartesian3.equals(n,Cartesian3.ZERO)){this._rtcCenter3D=n;const t=e.mapProjection,i=t.ellipsoid.cartesianToCartographic(this._rtcCenter3D),r=t.project(i);Cartesian3.fromElements(r.z,r.x,r.y,r),this._rtcCenter2D=r,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}addPipelineExtras(this.gltf),this._loadResources=new ModelLoadResources,this._loadRendererResourcesFromCache||ModelUtility.parseBuffers(this,bufferLoad)}}const i=this._loadResources,r=this._incrementallyLoadTextures;let o=!1;if(this._state===ModelState.LOADING){if(0===i.pendingBufferLoads){if(!i.initialized){if(e.brdfLutGenerator.update(e),ModelUtility.checkSupportedExtensions(this.extensionsRequired,n),ModelUtility.updateForwardAxis(this),!defined(this.gltf.extras.sourceVersion)){const e=this.gltf;e.extras.sourceVersion=ModelUtility.getAssetVersion(e),e.extras.sourceKHRTechniquesWebGL=defined(ModelUtility.getUsedExtensions(e).KHR_techniques_webgl),this._sourceVersion=e.extras.sourceVersion,this._sourceKHRTechniquesWebGL=e.extras.sourceKHRTechniquesWebGL,updateVersion(e),addDefaults(e);const t={addBatchIdToGeneratedShaders:this._addBatchIdToGeneratedShaders};processModelMaterialsCommon(e,t),processPbrMaterials(e,t)}this._sourceVersion=this.gltf.extras.sourceVersion,this._sourceKHRTechniquesWebGL=this.gltf.extras.sourceKHRTechniquesWebGL,this._dequantizeInShader=this._dequantizeInShader&&DracoLoader.hasExtension(this),addBuffersToLoadResources(this),parseArticulations(this),parseTechniques(this),this._loadRendererResourcesFromCache||(parseBufferViews(this),parseShaders(this),parsePrograms(this),parseTextures(this,t,n)),parseMaterials(this),parseMeshes(this),parseNodes(this),DracoLoader.parse(this,t),i.initialized=!0}i.finishedDecoding()||DracoLoader.decodeModel(this,t).otherwise(ModelUtility.getFailedLoadFunction(this,"model",this.basePath)),i.finishedDecoding()&&!i.resourcesParsed&&(this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,DracoLoader.cacheDataForModel(this),i.resourcesParsed=!0),i.resourcesParsed&&0===i.pendingShaderLoads&&(this.showOutline&&ModelOutlineLoader.outlinePrimitives(this),createResources$4(this,e))}(i.finished()||r&&i.finishedEverythingButTextureCreation())&&(this._state=ModelState.LOADED,o=!0)}if(defined(i)&&this._state===ModelState.LOADED&&(r&&!o&&createResources$4(this,e),i.finished())){this._loadResources=void 0;const e=this._rendererResources,t=this._cachedRendererResources;t.buffers=e.buffers,t.vertexArrays=e.vertexArrays,t.programs=e.programs,t.sourceShaders=e.sourceShaders,t.silhouettePrograms=e.silhouettePrograms,t.textures=e.textures,t.samplers=e.samplers,t.renderStates=e.renderStates,t.ready=!0,this._normalAttributeName=ModelUtility.getAttributeOrUniformBySemantic(this.gltf,"NORMAL"),defined(this._precreatedAttributes)&&(t.vertexArrays={}),this.releaseGltfJson&&releaseCachedGltf(this)}const a=OctahedralProjectedCubeMap.isSupported(t);if(this._shouldUpdateSpecularMapAtlas&&a){if(this._shouldUpdateSpecularMapAtlas=!1,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._specularEnvironmentMapAtlas=void 0,defined(this._specularEnvironmentMaps)){this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(this._specularEnvironmentMaps);const e=this;this._specularEnvironmentMapAtlas.readyPromise.then((function(){e._shouldRegenerateShaders=!0})).otherwise((function(e){console.error("Error loading specularEnvironmentMaps: "+e)}))}this._shouldRegenerateShaders=!0}defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);const s=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,c=!defined(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,l=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,u=!defined(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||s||c||l||u,this._useDefaultSpecularMaps=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients);const d=hasSilhouette(this,e),h=isTranslucent(this),p=isInvisible(this),f=this.backFaceCulling,m=!defined(this.distanceDisplayCondition)||distanceDisplayConditionVisible(this,e),g=this.show&&m&&0!==this.scale&&(!p||d);if(g&&this._state===ModelState.LOADED||o){const n=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;let i=this.modelMatrix;const r=e.mode!==this._mode;this._mode=e.mode;const a=!Matrix4.equals(this._modelMatrix,i)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale||this._heightReference!==this.heightReference||this._heightChanged||r;if(a||o){Matrix4.clone(i,this._modelMatrix),updateClamping(this),defined(this._clampedModelMatrix)&&(i=this._clampedModelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale,this._heightReference=this.heightReference,this._heightChanged=!1;const t=getScale(this,e),n=this._computedModelMatrix;Matrix4.multiplyByUniformScale(i,t,n),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(n,Axis$1.Y_UP_TO_Z_UP,n):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(n,Axis$1.X_UP_TO_Z_UP,n),this.forwardAxis===Axis$1.Z&&Matrix4.multiplyTransformation(n,Axis$1.Z_UP_TO_X_UP,n)}(n||a||o)&&(updateNodeHierarchyModelMatrix(this,a,o,e.mapProjection),this._dirty=!0,(n||o)&&applySkins(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,updatePerNodeShow(this)),updatePickIds(this),updateWireframe$1(this),updateShowBoundingVolume$2(this),updateShadows$1(this),updateClippingPlanes$1(this,e);const s=this._clippingPlanes;let c=0;const l=defaultValue(this.referenceMatrix,i);if(isClippingEnabled(this)){let e=scratchClippingPlanesMatrix$2;e=Matrix4.multiply(t.uniformState.view3D,l,e),e=Matrix4.multiply(e,s.modelMatrix,e),this._clippingPlanesMatrix=Matrix4.inverseTranspose(e,this._clippingPlanesMatrix),c=s.clippingPlanesState}const u=defined(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics,d=defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps;if(u||d){let e=scratchIBLReferenceFrameMatrix3,n=scratchIBLReferenceFrameMatrix4;n=Matrix4.multiply(t.uniformState.view3D,l,n),e=Matrix4.getMatrix3(n,e),e=Matrix3.getRotation(e,e),this._iblReferenceFrameMatrix=Matrix3.transpose(e,this._iblReferenceFrameMatrix)}let h=this._shouldRegenerateShaders;h=h||this._clippingPlanesState!==c,this._clippingPlanesState=c;const p=isColorShadingEnabled(this);p!==this._colorShadingEnabled&&(this._colorShadingEnabled=p,h=!0),h?regenerateShaders(this,e):(updateColor(this,e,!1),updateBackFaceCulling$1(this,e,!1),updateSilhouette(this,e,!1))}if(o){const t=this;return void e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}if(g&&!this._ignoreCommands){const t=e.commandList,n=e.passes,i=this._nodeCommands,r=i.length;let o,a;const s=e.mapProjection.ellipsoid.maximumRadius*CesiumMath.PI;let c;if(n.render||n.pick&&this.allowPicking){for(o=0;o<r;++o)if(a=i[o],a.show){let n=a.command;if(d?n=a.silhouetteModelCommand:h?n=a.translucentCommand:f||(n=a.disableCullingCommand),t.push(n),c=a.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(c.center.y+c.radius>s||c.center.y-c.radius<s)){let e=a.command2D;d?e=a.silhouetteModelCommand2D:h?e=a.translucentCommand2D:f||(e=a.disableCullingCommand2D),t.push(e)}}if(d&&!n.pick)for(o=0;o<r;++o)a=i[o],a.show&&(t.push(a.silhouetteColorCommand),c=a.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(c.center.y+c.radius>s||c.center.y-c.radius<s)&&t.push(a.silhouetteColorCommand2D))}}const _=this._credit;defined(_)&&e.creditDisplay.addCredit(_);const y=this._resourceCredits,C=y.length;for(let t=0;t<C;t++)e.creditDisplay.addCredit(y[t])},Model.prototype.isDestroyed=function(){return!1},Model.prototype.destroy=function(){defined(this._precreatedAttributes)&&destroy(this._rendererResources.vertexArrays),defined(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),defined(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0),defined(this._cachedRendererResources)&&destroyIfNotCached(this._rendererResources,this._cachedRendererResources),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release(),DracoLoader.destroyCachedDataForModel(this);const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();releaseCachedGltf(this),this._quantizedVertexShaders=void 0;const n=this._clippingPlanes;return defined(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),destroyObject(this)},Model._getClippingFunction=getClippingFunction,Model._modifyShaderForColor=modifyShaderForColor,Batched3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Batched3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this.batchTable.featuresLength}},pointsLength:{get:function(){return this._model.pointsLength}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return this.batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Batched3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Batched3DModel3DTileContent.prototype.getFeature=function(e){return createFeatures$4(this),this._features[e]},Batched3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,0===this.featuresLength?this._model.color=t:this._batchTable.setAllColor(t)},Batched3DModel3DTileContent.prototype.applyStyle=function(e){if(0===this.featuresLength){const t=defined(e)&&defined(e.color),n=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!n||e.show.evaluate(void 0)}else this._batchTable.applyStyle(e)},Batched3DModel3DTileContent.prototype.update=function(e,t){const n=t.commandList.length,i=this._model,r=this._tile,o=this._batchTable;o.update(e,t),this._contentModelMatrix=Matrix4.multiply(r.computedTransform,this._rtcCenterTransform,this._contentModelMatrix),i.modelMatrix=this._contentModelMatrix,i.shadows=e.shadows,i.imageBasedLightingFactor=e.imageBasedLightingFactor,i.lightColor=e.lightColor,i.luminanceAtZenith=e.luminanceAtZenith,i.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,i.specularEnvironmentMaps=e.specularEnvironmentMaps,i.backFaceCulling=e.backFaceCulling,i.debugWireframe=e.debugWireframe;const a=e.clippingPlanes;i.referenceMatrix=e.clippingPlanesOriginMatrix,defined(a)&&r.clippingPlanesDirty&&(i._clippingPlanes=a.enabled&&r._isClipped?a:void 0),defined(a)&&defined(i._clippingPlanes)&&i._clippingPlanes!==a&&(i._clippingPlanes=a),i.update(t);n<t.commandList.length&&(t.passes.render||t.passes.pick)&&!defined(this._classificationType)&&o.addDerivedCommands(t,n)},Batched3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Batched3DModel3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Composite3DTileContent.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].groupMetadata=e}}});const sizeOfUint32$4=Uint32Array.BYTES_PER_ELEMENT;function initialize$b(e,t,n,i){n=defaultValue(n,0);const r=new Uint8Array(t),o=new DataView(t);n+=sizeOfUint32$4;const a=o.getUint32(n,!0);if(1!==a)throw new RuntimeError("Only Composite Tile version 1 is supported. Version "+a+" is not.");n+=sizeOfUint32$4,n+=sizeOfUint32$4;const s=o.getUint32(n,!0);n+=sizeOfUint32$4;const c=[];for(let a=0;a<s;++a){const a=getMagic(r,n),s=o.getUint32(n+2*sizeOfUint32$4,!0),l=i[a];if(!defined(l))throw new RuntimeError("Unknown tile content type, "+a+", inside Composite tile");{const i=l(e._tileset,e._tile,e._resource,t,n);e._contents.push(i),c.push(i.readyPromise)}n+=s}when.all(c).then((function(){e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function Vector3DTileGeometry(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,defined(this._center)||(defined(this._boundingVolume)?this._center=Cartesian3.clone(this._boundingVolume.center):this._center=Cartesian3.clone(Cartesian3.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$4(e){const t=new Float64Array(Matrix4.packedLength+Cartesian3.packedLength);let n=0;return Cartesian3.pack(e._center,t,n),n+=Cartesian3.packedLength,Matrix4.pack(e._modelMatrix,t,n),t}function unpackBuffer$1(e,t){let n=0;const i=t[n++],r=t[n++],o=e._boundingVolumes=new Array(r);for(let e=0;e<r;++e)o[e]=BoundingSphere.unpack(t,n),n+=BoundingSphere.packedLength;const a=t[n++],s=e._batchedIndices=new Array(a);for(let e=0;e<a;++e){const i=Color.unpack(t,n);n+=Color.packedLength;const r=t[n++],o=t[n++],a=t[n++],c=new Array(a);for(let e=0;e<a;++e)c[e]=t[n++];s[e]=new Vector3DTileBatch({color:i,offset:r,count:o,batchIds:c})}return i}Composite3DTileContent.prototype.hasProperty=function(e,t){return!1},Composite3DTileContent.prototype.getFeature=function(e){},Composite3DTileContent.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let r=0;r<i;++r)n[r].applyDebugSettings(e,t)},Composite3DTileContent.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)},Composite3DTileContent.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let r=0;r<i;++r)n[r].update(e,t)},Composite3DTileContent.prototype.isDestroyed=function(){return!1},Composite3DTileContent.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return destroyObject(this)},Object.defineProperties(Vector3DTileGeometry.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}}),Vector3DTileGeometry.packedBoxLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedCylinderLength=Matrix4.packedLength+2,Vector3DTileGeometry.packedEllipsoidLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedSphereLength=Cartesian3.packedLength+1;const createVerticesTaskProcessor$4=new TaskProcessor("createVectorTileGeometries",5),scratchColor$k=new Color;function createPrimitive$1(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,r=e._cylinderBatchIds,o=e._ellipsoids,a=e._ellipsoidBatchIds,s=e._spheres,c=e._sphereBatchIds,l=e._batchTableColors,u=e._packedBuffer;if(!defined(l)){let d=0;defined(e._boxes)&&(t=e._boxes=arraySlice(t),n=e._boxBatchIds=arraySlice(n),d+=n.length),defined(e._cylinders)&&(i=e._cylinders=arraySlice(i),r=e._cylinderBatchIds=arraySlice(r),d+=r.length),defined(e._ellipsoids)&&(o=e._ellipsoids=arraySlice(o),a=e._ellipsoidBatchIds=arraySlice(a),d+=a.length),defined(e._spheres)&&(s=e._sphere=arraySlice(s),c=e._sphereBatchIds=arraySlice(c),d+=c.length),l=e._batchTableColors=new Uint32Array(d);const h=e._batchTable;for(let e=0;e<d;++e){const t=h.getColor(e,scratchColor$k);l[e]=t.toRgba()}u=e._packedBuffer=packBuffer$4(e)}const d=[];defined(t)&&d.push(t.buffer,n.buffer),defined(i)&&d.push(i.buffer,r.buffer),defined(o)&&d.push(o.buffer,a.buffer),defined(s)&&d.push(s.buffer,c.buffer),d.push(l.buffer,u.buffer);const h={boxes:defined(t)?t.buffer:void 0,boxBatchIds:defined(t)?n.buffer:void 0,cylinders:defined(i)?i.buffer:void 0,cylinderBatchIds:defined(i)?r.buffer:void 0,ellipsoids:defined(o)?o.buffer:void 0,ellipsoidBatchIds:defined(o)?a.buffer:void 0,spheres:defined(s)?s.buffer:void 0,sphereBatchIds:defined(s)?c.buffer:void 0,batchTableColors:l.buffer,packedBuffer:u.buffer},p=e._verticesPromise=createVerticesTaskProcessor$4.scheduleTask(h,d);if(!defined(p))return;p.then((function(t){const n=new Float64Array(t.packedBuffer),i=unpackBuffer$1(e,n);e._indices=2===i?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._positions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds),e._batchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:defaultValue(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}function Geometry3DTileContent(e,t,n,i,r){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$a(this,i,r)}function createColorChangedCallback$1(e){return function(t,n){defined(e._geometries)&&e._geometries.updateCommands(t,n)}}function getBatchIds$1(e,t){let n,i,r,o,a;const s=defaultValue(e.BOXES_LENGTH,0),c=defaultValue(e.CYLINDERS_LENGTH,0),l=defaultValue(e.ELLIPSOIDS_LENGTH,0),u=defaultValue(e.SPHERES_LENGTH,0);if(s>0&&defined(e.BOX_BATCH_IDS)){const i=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,s)}if(c>0&&defined(e.CYLINDER_BATCH_IDS)){const n=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,c)}if(l>0&&defined(e.ELLIPSOID_BATCH_IDS)){const n=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,n,l)}if(u>0&&defined(e.SPHERE_BATCH_IDS)){const n=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,n,u)}const d=defined(n)||defined(i)||defined(r)||defined(o),h=s>0&&!defined(n)||c>0&&!defined(i)||l>0&&!defined(r)||u>0&&!defined(o);if(d&&h)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!(defined(n)||defined(i)||defined(r)||defined(o))){let e=0;if(!defined(n)&&s>0)for(n=new Uint16Array(s),a=0;a<s;++a)n[a]=e++;if(!defined(i)&&c>0)for(i=new Uint16Array(c),a=0;a<c;++a)i[a]=e++;if(!defined(r)&&l>0)for(r=new Uint16Array(l),a=0;a<l;++a)r[a]=e++;if(!defined(o)&&u>0)for(o=new Uint16Array(u),a=0;a<u;++a)o[a]=e++}return{boxes:n,cylinders:i,ellipsoids:r,spheres:o}}Vector3DTileGeometry.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTileGeometry.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTileGeometry.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTileGeometry.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTileGeometry.prototype.update=function(e){createPrimitive$1(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTileGeometry.prototype.isDestroyed=function(){return!1},Vector3DTileGeometry.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Object.defineProperties(Geometry3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return defined(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});const sizeOfUint32$3=Uint32Array.BYTES_PER_ELEMENT;function initialize$a(e,t,n){n=defaultValue(n,0);const i=new Uint8Array(t),r=new DataView(t);n+=sizeOfUint32$3;const o=r.getUint32(n,!0);if(1!==o)throw new RuntimeError("Only Geometry tile version 1 is supported. Version "+o+" is not.");n+=sizeOfUint32$3;const a=r.getUint32(n,!0);if(n+=sizeOfUint32$3,0===a)return void e._readyPromise.resolve(e);const s=r.getUint32(n,!0);if(n+=sizeOfUint32$3,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");const c=r.getUint32(n,!0);n+=sizeOfUint32$3;const l=r.getUint32(n,!0);n+=sizeOfUint32$3;const u=r.getUint32(n,!0),d=getJsonFromTypedArray(i,n+=sizeOfUint32$3,s);n+=s;const h=new Uint8Array(t,n,c);let p,f;n+=c,l>0&&(p=getJsonFromTypedArray(i,n,l),n+=l,u>0&&(f=new Uint8Array(t,n,u),f=new Uint8Array(f)));const m=defaultValue(d.BOXES_LENGTH,0),g=defaultValue(d.CYLINDERS_LENGTH,0),_=defaultValue(d.ELLIPSOIDS_LENGTH,0),y=defaultValue(d.SPHERES_LENGTH,0),C=m+g+_+y,T=new Cesium3DTileBatchTable(e,C,p,f,createColorChangedCallback$1(e));if(e._batchTable=T,0===C)return;const S=e.tile.computedTransform;let A;defined(d.RTC_CENTER)&&(A=Cartesian3.unpack(d.RTC_CENTER),Matrix4.multiplyByPoint(S,A,A));const v=getBatchIds$1(d,h);if(m>0||g>0||_>0||y>0){let t,n,i,r;if(m>0){const e=h.byteOffset+d.BOXES.byteOffset;t=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedBoxLength*m)}if(g>0){const e=h.byteOffset+d.CYLINDERS.byteOffset;n=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedCylinderLength*g)}if(_>0){const e=h.byteOffset+d.ELLIPSOIDS.byteOffset;i=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedEllipsoidLength*_)}if(y>0){const e=h.byteOffset+d.SPHERES.byteOffset;r=new Float32Array(h.buffer,e,Vector3DTileGeometry.packedSphereLength*y)}e._geometries=new Vector3DTileGeometry({boxes:t,boxBatchIds:v.boxes,cylinders:n,cylinderBatchIds:v.cylinders,ellipsoids:i,ellipsoidBatchIds:v.ellipsoids,spheres:r,sphereBatchIds:v.spheres,center:A,modelMatrix:S,batchTable:T,boundingVolume:e.tile.boundingVolume.boundingVolume})}}function createFeatures$3(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const n=new Array(t);defined(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}function Gltf3DTileContent(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$9(this,i)}function initialize$9(e,t){const n=e._tileset,i=e._tile,r=e._resource,o={content:e,primitive:n};e._model=new Model({gltf:t,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:r,requestType:RequestType$1.TILES3D,modelMatrix:i.computedTransform,upAxis:n._gltfUpAxis,forwardAxis:Axis$1.X,shadows:n.shadows,debugWireframe:n.debugWireframe,incrementallyLoadTextures:!1,addBatchIdToGeneratedShaders:!1,pickObject:o,imageBasedLightingFactor:n.imageBasedLightingFactor,lightColor:n.lightColor,luminanceAtZenith:n.luminanceAtZenith,sphericalHarmonicCoefficients:n.sphericalHarmonicCoefficients,specularEnvironmentMaps:n.specularEnvironmentMaps,backFaceCulling:n.backFaceCulling,showOutline:n.showOutline}),e._model.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})}))}function hasExtension(e,t){return defined(e)&&defined(e.extensions)&&defined(e.extensions[t])}function ImplicitAvailabilityBitstream(e){const t=e.lengthBits;let n=e.availableCount;const i=e.constant,r=e.bitstream;if(defined(i))n=t;else{const i=Math.ceil(t/8);if(r.length!==i)throw new RuntimeError("Availability bitstream must be exactly "+i+" bytes long to store "+t+" bits. Actual bitstream was "+r.length+" bytes long.");const o=defaultValue(e.computeAvailableCountEnabled,!1);!defined(n)&&o&&(n=count1Bits(r,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=r}function count1Bits(e,t){let n=0;for(let i=0;i<t;i++){const t=i%8;n+=e[i>>3]>>t&1}return n}Geometry3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Geometry3DTileContent.prototype.getFeature=function(e){return createFeatures$3(this),this._features[e]},Geometry3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._geometries)&&this._geometries.applyDebugSettings(e,t)},Geometry3DTileContent.prototype.applyStyle=function(e){createFeatures$3(this),defined(this._geometries)&&this._geometries.applyStyle(e,this._features)},Geometry3DTileContent.prototype.update=function(e,t){if(defined(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),defined(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){const e=this;this._contentReadyPromise=this._geometries.readyPromise.then((function(){e._readyPromise.resolve(e)}))}},Geometry3DTileContent.prototype.isDestroyed=function(){return!1},Geometry3DTileContent.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Gltf3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return this._model.pointsLength}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Gltf3DTileContent.prototype.hasProperty=function(e,t){return!1},Gltf3DTileContent.prototype.getFeature=function(e){},Gltf3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._model.color=t},Gltf3DTileContent.prototype.applyStyle=function(e){const t=defined(e)&&defined(e.color),n=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!n||e.show.evaluate(void 0)},Gltf3DTileContent.prototype.update=function(e,t){const n=this._model,i=this._tile;n.modelMatrix=i.computedTransform,n.shadows=e.shadows,n.imageBasedLightingFactor=e.imageBasedLightingFactor,n.lightColor=e.lightColor,n.luminanceAtZenith=e.luminanceAtZenith,n.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,n.specularEnvironmentMaps=e.specularEnvironmentMaps,n.backFaceCulling=e.backFaceCulling,n.debugWireframe=e.debugWireframe;const r=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,defined(r)&&i.clippingPlanesDirty&&(n._clippingPlanes=r.enabled&&i._isClipped?r:void 0),defined(r)&&defined(n._clippingPlanes)&&n._clippingPlanes!==r&&(n._clippingPlanes=r),n.update(t)},Gltf3DTileContent.prototype.isDestroyed=function(){return!1},Gltf3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),destroyObject(this)},Object.defineProperties(ImplicitAvailabilityBitstream.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}}),ImplicitAvailabilityBitstream.prototype.getBit=function(e){if(defined(this._constant))return this._constant;const t=e>>3,n=e%8;return 1==(this._bitstream[t]>>n&1)};const ImplicitSubdivisionScheme={QUADTREE:"QUADTREE",OCTREE:"OCTREE",getBranchingFactor:function(e){switch(e){case ImplicitSubdivisionScheme.OCTREE:return 8;case ImplicitSubdivisionScheme.QUADTREE:return 4}}};var ImplicitSubdivisionScheme$1=Object.freeze(ImplicitSubdivisionScheme);function MetadataEntity(){}Object.defineProperties(MetadataEntity.prototype,{class:{get:function(){DeveloperError.throwInstantiationError()}}}),MetadataEntity.prototype.hasProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.hasPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyIds=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getProperty=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setProperty=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.getPropertyBySemantic=function(e){DeveloperError.throwInstantiationError()},MetadataEntity.prototype.setPropertyBySemantic=function(e,t){DeveloperError.throwInstantiationError()},MetadataEntity.hasProperty=function(e,t,n){if(defined(t[e]))return!0;if(defined(n)){const t=n.properties[e];if(defined(t)&&defined(t.default))return!0}return!1},MetadataEntity.hasPropertyBySemantic=function(e,t,n){if(!defined(n))return!1;return defined(n.propertiesBySemantic[e])},MetadataEntity.getPropertyIds=function(e,t,n){(n=defined(n)?n:[]).length=0;for(const t in e)e.hasOwnProperty(t)&&defined(e[t])&&n.push(t);if(defined(t)){const i=t.properties;for(const t in i)i.hasOwnProperty(t)&&!defined(e[t])&&defined(i[t].default)&&n.push(t)}return n},MetadataEntity.getProperty=function(e,t,n){let i,r=t[e];if(defined(n)&&(i=n.properties[e]),!defined(r)&&defined(i)&&(r=i.default),defined(r))return Array.isArray(r)&&(r=r.slice()),defined(i)&&(r=i.normalize(r),r=i.unpackVectorAndMatrixTypes(r)),r},MetadataEntity.setProperty=function(e,t,n,i){if(!defined(n[e]))return!1;if(Array.isArray(t)&&(t=t.slice()),defined(i)){const n=i.properties[e];defined(n)&&(t=n.packVectorAndMatrixTypes(t),t=n.unnormalize(t))}return n[e]=t,!0},MetadataEntity.getPropertyBySemantic=function(e,t,n){if(!defined(n))return;const i=n.propertiesBySemantic[e];return defined(i)?MetadataEntity.getProperty(i.id,t,n):void 0},MetadataEntity.setPropertyBySemantic=function(e,t,n,i){const r=i.propertiesBySemantic[e];return!!defined(r)&&MetadataEntity.setProperty(r.id,t,n,i)};const MetadataComponentType={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM",getMinimum:function(e){switch(e){case MetadataComponentType.INT8:return-128;case MetadataComponentType.UINT8:return 0;case MetadataComponentType.INT16:return-32768;case MetadataComponentType.UINT16:return 0;case MetadataComponentType.INT32:return-2147483648;case MetadataComponentType.UINT32:return 0;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt(0):0;case MetadataComponentType.FLOAT32:return-34028234663852886e22;case MetadataComponentType.FLOAT64:return-Number.MAX_VALUE}},getMaximum:function(e){switch(e){case MetadataComponentType.INT8:return 127;case MetadataComponentType.UINT8:return 255;case MetadataComponentType.INT16:return 32767;case MetadataComponentType.UINT16:return 65535;case MetadataComponentType.INT32:return 2147483647;case MetadataComponentType.UINT32:return 4294967295;case MetadataComponentType.INT64:return FeatureDetection.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case MetadataComponentType.UINT64:return FeatureDetection.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case MetadataComponentType.FLOAT32:return 34028234663852886e22;case MetadataComponentType.FLOAT64:return Number.MAX_VALUE}},isNumericType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},isIntegerType:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return!0;default:return!1}},isUnsignedIntegerType:function(e){switch(e){case MetadataComponentType.UINT8:case MetadataComponentType.UINT16:case MetadataComponentType.UINT32:case MetadataComponentType.UINT64:return!0;default:return!1}},isVectorCompatible:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:case MetadataComponentType.INT16:case MetadataComponentType.UINT16:case MetadataComponentType.INT32:case MetadataComponentType.UINT32:case MetadataComponentType.FLOAT32:case MetadataComponentType.FLOAT64:return!0;default:return!1}},normalize:function(e,t){return e>=0?Math.min(Number(e)/Number(MetadataComponentType.getMaximum(t)),1):-Math.min(Number(e)/Number(MetadataComponentType.getMinimum(t)),1)},unnormalize:function(e,t){const n=MetadataComponentType.getMinimum(t),i=MetadataComponentType.getMaximum(t);return e>=0?e*=Number(i):e=-e*Number(n),t!==MetadataComponentType.INT64&&t!==MetadataComponentType.UINT64||!FeatureDetection.supportsBigInt()||(e=BigInt(e)),e>i?i:e<n?n:e},getSizeInBytes:function(e){switch(e){case MetadataComponentType.INT8:case MetadataComponentType.UINT8:return 1;case MetadataComponentType.INT16:case MetadataComponentType.UINT16:return 2;case MetadataComponentType.INT32:case MetadataComponentType.UINT32:return 4;case MetadataComponentType.INT64:case MetadataComponentType.UINT64:return 8;case MetadataComponentType.FLOAT32:return 4;case MetadataComponentType.FLOAT64:return 8}}};var MetadataComponentType$1=Object.freeze(MetadataComponentType);const MetadataType={SINGLE:"SINGLE",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",ARRAY:"ARRAY",isVectorType:function(e){switch(e){case MetadataType.VEC2:case MetadataType.VEC3:case MetadataType.VEC4:return!0;default:return!1}},isMatrixType:function(e){switch(e){case MetadataType.MAT2:case MetadataType.MAT3:case MetadataType.MAT4:return!0;default:return!1}},getComponentCount:function(e){switch(e){case MetadataType.SINGLE:return 1;case MetadataType.VEC2:return 2;case MetadataType.VEC3:return 3;case MetadataType.VEC4:case MetadataType.MAT2:return 4;case MetadataType.MAT3:return 9;case MetadataType.MAT4:return 16;default:return}}};var MetadataType$1=Object.freeze(MetadataType);function MetadataTableProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,n=e.property,i=e.classProperty,r=e.bufferViews,o=i.type,a=o===MetadataType$1.ARRAY,s=a&&!defined(i.componentCount),c=MetadataType$1.isVectorType(o)||MetadataType$1.isMatrixType(o);let l=i.valueType;const u=i.enumType,d=l===MetadataComponentType$1.STRING,h=l===MetadataComponentType$1.BOOLEAN;let p,f,m,g;if(s){let e=defaultValue(n.arrayOffsetType,n.offsetType);e=defaultValue(MetadataComponentType$1[e],MetadataComponentType$1.UINT32),p=new BufferView(r[n.arrayOffsetBufferView],e,t+1)}if(f=s?p.get(t)-p.get(0):a||c?t*i.componentCount:t,d){let e=defaultValue(n.stringOffsetType,n.offsetType);e=defaultValue(MetadataComponentType$1[e],MetadataComponentType$1.UINT32),m=new BufferView(r[n.stringOffsetBufferView],e,f+1)}(d||h)&&(l=MetadataComponentType$1.UINT8),g=d?m.get(f)-m.get(0):h?Math.ceil(f/8):f;const _=new BufferView(r[n.bufferView],l,g),y=this;let C,T;d?C=function(e){return getString(e,y._values,y._stringOffsets)}:h?(C=function(e){return getBoolean(e,y._values)},T=function(e,t){setBoolean(e,y._values,t)}):defined(u)?(C=function(e){const t=y._values.get(e);return u.namesByValue[t]},T=function(e,t){const n=u.valuesByName[t];y._values.set(e,n)}):(C=function(e){return y._values.get(e)},T=function(e,t){y._values.set(e,t)}),this._arrayOffsets=p,this._stringOffsets=m,this._values=_,this._classProperty=i,this._count=t,this._getValue=C,this._setValue=T,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions}function get(e,t){requiresUnpackForGet(e)&&unpackProperty(e);const n=e._classProperty;if(defined(e._unpackedValues)){const i=e._unpackedValues[t];return n.type===MetadataType$1.ARRAY?i.slice():i}const i=n.type,r=n.type===MetadataType$1.ARRAY,o=MetadataType$1.isVectorType(i)||MetadataType$1.isMatrixType(i);if(!r&&!o)return e._getValue(t);let a,s;const c=n.componentCount;defined(c)?(a=t*c,s=c):(a=e._arrayOffsets.get(t),s=e._arrayOffsets.get(t+1)-a);const l=new Array(s);for(let t=0;t<s;++t)l[t]=e._getValue(a+t);return l}function set(e,t,n){requiresUnpackForSet(e,t,n)&&unpackProperty(e);const i=e._classProperty;if(defined(e._unpackedValues))return i.type===MetadataType$1.ARRAY&&(n=n.slice()),void(e._unpackedValues[t]=n);const r=i.type,o=i.type===MetadataType$1.ARRAY,a=MetadataType$1.isVectorType(r)||MetadataType$1.isMatrixType(r);if(!o&&!a)return void e._setValue(t,n);let s,c;const l=i.componentCount;defined(l)?(s=t*l,c=l):(s=e._arrayOffsets.get(t),c=e._arrayOffsets.get(t+1)-s);for(let t=0;t<c;++t)e._setValue(s+t,n[t])}function getString(e,t,n){const i=n.get(e),r=n.get(e+1)-i;return getStringFromTypedArray(t.typedArray,i,r)}function getBoolean(e,t){const n=e>>3,i=e%8;return 1==(t.typedArray[n]>>i&1)}function setBoolean(e,t,n){const i=e>>3,r=e%8;n?t.typedArray[i]|=1<<r:t.typedArray[i]&=~(1<<r)}function getInt64NumberFallback(e,t){const n=t.dataView,i=8*e;let r=0;const o=(128&n.getUint8(i+7))>0;let a=!0;for(let e=0;e<8;++e){let t=n.getUint8(i+e);o&&(a?0!==t&&(t=255&~(t-1),a=!1):t=255&~t),r+=t*Math.pow(256,e)}return o&&(r=-r),r}function getInt64BigIntFallback(e,t){const n=t.dataView,i=8*e;var r=BigInt(0);const o=(128&n.getUint8(i+7))>0;let a=!0;for(let e=0;e<8;++e){let t=n.getUint8(i+e);o&&(a?0!==t&&(t=255&~(t-1),a=!1):t=255&~t),r+=BigInt(t)*(BigInt(1)<<BigInt(8*e))}return o&&(r=-r),r}function getUint64NumberFallback(e,t){const n=t.dataView,i=8*e;return n.getUint32(i,!0)+4294967296*n.getUint32(i+4,!0)}function getUint64BigIntFallback(e,t){const n=t.dataView,i=8*e;var r=BigInt(n.getUint32(i,!0)),o=BigInt(n.getUint32(i+4,!0));return r+BigInt(4294967296)*o}function getComponentDatatype(e){switch(e){case MetadataComponentType$1.INT8:return ComponentDatatype$1.BYTE;case MetadataComponentType$1.UINT8:return ComponentDatatype$1.UNSIGNED_BYTE;case MetadataComponentType$1.INT16:return ComponentDatatype$1.SHORT;case MetadataComponentType$1.UINT16:return ComponentDatatype$1.UNSIGNED_SHORT;case MetadataComponentType$1.INT32:return ComponentDatatype$1.INT;case MetadataComponentType$1.UINT32:return ComponentDatatype$1.UNSIGNED_INT;case MetadataComponentType$1.FLOAT32:return ComponentDatatype$1.FLOAT;case MetadataComponentType$1.FLOAT64:return ComponentDatatype$1.DOUBLE}}function requiresUnpackForGet(e){if(defined(e._unpackedValues))return!1;const t=e._classProperty.valueType;return t===MetadataComponentType$1.STRING||(t===MetadataComponentType$1.INT64&&!FeatureDetection.supportsBigInt64Array()||t===MetadataComponentType$1.UINT64&&!FeatureDetection.supportsBigUint64Array())}function requiresUnpackForSet(e,t,n){if(requiresUnpackForGet(e))return!0;const i=e._arrayOffsets;if(defined(i)){if(i.get(t+1)-i.get(t)!==n.length)return!0}return!1}function unpackProperty(e){e._unpackedValues=unpackValues(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function unpackValues(e){let t;const n=e._count,i=new Array(n),r=e._classProperty;if(r.type!==MetadataType$1.ARRAY){for(t=0;t<n;++t)i[t]=e._getValue(t);return i}let o,a,s;const c=r.componentCount;if(defined(c)){for(t=0;t<n;++t)for(s=new Array(c),i[t]=s,a=t*c,o=0;o<c;++o)s[o]=e._getValue(a+o);return i}for(t=0;t<n;++t){a=e._arrayOffsets.get(t);const n=e._arrayOffsets.get(t+1)-a;for(s=new Array(n),i[t]=s,o=0;o<n;++o)s[o]=e._getValue(a+o)}return i}function BufferView(e,t,n){const i=this;let r,o,a;if(t===MetadataComponentType$1.INT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigInt64Array()?(r=new BigInt64Array(e.buffer,e.byteOffset,n),a=function(e,t){i.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*n),o=function(e){return getInt64BigIntFallback(e,i)}):(oneTimeWarning("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*n),o=function(e){return getInt64NumberFallback(e,i)});else if(t===MetadataComponentType$1.UINT64)FeatureDetection.supportsBigInt()?FeatureDetection.supportsBigUint64Array()?(r=new BigUint64Array(e.buffer,e.byteOffset,n),a=function(e,t){i.typedArray[e]=BigInt(t)}):(r=new Uint8Array(e.buffer,e.byteOffset,8*n),o=function(e){return getUint64BigIntFallback(e,i)}):(oneTimeWarning("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),r=new Uint8Array(e.buffer,e.byteOffset,8*n),o=function(e){return getUint64NumberFallback(e,i)});else{const o=getComponentDatatype(t);r=ComponentDatatype$1.createArrayBufferView(o,e.buffer,e.byteOffset,n),a=function(e,t){i.typedArray[e]=t}}defined(o)||(o=function(e){return i.typedArray[e]}),this.typedArray=r,this.dataView=new DataView(r.buffer,r.byteOffset),this.get=o,this.set=a,this._componentType=t}function MetadataTable(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).count,n={};if(defined(e.properties))for(const i in e.properties)e.properties.hasOwnProperty(i)&&(n[i]=new MetadataTableProperty({count:t,property:e.properties[i],classProperty:e.class.properties[i],bufferViews:e.bufferViews}));this._count=t,this._class=e.class,this._properties=n}function getDefault$1(e,t){if(defined(e)){const n=e.properties[t];if(defined(n)&&defined(n.default)){let e=n.default;return n.type===MetadataType$1.ARRAY&&(e=e.slice()),e=n.normalize(e),n.unpackVectorAndMatrixTypes(e)}}}function ResourceLoader(){}Object.defineProperties(MetadataTableProperty.prototype,{extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataTableProperty.prototype.get=function(e){let t=get(this,e);return t=this._classProperty.normalize(t),this._classProperty.unpackVectorAndMatrixTypes(t)},MetadataTableProperty.prototype.set=function(e,t){const n=this._classProperty;t=n.packVectorAndMatrixTypes(t),set(this,e,t=n.unnormalize(t))},MetadataTableProperty.prototype.getTypedArray=function(){if(defined(this._values))return this._values.typedArray},Object.defineProperties(MetadataTable.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}}}),MetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},MetadataTable.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},MetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},MetadataTable.prototype.getProperty=function(e,t){const n=this._properties[t];let i;return i=defined(n)?n.get(e):getDefault$1(this._class,t),i},MetadataTable.prototype.setProperty=function(e,t,n){const i=this._properties[t];return!!defined(i)&&(i.set(e,n),!0)},MetadataTable.prototype.getPropertyBySemantic=function(e,t){if(defined(this._class)){const n=this._class.propertiesBySemantic[t];if(defined(n))return this.getProperty(e,n.id)}},MetadataTable.prototype.setPropertyBySemantic=function(e,t,n){if(defined(this._class)){const i=this._class.propertiesBySemantic[t];if(defined(i))return this.setProperty(e,i.id,n)}return!1},MetadataTable.prototype.getPropertyTypedArray=function(e){const t=this._properties[e];if(defined(t))return t.getTypedArray()},MetadataTable.prototype.getPropertyTypedArrayBySemantic=function(e){if(defined(this._class)){const t=this._class.propertiesBySemantic[e];if(defined(t))return this.getPropertyTypedArray(t.id)}},Object.defineProperties(ResourceLoader.prototype,{promise:{get:function(){DeveloperError.throwInstantiationError()}},cacheKey:{get:function(){DeveloperError.throwInstantiationError()}}}),ResourceLoader.prototype.load=function(){DeveloperError.throwInstantiationError()},ResourceLoader.prototype.unload=function(){},ResourceLoader.prototype.process=function(e){},ResourceLoader.prototype.getError=function(e,t){return defined(t)&&(e+="\n"+t.message),new RuntimeError(e)},ResourceLoader.prototype.isDestroyed=function(){return!1},ResourceLoader.prototype.destroy=function(){return this.unload(),destroyObject(this)};const ResourceLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4};var ResourceLoaderState$1=Object.freeze(ResourceLoaderState);function BufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).typedArray,n=e.resource,i=e.cacheKey;this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadExternalBuffer(e){const t=e._resource;e._state=ResourceLoaderState$1.LOADING,BufferLoader._fetchArrayBuffer(t).then((function(t){e.isDestroyed()||(e._typedArray=new Uint8Array(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).otherwise((function(n){if(e.isDestroyed())return;e._state=ResourceLoaderState$1.FAILED;const i="Failed to load external buffer: "+t.url;e._promise.reject(e.getError(i,n))}))}defined(Object.create)&&(BufferLoader.prototype=Object.create(ResourceLoader.prototype),BufferLoader.prototype.constructor=BufferLoader),Object.defineProperties(BufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),BufferLoader.prototype.load=function(){defined(this._typedArray)?this._promise.resolve(this):loadExternalBuffer(this)},BufferLoader._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()},BufferLoader.prototype.unload=function(){this._typedArray=void 0},function(){var e,t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n=WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}var o=0;for(i=0;i<e.length;++i)n[o++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,o)}("B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gIUUUEU9gVUUUUUB9gLUUUUB9gD99UE99Ie8aDILEVOLEVLRRRRRWWVBOOBEdddLVE9wEIIVIEBEOWEUEC+Q/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBO8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBRe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBWA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBdl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBQk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBKl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBXe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBZA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBhL79iv9rBodWEBCEKDqxQ+f9Q8aDBK/EpE8jU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrBJ+KJJBC+gEv86BBAVCJDFCBCJDZnJJJB8aDNAItMBAVCJDFADALZ+TJJJB8aKABAEFHRABCEFHEAVALFCBCBCJDAL9rALCfE0eZnJJJB8aAVAVCJDFALZ+TJJJBHWCJ/ABAL9uHODNAItMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAWCJLFCBCJDZnJJJB8aAdAIAQ9rAQAdFAI6eHKADAQAL2FHXDNALtMBAKCSFGOC9wgHMAOCL4CIFCD4HpCBHSAXHZAEHhINDNAKtMBAWASFrBBHoCBHEAZHOINAWCJLFAEFAOrBBGaAo9rGoCETAoCkTCk91CR4786BBAOALFHOAaHoAECEFGEAK9HMBKKDNARAh9rAp6MBAhCBApZnJJJBGcApFHEDNAMtMBCBHxAWCJLFHqINARAE9rCk6MDAWCJLFAxFGlrBDHoCUHODNAlrBEGaAlrBBGkvCfEgMBCBHaAoCfEgMBCBHoDNAlrBIMBAlrBLMBAlrBVMBAlrBOMBAlrBRMBAlrBWMBAlrBdMBAlrBQMBAlrBKMBAlrBXMBAlrBMMBCBHaAlrBpMECBHoCUCBAlrBSeHOKCBHaKDNDNDNDNCLCDCECWAOCZ6GheAkCfEgGkCD0CLvAaCfEgGaCD0FAoCfEgGoCD0FAlrBIGyCD0FAlrBLG8aCD0FAlrBVGeCD0FAlrBOG3CD0FAlrBRG5CD0FAlrBWG8eCD0FAlrBdG8fCD0FAlrBQGACD0FAlrBKGHCD0FAlrBXGGCD0FAlrBMG8jCD0FAlrBpG8kCD0FAlrBSG8lCD0FG8mAOCZAheG8n6GOeAkCp0CWvAaCp0FAoCp0FAyCp0FA8aCp0FAeCp0FA3Cp0FA5Cp0FA8eCp0FA8fCp0FAACp0FAHCp0FAGCp0FA8jCp0FA8kCp0FA8lCp0FA8mA8nAOe6GoeGyCUFpDIEBKAcAxCO4FGaAarBBCDCIAoeAxCI4COgTv86BBAyCW9HMEAEAl8pBB83BBAECWFAlCWF8pBB83BBAECZFHEXDKAcAxCO4FGaAarBBCEAxCI4COgTv86BBKCDCLCWCEAheAOeAoeH8aCUAyTCU7HaCBH5AqHeINAEH3A8aHoAeHECBHOINAErBBGhAaAhAaCfEgGk6eAOCfEgAyTvHOAECEFHEAoCUFGoMBKA3AO86BBAeA8aFHeA3CEFHEA5A8aFG5CZ6MBKDNAlrBBGOAk6MBA3AO86BEA3CDFHEKDNAlrBEGOAk6MBAEAO86BBAECEFHEKDNAlrBDGOAk6MBAEAO86BBAECEFHEKDNAlrBIGOAk6MBAEAO86BBAECEFHEKDNAlrBLGOAk6MBAEAO86BBAECEFHEKDNAlrBVGOAk6MBAEAO86BBAECEFHEKDNAlrBOGOAk6MBAEAO86BBAECEFHEKDNAlrBRGOAk6MBAEAO86BBAECEFHEKDNAlrBWGOAk6MBAEAO86BBAECEFHEKDNAlrBdGOAk6MBAEAO86BBAECEFHEKDNAlrBQGOAk6MBAEAO86BBAECEFHEKDNAlrBKGOAk6MBAEAO86BBAECEFHEKDNAlrBXGOAk6MBAEAO86BBAECEFHEKDNAlrBMGOAk6MBAEAO86BBAECEFHEKDNAlrBpGOAk6MBAEAO86BBAECEFHEKAlrBSGOAk6MBAEAO86BBAECEFHEKAqCZFHqAxCZFGxAM6MBKKAEtMBAZCEFHZAEHhASCEFGSALsMDXEKKCBHOXIKAWAXAKCUFAL2FALZ+TJJJB8aAKAQFGQAI6MBKKCBHOARAE9rCAALALCA6e6MBDNALC8f0MBAECBCAAL9rGOZnJJJBAOFHEKAEAWCJDFALZ+TJJJBALFAB9rHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbDJ+KJJBK/pSEeU8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYD+E+KJJBGRC/gEv86BBALC/ABFCfECJEZnJJJB8aALCuFGW9CU83IBALC8wFGd9CU83IBALCYFGQ9CU83IBALCAFGK9CU83IBALCkFGX9CU83IBALCZFGM9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFGpABCEFGSAOFGE6HODNAItMBCMCSARCB9KeHZCBHhCBHoCBHaCBHcCBHxINDNAOCEgtMBCBHVXIKCDHqADAaCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aCBHODNDNDNDNDNDNDNDNDNINALC/ABFAOCU7AxFCSgCITFGVYDLHeDNAVYDBGVAl9HMBAeAy9HMBAqC9+FHqXDKDNAVAy9HMBAeAk9HMBAqCUFHqXDKDNAVAk9HMBAeAlsMDKAqCLFHqA8aCZFH8aAOCEFGOCZ9HMBXDKKAqC870MBADAqCIgCX2GVC+E1JJBFYDBAaFCDTFYDBHqADAVCJ1JJBFYDBAaFCDTFYDBHyALADAVC11JJBFYDBAaFCDTFYDBGVAcZ+FJJJBGeCBCSAVAhsGkeAeCB9KAeAZ9IgGleHeAkAlCE7gHkDNARCE9IMBAeCS9HMBAVAVAoAVCEFAosGeeGoCEFsMDCMCSAeeHeKASAeA8av86BBAeCS9HMDAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoXIKADCEAkAhsCETAyAhseCX2GOC11JJBFYDBAaFCDTFYDBHqADAOC+E1JJBFYDBAaFCDTFYDBHeADAOCJ1JJBFYDBAaFCDTFYDBHVCBHlDNARCE9IMBAhtMBAVMBAeCE9HMBAqCD9HMBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAM9CU83IBAL9CU83IWAL9CU83IBCBHhCEHlKAhAVAhsGOFH8aALAeAcZ+FJJJBHyALAqAcZ+FJJJBHkAyCM0MLAyCEFHyXVKCpHeASAOCLTCpv86BBAVHoKAetMBAeAZ9IMEKALAcCDTFAVbDBAcCEFCSgHcKAhAkFHhALC/ABFAxCITFGOAqbDLAOAVbDBALC/ABFAxCEFCSgGOCITFGeAVbDLAeAybDBAOCEFHVXDKCBCSAeA8asG3eHyA8aA3FH8aKDNDNAkCM0MBAkCEFHkXEKCBCSAqA8asG3eHkA8aA3FH8aKDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNAkAyCLTvG3CfEgG5C+qUFp9UISSSSSSSSSSSSSSWSLQMSSSSSSSSSSSSESVSSSSSSSSSSSSSRDSdSSSSSSSSSSSSSSKSSSSSSSSSSSSSSSSOBKC/wEH8eA5pDMKpKC/xEH8eXXKC/yEH8eXKKC/zEH8eXQKC/0EH8eXdKC/1EH8eXWKC/2EH8eXRKC/3EH8eXOKC/4EH8eXVKC/5EH8eXLKC/6EH8eXIKC/7EH8eXDKC/8EH8eXEKCPEH8eKAlAVAh9HvMBASA8e86BBXEKASC9+CUAOe86BBAEA386BBAECEFHEKDNAOMBAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoKDNAyCS9HMBAeAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAeHoKDNAkCS9HMBAqAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAqHoKALAcCDTFAVbDBAcCEFCSgHODNDNAypZBEEEEEEEEEEEEEEBEKALAOCDTFAebDBAcCDFCSgHOKDNDNAkpZBEEEEEEEEEEEEEEBEKALAOCDTFAqbDBAOCEFCSgHOKALC/ABFAxCITFGyAVbDLAyAebDBALC/ABFAxCEFCSgCITFGyAebDLAyAqbDBALC/ABFAxCDFCSgCITFGeAqbDLAeAVbDBAxCIFHVAOHcA8aHhKApAE6HOASCEFHSAVCSgHxAaCIFGaAI6MBKKCBHVAOMBAE9C/lm+i/D+Z+g8a83BWAE9CJ/s+d+0/1+M/e/U+GU83BBAEAB9rCZFHVKALC/AEF8kJJJJBAVK+mIEEUCBHIDNABADCUFCSgCDTFYDBAEsMBCEHIABADCpFCSgCDTFYDBAEsMBCDHIABADCMFCSgCDTFYDBAEsMBCIHIABADCXFCSgCDTFYDBAEsMBCLHIABADCKFCSgCDTFYDBAEsMBCVHIABADCQFCSgCDTFYDBAEsMBCOHIABADCdFCSgCDTFYDBAEsMBCRHIABADCWFCSgCDTFYDBAEsMBCWHIABADCRFCSgCDTFYDBAEsMBCdHIABADCOFCSgCDTFYDBAEsMBCQHIABADCVFCSgCDTFYDBAEsMBCKHIABADCLFCSgCDTFYDBAEsMBCXHIABADCIFCSgCDTFYDBAEsMBCMHIABADCDFCSgCDTFYDBAEsMBCpHIABADCEFCSgCDTFYDBAEsMBCSCUABADCSgCDTFYDBAEseSKAIKjEIUCRHDDNINADCEFHIADC96FGLC8f0MEAIHDCEALTAE6MBKKAICR9uCI2CDFABCI9u2ChFKMBCBABbD+E+KJJBK+YDERU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHVABCBrB+E+KJJBC/QEv86BBAL9CB83IWABCEFHOABAEFC98FHRDNAItMBCBHWINDNARAO0MBCBSKAVADAWCDTFYDBGdALCWFAVCDTFYDB9rGEAEC8f91GEFAE7C59K7GVAdALCWFAVCDTFGQYDB9rGEC8f91CETAECDT7vHEINAOAECfB0CRTAECfBgv86BBAOCEFHOAECR4GEMBKAQAdbDBAWCEFGWAI9HMBKKCBHVARAO6MBAOCBbBBAOAB9rCLFHVKAVK86EIUCWHDDNINADCEFHIADC95FGLC8f0MEAIHDCEALTAE6MBKKAICR9uAB2CVFK+yWDEUO99DNAEtMBADCLsHVCUADCETCUFTCU7HDDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKAD+yHWDNAVMBABCOFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADC9+FAI87EBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB87EBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC98FAB87EBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC96FAB87EBALCZFHLADCWFHDAECUFGEMBXDKKABCIFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADCUFAI86BBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB86BBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC9+FAB86BBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC99FAB86BBALCZFHLADCLFHDAECUFGEMBKKK/KLLD99EUE99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNjBBBzjBBB+/ALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABAd87EBDNDNjBBBzjBBB+/AOALAICDFCIgCDTFiDBj/zL+1znnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABCDFAd87EBDNDNjBBBzjBBB+/AOALAICUFCIgCDTFiDBj/zL+1znnGOjBBBB9geAOjBBJ+/AOjBBJ+/9geGOjBBJzAOjBBJz9feAVnmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+tDDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCD4GOtMBCEAI9rHRAOCDTHWCBHdINC+cUHDALHIAOHQINAIiDBAVCXFZ+YJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKARADFGICkTHKCBHDCBAI9rHXAOHIINDNDNALADFiDBGMAXZ+XJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK+iMDlUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZnJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGRADCffffI0eCBYD/4+JJJBhJJJJBBGEbD+oEAVCEbD1DAEABARZ+TJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+OJJJBCUAICDTGWAICffffI0eGdCBYD/4+JJJBhJJJJBBHRAVC+oEFAVYD1DGOCDTFARbDBAVAOCEFGQbD1DARAVYD+YEGKAWZ+TJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD/4+JJJBhJJJJBBGRbDBAVAOCDFGWbD1DARCBAMZnJJJBHpAVC+oEFAWCDTFAdCBYD/4+JJJBhJJJJBBGSbDBAVAOCIFGQbD1DAXHRASHWINAWALiDBALARYDBGdCWAdCW6eCDTFC/EBFiDBmuDBARCLFHRAWCLFHWAICUFGIMBKCBHIAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD/4+JJJBhJJJJBBGQbDBAVAOCLFGObD1DDNADCI6MBAEHRAQHWINAWASARYDBCDTFiDBASARCLFYDBCDTFiDBmASARCWFYDBCDTFiDBmuDBARCXFHRAWCLFHWAICEFGIAM6MBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHRCBHdCBHWCBHaCEHcINARHxAEAWCX2FGqCWFGlYDBHDAqYDBHkABAaCX2FGRCLFAqCLFGyYDBG8abDBARAkbDBARCWFADbDBApAWFCE86BBAZADbDWAZA8abDLAZAkbDBAQAWCDTFCBbDBCIHeDNAdtMBAxHRINDNARYDBGIADsMBAIAksMBAIA8asMBAZAeCDTFAIbDBAeCEFHeKARCLFHRAdCUFGdMBKKAXAkCDTFGRARYDBCUFbDBAXA8aCDTFGRARYDBCUFbDBAXADCDTFGRARYDBCUFbDBAoAhAqYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGItMDXBKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKAoAhAyYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNAKAlYDBCDTGRFGDYDBGdtMBAoAhARFYDBCDTFGkHRAdHIDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNDNAetMBCUHWjBBBBH3CBHRINASAZARCDTFYDBCDTGIFGdiDBH5AdALCBARCEFGkARCS0eCDTFiDBALAXAIFYDBGRCWARCW6eCDTFC/EBFiDBmG8euDBDNAKAIFYDBGdtMBA8eA5+TH8eAoAhAIFYDBCDTFHRAdCDTHIINAQARYDBGdCDTFGDA8eADiDBmG5uDBA5A3A3A59dGDeH3AdAWADeHWARCLFHRAIC98FGIMBKKAkHRAkAe9HMBKAWCU9HMEKAcAM9PMDINDNApAcFrBBMBAcHWXDKAMAcCEFGc9HMBXIKKAaCEFHaAeCZAeCZ6eHdAZHRAxHZAWCU9HMBKKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD/0+JJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/iLEVUCUAICDTGVAICffffI0eGOCBYD/4+JJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZnJJJB8aADCI9uHdDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEALCEFGLAd6MBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+k1JJBZ+NJJJBKqBABAEADAIC+M+JJJBZ+NJJJBK9dEEUABCfEAICDTZnJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/8+JJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/8+JJJBFGDbD/8+JJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+ZJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+YJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9OMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD9IeC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9MMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2999KeC/MEFHEKABAEClTCJJJ/8IF++nKK+ODDBCJWK/0EBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC/0dKXEBBBDBBBZwBB"),{}).then((function(t){(e=t.instance).exports.__wasm_call_ctors(),e.exports.meshopt_encodeVertexVersion(0),e.exports.meshopt_encodeIndexVersion(1)}));function i(e){if(!e)throw new Error("Assertion failed")}function r(t,n,i,r,o){var a=e.exports.sbrk,s=a(n),c=a(r*o),l=new Uint8Array(e.exports.memory.buffer);l.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),c);var u=t(s,n,c,r,o),d=new Uint8Array(u);return d.set(l.subarray(s,s+u)),a(s-a(0)),d}function o(e){for(var t=0,n=0;n<e.length;++n){var i=e[n];t=t<i?i:t}return t}function a(e,t){if(i(2==t||4==t),4==t)return new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4);var n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);return new Uint32Array(n)}function s(t,n,i,r,o,a){var s=e.exports.sbrk,c=s(i*r),l=s(i*a),u=new Uint8Array(e.exports.memory.buffer);u.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),l),t(c,i,r,o,l);var d=new Uint8Array(i*r);return d.set(u.subarray(c,c+i*r)),s(c-s(0)),d}}();var MeshoptDecoder=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,i="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLLVE9wEEEVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+x8yQDBK/qMEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uC/wfBgGOCJDAOCJD6eHdAICEFHLCBHQDNINAQAE9PMEAdAEAQ9rAQAdFAE6eHKDNDNADtMBAKCSFGOC9wgHXAOCL4CIFCD4HMAWCJDFHpCBHSALHZINDNARAZ9rAM9PMBCBHLXIKAZAMFHLDNAXtMBCBHhCBHIINDNARAL9rCk9PMBCBHLXVKAWCJ/CBFAIFHODNDNDNDNDNAZAICO4FrBBAhCOg4CIgpLBEDIBKAO9CB83IBAOCWF9CB83IBXIKAOALrBLALrBBGoCO4GaAaCIsGae86BBAOCEFALCLFAaFGarBBAoCL4CIgGcAcCIsGce86BBAOCDFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCIFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCLFAaAoFGarBBALrBEGoCO4GcAcCIsGce86BBAOCVFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCOFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCRFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCWFAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOCdFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCQFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCKFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCXFAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOCMFAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOCpFAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCSFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAOALrBWALrBBGoCL4GaAaCSsGae86BBAOCEFALCWFAaFGarBBAoCSgGoAoCSsGoe86BBAOCDFAaAoFGorBBALrBEGaCL4GcAcCSsGce86BBAOCIFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCLFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOCVFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCOFAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOCRFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCWFAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOCdFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCQFAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOCKFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCXFAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOCMFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCpFAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCSFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAOAL8pBB83BBAOCWFALCWF8pBB83BBALCZFHLKAhCDFHhAICZFGIAX6MBKKDNALMBCBHLXIKDNAKtMBAWASFrBBHhCBHOApHIINAIAWCJ/CBFAOFrBBGZCE4CBAZCEg9r7AhFGh86BBAIADFHIAOCEFGOAK9HMBKKApCEFHpALHZASCEFGSAD9HMBKKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aKAKCBALeAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK+OoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNjBBBzjBBB+/ABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBBBB9gGdeAWjBB/+9CAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI86BBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD86BBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNjBBBzjBBB+/ABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjBBBB9gGdeAWjB/+fsAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI87EBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD87EBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK6BDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCk91ClTCJJJ/8IF++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB";WebAssembly.validate(e)&&(i="B9h79tEBBBE5V9gBB9gVUUUUUEU9gIUUUB9gDUUB9gEUEUIMXBBEBEEDIDIDLLVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBWl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBQL79iv9rBKQ/j6XLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK1HLSUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uC/wfBgGOCJDAOCJD6eHWAICEFHOCBHdDNINAdAE9PMEAWAEAd9rAdAWFAE6eHQDNDNADtMBAQCSFGLC9wgGKCI2HXAKCETHMALCL4CIFCD4HpCBHSINAOHZCBHhDNINDNARAZ9rAp9PMBCBHOXVKAVCJ/CBFAhAK2FHoAZApFHOCBHIDNAKC/AB6MBARAO9rC/gB6MBCBHLINAoALFHIDNDNDNDNDNAZALCO4FrBBGaCIgpLBEDIBKAICBPhPKLBXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLBAOCZFHOKDNDNDNDNDNAaCD4CIgpLBEDIBKAICBPhPKLZXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLZAOCZFHOKDNDNDNDNDNAaCL4CIgpLBEDIBKAICBPhPKLAXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLAAOCZFHOKDNDNDNDNDNAaCO4pLBEDIBKAICBPhPKL8wXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCLFAlPqBFAaC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCWFAlPqBFAaC+Q+YJJBFrBBFHOXEKAIAOPBBBPKL8wAOCZFHOKALC/ABFHIALCJEFAK0MEAIHLARAO9rC/fB0MBKKDNAIAK9PMBAICI4HLINDNARAO9rCk9PMBCBHOXRKAoAIFHaDNDNDNDNDNAZAICO4FrBBALCOg4CIgpLBEDIBKAaCBPhPKLBXIKAaAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAaAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAaAOPBBBPKLBAOCZFHOKALCDFHLAICZFGIAK6MBKKDNAOtMBAOHZAhCEFGhCLsMDXEKKCBHOXIKDNAKtMBAVCJDFASFHIAVASFPBDBHlCBHaINAIAVCJ/CBFAaFGLPBLBGxCEP9tAxCEPSGcP9OP9hP9RGxALAKFPBLBGkCEP9tAkAcP9OP9hP9RGkPMBZEhDoIaLcVxOqRlGyALAMFPBLBG8aCEP9tA8aAcP9OP9hP9RG8aALAXFPBLBGeCEP9tAeAcP9OP9hP9RGePMBZEhDoIaLcVxOqRlG3PMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIAlP9uGlPeBbDBAIADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAyA3PMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWkdyQ8aKeX3M5p8eS8fGxA8aAePMWkdyQ8aKeX3M5p8eS8fGkPMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFHIAaCZFGaAK6MBKKASCLFGSAD6MBKKABAdAD2FAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBKAQCBAOeAdFHdAOMBKC9+HOXEKCBC99ARAO9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK+KoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK/xVDIUO978jJJJJBCA9rGI8kJJJJBDNDNADCL9HMBDNAEC98gGLtMBABHDCBHVINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKLBKALAIAD/8QBBXEKABAEC98gGDZ+HJJJBADAE9PMBAIAECIgGLCITGVFCBCAAV9r/8KBAIABADCITFGDAV/8QBBAIALZ+HJJJBADAIAV/8QBBKAICAF8kJJJJBK+yIDDUR97DNAEtMBCBHDINABCZFGIAIPBBBGLCBPhGVCJJ98P3ECJJ98P3IGOP9OABPBBBGRALPMLVORXMpScxql358e8fCffEPhP9OP/6EARALPMBEDIWdQKZhoaky8aeGLCZP+sEP/6EGWP/gEALCZP+rECZP+sEP/6EGdP/gEP/kEP/lEGLjB/+fsPaAdALAVP+2EGVAdCJJJJ94PhGQP9OP9RP/kEGdAdP/mEALALP/mEAWAVAWAQP9OP9RP/kEGLALP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGVP/kECZP+rEAdAWP/mEAVP/kECffIPhP9OP9QGdALAWP/mEAVP/kECUPSCBPlDCBPlICBPlOCBPlRCBPlQCBPlKCBPlpCBPlSP9OGLPMWdkyQK8aeXM35pS8e8fP9QPKBBABARAOP9OAdALPMBEZhDIoaLVcxORqlP9QPKBBABCAFHBADCLFGDAE6MBKKK94EIU8jJJJJBCA9rGI8kJJJJBABAEC98gGLZ+JJJJBDNALAE9PMBAIAECIgGVCITGEFCBCAAE9r/8KBAIABALCITFGBAE/8QBBAIAVZ+JJJJBABAIAE/8QBBKAICAF8kJJJJBK/hILDUE97EUV978jJJJJBCZ9rHDDNAEtMBCBHIINADABPBBBGLABCZFGVPBBBGOPMLVORXMpScxql358e8fGRCZP+sEGWCLP+rEPKLBABjBBJzPaj/zL81zPaAWCIPhP9QP/6EP/nEGWALAOPMBEDIWdQKZhoaky8aeGLCZP+rECZP+sEP/6EP/mEGOAOP/mEAWALCZP+sEP/6EP/mEGdAdP/mEAWARCZP+rECZP+sEP/6EP/mEGRARP/mEP/kEP/kEP/lECBPhP+4EP/jEjB/+fsPaGWP/mEjBBN0PaGLP/kECffIPhGQP9OAdAWP/mEALP/kECZP+rEP9QGdARAWP/mEALP/kECZP+rEAOAWP/mEALP/kEAQP9OP9QGWPMBEZhDIoaLVcxORqlGLP5BADPBLBPeB+t+J83IBABCWFALP5EADPBLBPeE+t+J83IBAVAdAWPMWdkyQK8aeXM35pS8e8fGWP5BADPBLBPeD+t+J83IBABCkFAWP5EADPBLBPeI+t+J83IBABCAFHBAICLFGIAE6MBKKK/3EDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB");var r=WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}var o=0;for(i=0;i<e.length;++i)n[o++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,o)}(i),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));function o(e,t,i,r,o,a){var s=n.exports.sbrk,c=i+3&-4,l=s(c*r),u=s(o.length),d=new Uint8Array(n.exports.memory.buffer);d.set(o,u);var h=e(l,i,r,u,o.length);if(0==h&&a&&a(l,c,r),t.set(d.subarray(l,l+i*r)),s(l-s(0)),0!=h)throw new Error("Malformed buffer data: "+h)}var a={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeVertexBuffer:function(e,t,i,r,s){o(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[a[s]])},decodeIndexBuffer:function(e,t,i,r){o(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence:function(e,t,i,r){o(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer:function(e,t,i,r,c,l){o(n.exports[s[c]],e,t,i,r,n.exports[a[l]])}}}();function GltfBufferViewLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.bufferViewId,r=e.gltfResource,o=e.baseResource,a=e.cacheKey,s=n.bufferViews[i];let c,l,u,d,h=s.buffer,p=s.byteOffset,f=s.byteLength,m=!1;if(hasExtension(s,"EXT_meshopt_compression")){const e=s.extensions.EXT_meshopt_compression;h=e.buffer,p=defaultValue(e.byteOffset,0),f=e.byteLength,m=!0,c=e.byteStride,l=e.count,u=e.mode,d=defaultValue(e.filter,"NONE")}const g=n.buffers[h];this._hasMeshopt=m,this._meshoptByteStride=c,this._meshoptCount=l,this._meshoptMode=u,this._meshoptFilter=d,this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._buffer=g,this._bufferId=h,this._byteOffset=p,this._byteLength=f,this._cacheKey=a,this._bufferLoader=void 0,this._typedArray=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getBufferLoader(e){const t=e._resourceCache,n=e._buffer;if(defined(n.uri)){const i=e._baseResource.getDerivedResource({url:n.uri});return t.loadExternalBuffer({resource:i})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}function GltfDracoLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.draco,r=e.gltfResource,o=e.baseResource,a=e.cacheKey;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=n,this._draco=i,this._cacheKey=a,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function handleError$7(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;e._promise.reject(e.getError("Failed to load Draco",t))}function GltfImageLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.imageId,r=e.gltfResource,o=e.baseResource,a=e.cacheKey,s=n.images[i],c=s.bufferView,l=s.uri;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=n,this._bufferViewId=c,this._uri=l,this._cacheKey=a,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getImageAndMipLevels(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map((function(e){return e.bufferView})),e=e[0]),{image:e,mipLevels:t}}function loadFromBufferView$2(e){const t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;return loadImageFromBufferTypedArray(t.typedArray).then((function(t){if(e.isDestroyed())return;const n=getImageAndMipLevels(t);e.unload(),e._image=n.image,e._mipLevels=n.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)}))})).otherwise((function(t){e.isDestroyed()||handleError$6(e,t,"Failed to load embedded image")}))}function loadFromUri$1(e){const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});e._state=ResourceLoaderState$1.LOADING,loadImageFromUri(i).then((function(t){if(e.isDestroyed())return;const n=getImageAndMipLevels(t);e.unload(),e._image=n.image,e._mipLevels=n.mipLevels,e._state=ResourceLoaderState$1.READY,e._promise.resolve(e)})).otherwise((function(t){e.isDestroyed()||handleError$6(e,t,"Failed to load image: "+n)}))}function handleError$6(e,t,n){e.unload(),e._state=ResourceLoaderState$1.FAILED,e._promise.reject(e.getError(n,t))}function getMimeTypeFromTypedArray(e){const t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(255===t[0]&&216===t[1])return"image/jpeg";if(137===t[0]&&80===t[1])return"image/png";if(171===t[0]&&75===t[1])return"image/ktx2";if(82===n[0]&&73===n[1]&&70===n[2]&&70===n[3]&&87===i[0]&&69===i[1]&&66===i[2]&&80===i[3])return"image/webp";throw new RuntimeError("Image format is not recognized")}function loadImageFromBufferTypedArray(e){const t=getMimeTypeFromTypedArray(e);if("image/ktx2"===t){return loadKTX2(new Uint8Array(e))}return GltfImageLoader._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}defined(Object.create)&&(GltfBufferViewLoader.prototype=Object.create(ResourceLoader.prototype),GltfBufferViewLoader.prototype.constructor=GltfBufferViewLoader),Object.defineProperties(GltfBufferViewLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),GltfBufferViewLoader.prototype.load=function(){const e=getBufferLoader(this);this._bufferLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){if(t.isDestroyed())return;const n=e.typedArray,i=new Uint8Array(n.buffer,n.byteOffset+t._byteOffset,t._byteLength);t.unload(),t._typedArray=i,t._hasMeshopt?t._state=ResourceLoaderState$1.PROCESSING:(t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))})).otherwise((function(e){if(t.isDestroyed())return;t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load buffer view",e))}))},GltfBufferViewLoader.prototype.process=function(e){if(!this._hasMeshopt)return;if(!defined(this._typedArray))return;if(this._state!==ResourceLoaderState$1.PROCESSING)return;const t=this._meshoptCount,n=this._meshoptByteStride,i=new Uint8Array(t*n);MeshoptDecoder.decodeGltfBuffer(i,t,n,this._typedArray,this._meshoptMode,this._meshoptFilter),this._typedArray=i,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfBufferViewLoader.prototype.unload=function(){defined(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0},defined(Object.create)&&(GltfDracoLoader.prototype=Object.create(ResourceLoader.prototype),GltfDracoLoader.prototype.constructor=GltfDracoLoader),Object.defineProperties(GltfDracoLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}}),GltfDracoLoader.prototype.load=function(){const e=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._bufferViewTypedArray=e.typedArray,t._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(e){t.isDestroyed()||handleError$7(t,e)}))},GltfDracoLoader.prototype.process=function(e){if(!defined(this._bufferViewTypedArray))return;if(defined(this._decodePromise))return;const t=this._draco,n=this._gltf.bufferViews[t.bufferView],i=t.attributes,r={array:new Uint8Array(this._bufferViewTypedArray),bufferView:n,compressedAttributes:i,dequantizeInShader:!0},o=DracoLoader.decodeBufferView(r);if(!defined(o))return;const a=this;this._decodePromise=o.then((function(e){a.isDestroyed()||(a.unload(),a._decodedData={indices:e.indexArray,vertexAttributes:e.attributeData},a._state=ResourceLoaderState$1.READY,a._promise.resolve(a))})).otherwise((function(e){a.isDestroyed()||handleError$7(a,e)}))},GltfDracoLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0},defined(Object.create)&&(GltfImageLoader.prototype=Object.create(ResourceLoader.prototype),GltfImageLoader.prototype.constructor=GltfImageLoader),Object.defineProperties(GltfImageLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}}),GltfImageLoader.prototype.load=function(){defined(this._bufferViewId)?loadFromBufferView$2(this):loadFromUri$1(this)};const ktx2Regex$1=/(^data:image\/ktx2)|(\.ktx2$)/i;function loadImageFromUri(e){const t=e.url;return ktx2Regex$1.test(t)?loadKTX2(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}function GltfIndexBufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.accessorId,r=e.gltfResource,o=e.baseResource,a=e.draco,s=e.cacheKey,c=defaultValue(e.asynchronous,!0),l=defaultValue(e.loadAsTypedArray,!1),u=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=r,this._baseResource=o,this._gltf=n,this._accessorId=i,this._indexDatatype=u,this._draco=a,this._cacheKey=s,this._asynchronous=c,this._loadAsTypedArray=l,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadFromDraco$1(e){const t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;const n=t.decodedData.indices.typedArray;e._typedArray=n,e._indexDatatype=ComponentDatatype$1.fromTypedArray(n),e._state=ResourceLoaderState$1.PROCESSING})).otherwise((function(t){e.isDestroyed()||handleError$5(e,t)}))}function loadFromBufferView$1(e){const t=e._gltf,n=e._accessorId,i=t.accessors[n].bufferView,r=e._resourceCache.loadBufferView({gltf:t,bufferViewId:i,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=r,r.promise.then((function(){if(e.isDestroyed())return;const t=r.typedArray;e._typedArray=createIndicesTypedArray(e,t),e._state=ResourceLoaderState$1.PROCESSING})).otherwise((function(t){e.isDestroyed()||handleError$5(e,t)}))}function createIndicesTypedArray(e,t){const n=e._gltf,i=e._accessorId,r=n.accessors[i],o=r.count,a=r.componentType,s=t.buffer,c=t.byteOffset+r.byteOffset;let l;return a===IndexDatatype$1.UNSIGNED_BYTE?l=new Uint8Array(s,c,o):a===IndexDatatype$1.UNSIGNED_SHORT?l=new Uint16Array(s,c,o):a===IndexDatatype$1.UNSIGNED_INT&&(l=new Uint32Array(s,c,o)),l}function handleError$5(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load index buffer",t),e._promise.reject(t)}function CreateIndexBufferJob(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}function createIndexBuffer(e,t,n){const i=Buffer$1.createIndexBuffer({typedArray:e,context:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}GltfImageLoader.prototype.unload=function(){defined(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0},GltfImageLoader._loadImageFromTypedArray=loadImageFromTypedArray,defined(Object.create)&&(GltfIndexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfIndexBufferLoader.prototype.constructor=GltfIndexBufferLoader),Object.defineProperties(GltfIndexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}}),GltfIndexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco$1(this):loadFromBufferView$1(this)},CreateIndexBufferJob.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n},CreateIndexBufferJob.prototype.execute=function(){this.buffer=createIndexBuffer(this.typedArray,this.indexDatatype,this.context)};const scratchIndexBufferJob=new CreateIndexBufferJob;function removePipelineExtras(e){return ForEach.shader(e,(function(e){removeExtras(e)})),ForEach.buffer(e,(function(e){removeExtras(e)})),ForEach.image(e,(function(e){removeExtras(e)})),removeExtras(e),e}function removeExtras(e){defined(e.extras)&&(defined(e.extras._pipeline)&&delete e.extras._pipeline,0===Object.keys(e.extras).length&&delete e.extras)}function GltfJsonLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltfResource,i=e.baseResource,r=e.typedArray,o=e.gltfJson,a=e.cacheKey;this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=r,this._gltfJson=o,this._cacheKey=a,this._gltf=void 0,this._bufferLoaders=[],this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadFromUri(e){return e._fetchGltf().then((function(t){if(e.isDestroyed())return;const n=new Uint8Array(t);return processGltfTypedArray(e,n)}))}function handleError$4(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;const n="Failed to load glTF: "+e._gltfResource.url;e._promise.reject(e.getError(n,t))}function upgradeVersion(e,t){if("2.0"===t.asset.version)return when.resolve();const n=[];return ForEach.buffer(t,(function(t){if(!defined(t.extras._pipeline.source)&&defined(t.uri)){const i=e._baseResource.getDerivedResource({url:t.uri}),r=e._resourceCache.loadExternalBuffer({resource:i});e._bufferLoaders.push(r),n.push(r.promise.then((function(e){t.extras._pipeline.source=e.typedArray})))}})),when.all(n).then((function(){updateVersion(t)}))}function decodeDataUris(e){const t=[];return ForEach.buffer(e,(function(e){const n=e.uri;!defined(e.extras._pipeline.source)&&defined(n)&&isDataUri(n)&&(delete e.uri,t.push(Resource.fetchArrayBuffer(n).then((function(t){e.extras._pipeline.source=new Uint8Array(t)}))))})),when.all(t)}function loadEmbeddedBuffers(e,t){const n=[];return ForEach.buffer(t,(function(t,i){const r=t.extras._pipeline.source;if(defined(r)&&!defined(t.uri)){const t=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:i,typedArray:r});e._bufferLoaders.push(t),n.push(t.promise)}})),when.all(n)}function processGltfJson(e,t){return addPipelineExtras(t),decodeDataUris(t).then((function(){return upgradeVersion(e,t).then((function(){return addDefaults(t),loadEmbeddedBuffers(e,t).then((function(){return removePipelineExtras(t),t}))}))}))}function processGltfTypedArray(e,t){let n;return n="glTF"===getMagic(t)?parseGlb(t):getJsonFromTypedArray(t),processGltfJson(e,n)}GltfIndexBufferLoader.prototype.process=function(e){if(this._state===ResourceLoaderState$1.READY)return;const t=this._typedArray,n=this._indexDatatype;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),!defined(t))return;if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);let i;if(this._asynchronous){const r=scratchIndexBufferJob;r.set(t,n,e.context);if(!e.jobScheduler.execute(r,JobType$1.BUFFER))return;i=r.buffer}else i=createIndexBuffer(t,n,e.context);this.unload(),this._buffer=i,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfIndexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},defined(Object.create)&&(GltfJsonLoader.prototype=Object.create(ResourceLoader.prototype),GltfJsonLoader.prototype.constructor=GltfJsonLoader),Object.defineProperties(GltfJsonLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}}),GltfJsonLoader.prototype.load=function(){let e;this._state=ResourceLoaderState$1.LOADING,e=defined(this._gltfJson)?processGltfJson(this,this._gltfJson):defined(this._typedArray)?processGltfTypedArray(this,this._typedArray):loadFromUri(this);const t=this;return e.then((function(e){t.isDestroyed()||(t._gltf=e,t._state=ResourceLoaderState$1.READY,t._promise.resolve(t))})).otherwise((function(e){t.isDestroyed()||handleError$4(t,e)}))},GltfJsonLoader.prototype.unload=function(){const e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0},GltfJsonLoader.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};var AlphaMode$1=Object.freeze(AlphaMode);const ModelComponents={};function Quantization$1(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function Attribute$3(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.packedTypedArray=void 0,this.buffer=void 0,this.typedArray=void 0,this.byteOffset=0,this.byteStride=void 0}function Indices$1(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function FeatureIdAttribute$4(){this.propertyTableId=void 0,this.setIndex=void 0,this.offset=0,this.repeat=void 0}function FeatureIdTexture$1(){this.propertyTableId=void 0,this.textureReader=void 0}function MorphTarget$1(){this.attributes=[]}function Primitive$2(){this.attributes=[],this.morphTargets=[],this.morphWeights=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIdAttributes=[],this.featureIdTextures=[],this.featureTextureIds=[]}function Instances$2(){this.attributes=[],this.featureIdAttributes=[],this.transformInWorldSpace=!1}function Skin$1(){this.joints=void 0,this.inverseBindMatrices=void 0}function Node$3(){this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0}function Scene$3(){this.nodes=[]}function Components$2(){this.scene=void 0,this.nodes=void 0,this.featureMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=Matrix4.clone(Matrix4.IDENTITY)}function TextureReader(){this.texture=void 0,this.texCoord=0,this.transform=Matrix3.clone(Matrix3.IDENTITY),this.channels=void 0}function MetallicRoughness$3(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=Cartesian4.clone(MetallicRoughness$3.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=MetallicRoughness$3.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=MetallicRoughness$3.DEFAULT_ROUGHNESS_FACTOR}function SpecularGlossiness$2(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=Cartesian4.clone(SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=Cartesian3.clone(SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR}function Material$3(){this.metallicRoughness=new MetallicRoughness$3,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=Cartesian3.clone(Material$3.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=AlphaMode$1.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}MetallicRoughness$3.DEFAULT_BASE_COLOR_FACTOR=Cartesian4.ONE,MetallicRoughness$3.DEFAULT_METALLIC_FACTOR=1,MetallicRoughness$3.DEFAULT_ROUGHNESS_FACTOR=1,SpecularGlossiness$2.DEFAULT_DIFFUSE_FACTOR=Cartesian4.ONE,SpecularGlossiness$2.DEFAULT_SPECULAR_FACTOR=Cartesian3.ONE,SpecularGlossiness$2.DEFAULT_GLOSSINESS_FACTOR=1,Material$3.DEFAULT_EMISSIVE_FACTOR=Cartesian3.ZERO,ModelComponents.Quantization=Quantization$1,ModelComponents.Attribute=Attribute$3,ModelComponents.Indices=Indices$1,ModelComponents.FeatureIdAttribute=FeatureIdAttribute$4,ModelComponents.FeatureIdTexture=FeatureIdTexture$1,ModelComponents.MorphTarget=MorphTarget$1,ModelComponents.Primitive=Primitive$2,ModelComponents.Instances=Instances$2,ModelComponents.Skin=Skin$1,ModelComponents.Node=Node$3,ModelComponents.Scene=Scene$3,ModelComponents.Components=Components$2,ModelComponents.TextureReader=TextureReader,ModelComponents.MetallicRoughness=MetallicRoughness$3,ModelComponents.SpecularGlossiness=SpecularGlossiness$2,ModelComponents.Material=Material$3;const GltfLoaderUtil={getImageIdFromTexture:function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.textureId,i=e.supportedImageFormats,r=t.textures[n],o=r.extensions;if(defined(o)){if(i.webp&&defined(o.EXT_texture_webp))return o.EXT_texture_webp.source;if(i.basis&&defined(o.KHR_texture_basisu))return o.KHR_texture_basisu.source}return r.source},createSampler:function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=defaultValue(e.compressedTextureNoMipmap,!1);let r=TextureWrap$1.REPEAT,o=TextureWrap$1.REPEAT,a=TextureMinificationFilter$1.LINEAR,s=TextureMagnificationFilter$1.LINEAR;const c=n.index,l=t.textures[c].sampler;if(defined(l)){const e=t.samplers[l];r=defaultValue(e.wrapS,r),o=defaultValue(e.wrapT,o),a=defaultValue(e.minFilter,a),s=defaultValue(e.magFilter,s)}let u=!1;const d=n.extensions;return defined(d)&&defined(d.KHR_texture_transform)&&(u=!0),(i||u)&&a!==TextureMinificationFilter$1.LINEAR&&a!==TextureMinificationFilter$1.NEAREST&&(a=a===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||a===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR),new Sampler({wrapS:r,wrapT:o,minificationFilter:a,magnificationFilter:s})}},defaultScale$2=new Cartesian2(1,1);function GltfTextureLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.textureInfo,r=e.gltfResource,o=e.baseResource,a=e.supportedImageFormats,s=e.cacheKey,c=defaultValue(e.asynchronous,!0),l=i.index,u=GltfLoaderUtil.getImageIdFromTexture({gltf:n,textureId:l,supportedImageFormats:a});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=u,this._gltfResource=r,this._baseResource=o,this._cacheKey=s,this._asynchronous=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function CreateTextureJob(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}function resizeImageToNextPowerOfTwo(e){const t=document.createElement("canvas");t.width=CesiumMath.nextPowerOfTwo(e.width),t.height=CesiumMath.nextPowerOfTwo(e.height);return t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function createTexture$1(e,t,n,i,r){const o=n.internalFormat;let a=!1;PixelFormat$1.isCompressedFormat(o)&&!defined(i)&&(a=!0);const s=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:a}),c=s.minificationFilter,l=s.wrapS,u=s.wrapT,d=c===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||c===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||c===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||c===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,h=!defined(o)&&d,p=h||l===TextureWrap$1.REPEAT||l===TextureWrap$1.MIRRORED_REPEAT||u===TextureWrap$1.REPEAT||u===TextureWrap$1.MIRRORED_REPEAT,f=!CesiumMath.isPowerOfTwo(n.width)||!CesiumMath.isPowerOfTwo(n.height),m=p&&f;let g;return defined(o)?(!r.webgl2&&PixelFormat$1.isCompressedFormat(o)&&f&&p&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),g=Texture.create({context:r,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:s})):(m&&(n=resizeImageToNextPowerOfTwo(n)),g=Texture.create({context:r,source:n,sampler:s,flipY:!1,skipColorSpaceConversion:!0})),h&&g.generateMipmap(),g}GltfLoaderUtil.createModelTextureReader=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureInfo,n=e.channels,i=e.texture;let r,o=defaultValue(t.texCoord,0);const a=defaultValue(t.extensions,defaultValue.EMPTY_OBJECT).KHR_texture_transform;if(defined(a)){o=defaultValue(a.texCoord,o);const e=defined(a.offset)?Cartesian2.unpack(a.offset):Cartesian2.ZERO;let t=defaultValue(a.rotation,0);const n=defined(a.scale)?Cartesian2.unpack(a.scale):defaultScale$2;t=-t,r=new Matrix3(Math.cos(t)*n.x,-Math.sin(t)*n.y,e.x,Math.sin(t)*n.x,Math.cos(t)*n.y,e.y,0,0,1)}const s=new ModelComponents.TextureReader;return s.texture=i,s.texCoord=o,s.transform=r,s.channels=n,s},defined(Object.create)&&(GltfTextureLoader.prototype=Object.create(ResourceLoader.prototype),GltfTextureLoader.prototype.constructor=GltfTextureLoader),Object.defineProperties(GltfTextureLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}}),GltfTextureLoader.prototype.load=function(){const e=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=e,this._state=ResourceLoaderState$1.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._image=e.image,t._mipLevels=e.mipLevels,t._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(e){if(t.isDestroyed())return;t.unload(),t._state=ResourceLoaderState$1.FAILED;t._promise.reject(t.getError("Failed to load texture",e))}))},CreateTextureJob.prototype.set=function(e,t,n,i,r){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=r},CreateTextureJob.prototype.execute=function(){this.texture=createTexture$1(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};const scratchTextureJob=new CreateTextureJob;function GltfVertexBufferLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.gltfResource,r=e.baseResource,o=e.bufferViewId,a=e.draco,s=e.attributeSemantic,c=e.accessorId,l=e.cacheKey,u=defaultValue(e.asynchronous,!0),d=defaultValue(e.dequantize,!1),h=defaultValue(e.loadAsTypedArray,!1);this._resourceCache=t,this._gltfResource=i,this._baseResource=r,this._gltf=n,this._bufferViewId=o,this._draco=a,this._attributeSemantic=s,this._accessorId=c,this._cacheKey=l,this._asynchronous=u,this._dequantize=d,this._loadAsTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function getQuantizationInformation(e,t,n,i){const r=(1<<e.quantizationBits)-1,o=1/r,a=new ModelComponents.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=AttributeType$1.VEC2,a.normalizationRange=r;else{const t=AttributeType$1.getMathType(i);if(t===Number){const t=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=t,a.normalizationRange=r,a.quantizedVolumeStepSize=t*o}else{a.quantizedVolumeOffset=t.unpack(e.minValues),a.normalizationRange=t.unpack(arrayFill(new Array(n),r));const i=arrayFill(new Array(n),e.range);a.quantizedVolumeDimensions=t.unpack(i);const s=i.map((function(e){return e*o}));a.quantizedVolumeStepSize=t.unpack(s)}}return a}function loadFromDraco(e){const t=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});e._dracoLoader=t,e._state=ResourceLoaderState$1.LOADING,t.promise.then((function(){if(e.isDestroyed())return;const n=t.decodedData.vertexAttributes[e._attributeSemantic],i=e._accessorId,r=e._gltf.accessors[i].type,o=n.array,a=n.data.quantization;defined(a)&&(e._quantization=getQuantizationInformation(a,n.data.componentDatatype,n.data.componentsPerAttribute,r)),e._typedArray=o,e._state=ResourceLoaderState$1.PROCESSING})).otherwise((function(t){e.isDestroyed()||handleError$3(e,t)}))}function loadFromBufferView(e){const t=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});e._state=ResourceLoaderState$1.LOADING,e._bufferViewLoader=t,t.promise.then((function(){e.isDestroyed()||(e._typedArray=t.typedArray,e._state=ResourceLoaderState$1.PROCESSING)})).otherwise((function(t){e.isDestroyed()||handleError$3(e,t)}))}function handleError$3(e,t){e.unload(),e._state=ResourceLoaderState$1.FAILED;t=e.getError("Failed to load vertex buffer",t),e._promise.reject(t)}function CreateVertexBufferJob(){this.typedArray=void 0,this.dequantize=void 0,this.componentType=void 0,this.type=void 0,this.count=void 0,this.context=void 0,this.buffer=void 0}function createVertexBuffer$1(e,t,n,i,r,o){t&&n!==ComponentDatatype$1.FLOAT&&(e=AttributeCompression.dequantize(e,n,i,r));const a=Buffer$1.createVertexBuffer({typedArray:e,context:o,usage:BufferUsage$1.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}GltfTextureLoader.prototype.process=function(e){if(defined(this._texture))return;if(!defined(this._image))return;let t;if(this._asynchronous){const n=scratchTextureJob;n.set(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);if(!e.jobScheduler.execute(n,JobType$1.TEXTURE))return;t=n.texture}else t=createTexture$1(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);this.unload(),this._texture=t,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfTextureLoader.prototype.unload=function(){defined(this._texture)&&this._texture.destroy(),defined(this._imageLoader)&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0},defined(Object.create)&&(GltfVertexBufferLoader.prototype=Object.create(ResourceLoader.prototype),GltfVertexBufferLoader.prototype.constructor=GltfVertexBufferLoader),Object.defineProperties(GltfVertexBufferLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}}),GltfVertexBufferLoader.prototype.load=function(){defined(this._draco)?loadFromDraco(this):loadFromBufferView(this)},CreateVertexBufferJob.prototype.set=function(e,t,n,i,r,o){this.typedArray=e,this.dequantize=t,this.componentType=n,this.type=i,this.count=r,this.context=o},CreateVertexBufferJob.prototype.execute=function(){this.buffer=createVertexBuffer$1(this.typedArray,this.dequantize,this.componentType,this.type,this.count,this.context)};const scratchVertexBufferJob=new CreateVertexBufferJob;function MetadataClassProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,n=e.property;let i;defined(n.enumType)&&(i=e.enums[n.enumType]);let r,o=n.type;MetadataComponentType$1.hasOwnProperty(o)?(r=MetadataComponentType$1[o],o=MetadataType$1.SINGLE):(o=defaultValue(MetadataType$1[o],MetadataType$1.SINGLE),r=MetadataComponentType$1[n.componentType]);const a=getValueType(r,i),s=MetadataComponentType$1.isIntegerType(r)&&defaultValue(n.normalized,!1),c=o===MetadataType$1.ARRAY?n.componentCount:MetadataType$1.getComponentCount(o);this._id=t,this._name=n.name,this._description=n.description,this._type=o,this._enumType=i,this._valueType=a,this._componentType=r,this._componentCount=c,this._normalized=s,this._min=n.min,this._max=n.max,this._default=n.default,this._optional=defaultValue(n.optional,!1),this._semantic=n.semantic,this._extras=n.extras,this._extensions=n.extensions}function validateArray(e,t,n){if(!Array.isArray(t))return getTypeErrorMessage(t,MetadataType$1.ARRAY);const i=t.length;if(defined(n)&&n!==i)return"Array length does not match componentCount";for(let n=0;n<i;++n){const i=checkValue(e,t[n]);if(defined(i))return i}}function validateVectorOrMatrix(e,t,n){if(!MetadataComponentType$1.isVectorCompatible(n)){const e="componentType "+n+" is incompatible with ";return MetadataType$1.isVectorType(t)?e+"vector type "+t:e+"matrix type "+t}return t!==MetadataType$1.VEC2||e instanceof Cartesian2?t!==MetadataType$1.VEC3||e instanceof Cartesian3?t!==MetadataType$1.VEC4||e instanceof Cartesian4?t!==MetadataType$1.MAT2||e instanceof Matrix2?t!==MetadataType$1.MAT3||e instanceof Matrix3?t!==MetadataType$1.MAT4||e instanceof Matrix4?void 0:"matrix value "+e+" must be a Matrix4":"matrix value "+e+" must be a Matrix3":"matrix value "+e+" must be a Matrix2":"vector value "+e+" must be a Cartesian4":"vector value "+e+" must be a Cartesian3":"vector value "+e+" must be a Cartesian2"}function getTypeErrorMessage(e,t){return"value "+e+" does not match type "+t}function getOutOfRangeErrorMessage(e,t,n){let i="value "+e+" is out of range for type "+t;return n&&(i+=" (normalized)"),i}function checkInRange(e,t,n){if(n){const i=1;return e<(MetadataComponentType$1.isUnsignedIntegerType(t)?0:-1)||e>i?getOutOfRangeErrorMessage(e,t,n):void 0}if(e<MetadataComponentType$1.getMinimum(t)||e>MetadataComponentType$1.getMaximum(t))return getOutOfRangeErrorMessage(e,t,n)}function getNonFiniteErrorMessage(e,t){return"value "+e+" of type "+t+" must be finite"}function checkValue(e,t){const n=typeof t,i=e._enumType;if(defined(i))return"string"===n&&defined(i.valuesByName[t])?void 0:"value "+t+" is not a valid enum name for "+i.id;const r=e._valueType,o=e._normalized;switch(r){case MetadataComponentType$1.INT8:case MetadataComponentType$1.UINT8:case MetadataComponentType$1.INT16:case MetadataComponentType$1.UINT16:case MetadataComponentType$1.INT32:case MetadataComponentType$1.UINT32:return"number"!==n?getTypeErrorMessage(t,r):checkInRange(t,r,o);case MetadataComponentType$1.INT64:case MetadataComponentType$1.UINT64:return"number"!==n&&"bigint"!==n?getTypeErrorMessage(t,r):checkInRange(t,r,o);case MetadataComponentType$1.FLOAT32:case MetadataComponentType$1.FLOAT64:return"number"!==n?getTypeErrorMessage(t,r):isFinite(t)?checkInRange(t,r,o):getNonFiniteErrorMessage(t,r);case MetadataComponentType$1.BOOLEAN:if("boolean"!==n)return getTypeErrorMessage(t,r);break;case MetadataComponentType$1.STRING:if("string"!==n)return getTypeErrorMessage(t,r)}}function normalize(e,t,n){if(!e._normalized)return t;const i=e._type,r=e._valueType;let o,a;if(i===MetadataType$1.ARRAY)for(a=t.length,o=0;o<a;++o)t[o]=n(t[o],r);else if(MetadataType$1.isVectorType(i)||MetadataType$1.isMatrixType(i))for(a=MetadataType$1.getComponentCount(i),o=0;o<a;++o)t[o]=n(t[o],r);else t=n(t,r);return t}function getValueType(e,t){return e===MetadataComponentType$1.ENUM?t.valueType:e}function MetadataClass(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,n=e.class,i={},r={};for(const t in n.properties)if(n.properties.hasOwnProperty(t)){const o=new MetadataClassProperty({id:t,property:n.properties[t],enums:e.enums});i[t]=o,defined(o.semantic)&&(r[o.semantic]=o)}this._properties=i,this._propertiesBySemantic=r,this._id=t,this._name=n.name,this._description=n.description,this._extras=n.extras,this._extensions=n.extensions}function MetadataEnumValue(e){this._value=e.value,this._name=e.name,this._description=e.description,this._extras=e.extras,this._extensions=e.extensions}function MetadataEnum(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,n=e.enum,i={},r={},o=n.values.map((function(e){return i[e.value]=e.name,r[e.name]=e.value,new MetadataEnumValue(e)})),a=defaultValue(MetadataComponentType$1[n.valueType],MetadataComponentType$1.UINT16);this._values=o,this._namesByValue=i,this._valuesByName=r,this._valueType=a,this._id=t,this._name=n.name,this._description=n.description,this._extras=n.extras,this._extensions=n.extensions}function MetadataSchema(e){const t={};if(defined(e.enums))for(const n in e.enums)e.enums.hasOwnProperty(n)&&(t[n]=new MetadataEnum({id:n,enum:e.enums[n]}));const n={};if(defined(e.classes))for(const i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=new MetadataClass({id:i,class:e.classes[i],enums:t}));this._classes=n,this._enums=t,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=e.extras,this._extensions=e.extensions}function MetadataSchemaLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,n=e.resource,i=e.cacheKey;this._schema=defined(t)?new MetadataSchema(t):void 0,this._resource=n,this._cacheKey=i,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function loadExternalSchema(e){const t=e._resource;e._state=ResourceLoaderState$1.LOADING,t.fetchJson().then((function(t){e.isDestroyed()||(e._schema=new MetadataSchema(t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).otherwise((function(n){if(e.isDestroyed())return;e._state=ResourceLoaderState$1.FAILED;const i="Failed to load schema: "+t.url;e._promise.reject(e.getError(i,n))}))}GltfVertexBufferLoader.prototype.process=function(e){if(this._state===ResourceLoaderState$1.READY)return;const t=this._typedArray,n=this._dequantize;if(defined(this._dracoLoader)&&this._dracoLoader.process(e),defined(this._bufferViewLoader)&&this._bufferViewLoader.process(e),!defined(t))return;if(this._loadAsTypedArray)return this.unload(),this._typedArray=t,this._state=ResourceLoaderState$1.READY,void this._promise.resolve(this);const i=this._gltf.accessors[this._accessorId];let r;if(this._asynchronous){const o=scratchVertexBufferJob;o.set(t,n,i.componentType,i.type,i.count,e.context);if(!e.jobScheduler.execute(o,JobType$1.BUFFER))return;r=o.buffer}else r=createVertexBuffer$1(t,n,i.componentType,i.type,i.count,e.context);this.unload(),this._buffer=r,this._state=ResourceLoaderState$1.READY,this._promise.resolve(this)},GltfVertexBufferLoader.prototype.unload=function(){defined(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;defined(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),defined(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},Object.defineProperties(MetadataClassProperty.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},componentCount:{get:function(){return this._componentCount}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},default:{get:function(){return this._default}},optional:{get:function(){return this._optional}},semantic:{get:function(){return this._semantic}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClassProperty.prototype.normalize=function(e){return normalize(this,e,MetadataComponentType$1.normalize)},MetadataClassProperty.prototype.unnormalize=function(e){return normalize(this,e,MetadataComponentType$1.unnormalize)},MetadataClassProperty.prototype.unpackVectorAndMatrixTypes=function(e){switch(this._type){case MetadataType$1.VEC2:return Cartesian2.unpack(e);case MetadataType$1.VEC3:return Cartesian3.unpack(e);case MetadataType$1.VEC4:return Cartesian4.unpack(e);case MetadataType$1.MAT2:return Matrix2.unpack(e);case MetadataType$1.MAT3:return Matrix3.unpack(e);case MetadataType$1.MAT4:return Matrix4.unpack(e);default:return e}},MetadataClassProperty.prototype.packVectorAndMatrixTypes=function(e){switch(this._type){case MetadataType$1.VEC2:return Cartesian2.pack(e,[]);case MetadataType$1.VEC3:return Cartesian3.pack(e,[]);case MetadataType$1.VEC4:return Cartesian4.pack(e,[]);case MetadataType$1.MAT2:return Matrix2.pack(e,[]);case MetadataType$1.MAT3:return Matrix3.pack(e,[]);case MetadataType$1.MAT4:return Matrix4.pack(e,[]);default:return e}},MetadataClassProperty.prototype.validate=function(e){const t=this._type,n=this._componentType;return MetadataType$1.isVectorType(t)||MetadataType$1.isMatrixType(t)?validateVectorOrMatrix(e,t,n):t===MetadataType$1.ARRAY?validateArray(this,e,this._componentCount):checkValue(this,e)},Object.defineProperties(MetadataClass.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),MetadataClass.BATCH_TABLE_CLASS_NAME="_batchTable",Object.defineProperties(MetadataEnumValue.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataEnum.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(MetadataSchema.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),defined(Object.create)&&(MetadataSchemaLoader.prototype=Object.create(ResourceLoader.prototype),MetadataSchemaLoader.prototype.constructor=MetadataSchemaLoader),Object.defineProperties(MetadataSchemaLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}}),MetadataSchemaLoader.prototype.load=function(){defined(this._schema)?this._promise.resolve(this):loadExternalSchema(this)},MetadataSchemaLoader.prototype.unload=function(){this._schema=void 0};const ResourceCacheKey={};function getExternalResourceCacheKey(e){return getAbsoluteUri(e.url)}function getBufferViewCacheKey(e){let t=e.byteOffset,n=e.byteLength;if(hasExtension(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=defaultValue(i.byteOffset,0),n=i.byteLength}return t+"-"+(t+n)}function getAccessorCacheKey(e,t){return t.byteOffset+e.byteOffset+"-"+e.componentType+"-"+e.type+"-"+e.count}function getExternalBufferCacheKey(e){return getExternalResourceCacheKey(e)}function getEmbeddedBufferCacheKey(e,t){return getExternalResourceCacheKey(e)+"-buffer-id-"+t}function getBufferCacheKey(e,t,n,i){if(defined(e.uri)){return getExternalBufferCacheKey(i.getDerivedResource({url:e.uri}))}return getEmbeddedBufferCacheKey(n,t)}function getDracoCacheKey(e,t,n,i){const r=t.bufferView,o=e.bufferViews[r],a=o.buffer;return getBufferCacheKey(e.buffers[a],a,n,i)+"-range-"+getBufferViewCacheKey(o)}function getImageCacheKey(e,t,n,i){const r=e.images[t],o=r.bufferView,a=r.uri;if(defined(a)){return getExternalResourceCacheKey(i.getDerivedResource({url:a}))}const s=e.bufferViews[o],c=s.buffer;return getBufferCacheKey(e.buffers[c],c,n,i)+"-range-"+getBufferViewCacheKey(s)}function getSamplerCacheKey(e,t){const n=GltfLoaderUtil.createSampler({gltf:e,textureInfo:t});return n.wrapS+"-"+n.wrapT+"-"+n.minificationFilter+"-"+n.magnificationFilter}function ResourceCache(){}function CacheEntry(e){this.referenceCount=1,this.resourceLoader=e}function ImplicitSubtree(e,t,n,i){this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._implicitCoordinates=i,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._subtreeLevels=n.subtreeLevels,this._subdivisionScheme=n.subdivisionScheme,this._branchingFactor=n.branchingFactor,this._readyPromise=when.defer(),this._metadataTable=void 0,this._metadataExtension=void 0,this._jumpBuffer=void 0,initialize$8(this,t,n)}function initialize$8(e,t,n){const i=parseSubtreeChunks(t),r=i.json;let o;e._subtreeJson=r,hasExtension(r,"3DTILES_metadata")&&(o=r.extensions["3DTILES_metadata"]),e._metadataExtension=o;const a={constant:0};r.contentAvailabilityHeaders=[],hasExtension(r,"3DTILES_multiple_contents")?r.contentAvailabilityHeaders=r.extensions["3DTILES_multiple_contents"].contentAvailability:r.contentAvailabilityHeaders.push(defaultValue(r.contentAvailability,a));const s=preprocessBuffers(r.buffers),c=preprocessBufferViews(r.bufferViews,s);markActiveBufferViews(r,c),defined(o)&&markActiveMetadataBufferViews(o,c),requestActiveBuffers(e,s,i.binary).then((function(t){const i=parseActiveBufferViews(c,t);parseAvailability(e,r,n,i),defined(o)&&(parseMetadataTable(e,n,i),makeJumpBuffer(e)),e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function parseSubtreeChunks(e){const t=new DataView(e.buffer,e.byteOffset);let n=8;const i=t.getUint32(n,true);n+=8;const r=t.getUint32(n,true);n+=8;const o=getJsonFromTypedArray(e,n,i);n+=i;return{json:o,binary:e.subarray(n,n+r)}}function preprocessBuffers(e){e=defined(e)?e:[];for(let t=0;t<e.length;t++){const n=e[t];n.isExternal=defined(n.uri),n.isActive=!1}return e}function preprocessBufferViews(e,t){e=defined(e)?e:[];for(let n=0;n<e.length;n++){const i=e[n],r=t[i.buffer];i.bufferHeader=r,i.isActive=!1}return e}function markActiveBufferViews(e,t){let n;const i=e.tileAvailability;defined(i.bufferView)&&(n=t[i.bufferView],n.isActive=!0,n.bufferHeader.isActive=!0);const r=e.contentAvailabilityHeaders;for(let e=0;e<r.length;e++)defined(r[e].bufferView)&&(n=t[r[e].bufferView],n.isActive=!0,n.bufferHeader.isActive=!0);const o=e.childSubtreeAvailability;defined(o.bufferView)&&(n=t[o.bufferView],n.isActive=!0,n.bufferHeader.isActive=!0)}function markActiveMetadataBufferViews(e,t){const n=e.properties;let i;for(const e in n)if(n.hasOwnProperty(e)){const r=n[e];i=t[r.bufferView],i.isActive=!0,i.bufferHeader.isActive=!0,defined(r.stringOffsetBufferView)&&(i=t[r.stringOffsetBufferView],i.isActive=!0,i.bufferHeader.isActive=!0),defined(r.arrayOffsetBufferView)&&(i=t[r.arrayOffsetBufferView],i.isActive=!0,i.bufferHeader.isActive=!0)}}function requestActiveBuffers(e,t,n){const i=[];for(let r=0;r<t.length;r++){const o=t[r];if(o.isActive)if(o.isExternal){const t=requestExternalBuffer(e,o);i.push(t)}else i.push(when.resolve(n));else i.push(when.resolve(void 0))}return when.all(i).then((function(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];defined(i)&&(t[n]=i)}return t}))}function requestExternalBuffer(e,t){const n=e._resource.getDerivedResource({url:t.uri}),i=ResourceCache.loadExternalBuffer({resource:n});return e._bufferLoader=i,i.promise.then((function(e){return e.typedArray}))}function parseActiveBufferViews(e,t){const n={};for(let i=0;i<e.length;i++){const r=e[i];if(!r.isActive)continue;const o=r.byteOffset,a=o+r.byteLength,s=t[r.buffer].subarray(o,a);n[i]=s}return n}function parseAvailability(e,t,n,i){const r=n.branchingFactor,o=n.subtreeLevels,a=(Math.pow(r,o)-1)/(r-1),s=Math.pow(r,o),c=hasExtension(t,"3DTILES_metadata");e._tileAvailability=parseAvailabilityBitstream(t.tileAvailability,i,a,c);for(let n=0;n<t.contentAvailabilityHeaders.length;n++){const r=parseAvailabilityBitstream(t.contentAvailabilityHeaders[n],i,a);e._contentAvailabilityBitstreams.push(r)}e._childSubtreeAvailability=parseAvailabilityBitstream(t.childSubtreeAvailability,i,s)}function parseAvailabilityBitstream(e,t,n,i){if(defined(e.constant))return new ImplicitAvailabilityBitstream({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});return new ImplicitAvailabilityBitstream({bitstream:t[e.bufferView],lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function parseMetadataTable(e,t,n){const i=e._metadataExtension,r=e._tileAvailability.availableCount,o=i.class,a=t.metadataSchema.classes[o];e._metadataTable=new MetadataTable({class:a,count:r,properties:i.properties,bufferViews:n})}function makeJumpBuffer(e){const t=e._tileAvailability;let n=0;const i=t.lengthBits,r=t.availableCount;let o;o=r<256?new Uint8Array(i):r<65536?new Uint16Array(i):new Uint32Array(i);for(let e=0;e<t.lengthBits;e++)t.getBit(e)&&(o[e]=n,n++);e._jumpBuffer=o}function ImplicitTileMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._class=e.class;const t=e.implicitSubtree;this._metadataTable=t.metadataTable,this._entityId=t.getEntityId(e.implicitCoordinates);const n=t.metadataExtension;this._extensions=n.extensions,this._extras=n.extras}ResourceCacheKey.getSchemaCacheKey=function(e){const t=e.schema,n=e.resource;return defined(t)?"embedded-schema:"+JSON.stringify(t):"external-schema:"+getExternalResourceCacheKey(n)},ResourceCacheKey.getExternalBufferCacheKey=function(e){return"external-buffer:"+getExternalBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource)},ResourceCacheKey.getEmbeddedBufferCacheKey=function(e){return"embedded-buffer:"+getEmbeddedBufferCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,e.bufferId)},ResourceCacheKey.getGltfCacheKey=function(e){return"gltf:"+getExternalResourceCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource)},ResourceCacheKey.getBufferViewCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.bufferViewId,i=e.gltfResource,r=e.baseResource,o=t.bufferViews[n];let a=o.buffer;const s=t.buffers[a];if(hasExtension(o,"EXT_meshopt_compression")){a=o.extensions.EXT_meshopt_compression.buffer}return"buffer-view:"+getBufferCacheKey(s,a,i,r)+"-range-"+getBufferViewCacheKey(o)},ResourceCacheKey.getDracoCacheKey=function(e){return"draco:"+getDracoCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.draco,e.gltfResource,e.baseResource)},ResourceCacheKey.getVertexBufferCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.gltfResource,i=e.baseResource,r=e.bufferViewId,o=e.draco,a=e.attributeSemantic;let s="";if(defaultValue(e.dequantize,!1)&&(s+="-dequantize"),defaultValue(e.loadAsTypedArray,!1)&&(s+="-typed-array"),defined(o)){return"vertex-buffer:"+getDracoCacheKey(t,o,n,i)+"-draco-"+a+s}const c=t.bufferViews[r],l=c.buffer;return"vertex-buffer:"+getBufferCacheKey(t.buffers[l],l,n,i)+"-range-"+getBufferViewCacheKey(c)+s},ResourceCacheKey.getIndexBufferCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.accessorId,i=e.gltfResource,r=e.baseResource,o=e.draco;let a="";if(defaultValue(e.loadAsTypedArray,!1)&&(a+="-typed-array"),defined(o)){return"index-buffer:"+getDracoCacheKey(t,o,i,r)+"-draco"+a}const s=t.accessors[n],c=s.bufferView,l=t.bufferViews[c],u=l.buffer;return"index-buffer:"+getBufferCacheKey(t.buffers[u],u,i,r)+"-accessor-"+getAccessorCacheKey(s,l)+a},ResourceCacheKey.getImageCacheKey=function(e){return"image:"+getImageCacheKey((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,e.imageId,e.gltfResource,e.baseResource)},ResourceCacheKey.getTextureCacheKey=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=e.gltfResource,r=e.baseResource,o=e.supportedImageFormats,a=n.index;return"texture:"+getImageCacheKey(t,GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:o}),i,r)+"-sampler-"+getSamplerCacheKey(t,n)},ResourceCache.cacheEntries={},ResourceCache.get=function(e){const t=ResourceCache.cacheEntries[e];if(defined(t))return++t.referenceCount,t.resourceLoader},ResourceCache.load=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resourceLoader,n=t.cacheKey;ResourceCache.cacheEntries[n]=new CacheEntry(t),t.load()},ResourceCache.unload=function(e){const t=e.cacheKey,n=ResourceCache.cacheEntries[t];--n.referenceCount,0===n.referenceCount&&(e.destroy(),delete ResourceCache.cacheEntries[t])},ResourceCache.loadSchema=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).schema,n=e.resource,i=ResourceCacheKey.getSchemaCacheKey({schema:t,resource:n});let r=ResourceCache.get(i);return defined(r)||(r=new MetadataSchemaLoader({schema:t,resource:n,cacheKey:i}),ResourceCache.load({resourceLoader:r})),r},ResourceCache.loadEmbeddedBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).parentResource,n=e.bufferId,i=e.typedArray,r=ResourceCacheKey.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let o=ResourceCache.get(r);return defined(o)||(o=new BufferLoader({typedArray:i,cacheKey:r}),ResourceCache.load({resourceLoader:o})),o},ResourceCache.loadExternalBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).resource,n=ResourceCacheKey.getExternalBufferCacheKey({resource:t});let i=ResourceCache.get(n);return defined(i)||(i=new BufferLoader({resource:t,cacheKey:n}),ResourceCache.load({resourceLoader:i})),i},ResourceCache.loadGltfJson=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource,n=e.baseResource,i=e.typedArray,r=e.gltfJson,o=ResourceCacheKey.getGltfCacheKey({gltfResource:t});let a=ResourceCache.get(o);return defined(a)||(a=new GltfJsonLoader({resourceCache:ResourceCache,gltfResource:t,baseResource:n,typedArray:i,gltfJson:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadBufferView=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.bufferViewId,i=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfBufferViewLoader({resourceCache:ResourceCache,gltf:t,bufferViewId:n,gltfResource:i,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadDraco=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.draco,i=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfDracoLoader({resourceCache:ResourceCache,gltf:t,draco:n,gltfResource:i,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadVertexBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.gltfResource,i=e.baseResource,r=e.bufferViewId,o=e.draco,a=e.attributeSemantic,s=e.accessorId,c=defaultValue(e.asynchronous,!0),l=defaultValue(e.dequantize,!1),u=defaultValue(e.loadAsTypedArray,!1),d=ResourceCacheKey.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:o,attributeSemantic:a,dequantize:l,loadAsTypedArray:u});let h=ResourceCache.get(d);return defined(h)||(h=new GltfVertexBufferLoader({resourceCache:ResourceCache,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:o,attributeSemantic:a,accessorId:s,cacheKey:d,asynchronous:c,dequantize:l,loadAsTypedArray:u}),ResourceCache.load({resourceLoader:h})),h},ResourceCache.loadIndexBuffer=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.accessorId,i=e.gltfResource,r=e.baseResource,o=e.draco,a=defaultValue(e.asynchronous,!0),s=defaultValue(e.loadAsTypedArray,!1),c=ResourceCacheKey.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:r,draco:o,loadAsTypedArray:s});let l=ResourceCache.get(c);return defined(l)||(l=new GltfIndexBufferLoader({resourceCache:ResourceCache,gltf:t,accessorId:n,gltfResource:i,baseResource:r,draco:o,cacheKey:c,asynchronous:a,loadAsTypedArray:s}),ResourceCache.load({resourceLoader:l})),l},ResourceCache.loadImage=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.imageId,i=e.gltfResource,r=e.baseResource,o=ResourceCacheKey.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:r});let a=ResourceCache.get(o);return defined(a)||(a=new GltfImageLoader({resourceCache:ResourceCache,gltf:t,imageId:n,gltfResource:i,baseResource:r,cacheKey:o}),ResourceCache.load({resourceLoader:a})),a},ResourceCache.loadTexture=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=e.gltfResource,r=e.baseResource,o=e.supportedImageFormats,a=defaultValue(e.asynchronous,!0),s=ResourceCacheKey.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:r,supportedImageFormats:o});let c=ResourceCache.get(s);return defined(c)||(c=new GltfTextureLoader({resourceCache:ResourceCache,gltf:t,textureInfo:n,gltfResource:i,baseResource:r,supportedImageFormats:o,cacheKey:s,asynchronous:a}),ResourceCache.load({resourceLoader:c})),c},ResourceCache.clearForSpecs=function(){const e=[GltfVertexBufferLoader,GltfIndexBufferLoader,GltfDracoLoader,GltfTextureLoader,GltfImageLoader,GltfBufferViewLoader,BufferLoader,MetadataSchemaLoader,GltfJsonLoader];let t;const n=ResourceCache.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort((function(t,n){return e.indexOf(t.resourceLoader.constructor)-e.indexOf(n.resourceLoader.constructor)}));const r=i.length;for(let e=0;e<r;++e){const r=i[e];t=r.resourceLoader.cacheKey,defined(n[t])&&(r.resourceLoader.destroy(),delete n[t])}},Object.defineProperties(ImplicitSubtree.prototype,{readyPromise:{get:function(){return this._readyPromise.promise}},metadataTable:{get:function(){return this._metadataTable}},metadataExtension:{get:function(){return this._metadataExtension}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}}),ImplicitSubtree.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)},ImplicitSubtree.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)},ImplicitSubtree.prototype.contentIsAvailableAtIndex=function(e,t){return t=defaultValue(t,0),this._contentAvailabilityBitstreams[t].getBit(e)},ImplicitSubtree.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e,t);return this.contentIsAvailableAtIndex(n)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)},ImplicitSubtree.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)},ImplicitSubtree.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)},ImplicitSubtree.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(t=3),e>>t},ImplicitSubtree.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new RuntimeError("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex},ImplicitSubtree.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new RuntimeError("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex},ImplicitSubtree.prototype.getEntityId=function(e){if(!defined(this._metadataTable))return;const t=this.getTileIndex(e);return this._tileAvailability.getBit(t)?this._jumpBuffer[t]:void 0},ImplicitSubtree.prototype.isDestroyed=function(){return!1},ImplicitSubtree.prototype.destroy=function(){return defined(this._bufferLoader)&&ResourceCache.unload(this._bufferLoader),destroyObject(this)},Object.defineProperties(ImplicitTileMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),ImplicitTileMetadata.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)},ImplicitTileMetadata.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)},ImplicitTileMetadata.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)},ImplicitTileMetadata.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)},ImplicitTileMetadata.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)},ImplicitTileMetadata.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)},ImplicitTileMetadata.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const MetadataSemantic={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"};var MetadataSemantic$1=Object.freeze(MetadataSemantic);function parseBoundingVolumeSemantics(e){return{tile:{boundingVolume:parseBoundingVolume("TILE",e),minimumHeight:parseMinimumHeight("TILE",e),maximumHeight:parseMaximumHeight("TILE",e)},content:{boundingVolume:parseBoundingVolume("CONTENT",e),minimumHeight:parseMinimumHeight("CONTENT",e),maximumHeight:parseMaximumHeight("CONTENT",e)}}}function parseBoundingVolume(e,t){const n=e+"_BOUNDING_BOX",i=t.getPropertyBySemantic(n);if(defined(i))return{box:i};const r=e+"_BOUNDING_REGION",o=t.getPropertyBySemantic(r);if(defined(o))return{region:o};const a=e+"_BOUNDING_SPHERE",s=t.getPropertyBySemantic(a);return defined(s)?{sphere:s}:void 0}function parseMinimumHeight(e,t){const n=e+"_MINIMUM_HEIGHT";return t.getPropertyBySemantic(n)}function parseMaximumHeight(e,t){const n=e+"_MAXIMUM_HEIGHT";return t.getPropertyBySemantic(n)}function Implicit3DTileContent(e,t,n,i,r){const o=t.implicitTileset,a=t.implicitCoordinates;this._implicitTileset=o,this._implicitCoordinates=a,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=n,this._readyPromise=when.defer(),this.featurePropertiesDirty=!1,this._groupMetadata=void 0;const s=a.getTemplateValues(),c=o.subtreeUriTemplate.getDerivedResource({templateValues:s});this._url=c.getUrlComponent(!0),initialize$7(this,i,r)}function initialize$7(e,t,n){n=defaultValue(n,0);const i=new Uint8Array(t,n),r=new ImplicitSubtree(e._resource,i,e._implicitTileset,e._implicitCoordinates);e._implicitSubtree=r,r.readyPromise.then((function(){expandSubtree(e,r),e._readyPromise.resolve()})).otherwise((function(t){e._readyPromise.reject(t)}))}function expandSubtree(e,t){const n=e._tile,i=transcodeSubtreeTiles(e,t,n,e._implicitCoordinates.childIndex);n.children.push(i.rootTile);const r=listChildSubtrees(e,t,i.bottomRow);for(let t=0;t<r.length;t++){const n=r[t],i=n.tile,o=makePlaceholderChildSubtree(e,i,n.childIndex);i.children.push(o)}}function listChildSubtrees(e,t,n){const i=[],r=e._implicitTileset.branchingFactor;for(let e=0;e<n.length;e++){const o=n[e];if(defined(o))for(let n=0;n<r;n++){const a=e*r+n;t.childSubtreeIsAvailableAtIndex(a)&&i.push({tile:o,childIndex:n})}}return i}function transcodeSubtreeTiles(e,t,n,i){const r=deriveChildTile(e,t,n,i,0,!0);let o=[r],a=[];const s=e._implicitTileset;for(let n=1;n<s.subtreeLevels;n++){const i=t.getLevelOffset(n),r=s.branchingFactor*o.length;for(let n=0;n<r;n++){const r=i+n;if(!t.tileIsAvailableAtIndex(r)){a.push(void 0);continue}const c=o[t.getParentMortonIndex(n)],l=deriveChildTile(e,t,c,n%s.branchingFactor,r);c.children.push(l),a.push(l)}o=a,a=[]}return{rootTile:r,bottomRow:o}}function getGeometricError$3(e,t,n){const i=MetadataSemantic$1.TILE_GEOMETRIC_ERROR;return defined(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function deriveChildTile(e,t,n,i,r,o){const a=e._implicitTileset;let s,c,l,u;if(s=defaultValue(o,!1)?n.implicitCoordinates:n.implicitCoordinates.getChildCoordinates(i),defined(t.metadataExtension)){c=new ImplicitTileMetadata({class:t.metadataTable.class,implicitCoordinates:s,implicitSubtree:t});const e=parseBoundingVolumeSemantics(c);l=e.tile,u=e.content}const d=getTileBoundingVolume(a,s,i,o,n,l),h=[];for(let e=0;e<a.contentCount;e++){if(!t.contentIsAvailableAtIndex(r,e))continue;const n={uri:a.contentUriTemplates[e].getDerivedResource({templateValues:s.getTemplateValues()}).url},i=getContentBoundingVolume$1(d,u);defined(i)&&(n.boundingVolume=i),h.push(combine$2(n,a.contentHeaders[e]))}const p={boundingVolume:d,geometricError:getGeometricError$3(c,a,s),refine:a.refine};1===h.length?p.content=h[0]:h.length>1&&(p.extensions={"3DTILES_multiple_contents":{content:h}});const f=clone$1(a.tileHeader,true);delete f.boundingVolume,delete f.transform;const m=combine$2(p,f,true),g=makeTile$1(e,a.baseResource,m,n);return g.implicitCoordinates=s,g.implicitSubtree=t,g.metadata=c,g}function canUpdateHeights(e,t){return defined(e)&&defined(t)&&(defined(t.minimumHeight)||defined(t.maximumHeight))&&(hasExtension(e,"3DTILES_bounding_volume_S2")||defined(e.region))}function updateHeights$1(e,t){hasExtension(e,"3DTILES_bounding_volume_S2")&&defined(t)?updateS2CellHeights(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):defined(e.region)&&defined(t)&&updateRegionHeights(e.region,t.minimumHeight,t.maximumHeight)}function updateRegionHeights(e,t,n){defined(t)&&(e[4]=t),defined(n)&&(e[5]=n)}function updateS2CellHeights(e,t,n){defined(t)&&(e.minimumHeight=t),defined(n)&&(e.maximumHeight=n)}function getTileBoundingVolume(e,t,n,i,r,o){let a;return a=!defined(o)||!defined(o.boundingVolume)||!canUpdateHeights(o.boundingVolume,o)&&canUpdateHeights(e.boundingVolume,o)?deriveBoundingVolume(e,t,n,defaultValue(i,!1),r):o.boundingVolume,updateHeights$1(a,o),a}function getContentBoundingVolume$1(e,t){let n;return defined(t)&&(n=t.boundingVolume),canUpdateHeights(n,t)?updateHeights$1(n,t):canUpdateHeights(e,t)&&(n=clone$1(e,!0),updateHeights$1(n,t)),n}function deriveBoundingVolume(e,t,n,i,r){const o=e.boundingVolume;if(hasExtension(o,"3DTILES_bounding_volume_S2"))return deriveBoundingVolumeS2(i,r,n,t.level,t.x,t.y,t.z);if(defined(o.region)){return{region:deriveBoundingRegion(o.region,t.level,t.x,t.y,t.z)}}return{box:deriveBoundingBox(o.box,t.level,t.x,t.y,t.z)}}function deriveBoundingVolumeS2(e,t,n,i,r,o,a){const s=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(s.s2Cell._cellId),minimumHeight:s.minimumHeight,maximumHeight:s.maximumHeight}}};var c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61));const l=c%2==0?HilbertOrder.encode2D(i,r,o):HilbertOrder.encode2D(i,o,r);var u=S2Cell.fromFacePositionLevel(c,BigInt(l),i);let d,h;if(defined(a)){const e=(s.maximumHeight+s.minimumHeight)/2;d=n<4?s.minimumHeight:e,h=n<4?e:s.maximumHeight}else d=s.minimumHeight,h=s.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:S2Cell.getTokenFromId(u._cellId),minimumHeight:d,maximumHeight:h}}}}Object.defineProperties(Implicit3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});const scratchScaleFactors=new Cartesian3,scratchRootCenter=new Cartesian3,scratchCenter$5=new Cartesian3,scratchHalfAxes$1=new Matrix3;function deriveBoundingBox(e,t,n,i,r){if(0===t)return e;const o=Cartesian3.unpack(e,0,scratchRootCenter),a=Matrix3.unpack(e,3,scratchHalfAxes$1),s=Math.pow(2,-t),c=(2*n+1)*s-1,l=(2*i+1)*s-1;let u=0;const d=Cartesian3.fromElements(s,s,1,scratchScaleFactors);defined(r)&&(u=(2*r+1)*s-1,d.z=s);let h=Cartesian3.fromElements(c,l,u,scratchCenter$5);h=Matrix3.multiplyByVector(a,h,scratchCenter$5),h=Cartesian3.add(h,o,scratchCenter$5);let p=Matrix3.clone(a);p=Matrix3.multiplyByScale(p,d,p);const f=new Array(12);return Cartesian3.pack(h,f),Matrix3.pack(p,f,3),f}const scratchRectangle$6=new Rectangle;function deriveBoundingRegion(e,t,n,i,r){if(0===t)return e.slice();const o=Rectangle.unpack(e,0,scratchRectangle$6),a=e[4],s=e[5],c=Math.pow(2,-t),l=c*o.width,u=CesiumMath.negativePiToPi(o.west+n*l),d=CesiumMath.negativePiToPi(u+l),h=c*o.height,p=CesiumMath.negativePiToPi(o.south+i*h),f=CesiumMath.negativePiToPi(p+h);let m=a,g=s;if(defined(r)){const e=c*(s-a);m+=r*e,g=m+e}return[u,p,d,f,m,g]}function makePlaceholderChildSubtree(e,t,n){const i=e._implicitTileset,r=t.implicitCoordinates.getChildCoordinates(n),o=deriveBoundingVolume(i,r,n,!1,t),a=getGeometricError$3(void 0,i,r),s=i.subtreeUriTemplate.getDerivedResource({templateValues:r.getTemplateValues()}).url,c={boundingVolume:o,geometricError:a,refine:i.refine,content:{uri:s}},l=makeTile$1(e,i.baseResource,c,t);return l.implicitTileset=i,l.implicitCoordinates=r,l}function makeTile$1(e,t,n,i){return new(0,e._tile.constructor)(e._tileset,t,n,i)}Implicit3DTileContent.prototype.hasProperty=function(e,t){return!1},Implicit3DTileContent.prototype.getFeature=function(e){},Implicit3DTileContent.prototype.applyDebugSettings=function(e,t){},Implicit3DTileContent.prototype.applyStyle=function(e){},Implicit3DTileContent.prototype.update=function(e,t){},Implicit3DTileContent.prototype.isDestroyed=function(){return!1},Implicit3DTileContent.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),destroyObject(this)},Implicit3DTileContent._deriveBoundingBox=deriveBoundingBox,Implicit3DTileContent._deriveBoundingRegion=deriveBoundingRegion,Implicit3DTileContent._deriveBoundingVolumeS2=deriveBoundingVolumeS2;const I3dmParser={};I3dmParser._deprecationWarning=deprecationWarning;const sizeOfUint32$2=Uint32Array.BYTES_PER_ELEMENT;function ModelInstance(e,t,n){this.primitive=e,this._modelMatrix=Matrix4.clone(t),this._instanceId=n}I3dmParser.parse=function(e,t){const n=defaultValue(t,0);t=n;const i=new Uint8Array(e),r=new DataView(e);t+=sizeOfUint32$2;const o=r.getUint32(t,!0);if(1!==o)throw new RuntimeError("Only Instanced 3D Model version 1 is supported. Version "+o+" is not.");t+=sizeOfUint32$2;const a=r.getUint32(t,!0);t+=sizeOfUint32$2;const s=r.getUint32(t,!0);if(0===s)throw new RuntimeError("featureTableJsonByteLength is zero, the feature table must be defined.");t+=sizeOfUint32$2;const c=r.getUint32(t,!0);t+=sizeOfUint32$2;const l=r.getUint32(t,!0);t+=sizeOfUint32$2;const u=r.getUint32(t,!0);t+=sizeOfUint32$2;const d=r.getUint32(t,!0);if(1!==d&&0!==d)throw new RuntimeError("Only glTF format 0 (uri) or 1 (embedded) are supported. Format "+d+" is not.");const h=getJsonFromTypedArray(i,t+=sizeOfUint32$2,s);t+=s;const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=getJsonFromTypedArray(i,t,l),t+=l,u>0&&(m=new Uint8Array(e,t,u),m=new Uint8Array(m),t+=u));const g=n+a-t;if(0===g)throw new RuntimeError("glTF byte length must be greater than 0.");let _;return t%4==0?_=new Uint8Array(e,t,g):(I3dmParser._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),_=new Uint8Array(i.subarray(t,t+g))),{gltfFormat:d,featureTableJson:h,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:_}},Object.defineProperties(ModelInstance.prototype,{instanceId:{get:function(){return this._instanceId}},model:{get:function(){return this.primitive._model}},modelMatrix:{get:function(){return Matrix4.clone(this._modelMatrix)},set:function(e){Matrix4.clone(e,this._modelMatrix),this.primitive.expandBoundingSphere(this._modelMatrix),this.primitive._dirty=!0}}});const LoadState={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3};function ModelInstanceCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this._instancingSupported=!1,this._dynamic=defaultValue(e.dynamic,!1),this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this._state=LoadState.NEEDS_LOAD,this._dirty=!1,this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._instances=createInstances$1(this,e.instances),this._batchTable=e.batchTable,this._model=void 0,this._vertexBufferTypedArray=void 0,this._vertexBuffer=void 0,this._batchIdBuffer=void 0,this._instancedUniformsByProgram=void 0,this._drawCommands=[],this._modelCommands=void 0,this._renderStates=void 0,this._disableCullingRenderStates=void 0,this._boundingSphere=createBoundingSphere(this),this._center=Cartesian3.clone(this._boundingSphere.center),this._rtcTransform=new Matrix4,this._rtcModelView=new Matrix4,this._mode=void 0,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._url=Resource.createIfNeeded(e.url),this._requestType=e.requestType,this._gltf=e.gltf,this._basePath=Resource.createIfNeeded(e.basePath),this._asynchronous=e.asynchronous,this._incrementallyLoadTextures=e.incrementallyLoadTextures,this._upAxis=e.upAxis,this._forwardAxis=e.forwardAxis,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this._pickIdLoaded=e.pickIdLoaded,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=e.luminanceAtZenith,this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this._backFaceCulling=this.backFaceCulling}function createInstances$1(e,t){const n=(t=defaultValue(t,[])).length,i=new Array(n);for(let r=0;r<n;++r){const n=t[r],o=n.modelMatrix,a=defaultValue(n.batchId,r);i[r]=new ModelInstance(e,o,a)}return i}function createBoundingSphere(e){const t=e.length,n=new Array(t);for(let i=0;i<t;++i)n[i]=Matrix4.getTranslation(e._instances[i]._modelMatrix,new Cartesian3);return BoundingSphere.fromPoints(n)}Object.defineProperties(ModelInstanceCollection.prototype,{allowPicking:{get:function(){return this._allowPicking}},length:{get:function(){return this._instances.length}},activeAnimations:{get:function(){return this._model.activeAnimations}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}}});const scratchCartesian$7=new Cartesian3,scratchMatrix$3=new Matrix4;function getCheckUniformSemanticFunction(e,t,n,i){return function(r,o){const a=r.semantic;if(defined(a)&&e.indexOf(a)>-1){if(!(t.indexOf(a)>-1))throw new RuntimeError('Shader program cannot be optimized for instancing. Uniform "'+o+'" in program "'+n+'" uses unsupported semantic "'+a+'"');i[o]=a}}}function getInstancedUniforms(e,t){if(defined(e._instancedUniformsByProgram))return e._instancedUniformsByProgram[t];const n={};e._instancedUniformsByProgram=n;const i=["MODEL","MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELINVERSE","MODELVIEWINVERSE","MODELVIEWPROJECTIONINVERSE","MODELINVERSETRANSPOSE","MODELVIEWINVERSETRANSPOSE"],r=["MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELVIEWINVERSETRANSPOSE"],o=e._model._sourceTechniques;for(const e in o)if(o.hasOwnProperty(e)){const a=o[e],s=a.program;if(!defined(n[s])){const e={};n[s]=e,ForEach.techniqueUniform(a,getCheckUniformSemanticFunction(i,r,t,e))}}return n[t]}function getVertexShaderCallback(e){return function(t,n){const i=getInstancedUniforms(e,n),r=defined(e._batchTable);let o=ShaderSource.replaceMain(t,"czm_instancing_main"),a="",s="";for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];let n;"MODELVIEW"===t||"CESIUM_RTC_MODELVIEW"===t?n="czm_instanced_modelView":"MODELVIEWPROJECTION"===t?(n="czm_instanced_modelViewProjection",a+="mat4 czm_instanced_modelViewProjection;\n",s+="czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;\n"):"MODELVIEWINVERSETRANSPOSE"===t&&(n="czm_instanced_modelViewInverseTranspose",a+="mat3 czm_instanced_modelViewInverseTranspose;\n",s+="czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);\n");let r=new RegExp("uniform.*"+e+".*");o=o.replace(r,""),r=new RegExp(e+"\\b","g"),o=o.replace(r,n)}let c,l,u;r?(c="attribute float a_batchId;\n",l="",u=""):(c="",l="attribute vec4 pickColor;\nvarying vec4 v_pickColor;\n",u=" v_pickColor = pickColor;\n");let d="uniform mat4 czm_instanced_modifiedModelView;\nuniform mat4 czm_instanced_nodeTransform;\n"+a+"mat4 czm_instanced_modelView;\nattribute vec4 czm_modelMatrixRow0;\nattribute vec4 czm_modelMatrixRow1;\nattribute vec4 czm_modelMatrixRow2;\n"+c+l+o+"void main()\n{\n mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);\n czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;\n"+s+" czm_instancing_main();\n"+u+"}\n";if(r){const t=e._model.gltf,i=ModelUtility.getDiffuseAttributeOrUniform(t,n);d=e._batchTable.getVertexShaderCallback(!0,"a_batchId",i)(d)}return d}}function getFragmentShaderCallback(e){return function(t,n){const i=e._batchTable;if(defined(i)){const r=e._model.gltf,o=ModelUtility.getDiffuseAttributeOrUniform(r,n);t=i.getFragmentShaderCallback(!0,o,!1)(t)}else t="varying vec4 v_pickColor;\n"+t;return t}}function createModifiedModelView(e,t){return function(){return Matrix4.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function createNodeTransformFunction(e){return function(){return e.computedMatrix}}function getUniformMapCallback(e,t){return function(n,i,r){(n=clone$1(n)).czm_instanced_modifiedModelView=createModifiedModelView(e,t),n.czm_instanced_nodeTransform=createNodeTransformFunction(r);const o=getInstancedUniforms(e,i);for(const e in o)o.hasOwnProperty(e)&&delete n[e];return defined(e._batchTable)&&(n=e._batchTable.getUniformMapCallback()(n)),n}}function getVertexShaderNonInstancedCallback(e){return function(t,n){if(defined(e._batchTable)){const i=e._model.gltf,r=ModelUtility.getDiffuseAttributeOrUniform(i,n);t="uniform float a_batchId\n;"+(t=e._batchTable.getVertexShaderCallback(!0,"a_batchId",r)(t))}return t}}function getFragmentShaderNonInstancedCallback(e){return function(t,n){const i=e._batchTable;if(defined(i)){const r=e._model.gltf,o=ModelUtility.getDiffuseAttributeOrUniform(r,n);t=i.getFragmentShaderCallback(!0,o,!1)(t)}else t="uniform vec4 czm_pickColor;\n"+t;return t}}function getUniformMapNonInstancedCallback(e){return function(t){return defined(e._batchTable)&&(t=e._batchTable.getUniformMapCallback()(t)),t}}function getVertexBufferTypedArray(e){const t=e._instances,n=e.length,i=e._center;let r=e._vertexBufferTypedArray;defined(r)||(r=new Float32Array(12*n)),e._dynamic&&(e._vertexBufferTypedArray=r);for(let e=0;e<n;++e){const n=t[e]._modelMatrix,o=Matrix4.clone(n,scratchMatrix$3);o[12]-=i.x,o[13]-=i.y,o[14]-=i.z;const a=12*e;r[a+0]=o[0],r[a+1]=o[4],r[a+2]=o[8],r[a+3]=o[12],r[a+4]=o[1],r[a+5]=o[5],r[a+6]=o[9],r[a+7]=o[13],r[a+8]=o[2],r[a+9]=o[6],r[a+10]=o[10],r[a+11]=o[14]}return r}function createVertexBuffer(e,t){let n;const i=e._instances,r=e.length,o=e._dynamic,a=defined(e._batchTable);if(a){const o=new Uint16Array(r);for(n=0;n<r;++n)o[n]=i[n]._instanceId;e._batchIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW})}if(!a){const i=new Uint8Array(4*r);for(n=0;n<r;++n){const t=e._pickIds[n].color,r=4*n;i[r]=Color.floatToByte(t.red),i[r+1]=Color.floatToByte(t.green),i[r+2]=Color.floatToByte(t.blue),i[r+3]=Color.floatToByte(t.alpha)}e._pickIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW})}const s=getVertexBufferTypedArray(e);e._vertexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:o?BufferUsage$1.STREAM_DRAW:BufferUsage$1.STATIC_DRAW})}function updateVertexBuffer(e){const t=getVertexBufferTypedArray(e);e._vertexBuffer.copyFromArrayView(t)}function createPickIds(e,t){const n=e._instances,i=n.length,r=new Array(i);for(let e=0;e<i;++e)r[e]=t.createPickId(n[e]);return r}function createModel$1(e,t){const n=e._instancingSupported,i=defined(e._batchTable),r=e._allowPicking,o={url:e._url,requestType:e._requestType,gltf:e._gltf,basePath:e._basePath,shadows:e._shadows,cacheKey:void 0,asynchronous:e._asynchronous,allowPicking:r,incrementallyLoadTextures:e._incrementallyLoadTextures,upAxis:e._upAxis,forwardAxis:e._forwardAxis,precreatedAttributes:void 0,vertexShaderLoaded:void 0,fragmentShaderLoaded:void 0,uniformMapLoaded:void 0,pickIdLoaded:e._pickIdLoaded,ignoreCommands:!0,opaquePass:e._opaquePass,imageBasedLightingFactor:e.imageBasedLightingFactor,lightColor:e.lightColor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps,showOutline:e.showOutline};if(i||(e._pickIds=createPickIds(e,t)),n){createVertexBuffer(e,t);const n=12,r=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),a={czm_modelMatrixRow0:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:r*n,instanceDivisor:1},czm_modelMatrixRow1:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*r,strideInBytes:r*n,instanceDivisor:1},czm_modelMatrixRow2:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*r,strideInBytes:r*n,instanceDivisor:1}};i&&(a.a_batchId={index:0,vertexBuffer:e._batchIdBuffer,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),i||(a.pickColor={index:0,vertexBuffer:e._pickIdBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),o.precreatedAttributes=a,o.vertexShaderLoaded=getVertexShaderCallback(e),o.fragmentShaderLoaded=getFragmentShaderCallback(e),o.uniformMapLoaded=getUniformMapCallback(e,t),defined(e._url)&&(o.cacheKey=e._url.getUrlComponent()+"#instanced")}else o.vertexShaderLoaded=getVertexShaderNonInstancedCallback(e),o.fragmentShaderLoaded=getFragmentShaderNonInstancedCallback(e),o.uniformMapLoaded=getUniformMapNonInstancedCallback(e);defined(e._url)?e._model=Model.fromGltf(o):e._model=new Model(o)}function updateWireframe(e,t){if(e._debugWireframe!==e.debugWireframe||t){e._debugWireframe=e.debugWireframe;const t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,n=e._drawCommands,i=n.length;for(let e=0;e<i;++e)n[e].primitiveType=t}}function getDisableCullingRenderState(e){const t=clone$1(e,!0);return t.cull.enabled=!1,RenderState.fromCache(t)}function updateBackFaceCulling(e,t){if(e._backFaceCulling!==e.backFaceCulling||t){e._backFaceCulling=e.backFaceCulling;const t=e._drawCommands,n=t.length;let i;if(!defined(e._disableCullingRenderStates))for(e._disableCullingRenderStates=new Array(n),e._renderStates=new Array(n),i=0;i<n;++i){const n=t[i].renderState,r=getDisableCullingRenderState(n);e._disableCullingRenderStates[i]=r,e._renderStates[i]=n}for(i=0;i<n;++i)t[i].renderState=e._backFaceCulling?e._renderStates[i]:e._disableCullingRenderStates[i]}}function updateShowBoundingVolume$1(e,t){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume||t){e._debugShowBoundingVolume=e.debugShowBoundingVolume;const t=e._drawCommands,n=t.length;for(let i=0;i<n;++i)t[i].debugShowBoundingVolume=e.debugShowBoundingVolume}}function createCommands$2(e,t){const n=t.length,i=e.length,r=e._boundingSphere,o=e._cull;for(let a=0;a<n;++a){const n=DrawCommand.shallowClone(t[a]);n.instanceCount=i,n.boundingVolume=r,n.cull=o,defined(e._batchTable)?n.pickId=e._batchTable.getPickId():n.pickId="v_pickColor",e._drawCommands.push(n)}}function createBatchIdFunction(e){return function(){return e}}function createPickColorFunction(e){return function(){return e}}function createCommandsNonInstanced(e,t){const n=e._instances,i=t.length,r=e.length,o=defined(e._batchTable),a=e._cull;for(let s=0;s<i;++s)for(let i=0;i<r;++i){const r=DrawCommand.shallowClone(t[s]);if(r.modelMatrix=new Matrix4,r.boundingVolume=new BoundingSphere,r.cull=a,r.uniformMap=clone$1(r.uniformMap),o)r.uniformMap.a_batchId=createBatchIdFunction(n[i]._instanceId);else{const t=e._pickIds[i];r.uniformMap.czm_pickColor=createPickColorFunction(t.color)}e._drawCommands.push(r)}}function updateCommandsNonInstanced(e){const t=e._modelCommands,n=t.length,i=e.length,r=e._rtcTransform,o=e._center;for(let a=0;a<n;++a){const n=t[a];for(let t=0;t<i;++t){const s=a*i+t,c=e._drawCommands[s];let l=Matrix4.clone(e._instances[t]._modelMatrix,scratchMatrix$3);l[12]-=o.x,l[13]-=o.y,l[14]-=o.z,l=Matrix4.multiply(r,l,scratchMatrix$3);const u=n.modelMatrix,d=c.modelMatrix;Matrix4.multiply(l,u,d);const h=n.boundingVolume,p=c.boundingVolume;BoundingSphere.transform(h,l,p)}}}function getModelCommands(e){const t=e._nodeCommands,n=t.length,i=[];for(let e=0;e<n;++e){const n=t[e];n.show&&i.push(n.command)}return i}function commandsDirty(e){const t=e._nodeCommands,n=t.length;let i=!1;for(let e=0;e<n;e++){const n=t[e];n.command.dirty&&(n.command.dirty=!1,i=!0)}return i}function generateModelCommands(e,t){e._drawCommands=[];const n=getModelCommands(e._model);t?createCommands$2(e,n):(createCommandsNonInstanced(e,n),updateCommandsNonInstanced(e))}function updateShadows(e,t){if(e.shadows!==e._shadows||t){e._shadows=e.shadows;const t=ShadowMode$1.castShadows(e.shadows),n=ShadowMode$1.receiveShadows(e.shadows),i=e._drawCommands,r=i.length;for(let e=0;e<r;++e){const r=i[e];r.castShadows=t,r.receiveShadows=n}}}function Instanced3DModel3DTileContent(e,t,n,i,r){this._tileset=e,this._tile=t,this._resource=n,this._modelInstanceCollection=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$6(this,i,r)}function getPickIdCallback(e){return function(){return e._batchTable.getPickId()}}ModelInstanceCollection.prototype.expandBoundingSphere=function(e){const t=Matrix4.getTranslation(e,scratchCartesian$7);BoundingSphere.expand(this._boundingSphere,t,this._boundingSphere)},ModelInstanceCollection.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!this.show)return;if(0===this.length)return;const t=e.context;if(this._state===LoadState.NEEDS_LOAD){this._state=LoadState.LOADING,this._instancingSupported=t.instancedArrays,createModel$1(this,t);const e=this;this._model.readyPromise.otherwise((function(t){e._state=LoadState.FAILED,e._readyPromise.reject(t)}))}const n=this._instancingSupported,i=this._model;if(i.imageBasedLightingFactor=this.imageBasedLightingFactor,i.lightColor=this.lightColor,i.luminanceAtZenith=this.luminanceAtZenith,i.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,i.specularEnvironmentMaps=this.specularEnvironmentMaps,i.update(e),i.ready&&this._state===LoadState.LOADING){this._state=LoadState.LOADED,this._ready=!0;const e=i.boundingSphere.radius+Cartesian3.magnitude(i.boundingSphere.center);return this._boundingSphere.radius+=e,this._modelCommands=getModelCommands(i),generateModelCommands(this,n),void this._readyPromise.resolve(this)}if(this._state!==LoadState.LOADED)return;const r=e.mode!==this._mode,o=this.modelMatrix,a=!Matrix4.equals(this._modelMatrix,o);if(r||a){this._mode=e.mode,Matrix4.clone(o,this._modelMatrix);let t=Matrix4.multiplyByTranslation(this._modelMatrix,this._center,this._rtcTransform);this._mode!==SceneMode$1.SCENE3D&&(t=Transforms.basisTo2D(e.mapProjection,t,t)),Matrix4.getTranslation(t,this._boundingSphere.center)}n&&this._dirty&&(this._dynamic=!0,this._dirty=!1,updateVertexBuffer(this));const s=commandsDirty(i);s&&generateModelCommands(this,n),!n&&(i.dirty||this._dirty||r||a)&&updateCommandsNonInstanced(this),updateShadows(this,s),updateWireframe(this,s),updateBackFaceCulling(this,s),updateShowBoundingVolume$1(this,s);const c=e.passes;if(!c.render&&!c.pick)return;const l=e.commandList,u=this._drawCommands,d=u.length;for(let e=0;e<d;++e)l.push(u[e])},ModelInstanceCollection.prototype.isDestroyed=function(){return!1},ModelInstanceCollection.prototype.destroy=function(){this._model=this._model&&this._model.destroy();const e=this._pickIds;if(defined(e)){const t=e.length;for(let n=0;n<t;++n)e[n].destroy()}return destroyObject(this)},Instanced3DModel3DTileContent._deprecationWarning=deprecationWarning,Object.defineProperties(Instanced3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this._batchTable.featuresLength}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.trianglesLength:0}},geometryByteLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.geometryByteLength:0}},texturesByteLength:{get:function(){const e=this._modelInstanceCollection._model;return defined(e)?e.texturesByteLength:0}},batchTableByteLength:{get:function(){return this._batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._modelInstanceCollection.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});const propertyScratch1$1=new Array(4),propertyScratch2$1=new Array(4);function initialize$6(e,t,n){const i=I3dmParser.parse(t,n),r=i.gltfFormat,o=i.gltf,a=i.featureTableJson,s=i.featureTableBinary,c=i.batchTableJson,l=i.batchTableBinary,u=new Cesium3DTileFeatureTable(a,s),d=u.getGlobalProperty("INSTANCES_LENGTH");if(u.featuresLength=d,!defined(d))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");e._batchTable=new Cesium3DTileBatchTable(e,d,c,l);const h=e._tileset,p={instances:new Array(d),batchTable:e._batchTable,cull:!1,url:void 0,requestType:RequestType$1.TILES3D,gltf:void 0,basePath:void 0,incrementallyLoadTextures:!1,upAxis:h._gltfUpAxis,forwardAxis:Axis$1.X,opaquePass:Pass$1.CESIUM_3D_TILE,pickIdLoaded:getPickIdCallback(e),imageBasedLightingFactor:h.imageBasedLightingFactor,lightColor:h.lightColor,luminanceAtZenith:h.luminanceAtZenith,sphericalHarmonicCoefficients:h.sphericalHarmonicCoefficients,specularEnvironmentMaps:h.specularEnvironmentMaps,backFaceCulling:h.backFaceCulling,showOutline:h.showOutline};if(0===r){let t=getStringFromTypedArray(o);t=t.replace(/[\s\0]+$/,""),p.url=e._resource.getDerivedResource({url:t})}else p.gltf=o,p.basePath=e._resource.clone();const f=u.getGlobalProperty("EAST_NORTH_UP");let m;const g=u.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(g)&&(m=Cartesian3.unpack(g));const _=p.instances,y=new Cartesian3,C=new Array(3),T=new Cartesian3,S=new Cartesian3,A=new Cartesian3,v=new Matrix3,E=new Quaternion;let b=new Cartesian3;const x=new TranslationRotationScale,P=new Matrix4;for(let e=0;e<d;e++){let t=u.getProperty("POSITION",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1);if(!defined(t)){t=C;const n=u.getProperty("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3,e,propertyScratch1$1);if(!defined(n))throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.");const i=u.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(i))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const r=u.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(r))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(let e=0;e<3;e++)t[e]=n[e]/65535*r[e]+i[e]}Cartesian3.unpack(t,0,y),defined(m)&&Cartesian3.add(y,m,y),x.translation=y;const n=u.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1),i=u.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,e,propertyScratch2$1);let r=!1;if(defined(n)){if(!defined(i))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(n,0,S),Cartesian3.unpack(i,0,T),r=!0}else{const t=u.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,e,propertyScratch1$1),n=u.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,e,propertyScratch2$1);if(defined(t)){if(!defined(n))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(t[0],t[1],65535,S),AttributeCompression.octDecodeInRange(n[0],n[1],65535,T),r=!0}else f?(Transforms.eastNorthUpToFixedFrame(y,Ellipsoid.WGS84,P),Matrix4.getMatrix3(P,v)):Matrix3.clone(Matrix3.IDENTITY,v)}r&&(Cartesian3.cross(T,S,A),Cartesian3.normalize(A,A),Matrix3.setColumn(v,0,T,v),Matrix3.setColumn(v,1,S,v),Matrix3.setColumn(v,2,A,v)),Quaternion.fromRotationMatrix(v,E),x.rotation=E,b=Cartesian3.fromElements(1,1,1,b);const o=u.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,e);defined(o)&&Cartesian3.multiplyByScalar(b,o,b);const a=u.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,e,propertyScratch1$1);defined(a)&&(b.x*=a[0],b.y*=a[1],b.z*=a[2]),x.scale=b;let s=u.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,e);defined(s)||(s=e),Matrix4.fromTranslationRotationScale(x,P);const c=P.clone();_[e]={modelMatrix:c,batchId:s}}e._modelInstanceCollection=new ModelInstanceCollection(p),e._modelInstanceCollection.readyPromise.then((function(e){e.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT})}))}function createFeatures$2(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const n=new Array(t);for(let i=0;i<t;++i)n[i]=new Cesium3DTileFeature(e,i);e._features=n}}Instanced3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Instanced3DModel3DTileContent.prototype.getFeature=function(e){return this.featuresLength,createFeatures$2(this),this._features[e]},Instanced3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._batchTable.setAllColor(t)},Instanced3DModel3DTileContent.prototype.applyStyle=function(e){this._batchTable.applyStyle(e)},Instanced3DModel3DTileContent.prototype.update=function(e,t){const n=t.commandList.length;this._batchTable.update(e,t),this._modelInstanceCollection.modelMatrix=this._tile.computedTransform,this._modelInstanceCollection.shadows=this._tileset.shadows,this._modelInstanceCollection.lightColor=this._tileset.lightColor,this._modelInstanceCollection.luminanceAtZenith=this._tileset.luminanceAtZenith,this._modelInstanceCollection.imageBasedLightingFactor=this._tileset.imageBasedLightingFactor,this._modelInstanceCollection.sphericalHarmonicCoefficients=this._tileset.sphericalHarmonicCoefficients,this._modelInstanceCollection.specularEnvironmentMaps=this._tileset.specularEnvironmentMaps,this._modelInstanceCollection.backFaceCulling=this._tileset.backFaceCulling,this._modelInstanceCollection.debugWireframe=this._tileset.debugWireframe;const i=this._modelInstanceCollection._model;if(defined(i)){const e=this._tileset.clippingPlanes;i.referenceMatrix=this._tileset.clippingPlanesOriginMatrix,defined(e)&&this._tile.clippingPlanesDirty&&(i._clippingPlanes=e.enabled&&this._tile._isClipped?e:void 0),defined(e)&&defined(i._clippingPlanes)&&i._clippingPlanes!==e&&(i._clippingPlanes=e)}this._modelInstanceCollection.update(t);n<t.commandList.length&&(t.passes.render||t.passes.pick)&&this._batchTable.addDerivedCommands(t,n,!1)},Instanced3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Instanced3DModel3DTileContent.prototype.destroy=function(){return this._modelInstanceCollection=this._modelInstanceCollection&&this._modelInstanceCollection.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};const Cesium3DTileRefine={ADD:0,REPLACE:1};var Cesium3DTileRefine$1=Object.freeze(Cesium3DTileRefine);const VertexAttributeSemantic={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"FEATURE_ID"};function semanticToVariableName(e){switch(e){case VertexAttributeSemantic.POSITION:return"positionMC";case VertexAttributeSemantic.NORMAL:return"normalMC";case VertexAttributeSemantic.TANGENT:return"tangentMC";case VertexAttributeSemantic.TEXCOORD:return"texCoord";case VertexAttributeSemantic.COLOR:return"color";case VertexAttributeSemantic.JOINTS:return"joints";case VertexAttributeSemantic.WEIGHTS:return"weights";case VertexAttributeSemantic.FEATURE_ID:return"featureId"}}VertexAttributeSemantic.hasSetIndex=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return!1;case VertexAttributeSemantic.TEXCOORD:case VertexAttributeSemantic.COLOR:case VertexAttributeSemantic.JOINTS:case VertexAttributeSemantic.WEIGHTS:case VertexAttributeSemantic.FEATURE_ID:return!0}},VertexAttributeSemantic.fromGltfSemantic=function(e){let t=e;const n=/^(\w+)_\d+$/.exec(e);switch(null!==n&&(t=n[1]),t){case"POSITION":return VertexAttributeSemantic.POSITION;case"NORMAL":return VertexAttributeSemantic.NORMAL;case"TANGENT":return VertexAttributeSemantic.TANGENT;case"TEXCOORD":return VertexAttributeSemantic.TEXCOORD;case"COLOR":return VertexAttributeSemantic.COLOR;case"JOINTS":return VertexAttributeSemantic.JOINTS;case"WEIGHTS":return VertexAttributeSemantic.WEIGHTS;case"_FEATURE_ID":case"FEATURE_ID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.fromPntsSemantic=function(e){switch(e){case"POSITION":case"POSITION_QUANTIZED":return VertexAttributeSemantic.POSITION;case"RGBA":case"RGB":case"RGB565":return VertexAttributeSemantic.COLOR;case"NORMAL":case"NORMAL_OCT16P":return VertexAttributeSemantic.NORMAL;case"BATCH_ID":return VertexAttributeSemantic.FEATURE_ID}},VertexAttributeSemantic.getGlslType=function(e){switch(e){case VertexAttributeSemantic.POSITION:case VertexAttributeSemantic.NORMAL:case VertexAttributeSemantic.TANGENT:return"vec3";case VertexAttributeSemantic.TEXCOORD:return"vec2";case VertexAttributeSemantic.COLOR:return"vec4";case VertexAttributeSemantic.JOINTS:return"ivec4";case VertexAttributeSemantic.WEIGHTS:return"vec4";case VertexAttributeSemantic.FEATURE_ID:return"int"}},VertexAttributeSemantic.getVariableName=function(e,t){let n=semanticToVariableName(e);return defined(t)&&(n+="_"+t),n};var VertexAttributeSemantic$1=Object.freeze(VertexAttributeSemantic);const PntsParser={},sizeOfUint32$1=Uint32Array.BYTES_PER_ELEMENT;function parseDracoProperties(e,t){const n=e.json;let i,r,o;const a=defined(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,s=defined(t)&&defined(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;let c,l,u,d,h,p;if(defined(s)&&(o=s.properties),defined(a)){r=a.properties;const t=a.byteOffset,n=a.byteLength;if(!defined(r)||!defined(t)||!defined(n))throw new RuntimeError("Draco properties, byteOffset, and byteLength must be defined");i=arraySlice(e.buffer,t,t+n),c=defined(r.POSITION),l=defined(r.RGB)||defined(r.RGBA),u=defined(r.NORMAL),d=defined(r.BATCH_ID),h=defined(r.RGBA)}return defined(i)&&(p={buffer:i,featureTableProperties:r,batchTableProperties:o,properties:combine$2(r,o),dequantizeInShader:!0}),{draco:p,hasPositions:c,hasColors:l,isTranslucent:h,hasNormals:u,hasBatchIds:d}}function parsePositions(e){const t=e.json;let n;if(defined(t.POSITION))return n=e.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3),{name:VertexAttributeSemantic$1.POSITION,semantic:VertexAttributeSemantic$1.POSITION,typedArray:n,isQuantized:!1,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3};if(defined(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3);const t=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(t))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const i=65535,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(r))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:VertexAttributeSemantic$1.POSITION,semantic:VertexAttributeSemantic$1.POSITION,typedArray:n,isQuantized:!0,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,quantizedRange:i,quantizedVolumeOffset:Cartesian3.unpack(r),quantizedVolumeScale:Cartesian3.unpack(t),quantizedComponentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,quantizedType:AttributeType$1.VEC3}}}function parseColors(e){const t=e.json;let n;if(defined(t.RGBA))return n=e.getPropertyArray("RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),{name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:n,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(defined(t.RGB))return n=e.getPropertyArray("RGB",ComponentDatatype$1.UNSIGNED_BYTE,3),{name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:n,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(defined(t.RGB565))return n=e.getPropertyArray("RGB565",ComponentDatatype$1.UNSIGNED_SHORT,1),{name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:n,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(defined(t.CONSTANT_RGBA)){const t=e.getGlobalProperty("CONSTANT_RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),n=t[3],i=Color.fromBytes(t[0],t[1],t[2],n),r=n<255;return{name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,constantColor:i,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC4,isQuantized:!1,isTranslucent:r}}}function parseNormals(e){const t=e.json;let n;if(defined(t.NORMAL))return n=e.getPropertyArray("NORMAL",ComponentDatatype$1.FLOAT,3),{name:VertexAttributeSemantic$1.NORMAL,semantic:VertexAttributeSemantic$1.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3};if(defined(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",ComponentDatatype$1.UNSIGNED_BYTE,2);const t=8;return{name:VertexAttributeSemantic$1.NORMAL,semantic:VertexAttributeSemantic$1.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<t)-1,quantizedType:AttributeType$1.VEC2,quantizedComponentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3}}}function parseBatchIds(e){if(defined(e.json.BATCH_ID)){const t=e.getPropertyArray("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1);return{name:VertexAttributeSemantic$1.FEATURE_ID,semantic:VertexAttributeSemantic$1.FEATURE_ID,setIndex:0,typedArray:t,componentDatatype:ComponentDatatype$1.fromTypedArray(t),type:AttributeType$1.SCALAR}}}PntsParser.parse=function(e,t){t=defaultValue(t,0);const n=new Uint8Array(e),i=new DataView(e);t+=sizeOfUint32$1;const r=i.getUint32(t,!0);if(1!==r)throw new RuntimeError("Only Point Cloud tile version 1 is supported. Version "+r+" is not.");t+=sizeOfUint32$1,t+=sizeOfUint32$1;const o=i.getUint32(t,!0);if(0===o)throw new RuntimeError("Feature table must have a byte length greater than zero");t+=sizeOfUint32$1;const a=i.getUint32(t,!0);t+=sizeOfUint32$1;const s=i.getUint32(t,!0);t+=sizeOfUint32$1;const c=i.getUint32(t,!0),l=getJsonFromTypedArray(n,t+=sizeOfUint32$1,o);t+=o;const u=new Uint8Array(e,t,a);let d,h;t+=a,s>0&&(d=getJsonFromTypedArray(n,t,s),t+=s,c>0&&(h=new Uint8Array(e,t,c),t+=c));const p=new Cesium3DTileFeatureTable(l,u),f=p.getGlobalProperty("POINTS_LENGTH");if(p.featuresLength=f,!defined(f))throw new RuntimeError("Feature table global property: POINTS_LENGTH must be defined");let m=p.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(m)&&(m=Cartesian3.unpack(m));const g=parseDracoProperties(p,d);if(g.rtcCenter=m,g.pointsLength=f,!g.hasPositions){const e=parsePositions(p);g.positions=e,g.hasPositions=g.hasPositions||defined(e)}if(!g.hasPositions)throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined.");if(!g.hasNormals){const e=parseNormals(p);g.normals=e,g.hasNormals=g.hasNormals||defined(e)}if(!g.hasColors){const e=parseColors(p);g.colors=e,g.hasColors=g.hasColors||defined(e),g.hasConstantColor=defined(g.constantColor),g.isTranslucent=defined(e)&&e.isTranslucent}if(!g.hasBatchIds){const e=parseBatchIds(p);g.batchIds=e,g.hasBatchIds=g.hasBatchIds||defined(e)}if(g.hasBatchIds){const e=p.getGlobalProperty("BATCH_LENGTH");if(!defined(e))throw new RuntimeError("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");g.batchLength=e}return defined(h)&&(h=new Uint8Array(h),g.batchTableJson=d,g.batchTableBinary=h),g};const DecodingState={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function PointCloud(e){this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Color.clone(Color.DARKGRAY),this._highlightColor=Color.clone(Color.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=DecodingState.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._readyPromise=when.defer(),this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._cull=defaultValue(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.time=0,this.shadows=ShadowMode$1.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,initialize$5(this,e)}function initialize$5(e,t){const n=PntsParser.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&defined(n.batchTableBinary)&&(n.styleableProperties=Cesium3DTileBatchTable.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),defined(n.draco)){const t=n.draco;e._decodingState=DecodingState.NEEDS_DECODE,t.dequantizeInShader=e._dequantizeInShader}const i=n.positions;defined(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const r=n.normals;defined(r)&&(e._isOctEncoded16P=r.octEncoded);const o=n.colors;defined(o)&&(defined(o.constantColor)&&(e._constantColor=Color.clone(o.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=o.isRGB565);const a=n.batchIds;defined(n.batchIds)&&(a.name="BATCH_ID",a.semantic="BATCH_ID",a.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength}Object.defineProperties(PointCloud.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},color:{get:function(){return Color.clone(this._highlightColor)},set:function(e){this._highlightColor=Color.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(defined(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=BoundingSphere.clone(e,this._boundingSphere)}}});const scratchMin$2=new Cartesian3,scratchMax$2=new Cartesian3,scratchPosition$6=new Cartesian3;let randomNumberGenerator$1,randomValues$1;function getRandomValues$1(e){if(!defined(randomValues$1)){randomNumberGenerator$1=new mersenneTwister(0),randomValues$1=new Array(e);for(let t=0;t<e;++t)randomValues$1[t]=randomNumberGenerator$1.random()}return randomValues$1}function computeApproximateBoundingSphereFromPositions(e){const t=e.length/3,n=Math.min(t,20),i=getRandomValues$1(20),r=Number.MAX_VALUE,o=-Number.MAX_VALUE,a=Cartesian3.fromElements(r,r,r,scratchMin$2),s=Cartesian3.fromElements(o,o,o,scratchMax$2);for(let r=0;r<n;++r){const n=Math.floor(i[r]*t),o=Cartesian3.unpack(e,3*n,scratchPosition$6);Cartesian3.minimumByComponent(a,o,a),Cartesian3.maximumByComponent(s,o,s)}const c=BoundingSphere.fromCornerPoints(a,s);return c.radius+=CesiumMath.EPSILON2,c}function prepareVertexAttribute(e,t){const n=ComponentDatatype$1.fromTypedArray(e);return n===ComponentDatatype$1.INT||n===ComponentDatatype$1.UNSIGNED_INT||n===ComponentDatatype$1.DOUBLE?(oneTimeWarning("Cast pnts property to floats",'Point cloud property "'+t+'" will be casted to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.'),new Float32Array(e)):e}const scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier=new Cartesian4,scratchQuantizedVolumeScaleAndOctEncodedRange=new Cartesian4,scratchColor$j=new Color,positionLocation=0,colorLocation=1,normalLocation=2,batchIdLocation=3,numberOfAttributes=4,scratchClippingPlanesMatrix$1=new Matrix4,scratchInverseTransposeClippingPlanesMatrix$1=new Matrix4;function createResources$3(e,t){const n=t.context,i=e._parsedContent,r=e._pointsLength,o=i.positions,a=i.colors,s=i.normals;let c=i.batchIds;const l=i.styleableProperties,u=defined(l),d=e._isQuantized,h=e._isQuantizedDraco,p=e._isOctEncoded16P,f=e._isOctEncodedDraco,m=e._quantizedRange,g=e._octEncodedRange,_=e._isRGB565,y=e._isTranslucent,C=e._hasColors,T=e._hasNormals,S=e._hasBatchIds;let A,v;const E=[],b={};if(e._styleableShaderAttributes=b,u){let t=numberOfAttributes;for(const i in l)if(l.hasOwnProperty(i)){const r=l[i],o=prepareVertexAttribute(r.typedArray,i);A=r.componentCount,v=ComponentDatatype$1.fromTypedArray(o);const a=Buffer$1.createVertexBuffer({context:n,typedArray:o,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=a.sizeInBytes;const s={index:t,vertexBuffer:a,componentsPerAttribute:A,componentDatatype:v,normalize:!1,offsetInBytes:0,strideInBytes:0};E.push(s),b[i]={location:t,componentCount:A},++t}}const x=Buffer$1.createVertexBuffer({context:n,typedArray:o.typedArray,usage:BufferUsage$1.STATIC_DRAW});let P,D,w;e._geometryByteLength+=x.sizeInBytes,C&&(P=Buffer$1.createVertexBuffer({context:n,typedArray:a.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=P.sizeInBytes),T&&(D=Buffer$1.createVertexBuffer({context:n,typedArray:s.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes),S&&(c=prepareVertexAttribute(c,"batchIds"),w=Buffer$1.createVertexBuffer({context:n,typedArray:c.typedArray,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=w.sizeInBytes);let M=[];if(v=d?ComponentDatatype$1.UNSIGNED_SHORT:h?m<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT:ComponentDatatype$1.FLOAT,M.push({index:positionLocation,vertexBuffer:x,componentsPerAttribute:3,componentDatatype:v,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(e._boundingSphere=d||h?BoundingSphere.fromCornerPoints(Cartesian3.ZERO,e._quantizedVolumeScale):computeApproximateBoundingSphereFromPositions(o.typedArray)),C)if(_)M.push({index:colorLocation,vertexBuffer:P,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const e=y?4:3;M.push({index:colorLocation,vertexBuffer:P,componentsPerAttribute:e,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}T&&(p?(A=2,v=ComponentDatatype$1.UNSIGNED_BYTE):f?(A=2,v=g<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT):(A=3,v=ComponentDatatype$1.FLOAT),M.push({index:normalLocation,vertexBuffer:D,componentsPerAttribute:A,componentDatatype:v,normalize:!1,offsetInBytes:0,strideInBytes:0})),S&&M.push({index:batchIdLocation,vertexBuffer:w,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),u&&(M=M.concat(E));const I=new VertexArray({context:n,attributes:M}),R={depthTest:{enabled:!0}},O={depthTest:{enabled:!0},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND};e._opaquePass===Pass$1.CESIUM_3D_TILE&&(R.stencilTest=StencilConstants$1.setCesium3DTileBit(),R.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,O.stencilTest=StencilConstants$1.setCesium3DTileBit(),O.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),e._opaqueRenderState=RenderState.fromCache(R),e._translucentRenderState=RenderState.fromCache(O),e._drawCommand=new DrawCommand({boundingVolume:new BoundingSphere,cull:e._cull,modelMatrix:new Matrix4,primitiveType:PrimitiveType$1.POINTS,vertexArray:I,count:r,shaderProgram:void 0,uniformMap:void 0,renderState:y?e._translucentRenderState:e._opaqueRenderState,pass:y?Pass$1.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function createUniformMap$4(e,t){const n=t.context,i=e._isQuantized,r=e._isQuantizedDraco,o=e._isOctEncodedDraco;let a={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const i=scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier;if(i.x=e._attenuation?e.maximumAttenuation:e._pointSize,i.x*=t.pixelRatio,i.y=e.time,e._attenuation){const r=t.camera.frustum;let o;o=t.mode===SceneMode$1.SCENE2D||r instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:n.drawingBufferHeight/t.camera.frustum.sseDenominator,i.z=e.geometricError*e.geometricErrorScale,i.w=o}return i},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const t=e.clippingPlanes;return e.isClipped?t.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const t=e.clippingPlanes;if(!defined(t))return Color.TRANSPARENT;const n=Color.clone(t.edgeColor,scratchColor$j);return n.alpha=t.edgeWidth,n},u_clippingPlanesMatrix:function(){const t=e.clippingPlanes;if(!defined(t))return Matrix4.IDENTITY;const i=defaultValue(e.clippingPlanesOriginMatrix,e._modelMatrix);Matrix4.multiply(n.uniformState.view3D,i,scratchClippingPlanesMatrix$1);const r=Matrix4.multiply(scratchClippingPlanesMatrix$1,t.modelMatrix,scratchClippingPlanesMatrix$1);return Matrix4.inverseTranspose(r,scratchInverseTransposeClippingPlanesMatrix$1)}};(i||r||o)&&(a=combine$2(a,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const t=scratchQuantizedVolumeScaleAndOctEncodedRange;if(defined(e._quantizedVolumeScale)){const n=Cartesian3.clone(e._quantizedVolumeScale,t);Cartesian3.divideByScalar(n,e._quantizedRange,t)}return t.w=e._octEncodedRange,t}})),defined(e._uniformMapLoaded)&&(a=e._uniformMapLoaded(a)),e._drawCommand.uniformMap=a}function getStyleablePropertyIds(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;null!==i;){const r=parseInt(i[1]);-1===t.indexOf(r)&&t.push(r),i=n.exec(e)}}function getBuiltinPropertyNames(e,t){e=e.slice(e.indexOf("\n"));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;null!==i;){const r=i[1];-1===t.indexOf(r)&&t.push(r),i=n.exec(e)}}function getVertexAttribute(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const n=e.getAttribute(i);if(n.index===t)return n}}const builtinVariableSubstitutionMap={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function createShaders$2(e,t,n){let i,r,o;const a=t.context,s=defined(n),c=e._isQuantized,l=e._isQuantizedDraco,u=e._isOctEncoded16P,d=e._isOctEncodedDraco,h=e._isRGB565,p=e._isTranslucent,f=e._hasColors,m=e._hasNormals,g=e._hasBatchIds,_=e._backFaceCulling,y=e._normalShading,C=e._drawCommand.vertexArray,T=e.clippingPlanes,S=e._attenuation;let A,v,E,b=p;const x=clone$1(builtinVariableSubstitutionMap),P={},D=e._styleableShaderAttributes;for(r in D)D.hasOwnProperty(r)&&(o=D[r],x[r]="czm_3dtiles_property_"+o.location,P[o.location]=o);if(s){const e={translucent:!1},t="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";A=n.getColorShaderFunction("getColorFromStyle"+t,x,e),v=n.getShowShaderFunction("getShowFromStyle"+t,x,e),E=n.getPointSizeShaderFunction("getPointSizeFromStyle"+t,x,e),defined(A)&&e.translucent&&(b=!0)}e._styleTranslucent=b;const w=defined(A),M=defined(v),I=defined(E),R=e.isClipped,O=[],B=[];w&&(getStyleablePropertyIds(A,O),getBuiltinPropertyNames(A,B)),M&&(getStyleablePropertyIds(v,O),getBuiltinPropertyNames(v,B)),I&&(getStyleablePropertyIds(E,O),getBuiltinPropertyNames(E,B));const L=B.indexOf("COLOR")>=0,F=B.indexOf("NORMAL")>=0;if(F&&!m)throw new RuntimeError("Style references the NORMAL semantic but the point cloud does not have normals");for(r in D)if(D.hasOwnProperty(r)){o=D[r];const e=O.indexOf(o.location)>=0;getVertexAttribute(C,o.location).enabled=e}const N=f&&(!w||L);if(f){getVertexAttribute(C,colorLocation).enabled=N}const V=m&&(y||_||F);if(m){getVertexAttribute(C,normalLocation).enabled=V}const k={a_position:positionLocation};N&&(k.a_color=colorLocation),V&&(k.a_normal=normalLocation),g&&(k.a_batchId=batchIdLocation);let U="";const G=O.length;for(i=0;i<G;++i){const e=O[i];o=P[e];const t=o.componentCount,n="czm_3dtiles_property_"+e;let r;r=1===t?"float":"vec"+t,U+="attribute "+r+" "+n+"; \n",k[n]=o.location}createUniformMap$4(e,t);let $="attribute vec3 a_position; \nvarying vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";$+="float u_pointSize; \nfloat u_time; \n",S&&($+="float u_geometricError; \nfloat u_depthMultiplier; \n"),$+=U,N&&($+=p?"attribute vec4 a_color; \n":h?"attribute float a_color; \nconst float SHIFT_RIGHT_11 = 1.0 / 2048.0; \nconst float SHIFT_RIGHT_5 = 1.0 / 32.0; \nconst float SHIFT_LEFT_11 = 2048.0; \nconst float SHIFT_LEFT_5 = 32.0; \nconst float NORMALIZE_6 = 1.0 / 64.0; \nconst float NORMALIZE_5 = 1.0 / 32.0; \n":"attribute vec3 a_color; \n"),V&&($+=u||d?"attribute vec2 a_normal; \n":"attribute vec3 a_normal; \n"),g&&($+="attribute float a_batchId; \n"),(c||l||d)&&($+="uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n"),w&&($+=A),M&&($+=v),I&&($+=E),$+="void main() \n{ \n u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n u_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n",S&&($+=" u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n"),$+=N?p?" vec4 color = a_color; \n":h?" float compressed = a_color; \n float r = floor(compressed * SHIFT_RIGHT_11); \n compressed -= r * SHIFT_LEFT_11; \n float g = floor(compressed * SHIFT_RIGHT_5); \n compressed -= g * SHIFT_LEFT_5; \n float b = compressed; \n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); \n vec4 color = vec4(rgb, 1.0); \n":" vec4 color = vec4(a_color, 1.0); \n":" vec4 color = u_constantColor; \n",$+=c||l?" vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n":" vec3 position = a_position; \n",$+=" vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n",V?($+=u?" vec3 normal = czm_octDecode(a_normal); \n":d?" vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n":" vec3 normal = a_normal; \n",$+=" vec3 normalEC = czm_normal * normal; \n"):$+=" vec3 normal = vec3(1.0); \n",w&&($+=" color = getColorFromStyle(position, position_absolute, color, normal); \n"),M&&($+=" float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n"),$+=I?" gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n":S?" vec4 positionEC = czm_modelView * vec4(position, 1.0); \n float depth = -positionEC.z; \n gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); \n":" gl_PointSize = u_pointSize; \n",$+=" color = color * u_highlightColor; \n",V&&y&&($+=" float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); \n diffuseStrength = max(diffuseStrength, 0.4); \n color.xyz *= diffuseStrength * czm_lightColor; \n"),$+=" v_color = color; \n gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n",V&&_&&($+=" float visible = step(-normalEC.z, 0.0); \n gl_Position *= visible; \n gl_PointSize *= visible; \n"),M&&($+=" gl_Position.w *= float(show); \n gl_PointSize *= float(show); \n"),$+="} \n";let z="varying vec4 v_color; \n";R&&(z+="uniform highp sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n",z+="\n",z+=getClippingFunction(T,a),z+="\n"),z+="void main() \n{ \n gl_FragColor = czm_gammaCorrect(v_color); \n",R&&(z+=getClipAndStyleCode("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),z+="} \n",defined(e._vertexShaderLoaded)&&($=e._vertexShaderLoaded($)),defined(e._fragmentShaderLoaded)&&(z=e._fragmentShaderLoaded(z));const H=e._drawCommand;defined(H.shaderProgram)&&H.shaderProgram.destroy(),H.shaderProgram=ShaderProgram.fromCache({context:a,vertexShaderSource:$,fragmentShaderSource:z,attributeLocations:k});try{H.shaderProgram._bind()}catch(e){throw new RuntimeError("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function decodeDraco$1(e,t){if(e._decodingState===DecodingState.READY)return!1;if(e._decodingState===DecodingState.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,r=DracoLoader.decodePointCloud(i,t);defined(r)&&(e._decodingState=DecodingState.DECODING,r.then((function(t){e._decodingState=DecodingState.READY;const r=defined(t.POSITION)?t.POSITION.array:void 0,o=defined(t.RGB)?t.RGB.array:void 0,a=defined(t.RGBA)?t.RGBA.array:void 0,s=defined(t.NORMAL)?t.NORMAL.array:void 0,c=defined(t.BATCH_ID)?t.BATCH_ID.array:void 0,l=defined(r)&&defined(t.POSITION.data.quantization),u=defined(s)&&defined(t.NORMAL.data.quantization);if(l){const n=t.POSITION.data.quantization,i=n.range;e._quantizedVolumeScale=Cartesian3.fromElements(i,i,i),e._quantizedVolumeOffset=Cartesian3.unpack(n.minValues),e._quantizedRange=(1<<n.quantizationBits)-1,e._isQuantizedDraco=!0}u&&(e._octEncodedRange=(1<<t.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let d=n.styleableProperties;const h=i.batchTableProperties;for(const e in h)if(h.hasOwnProperty(e)){const n=t[e];defined(d)||(d={}),d[e]={typedArray:n.array,componentCount:n.data.componentsPerAttribute}}defined(r)&&(n.positions={typedArray:r});const p=defaultValue(a,o);defined(p)&&(n.colors={typedArray:p}),defined(s)&&(n.normals={typedArray:s}),defined(c)&&(n.batchIds={typedArray:c}),n.styleableProperties=d})).otherwise((function(t){e._decodingState=DecodingState.FAILED,e._readyPromise.reject(t)})))}return!0}const scratchComputedTranslation=new Cartesian4,scratchScale$3=new Cartesian3;function attachTexture(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function attachRenderbuffer(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Framebuffer(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;let n,i,r,o,a;if(ContextLimits.maximumColorAttachments,this._gl=t,this._framebuffer=t.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=defaultValue(e.destroyAttachments,!0),defined(e.depthTexture)||defined(e.depthRenderbuffer),defined(e.depthStencilTexture)||defined(e.depthStencilRenderbuffer),this._bind(),defined(e.colorTextures)){const t=e.colorTextures;for(o=this._colorTextures.length=this._activeColorAttachments.length=t.length,r=0;r<o;++r)n=t[r],a=this._gl.COLOR_ATTACHMENT0+r,attachTexture(this,a,n),this._activeColorAttachments[r]=a,this._colorTextures[r]=n}if(defined(e.colorRenderbuffers)){const t=e.colorRenderbuffers;for(o=this._colorRenderbuffers.length=this._activeColorAttachments.length=t.length,r=0;r<o;++r)i=t[r],a=this._gl.COLOR_ATTACHMENT0+r,attachRenderbuffer(this,a,i),this._activeColorAttachments[r]=a,this._colorRenderbuffers[r]=i}defined(e.depthTexture)&&(n=e.depthTexture,attachTexture(this,this._gl.DEPTH_ATTACHMENT,n),this._depthTexture=n),defined(e.depthRenderbuffer)&&(i=e.depthRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_ATTACHMENT,i),this._depthRenderbuffer=i),defined(e.stencilRenderbuffer)&&(i=e.stencilRenderbuffer,attachRenderbuffer(this,this._gl.STENCIL_ATTACHMENT,i),this._stencilRenderbuffer=i),defined(e.depthStencilTexture)&&(n=e.depthStencilTexture,attachTexture(this,this._gl.DEPTH_STENCIL_ATTACHMENT,n),this._depthStencilTexture=n),defined(e.depthStencilRenderbuffer)&&(i=e.depthStencilRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_STENCIL_ATTACHMENT,i),this._depthStencilRenderbuffer=i),this._unBind()}PointCloud.prototype.update=function(e){if(decodeDraco$1(this,e.context))return;let t=!1,n=!Matrix4.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,n=!0),defined(this._drawCommand)||(createResources$3(this,e),n=!0,t=!0,this._ready=!0,this._readyPromise.resolve(this),this._parsedContent=void 0),n){Matrix4.clone(this.modelMatrix,this._modelMatrix);const t=this._drawCommand.modelMatrix;if(Matrix4.clone(this._modelMatrix,t),defined(this._rtcCenter)&&Matrix4.multiplyByTranslation(t,this._rtcCenter,t),defined(this._quantizedVolumeOffset)&&Matrix4.multiplyByTranslation(t,this._quantizedVolumeOffset,t),e.mode!==SceneMode$1.SCENE3D){const n=e.mapProjection,i=Matrix4.getColumn(t,3,scratchComputedTranslation);Cartesian4.equals(i,Cartesian4.UNIT_W)||Transforms.basisTo2D(n,t,t)}const n=this._drawCommand.boundingVolume;if(BoundingSphere.clone(this._boundingSphere,n),this._cull){const e=n.center;Matrix4.multiplyByPoint(t,e,e);const i=Matrix4.getScale(t,scratchScale$3);n.radius*=Cartesian3.maximumComponent(i)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,t=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,t=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,t=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,t=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,t=!0),t&&createShaders$2(this,e,this._style),this._drawCommand.castShadows=ShadowMode$1.castShadows(this.shadows),this._drawCommand.receiveShadows=ShadowMode$1.receiveShadows(this.shadows);const i=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=i?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=i?Pass$1.TRANSLUCENT:this._opaquePass;const r=e.commandList,o=e.passes;(o.render||o.pick)&&r.push(this._drawCommand)},PointCloud.prototype.isDestroyed=function(){return!1},PointCloud.prototype.destroy=function(){const e=this._drawCommand;return defined(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(Framebuffer.prototype,{status:{get:function(){this._bind();const e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}}),Framebuffer.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},Framebuffer.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},Framebuffer.prototype.getColorTexture=function(e){return this._colorTextures[e]},Framebuffer.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]},Framebuffer.prototype.isDestroyed=function(){return!1},Framebuffer.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;e<n;++e){const n=t[e];defined(n)&&n.destroy()}const i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){const t=i[e];defined(t)&&t.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),destroyObject(this)};const RenderbufferFormat={RGBA4:WebGLConstants$1.RGBA4,RGB5_A1:WebGLConstants$1.RGB5_A1,RGB565:WebGLConstants$1.RGB565,DEPTH_COMPONENT16:WebGLConstants$1.DEPTH_COMPONENT16,STENCIL_INDEX8:WebGLConstants$1.STENCIL_INDEX8,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,validate:function(e){return e===RenderbufferFormat.RGBA4||e===RenderbufferFormat.RGB5_A1||e===RenderbufferFormat.RGB565||e===RenderbufferFormat.DEPTH_COMPONENT16||e===RenderbufferFormat.STENCIL_INDEX8||e===RenderbufferFormat.DEPTH_STENCIL}};var RenderbufferFormat$1=Object.freeze(RenderbufferFormat);function Renderbuffer(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;ContextLimits.maximumRenderbufferSize;const n=defaultValue(e.format,RenderbufferFormat$1.RGBA4),i=defined(e.width)?e.width:t.drawingBufferWidth,r=defined(e.height)?e.height:t.drawingBufferHeight;this._gl=t,this._format=n,this._width=i,this._height=r,this._renderbuffer=this._gl.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this._renderbuffer),t.renderbufferStorage(t.RENDERBUFFER,n,i,r),t.bindRenderbuffer(t.RENDERBUFFER,null)}function FramebufferManager(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._colorAttachmentsLength=defaultValue(e.colorAttachmentsLength,1),this._color=defaultValue(e.color,!0),this._depth=defaultValue(e.depth,!1),this._depthStencil=defaultValue(e.depthStencil,!1),this._supportsDepthTexture=defaultValue(e.supportsDepthTexture,!1),this._createColorAttachments=defaultValue(e.createColorAttachments,!0),this._createDepthAttachments=defaultValue(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength)),this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(Renderbuffer.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),Renderbuffer.prototype._getRenderbuffer=function(){return this._renderbuffer},Renderbuffer.prototype.isDestroyed=function(){return!1},Renderbuffer.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),destroyObject(this)},Object.defineProperties(FramebufferManager.prototype,{framebuffer:{get:function(){return this._framebuffer}},status:{get:function(){return this._framebuffer.status}}}),FramebufferManager.prototype.isDirty=function(e,t,n,i){const r=this._width!==e||this._height!==t,o=defined(n)&&this._pixelDatatype!==n||defined(i)&&this._pixelFormat!==i;return this._attachmentsDirty||r||o||!defined(this._framebuffer)||this._color&&!defined(this._colorTextures[0])},FramebufferManager.prototype.update=function(e,t,n,i,r){if(i=defaultValue(i,this._color?defaultValue(this._pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE):void 0),r=defaultValue(r,this._color?defaultValue(this._pixelFormat,PixelFormat$1.RGBA):void 0),this.isDirty(t,n,i,r)){if(this.destroy(),this._width=t,this._height=n,this._pixelDatatype=i,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments)for(let o=0;o<this._colorAttachmentsLength;++o)this._colorTextures[o]=new Texture({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:i,sampler:Sampler.NEAREST});this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthStencilTexture=new Texture({context:e,width:t,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}):this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:t,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new Texture({context:e,width:t,height:n,pixelFormat:PixelFormat$1.DEPTH_COMPONENT,pixelDatatype:PixelDatatype$1.UNSIGNED_INT,sampler:Sampler.NEAREST}):this._depthRenderbuffer=new Renderbuffer({context:e,width:t,height:n,format:RenderbufferFormat$1.DEPTH_COMPONENT16})),this._framebuffer=new Framebuffer({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}},FramebufferManager.prototype.getColorTexture=function(e){return e=defaultValue(e,0),this._colorTextures[e]},FramebufferManager.prototype.setColorTexture=function(e,t){t=defaultValue(t,0),this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e},FramebufferManager.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer},FramebufferManager.prototype.setDepthRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e},FramebufferManager.prototype.getDepthTexture=function(){return this._depthTexture},FramebufferManager.prototype.setDepthTexture=function(e){this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e},FramebufferManager.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer},FramebufferManager.prototype.setDepthStencilRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e},FramebufferManager.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture},FramebufferManager.prototype.setDepthStencilTexture=function(e){this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e},FramebufferManager.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._framebuffer,t.execute(e,n),t.framebuffer=i},FramebufferManager.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy()},FramebufferManager.prototype.destroy=function(){if(this._color&&this._createColorAttachments){const e=this._colorTextures.length;for(let t=0;t<e;++t){const e=this._colorTextures[t];defined(e)&&!e.isDestroyed()&&(this._colorTextures[t].destroy(),this._colorTextures[t]=void 0)}}this._depthStencil&&this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),this._depth&&this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),this.destroyFramebuffer()};var PointCloudEyeDomeLightingShader="#extension GL_EXT_frag_depth : enable\nuniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nvarying vec2 v_textureCoordinates;\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\nfloat dist = u_distanceAndEdlStrength.x;\nvec2 texCoordOrig = v_textureCoordinates + offset * dist;\nvec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\nvec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\nfloat depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));\nfloat depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));\nif (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\nreturn vec2(0.0);\n}\nfloat depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\nreturn vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\nvoid main()\n{\nfloat depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat log2Depth = log2(-eyeCoordinate.z);\nif (depthOrLogDepth == 0.0)\n{\ndiscard;\n}\nvec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);\nvec2 texelSize = 1.0 / czm_viewport.zw;\nvec2 responseAndCount = vec2(0.0);\nresponseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\nfloat response = responseAndCount.x / responseAndCount.y;\nfloat strength = u_distanceAndEdlStrength.y;\nfloat shade = exp(-response * 300.0 * strength);\ncolor.rgb *= shade;\ngl_FragColor = vec4(color);\ngl_FragDepthEXT = depthOrLogDepth;\n}\n";function PointCloudEyeDomeLighting(){this._framebuffer=new FramebufferManager({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}function destroyFramebuffer$1(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}Object.defineProperties(PointCloudEyeDomeLighting.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});const distanceAndEdlStrengthScratch=new Cartesian2;function createCommands$1(e,t){const n=new ShaderSource({defines:["LOG_DEPTH_WRITE"],sources:[PointCloudEyeDomeLightingShader]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return distanceAndEdlStrengthScratch.x=e._radius,distanceAndEdlStrengthScratch.y=e._strength,distanceAndEdlStrengthScratch}},r=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:r,pass:Pass$1.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ClearCommand({framebuffer:e.framebuffer,color:new Color(0,0,0,0),depth:1,renderState:RenderState.fromCache(),pass:Pass$1.CESIUM_3D_TILE,owner:e})}function createResources$2(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),createCommands$1(e,t)}function isSupported(e){return e.drawBuffers&&e.fragmentDepth}function getECShaderProgram(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!defined(n)){const i=t._attributeLocations,r=t.fragmentShaderSource.clone();r.sources=r.sources.map((function(e){return e=(e=ShaderSource.replaceMain(e,"czm_point_cloud_post_process_main")).replace(/gl_FragColor/g,"gl_FragData[0]")})),r.sources.unshift("#extension GL_EXT_draw_buffers : enable \n"),r.sources.push("void main() \n{ \n czm_point_cloud_post_process_main(); \n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n gl_FragData[1] = czm_packDepth(gl_FragDepthEXT); \n#else\n gl_FragData[1] = czm_packDepth(gl_FragCoord.z);\n#endif\n}"),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:i})}return n}function PointCloudShading(e){const t=defaultValue(e,{});this.attenuation=defaultValue(t.attenuation,!1),this.geometricErrorScale=defaultValue(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=defaultValue(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=defaultValue(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=defaultValue(t.eyeDomeLightingRadius,1),this.backFaceCulling=defaultValue(t.backFaceCulling,!1),this.normalShading=defaultValue(t.normalShading,!0)}function PointCloud3DTileContent(e,t,n,i,r){this._tileset=e,this._tile=t,this._resource=n,this._pickId=void 0,this._batchTable=void 0,this._styleDirty=!1,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,this._pointCloud=new PointCloud({arrayBuffer:i,byteOffset:r,cull:!1,opaquePass:Pass$1.CESIUM_3D_TILE,vertexShaderLoaded:getVertexShaderLoaded(this),fragmentShaderLoaded:getFragmentShaderLoaded$1(this),uniformMapLoaded:getUniformMapLoaded$1(this),batchTableLoaded:getBatchTableLoaded(this),pickIdLoaded:getPickIdLoaded$1(this)})}function getVertexShaderLoaded(e){return function(t){return defined(e._batchTable)?e._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(t):t}}function getFragmentShaderLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getFragmentShaderCallback(!1,void 0,!1)(t):"uniform vec4 czm_pickColor;\n"+t}}function getUniformMapLoaded$1(e){return function(t){return defined(e._batchTable)?e._batchTable.getUniformMapCallback()(t):combine$2(t,{czm_pickColor:function(){return e._pickId.color}})}}function getBatchTableLoaded(e){return function(t,n,i){e._batchTable=new Cesium3DTileBatchTable(e,t,n,i)}}function getPickIdLoaded$1(e){return function(){return defined(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function getGeometricError$2(e){const t=e._tileset.pointCloudShading,n=e._tile.contentBoundingVolume.boundingSphere.volume(),i=CesiumMath.cbrt(n/e.pointsLength);let r=e._tile.geometricError;return 0===r&&(r=defined(t)&&defined(t.baseResolution)?t.baseResolution:i),r}function createFeatures$1(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const n=new Array(t);for(let i=0;i<t;++i)n[i]=new Cesium3DTileFeature(e,i);e._features=n}}PointCloudEyeDomeLighting.isSupported=isSupported,PointCloudEyeDomeLighting.prototype.update=function(e,t,n,i){if(!isSupported(e.context))return;let r;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,createResources$2(this,e.context);const o=e.commandList,a=o.length;let s,c;for(r=t;r<a;++r){const t=o[r];if(t.primitiveType!==PrimitiveType$1.POINTS||t.pass===Pass$1.TRANSLUCENT)continue;s=void 0,c=void 0;let n=t.derivedCommands.pointCloudProcessor;defined(n)&&(s=n.command,c=n.originalShaderProgram),defined(s)&&!t.dirty&&c===t.shaderProgram&&s.framebuffer===this.framebuffer||(s=DrawCommand.shallowClone(t,s),s.framebuffer=this.framebuffer,s.shaderProgram=getECShaderProgram(e.context,t.shaderProgram),s.castShadows=!1,s.receiveShadows=!1,defined(n)||(n={command:s,originalShaderProgram:t.shaderProgram},t.derivedCommands.pointCloudProcessor=n),n.originalShaderProgram=t.shaderProgram),o[r]=s}const l=this._clearCommand,u=this._drawCommand;u.boundingVolume=i,o.push(u),o.push(l)},PointCloudEyeDomeLighting.prototype.isDestroyed=function(){return!1},PointCloudEyeDomeLighting.prototype.destroy=function(){return destroyFramebuffer$1(this),destroyObject(this)},PointCloudShading.isSupported=function(e){return PointCloudEyeDomeLighting.isSupported(e.context)},Object.defineProperties(PointCloud3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return this._pointCloud.pointsLength}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return this._pointCloud.geometryByteLength}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._pointCloud.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),PointCloud3DTileContent.prototype.hasProperty=function(e,t){return!!defined(this._batchTable)&&this._batchTable.hasProperty(e,t)},PointCloud3DTileContent.prototype.getFeature=function(e){if(defined(this._batchTable))return this.featuresLength,createFeatures$1(this),this._features[e]},PointCloud3DTileContent.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:Color.WHITE},PointCloud3DTileContent.prototype.applyStyle=function(e){defined(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};const defaultShading$1=new PointCloudShading;function Tileset3DTileContent(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,this._readyPromise=when.defer(),this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$4(this,i)}function initialize$4(e,t){e._tileset.loadTileset(e._resource,t,e._tile),e._readyPromise.resolve(e)}function VertexArrayFacade(e,t,n,i){const r=VertexArrayFacade._verifyAttributes(t);n=defaultValue(n,0);const o=[],a={};let s,c;const l=r.length;for(let e=0;e<l;++e){const t=r[e];t.vertexBuffer?o.push(t):(c=t.usage,s=a[c],defined(s)||(s=a[c]=[]),s.push(t))}function u(e,t){return ComponentDatatype$1.getSizeInBytes(t.componentDatatype)-ComponentDatatype$1.getSizeInBytes(e.componentDatatype)}for(c in this._allBuffers=[],a)if(a.hasOwnProperty(c)){s=a[c],s.sort(u);const e=VertexArrayFacade._vertexSizeInBytes(s),t={vertexSizeInBytes:e,vertexBuffer:void 0,usage:s[0].usage,needsCommit:!1,arrayBuffer:void 0,arrayViews:VertexArrayFacade._createArrayViews(s,e)};this._allBuffers.push(t)}this._size=0,this._instanced=defaultValue(i,!1),this._precreated=o,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}PointCloud3DTileContent.prototype.update=function(e,t){const n=this._pointCloud,i=defaultValue(e.pointCloudShading,defaultShading$1),r=this._tile,o=this._batchTable,a=t.mode,s=e.clippingPlanes;let c;defined(this._pickId)||defined(o)||(this._pickId=t.context.createPickId({primitive:e,content:this})),defined(o)&&o.update(e,t),c=defined(r._contentBoundingVolume)?a===SceneMode$1.SCENE3D?r._contentBoundingVolume.boundingSphere:r._contentBoundingVolume2D.boundingSphere:a===SceneMode$1.SCENE3D?r._boundingVolume.boundingSphere:r._boundingVolume2D.boundingSphere;const l=this._styleDirty;this._styleDirty=!1,n.clippingPlanesOriginMatrix=e.clippingPlanesOriginMatrix,n.style=defined(o)?void 0:e.style,n.styleDirty=l,n.modelMatrix=r.computedTransform,n.time=e.timeSinceLoad,n.shadows=e.shadows,n.boundingSphere=c,n.clippingPlanes=s,n.isClipped=defined(s)&&s.enabled&&r._isClipped,n.clippingPlanesDirty=r.clippingPlanesDirty,n.attenuation=i.attenuation,n.backFaceCulling=i.backFaceCulling,n.normalShading=i.normalShading,n.geometricError=getGeometricError$2(this),n.geometricErrorScale=i.geometricErrorScale,defined(i)&&defined(i.maximumAttenuation)?n.maximumAttenuation=i.maximumAttenuation:r.refine===Cesium3DTileRefine$1.ADD?n.maximumAttenuation=5:n.maximumAttenuation=e.maximumScreenSpaceError,n.update(t)},PointCloud3DTileContent.prototype.isDestroyed=function(){return!1},PointCloud3DTileContent.prototype.destroy=function(){return this._pickId=this._pickId&&this._pickId.destroy(),this._pointCloud=this._pointCloud&&this._pointCloud.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(Tileset3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),Tileset3DTileContent.prototype.hasProperty=function(e,t){return!1},Tileset3DTileContent.prototype.getFeature=function(e){},Tileset3DTileContent.prototype.applyDebugSettings=function(e,t){},Tileset3DTileContent.prototype.applyStyle=function(e){},Tileset3DTileContent.prototype.update=function(e,t){},Tileset3DTileContent.prototype.isDestroyed=function(){return!1},Tileset3DTileContent.prototype.destroy=function(){return destroyObject(this)},VertexArrayFacade._verifyAttributes=function(e){const t=[];for(let n=0;n<e.length;++n){const i=e[n],r={index:defaultValue(i.index,n),enabled:defaultValue(i.enabled,!0),componentsPerAttribute:i.componentsPerAttribute,componentDatatype:defaultValue(i.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(i.normalize,!1),vertexBuffer:i.vertexBuffer,usage:defaultValue(i.usage,BufferUsage$1.STATIC_DRAW)};t.push(r)}const n=new Array(t.length);for(let e=0;e<t.length;++e){n[t[e].index]=!0}return t},VertexArrayFacade._vertexSizeInBytes=function(e){let t=0;const n=e.length;for(let i=0;i<n;++i){const n=e[i];t+=n.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(n.componentDatatype)}const i=n>0?ComponentDatatype$1.getSizeInBytes(e[0].componentDatatype):0,r=i>0?t%i:0;return t+=0===r?0:i-r,t},VertexArrayFacade._createArrayViews=function(e,t){const n=[];let i=0;const r=e.length;for(let o=0;o<r;++o){const r=e[o],a=r.componentDatatype;n.push({index:r.index,enabled:r.enabled,componentsPerAttribute:r.componentsPerAttribute,componentDatatype:a,normalize:r.normalize,offsetInBytes:i,vertexSizeInComponentType:t/ComponentDatatype$1.getSizeInBytes(a),view:void 0}),i+=r.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(a)}return n},VertexArrayFacade.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let e=0,n=t.length;e<n;++e){const n=t[e];VertexArrayFacade._resize(n,this._size),VertexArrayFacade._appendWriters(this.writers,n)}destroyVA(this)},VertexArrayFacade._resize=function(e,t){if(e.vertexSizeInBytes>0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(defined(e.arrayBuffer)){const t=new Uint8Array(n),i=new Uint8Array(e.arrayBuffer),r=i.length;for(let e=0;e<r;++e)t[e]=i[e]}const i=e.arrayViews,r=i.length;for(let e=0;e<r;++e){const t=i[e];t.view=ComponentDatatype$1.createArrayBufferView(t.componentDatatype,n,t.offsetInBytes)}e.arrayBuffer=n}};const createWriters=[function(e,t,n){return function(i,r){t[i*n]=r,e.needsCommit=!0}},function(e,t,n){return function(i,r,o){const a=i*n;t[a]=r,t[a+1]=o,e.needsCommit=!0}},function(e,t,n){return function(i,r,o,a){const s=i*n;t[s]=r,t[s+1]=o,t[s+2]=a,e.needsCommit=!0}},function(e,t,n){return function(i,r,o,a,s){const c=i*n;t[c]=r,t[c+1]=o,t[c+2]=a,t[c+3]=s,e.needsCommit=!0}}];function commit(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,r=defined(n);if(!r||n.sizeInBytes<i)return r&&n.destroy(),t.vertexBuffer=Buffer$1.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}function subCommit(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){const i=e.vertexSizeInBytes*t,r=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,r),i)}}function destroyVA(e){const t=e.va;if(!defined(t))return;const n=t.length;for(let e=0;e<n;++e)t[e].va.destroy();e.va=void 0}VertexArrayFacade._appendWriters=function(e,t){const n=t.arrayViews,i=n.length;for(let r=0;r<i;++r){const i=n[r];e[i.index]=createWriters[i.componentsPerAttribute-1](t,i.view,i.vertexSizeInComponentType)}},VertexArrayFacade.prototype.commit=function(e){let t=!1;const n=this._allBuffers;let i,r,o;for(r=0,o=n.length;r<o;++r)i=n[r],t=commit(this,i)||t;if(t||!defined(this.va)){destroyVA(this);const t=this.va=[],a=CesiumMath.SIXTY_FOUR_KILOBYTES-4,s=defined(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let c=0;c<s;++c){let l=[];for(r=0,o=n.length;r<o;++r){i=n[r];const e=c*(i.vertexSizeInBytes*a);VertexArrayFacade._appendAttributes(l,i,e,this._instanced)}l=l.concat(this._precreated),t.push({va:new VertexArray({context:this._context,attributes:l,indexBuffer:e}),indicesCount:1.5*(c!==s-1?a:this._size%a)})}}},VertexArrayFacade._appendAttributes=function(e,t,n,i){const r=t.arrayViews,o=r.length;for(let a=0;a<o;++a){const o=r[a];e.push({index:o.index,enabled:o.enabled,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:o.componentDatatype,normalize:o.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:n+o.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:i?1:0})}},VertexArrayFacade.prototype.subCommit=function(e,t){const n=this._allBuffers;for(let i=0,r=n.length;i<r;++i)subCommit(n[i],e,t)},VertexArrayFacade.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1},VertexArrayFacade.prototype.isDestroyed=function(){return!1},VertexArrayFacade.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){const n=e[t];n.vertexBuffer=n.vertexBuffer&&n.vertexBuffer.destroy()}return destroyVA(this),destroyObject(this)};var BillboardCollectionFS="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform sampler2D u_atlas;\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_textureCoordinates;\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nfloat getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)\n{\nvec2 lookupVector = imageSize * (depthLookupST - adjustedST);\nlookupVector = v_rotationMatrix * lookupVector;\nvec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));\nvec2 translation = v_originTextureCoordinateAndTranslate.zw;\nif (applyTranslate)\n{\ntranslation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));\n}\nvec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));\nif (logDepthOrDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\n#ifdef SDF\nfloat getDistance(vec2 position)\n{\nreturn texture2D(u_atlas, position).r;\n}\nvec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n{\nfloat distance = getDistance(position);\nif (outlineWidth > 0.0)\n{\nfloat outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\nfloat outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nvec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\nfloat alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\nreturn vec4(sdfColor.rgb, sdfColor.a * alpha);\n}\nelse\n{\nfloat alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nreturn vec4(v_color.rgb, v_color.a * alpha);\n}\n}\n#endif\nvoid main()\n{\nvec4 color = texture2D(u_atlas, v_textureCoordinates);\n#ifdef SDF\nfloat outlineWidth = v_outlineWidth;\nvec4 outlineColor = v_outlineColor;\nfloat distance = getDistance(v_textureCoordinates);\n#ifdef GL_OES_standard_derivatives\nfloat smoothing = fwidth(distance);\nvec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\nvec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\nvec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\ncolor = (center + color1 + color2 + color3 + color4)/5.0;\n#else\nfloat smoothing = 1.0/32.0;\ncolor = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n#endif\ncolor = czm_gammaCorrect(color);\n#else\ncolor = czm_gammaCorrect(color);\ncolor *= czm_gammaCorrect(v_color);\n#endif\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\n#ifdef VECTOR_TILE\ncolor *= u_highlightColor;\n#endif\ngl_FragColor = color;\n#ifdef LOG_DEPTH\nczm_writeLogDepth();\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat temp = v_compressed.y;\ntemp = temp * SHIFT_RIGHT1;\nfloat temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\nbool enableDepthTest = temp2 != 0.0;\nbool applyTranslate = floor(temp) != 0.0;\nif (enableDepthTest) {\ntemp = v_compressed.z;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\ntemp = v_compressed.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 imageSize;\nimageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;\nimageSize.x = floor(temp);\nvec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;\nadjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);\nfloat epsilonEyeDepth = v_compressed.x + czm_epsilon1;\nfloat globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);\nif (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)\n{\nfloat globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)\n{\nfloat globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)\n{\ndiscard;\n}\n}\n}\n}\n#endif\n}\n",BillboardCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScale;\nattribute vec4 positionLowAndRotation;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 compressedAttribute2;\nattribute vec4 eyeOffset;\nattribute vec4 scaleByDistance;\nattribute vec4 pixelOffsetScaleByDistance;\nattribute vec4 compressedAttribute3;\nattribute vec2 sdf;\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\nattribute vec4 textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef VECTOR_TILE\nattribute float a_batchId;\n#endif\nvarying vec2 v_textureCoordinates;\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\n#endif\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\nconst float UPPER_BOUND = 32768.0;\nconst float SHIFT_LEFT16 = 65536.0;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_LEFT7 = 128.0;\nconst float SHIFT_LEFT5 = 32.0;\nconst float SHIFT_LEFT3 = 8.0;\nconst float SHIFT_LEFT2 = 4.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nconst float SHIFT_RIGHT7 = 1.0 / 128.0;\nconst float SHIFT_RIGHT5 = 1.0 / 32.0;\nconst float SHIFT_RIGHT3 = 1.0 / 8.0;\nconst float SHIFT_RIGHT2 = 1.0 / 4.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nvec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)\n{\nvec2 halfSize = imageSize * scale * 0.5;\nhalfSize *= ((direction * 2.0) - 1.0);\nvec2 originTranslate = origin * abs(halfSize);\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nif (validAlignedAxis || rotation != 0.0)\n{\nfloat angle = rotation;\nif (validAlignedAxis)\n{\nvec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);\nangle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nrotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\nelse\n{\nrotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n}\n#endif\nmpp = czm_metersPerPixel(positionEC);\npositionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\npositionEC.xy += (translate + pixelOffset) * mpp;\nreturn positionEC;\n}\n#ifdef VERTEX_DEPTH_CHECK\nfloat getGlobeDepth(vec4 positionEC)\n{\nvec4 posWC = czm_eyeToWindowCoordinates(positionEC);\nfloat globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\nif (globeDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\nvoid main()\n{\nvec3 positionHigh = positionHighAndScale.xyz;\nvec3 positionLow = positionLowAndRotation.xyz;\nfloat scale = positionHighAndScale.w;\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nfloat rotation = positionLowAndRotation.w;\n#else\nfloat rotation = 0.0;\n#endif\nfloat compressed = compressedAttribute0.x;\nvec2 pixelOffset;\npixelOffset.x = floor(compressed * SHIFT_RIGHT7);\ncompressed -= pixelOffset.x * SHIFT_LEFT7;\npixelOffset.x -= UPPER_BOUND;\nvec2 origin;\norigin.x = floor(compressed * SHIFT_RIGHT5);\ncompressed -= origin.x * SHIFT_LEFT5;\norigin.y = floor(compressed * SHIFT_RIGHT3);\ncompressed -= origin.y * SHIFT_LEFT3;\n#ifdef FRAGMENT_DEPTH_CHECK\nvec2 depthOrigin = origin.xy;\n#endif\norigin -= vec2(1.0);\nfloat show = floor(compressed * SHIFT_RIGHT2);\ncompressed -= show * SHIFT_LEFT2;\n#ifdef INSTANCED\nvec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\nvec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\nvec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n#else\nvec2 direction;\ndirection.x = floor(compressed * SHIFT_RIGHT1);\ndirection.y = compressed - direction.x * SHIFT_LEFT1;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n#endif\nfloat temp = compressedAttribute0.y * SHIFT_RIGHT8;\npixelOffset.y = -(floor(temp) - UPPER_BOUND);\nvec2 translate;\ntranslate.y = (temp - floor(temp)) * SHIFT_LEFT16;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\ntranslate.x = floor(temp) - UPPER_BOUND;\ntranslate.y += (temp - floor(temp)) * SHIFT_LEFT8;\ntranslate.y -= UPPER_BOUND;\ntemp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\nvec2 imageSize = vec2(floor(temp), temp2);\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\nfloat applyTranslate = 0.0;\nif (labelHorizontalOrigin != 0.0)\n{\napplyTranslate = 1.0;\nlabelHorizontalOrigin -= 2.0;\ndepthOrigin.x = labelHorizontalOrigin + 1.0;\n}\ndepthOrigin = vec2(1.0) - (depthOrigin * 0.5);\n#endif\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\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\ntemp = compressedAttribute3.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\n#endif\n#ifdef ALIGNED_AXIS\nvec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\ntemp = compressedAttribute2.z * SHIFT_RIGHT5;\nbool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n#else\nvec3 alignedAxis = vec3(0.0);\nbool validAlignedAxis = false;\n#endif\nvec4 pickColor;\nvec4 color;\ntemp = compressedAttribute2.y;\ntemp = temp * 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);\ntemp = compressedAttribute2.x;\ntemp = temp * 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 = compressedAttribute2.z * SHIFT_RIGHT8;\nbool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)\nfloat eyeDepth = positionEC.z;\n#endif\npositionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\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\nfloat distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\nscale *= distanceScale;\ntranslate *= distanceScale;\nif (scale == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\nfloat pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\npixelOffset *= pixelOffsetScale;\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = compressedAttribute3.x;\nfloat farSq = compressedAttribute3.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nmat2 rotationMatrix;\nfloat mpp;\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = compressedAttribute3.z;\n#endif\n#ifdef VERTEX_DEPTH_CHECK\nif (lengthSq < disableDepthTestDistance) {\nfloat depthsilon = 10.0;\nvec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;\nvec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth1 = getGlobeDepth(pEC1);\nif (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n{\nvec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth2 = getGlobeDepth(pEC2);\nif (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n{\nvec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth3 = getGlobeDepth(pEC3);\nif (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n{\npositionEC.xyz = vec3(0.0);\n}\n}\n}\n}\n#endif\npositionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\ngl_Position = czm_projection * positionEC;\nv_textureCoordinates = textureCoordinates;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth();\n#endif\n#ifdef DISABLE_DEPTH_DISTANCE\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nv_depthFromNearPlusOne = 1.0;\n#endif\n}\n}\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nif (sizeInMeters) {\ntranslate /= mpp;\ndimensions /= mpp;\nimageSize /= mpp;\n}\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nv_rotationMatrix = rotationMatrix;\n#else\nv_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n#endif\nfloat enableDepthCheck = 0.0;\nif (lengthSq < disableDepthTestDistance)\n{\nenableDepthCheck = 1.0;\n}\nfloat dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));\nfloat dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));\nfloat iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));\nfloat ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));\nv_compressed.x = eyeDepth;\nv_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;\nv_compressed.z = dw * SHIFT_LEFT12 + dh;\nv_compressed.w = iw * SHIFT_LEFT12 + ih;\nv_originTextureCoordinateAndTranslate.xy = depthOrigin;\nv_originTextureCoordinateAndTranslate.zw = translate;\nv_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef SDF\nvec4 outlineColor;\nfloat outlineWidth;\ntemp = sdf.x;\ntemp = temp * 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);\ntemp = sdf.y;\ntemp = temp * SHIFT_RIGHT8;\nfloat temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.a = floor(temp);\noutlineColor /= 255.0;\nv_outlineWidth = outlineWidth / 255.0;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\n#endif\nv_pickColor = pickColor;\nv_color = color;\nv_color.a *= translucency;\n}\n";const SceneTransforms={},actualPositionScratch=new Cartesian4(0,0,0,1);let positionCC=new Cartesian4;const scratchViewport$1=new BoundingRectangle,scratchWindowCoord0=new Cartesian2,scratchWindowCoord1=new Cartesian2;SceneTransforms.wgs84ToWindowCoordinates=function(e,t,n){return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(e,t,Cartesian3.ZERO,n)};const scratchCartesian4$3=new Cartesian4,scratchEyeOffset=new Cartesian3;function worldToClip(e,t,n,i){const r=n.viewMatrix,o=Matrix4.multiplyByVector(r,Cartesian4.fromElements(e.x,e.y,e.z,1,scratchCartesian4$3),scratchCartesian4$3),a=Cartesian3.multiplyComponents(t,Cartesian3.normalize(o,scratchEyeOffset),scratchEyeOffset);return o.x+=t.x+a.x,o.y+=t.y+a.y,o.z+=a.z,Matrix4.multiplyByVector(n.frustum.projectionMatrix,o,i)}const scratchMaxCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratchProjectedCartesian=new Cartesian3,scratchCameraPosition$1=new Cartesian3;SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){const r=e.frameState,o=SceneTransforms.computeActualWgs84Position(r,t,actualPositionScratch);if(!defined(o))return;const a=e.canvas,s=scratchViewport$1;s.x=0,s.y=0,s.width=a.clientWidth,s.height=a.clientHeight;const c=e.camera;let l=!1;if(r.mode===SceneMode$1.SCENE2D){const t=e.mapProjection,r=scratchMaxCartographic,u=t.project(r,scratchProjectedCartesian),d=Cartesian3.clone(c.position,scratchCameraPosition$1),h=c.frustum.clone(),p=Matrix4.computeViewportTransformation(s,0,1,new Matrix4),f=c.frustum.projectionMatrix,m=c.positionWC.y,g=Cartesian3.fromElements(CesiumMath.sign(m)*u.x-m,0,-c.positionWC.x),_=Transforms.pointToGLWindowCoordinates(f,p,g);if(0===m||_.x<=0||_.x>=a.clientWidth)l=!0;else{if(_.x>.5*a.clientWidth){s.width=_.x,c.frustum.right=u.x-m,positionCC=worldToClip(o,n,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x+=_.x,c.position.x=-c.position.x;const e=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-e,positionCC=worldToClip(o,n,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}else{s.x+=_.x,s.width-=_.x,c.frustum.left=-u.x-m,positionCC=worldToClip(o,n,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x=s.x-s.width,c.position.x=-c.position.x;const e=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-e,positionCC=worldToClip(o,n,c,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}Cartesian3.clone(d,c.position),c.frustum=h.clone(),((i=Cartesian2.clone(scratchWindowCoord0,i)).x<0||i.x>a.clientWidth)&&(i.x=scratchWindowCoord1.x)}}if(r.mode!==SceneMode$1.SCENE2D||l){if(positionCC=worldToClip(o,n,c,positionCC),positionCC.z<0&&!(c.frustum instanceof OrthographicFrustum)&&!(c.frustum instanceof OrthographicOffCenterFrustum))return;i=SceneTransforms.clipToGLWindowCoordinates(s,positionCC,i)}return i.y=a.clientHeight-i.y,i},SceneTransforms.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(defined(n=SceneTransforms.wgs84ToWindowCoordinates(e,t,n)))return SceneTransforms.transformWindowToDrawingBuffer(e,n,n)};const projectedPosition=new Cartesian3,positionInCartographic=new Cartographic;SceneTransforms.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===SceneMode$1.SCENE3D)return Cartesian3.clone(t,n);const r=e.mapProjection,o=r.ellipsoid.cartesianToCartographic(t,positionInCartographic);if(!defined(o))return;if(r.project(o,projectedPosition),i===SceneMode$1.COLUMBUS_VIEW)return Cartesian3.fromElements(projectedPosition.z,projectedPosition.x,projectedPosition.y,n);if(i===SceneMode$1.SCENE2D)return Cartesian3.fromElements(0,projectedPosition.x,projectedPosition.y,n);const a=e.morphTime;return Cartesian3.fromElements(CesiumMath.lerp(projectedPosition.z,t.x,a),CesiumMath.lerp(projectedPosition.x,t.y,a),CesiumMath.lerp(projectedPosition.y,t.z,a),n)};const positionNDC=new Cartesian3,positionWC=new Cartesian3,viewportTransform=new Matrix4;SceneTransforms.clipToGLWindowCoordinates=function(e,t,n){return Cartesian3.divideByScalar(t,t.w,positionNDC),Matrix4.computeViewportTransformation(e,0,1,viewportTransform),Matrix4.multiplyByPoint(viewportTransform,positionNDC,positionWC),Cartesian2.fromCartesian3(positionWC,n)},SceneTransforms.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,r=e.drawingBufferWidth/i.clientWidth,o=e.drawingBufferHeight/i.clientHeight;return Cartesian2.fromElements(t.x*r,t.y*o,n)};const scratchNDC=new Cartesian4,scratchWorldCoords=new Cartesian4;function Billboard(e,t){let n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,i=e.pixelOffsetScaleByDistance,r=e.scaleByDistance,o=e.distanceDisplayCondition;defined(n)&&(n=NearFarScalar.clone(n)),defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(o)&&(o=DistanceDisplayCondition.clone(o)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._translate=new Cartesian2(0,0),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.CENTER),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.CENTER),this._scale=defaultValue(e.scale,1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._rotation=defaultValue(e.rotation,0),this._alignedAxis=Cartesian3.clone(defaultValue(e.alignedAxis,Cartesian3.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=r,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._distanceDisplayCondition=o,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=defaultValue(e.collection,t),this._pickId=void 0,this._pickPrimitive=defaultValue(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;const a=e.image;let s=e.imageId;defined(a)&&(defined(s)||(s="string"==typeof a?a:defined(a.src)?a.src:createGuid()),this._imageId=s,this._image=a),defined(e.imageSubRegion)&&(this._imageId=s,this._imageSubRegion=e.imageSubRegion),defined(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=SceneMode$1.SCENE3D,this._clusterShow=!0,this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._updateClamping()}SceneTransforms.drawingBufferToWgs84Coordinates=function(e,t,n,i){const r=e.context.uniformState,o=r.currentFrustum,a=o.x,s=o.y;if(e.frameState.useLogDepth){const e=n*r.log2FarDepthFromNearPlusOne;n=s*(1-a/(Math.pow(2,e)-1+a))/(s-a)}const c=e.view.passState.viewport,l=Cartesian4.clone(Cartesian4.UNIT_W,scratchNDC);let u;l.x=(t.x-c.x)/c.width*2-1,l.y=(t.y-c.y)/c.height*2-1,l.z=2*n-1,l.w=1;let d=e.camera.frustum;if(defined(d.fovy)){u=Matrix4.multiplyByVector(r.inverseViewProjection,l,scratchWorldCoords);const e=1/u.w;Cartesian3.multiplyByScalar(u,e,u)}else defined(d._offCenterFrustum)&&(d=d._offCenterFrustum),u=scratchWorldCoords,u.x=.5*(l.x*(d.right-d.left)+d.left+d.right),u.y=.5*(l.y*(d.top-d.bottom)+d.bottom+d.top),u.z=.5*(l.z*(a-s)-a-s),u.w=1,u=Matrix4.multiplyByVector(r.inverseView,u,u);return Cartesian3.fromCartesian4(u,i)};const SHOW_INDEX$7=Billboard.SHOW_INDEX=0,POSITION_INDEX$7=Billboard.POSITION_INDEX=1,PIXEL_OFFSET_INDEX$1=Billboard.PIXEL_OFFSET_INDEX=2,EYE_OFFSET_INDEX$1=Billboard.EYE_OFFSET_INDEX=3,HORIZONTAL_ORIGIN_INDEX$1=Billboard.HORIZONTAL_ORIGIN_INDEX=4,VERTICAL_ORIGIN_INDEX$1=Billboard.VERTICAL_ORIGIN_INDEX=5,SCALE_INDEX$3=Billboard.SCALE_INDEX=6,IMAGE_INDEX_INDEX$1=Billboard.IMAGE_INDEX_INDEX=7,COLOR_INDEX$5=Billboard.COLOR_INDEX=8,ROTATION_INDEX$1=Billboard.ROTATION_INDEX=9,ALIGNED_AXIS_INDEX$1=Billboard.ALIGNED_AXIS_INDEX=10,SCALE_BY_DISTANCE_INDEX$3=Billboard.SCALE_BY_DISTANCE_INDEX=11,TRANSLUCENCY_BY_DISTANCE_INDEX$3=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX=12,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,DISTANCE_DISPLAY_CONDITION$2=Billboard.DISTANCE_DISPLAY_CONDITION=14,DISABLE_DEPTH_DISTANCE$1=Billboard.DISABLE_DEPTH_DISTANCE=15;Billboard.TEXTURE_COORDINATE_BOUNDS=16;const SDF_INDEX$1=Billboard.SDF_INDEX=17;function makeDirty$3(e,t){const n=e._billboardCollection;defined(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Billboard.NUMBER_OF_PROPERTIES=18,Object.defineProperties(Billboard.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$3(this,SHOW_INDEX$7))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping(),makeDirty$3(this,POSITION_INDEX$7))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){const t=this._pixelOffset;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,SCALE_BY_DISTANCE_INDEX$3))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,TRANSLUCENCY_BY_DISTANCE_INDEX$3))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){const t=this._pixelOffsetScaleByDistance;NearFarScalar.equals(t,e)||(this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){const t=this._eyeOffset;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,EYE_OFFSET_INDEX$1))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,makeDirty$3(this,HORIZONTAL_ORIGIN_INDEX$1))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,makeDirty$3(this,VERTICAL_ORIGIN_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,makeDirty$3(this,SCALE_INDEX$3))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,COLOR_INDEX$5))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,makeDirty$3(this,ROTATION_INDEX$1))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){const t=this._alignedAxis;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty$3(this,ALIGNED_AXIS_INDEX$1))}},width:{get:function(){return defaultValue(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},height:{get:function(){return defaultValue(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters!==e&&(this._sizeInMeters=e,makeDirty$3(this,COLOR_INDEX$5))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$3(this,DISTANCE_DISPLAY_CONDITION$2))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$3(this,DISABLE_DEPTH_DISTANCE$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,defined(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){defined(e)?"string"==typeof e?this.setImage(e,e):e instanceof Resource?this.setImage(e.url,e):defined(e.src)?this.setImage(e.src,e):this.setImage(createGuid(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,makeDirty$3(this,IMAGE_INDEX_INDEX$1))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition),makeDirty$3(this,POSITION_INDEX$7)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$3(this,SHOW_INDEX$7))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$3(this,SDF_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$3(this,SDF_INDEX$1))}}}),Billboard.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},Billboard.prototype._updateClamping=function(){Billboard._updateClamping(this._billboardCollection,this)};const scratchCartographic$c=new Cartographic,scratchPosition$5=new Cartesian3;Billboard._updateClamping=function(e,t){const n=e._scene;if(!defined(n)||!defined(n.globe))return;const i=n.globe,r=i.ellipsoid,o=i._surface,a=n.frameState.mode,s=a!==t._mode;if(t._mode=a,(t._heightReference===HeightReference$1.NONE||s)&&defined(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===HeightReference$1.NONE||!defined(t._position))return;const c=r.cartesianToCartographic(t._position);if(!defined(c))return void(t._actualClampedPosition=void 0);function l(e){if(t._heightReference===HeightReference$1.RELATIVE_TO_GROUND)if(t._mode===SceneMode$1.SCENE3D){const t=r.cartesianToCartographic(e,scratchCartographic$c);t.height+=c.height,r.cartographicToCartesian(t,e)}else e.x+=c.height;else if(t._heightReference===HeightReference$1.CLIP_TO_GROUND)if(t._mode===SceneMode$1.SCENE3D){const t=r.cartesianToCartographic(e,scratchCartographic$c);c.height>=t.height&&(t.height=c.height),r.cartographicToCartesian(t,e)}else c.height>=e.x&&(e.x=c.height);t._clampedPosition=Cartesian3.clone(e,t._clampedPosition)}defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),t._removeCallbackFunc=o.updateHeight(c,l),Cartographic.clone(c,scratchCartographic$c);const u=i.getHeight(c);defined(u)&&(scratchCartographic$c.height=u),r.cartographicToCartesian(scratchCartographic$c,scratchPosition$5),l(scratchPosition$5)},Billboard.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let r;if(defined(n)&&(r=e.addImage(t,n)),defined(i)&&(r=e.addSubRegion(t,i)),this._imageIndexPromise=r,!defined(r))return;const o=this;r.then((function(r){if(o._imageId!==t||o._image!==n||!BoundingRectangle.equals(o._imageSubRegion,i))return;const a=e.textureCoordinates[r];o._imageWidth=e.texture.width*a.width,o._imageHeight=e.texture.height*a.height,o._imageIndex=r,o._ready=!0,o._image=void 0,o._imageIndexPromise=void 0,makeDirty$3(o,IMAGE_INDEX_INDEX$1)})).otherwise((function(e){console.error("Error loading image for billboard: "+e),o._imageIndexPromise=void 0}))},Billboard.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype.setImageSubRegion=function(e,t){this._imageId===e&&BoundingRectangle.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=BoundingRectangle.clone(t),defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype._setTranslate=function(e){const t=this._translate;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty$3(this,PIXEL_OFFSET_INDEX$1))},Billboard.prototype._getActualPosition=function(){return defined(this._clampedPosition)?this._clampedPosition:this._actualPosition},Billboard.prototype._setActualPosition=function(e){defined(this._clampedPosition)||Cartesian3.clone(e,this._actualPosition),makeDirty$3(this,POSITION_INDEX$7)};const tempCartesian3$1=new Cartesian4;Billboard._computeActualPosition=function(e,t,n,i){return defined(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===SceneMode$1.SCENE3D?t:(Matrix4.multiplyByPoint(i,t,tempCartesian3$1),SceneTransforms.computeActualWgs84Position(n,tempCartesian3$1))};const scratchCartesian3$4=new Cartesian3;Billboard._computeScreenSpacePosition=function(e,t,n,i,r,o){const a=Matrix4.multiplyByPoint(e,t,scratchCartesian3$4),s=SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(r,a,n,o);if(defined(s))return Cartesian2.add(s,i,s),s};const scratchPixelOffset=new Cartesian2(0,0);Billboard.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;defined(t)||(t=new Cartesian2),Cartesian2.clone(this._pixelOffset,scratchPixelOffset),Cartesian2.add(scratchPixelOffset,this._translate,scratchPixelOffset);let i=n.modelMatrix,r=this._position;if(defined(this._clampedPosition)&&(r=this._clampedPosition,e.mode!==SceneMode$1.SCENE3D)){const t=e.mapProjection,n=t.ellipsoid,o=t.unproject(r,scratchCartographic$c);r=n.cartographicToCartesian(o,scratchCartesian3$4),i=Matrix4.IDENTITY}return Billboard._computeScreenSpacePosition(i,r,this._eyeOffset,scratchPixelOffset,e,t)},Billboard.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,r=e.height;const o=e.scale;i*=o,r*=o;let a=t.x;e.horizontalOrigin===HorizontalOrigin$1.RIGHT?a-=i:e.horizontalOrigin===HorizontalOrigin$1.CENTER&&(a-=.5*i);let s=t.y;return e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?s-=r:e.verticalOrigin===VerticalOrigin$1.CENTER&&(s-=.5*r),defined(n)||(n=new BoundingRectangle),n.x=a,n.y=s,n.width=i,n.height=r,n},Billboard.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&BoundingRectangle.equals(this._imageSubRegion,e._imageSubRegion)&&Color.equals(this._color,e._color)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian2.equals(this._translate,e._translate)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},Billboard.prototype._destroy=function(){defined(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const BlendOption={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};var BlendOption$1=Object.freeze(BlendOption);const SDFSettings={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25};var SDFSettings$1=Object.freeze(SDFSettings);function TextureAtlasNode(e,t,n,i,r){this.bottomLeft=defaultValue(e,Cartesian2.ZERO),this.topRight=defaultValue(t,Cartesian2.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=r}const defaultInitialSize=new Cartesian2(16,16);function TextureAtlas(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.borderWidthInPixels,1),n=defaultValue(e.initialSize,defaultInitialSize);this._context=e.context,this._pixelFormat=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=createGuid(),this._idHash={},this._initialSize=n,this._root=void 0}function resizeAtlas(e,t){const n=e._context,i=e.numberOfImages,r=e._borderWidthInPixels;if(i>0){const i=e._texture.width,o=e._texture.height,a=2*(i+t.width+r),s=2*(o+t.height+r),c=i/a,l=o/s,u=new TextureAtlasNode(new Cartesian2(i+r,r),new Cartesian2(a,o)),d=new TextureAtlasNode(new Cartesian2,new Cartesian2(a,o),e._root,u),h=new TextureAtlasNode(new Cartesian2(r,o+r),new Cartesian2(a,s)),p=new TextureAtlasNode(new Cartesian2,new Cartesian2(a,s),d,h);for(let t=0;t<e._textureCoordinates.length;t++){const n=e._textureCoordinates[t];defined(n)&&(n.x*=c,n.y*=l,n.width*=c,n.height*=l)}const f=new Texture({context:e._context,width:a,height:s,pixelFormat:e._pixelFormat}),m=new Framebuffer({context:n,colorTextures:[e._texture],destroyAttachments:!1});m._bind(),f.copyFromFramebuffer(0,0,0,0,a,s),m._unBind(),m.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=f,e._root=p}else{let n=2*(t.width+2*r),i=2*(t.height+2*r);n<e._initialSize.x&&(n=e._initialSize.x),i<e._initialSize.y&&(i=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new Texture({context:e._context,width:n,height:i,pixelFormat:e._pixelFormat}),e._root=new TextureAtlasNode(new Cartesian2(r,r),new Cartesian2(n,i))}}function findNode(e,t,n){if(defined(t)){if(!defined(t.childNode1)&&!defined(t.childNode2)){if(defined(t.imageIndex))return;const i=t.topRight.x-t.bottomLeft.x,r=t.topRight.y-t.bottomLeft.y,o=i-n.width,a=r-n.height;if(o<0||a<0)return;if(0===o&&0===a)return t;if(o>a){t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.bottomLeft.x+n.width,t.topRight.y));const i=t.bottomLeft.x+n.width+e._borderWidthInPixels;i<t.topRight.x&&(t.childNode2=new TextureAtlasNode(new Cartesian2(i,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.topRight.y)))}else{t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.bottomLeft.y+n.height));const i=t.bottomLeft.y+n.height+e._borderWidthInPixels;i<t.topRight.y&&(t.childNode2=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,i),new Cartesian2(t.topRight.x,t.topRight.y)))}return findNode(e,t.childNode1,n)}return findNode(e,t.childNode1,n)||findNode(e,t.childNode2,n)}}function addImage(e,t,n){const i=findNode(e,e._root,t);if(defined(i)){i.imageIndex=n;const r=e._texture.width,o=e._texture.height,a=i.topRight.x-i.bottomLeft.x,s=i.topRight.y-i.bottomLeft.y,c=i.bottomLeft.x/r,l=i.bottomLeft.y/o,u=a/r,d=s/o;e._textureCoordinates[n]=new BoundingRectangle(c,l,u,d),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else resizeAtlas(e,t),addImage(e,t,n);e._guid=createGuid()}Object.defineProperties(TextureAtlas.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return defined(this._texture)||(this._texture=new Texture({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}}),TextureAtlas.prototype.addImage=function(e,t){let n=this._idHash[e];if(defined(n))return n;if("function"==typeof t)t=t(e);else if("string"==typeof t||t instanceof Resource){t=Resource.createIfNeeded(t).fetchImage()}const i=this;return n=when(t,(function(e){if(i.isDestroyed())return-1;const t=i.numberOfImages;return addImage(i,e,t),t})),this._idHash[e]=n,n},TextureAtlas.prototype.addSubRegion=function(e,t){const n=this._idHash[e];if(!defined(n))throw new RuntimeError('image with id "'+e+'" not found in the atlas.');const i=this;return when(n,(function(e){if(-1===e)return-1;const n=i._texture.width,r=i._texture.height,o=i.numberOfImages,a=i._textureCoordinates[e],s=a.x+t.x/n,c=a.y+t.y/r,l=t.width/n,u=t.height/r;return i._textureCoordinates.push(new BoundingRectangle(s,c,l,u)),i._guid=createGuid(),o}))},TextureAtlas.prototype.isDestroyed=function(){return!1},TextureAtlas.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};const SHOW_INDEX$6=Billboard.SHOW_INDEX,POSITION_INDEX$6=Billboard.POSITION_INDEX,PIXEL_OFFSET_INDEX=Billboard.PIXEL_OFFSET_INDEX,EYE_OFFSET_INDEX=Billboard.EYE_OFFSET_INDEX,HORIZONTAL_ORIGIN_INDEX=Billboard.HORIZONTAL_ORIGIN_INDEX,VERTICAL_ORIGIN_INDEX=Billboard.VERTICAL_ORIGIN_INDEX,SCALE_INDEX$2=Billboard.SCALE_INDEX,IMAGE_INDEX_INDEX=Billboard.IMAGE_INDEX_INDEX,COLOR_INDEX$4=Billboard.COLOR_INDEX,ROTATION_INDEX=Billboard.ROTATION_INDEX,ALIGNED_AXIS_INDEX=Billboard.ALIGNED_AXIS_INDEX,SCALE_BY_DISTANCE_INDEX$2=Billboard.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX$2=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX$2=Billboard.DISTANCE_DISPLAY_CONDITION,DISABLE_DEPTH_DISTANCE=Billboard.DISABLE_DEPTH_DISTANCE,TEXTURE_COORDINATE_BOUNDS=Billboard.TEXTURE_COORDINATE_BOUNDS,SDF_INDEX=Billboard.SDF_INDEX,NUMBER_OF_PROPERTIES$4=Billboard.NUMBER_OF_PROPERTIES;let attributeLocations$6;const attributeLocationsBatched$1={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11},attributeLocationsInstanced$1={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12};function BillboardCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$4),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=defaultValue(e.debugShowTextureAtlas,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW],this._highlightColor=Color.clone(Color.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const n=this._scene;defined(n)&&defined(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener((function(){const e=this._billboards,t=e.length;for(let n=0;n<t;++n)defined(e[n])&&e[n]._updateClamping()}),this))}function destroyBillboards(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}function removeBillboards(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],n=e._billboards,i=n.length;for(let e=0,r=0;e<i;++e){const i=n[e];defined(i)&&(i._index=r++,t.push(i))}e._billboards=t}}let getIndexBuffer$1;function getIndexBufferBatched$1(e){let t=e.cache.billboardCollection_indexBufferBatched;if(defined(t))return t;const n=new Uint16Array(98298);for(let e=0,t=0;e<98298;e+=6,t+=4)n[e]=t,n[e+1]=t+1,n[e+2]=t+2,n[e+3]=t+0,n[e+4]=t+2,n[e+5]=t+3;return t=Buffer$1.createIndexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=t,t}function getIndexBufferInstanced$1(e){let t=e.cache.billboardCollection_indexBufferInstanced;return defined(t)||(t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced$1(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return defined(t)||(t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}function createVAF$2(e,t,n,i,r,o){const a=[{index:attributeLocations$6.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[POSITION_INDEX$6]},{index:attributeLocations$6.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[POSITION_INDEX$6]},{index:attributeLocations$6.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[PIXEL_OFFSET_INDEX]},{index:attributeLocations$6.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[TRANSLUCENCY_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[COLOR_INDEX$4]},{index:attributeLocations$6.eyeOffset,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[EYE_OFFSET_INDEX]},{index:attributeLocations$6.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[SCALE_BY_DISTANCE_INDEX$2]},{index:attributeLocations$6.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$6.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[DISTANCE_DISPLAY_CONDITION_INDEX$2]},{index:attributeLocations$6.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[TEXTURE_COORDINATE_BOUNDS]}];i&&a.push({index:attributeLocations$6.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced$1(e)}),defined(r)&&a.push({index:attributeLocations$6.a_batchId,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,bufferUsage:BufferUsage$1.STATIC_DRAW}),o&&a.push({index:attributeLocations$6.sdf,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[SDF_INDEX]});return new VertexArrayFacade(e,a,i?t:4*t,i)}Object.defineProperties(BillboardCollection.prototype,{length:{get:function(){return removeBillboards(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}}),BillboardCollection.prototype.add=function(e){const t=new Billboard(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},BillboardCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},BillboardCollection.prototype.removeAll=function(){destroyBillboards(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},BillboardCollection.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},BillboardCollection.prototype.contains=function(e){return defined(e)&&e._billboardCollection===this},BillboardCollection.prototype.get=function(e){return removeBillboards(this),this._billboards[e]},BillboardCollection.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<NUMBER_OF_PROPERTIES$4;++i){const r=0===n[i]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[i]!==r,e[i]=r}return t};const writePositionScratch$2=new EncodedCartesian3;function writePositionScaleAndRotation(e,t,n,i,r){let o;const a=i[attributeLocations$6.positionHighAndScale],s=i[attributeLocations$6.positionLowAndRotation],c=r._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(c,writePositionScratch$2);const l=r.scale,u=r.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);const d=writePositionScratch$2.high,h=writePositionScratch$2.low;e._instanced?(o=r._index,a(o,d.x,d.y,d.z,l),s(o,h.x,h.y,h.z,u)):(o=4*r._index,a(o+0,d.x,d.y,d.z,l),a(o+1,d.x,d.y,d.z,l),a(o+2,d.x,d.y,d.z,l),a(o+3,d.x,d.y,d.z,l),s(o+0,h.x,h.y,h.z,u),s(o+1,h.x,h.y,h.z,u),s(o+2,h.x,h.y,h.z,u),s(o+3,h.x,h.y,h.z,u))}const scratchCartesian2$3=new Cartesian2,UPPER_BOUND=32768,LEFT_SHIFT16$1=65536,LEFT_SHIFT12=4096,LEFT_SHIFT8$1=256,LEFT_SHIFT7=128,LEFT_SHIFT5=32,LEFT_SHIFT3=8,LEFT_SHIFT2=4,RIGHT_SHIFT8=1/256,LOWER_LEFT=0,LOWER_RIGHT=2,UPPER_RIGHT=3,UPPER_LEFT=1;function writeCompressedAttrib0$1(e,t,n,i,r){let o;const a=i[attributeLocations$6.compressedAttribute0],s=r.pixelOffset,c=s.x,l=s.y,u=r._translate,d=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+d),Math.abs(-l+h));const p=r.horizontalOrigin;let f=r._verticalOrigin,m=r.show&&r.clusterShow;0===r.color.alpha&&(m=!1),f===VerticalOrigin$1.BASELINE&&(f=VerticalOrigin$1.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===HorizontalOrigin$1.CENTER,e._allVerticalCenter=e._allVerticalCenter&&f===VerticalOrigin$1.CENTER;let g=0,_=0,y=0,C=0;const T=r._imageIndex;if(-1!==T){const e=n[T];g=e.x,_=e.y,y=e.width,C=e.height}const S=g+y,A=_+C;let v=Math.floor(CesiumMath.clamp(c,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT7;v+=(p+1)*LEFT_SHIFT5,v+=(f+1)*LEFT_SHIFT3,v+=(m?1:0)*LEFT_SHIFT2;let E=Math.floor(CesiumMath.clamp(l,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1,b=Math.floor(CesiumMath.clamp(d,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8$1;const x=(CesiumMath.clamp(h,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*RIGHT_SHIFT8,P=Math.floor(x);E+=P,b+=Math.floor((x-P)*LEFT_SHIFT8$1),scratchCartesian2$3.x=g,scratchCartesian2$3.y=_;const D=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=S;const w=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.y=A;const M=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);scratchCartesian2$3.x=g;const I=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);e._instanced?(o=r._index,a(o,v,E,b,D)):(o=4*r._index,a(o+0,v+LOWER_LEFT,E,b,D),a(o+1,v+LOWER_RIGHT,E,b,w),a(o+2,v+UPPER_RIGHT,E,b,M),a(o+3,v+UPPER_LEFT,E,b,I))}function writeCompressedAttrib1$1(e,t,n,i,r){let o;const a=i[attributeLocations$6.compressedAttribute1],s=r.alignedAxis;Cartesian3.equals(s,Cartesian3.ZERO)||(e._shaderAlignedAxis=!0);let c=0,l=1,u=1,d=1;const h=r.translucencyByDistance;defined(h)&&(c=h.near,l=h.nearValue,u=h.far,d=h.farValue,1===l&&1===d||(e._shaderTranslucencyByDistance=!0));let p=0;const f=r._imageIndex;if(-1!==f){p=n[f].width}const m=e._textureAtlas.texture.width,g=Math.round(defaultValue(r.width,m*p));e._maxSize=Math.max(e._maxSize,g);let _=CesiumMath.clamp(g,0,LEFT_SHIFT16$1),y=0;Math.abs(Cartesian3.magnitudeSquared(s)-1)<CesiumMath.EPSILON6&&(y=AttributeCompression.octEncodeFloat(s)),l=CesiumMath.clamp(l,0,1),l=1===l?255:255*l|0,_=_*LEFT_SHIFT8$1+l,d=CesiumMath.clamp(d,0,1),d=1===d?255:255*d|0,y=y*LEFT_SHIFT8$1+d,e._instanced?(o=r._index,a(o,_,y,c,u)):(o=4*r._index,a(o+0,_,y,c,u),a(o+1,_,y,c,u),a(o+2,_,y,c,u),a(o+3,_,y,c,u))}function writeCompressedAttrib2(e,t,n,i,r){let o;const a=i[attributeLocations$6.compressedAttribute2],s=r.color,c=defined(e._batchTable)?Color.WHITE:r.getPickId(t.context).color,l=r.sizeInMeters?1:0,u=Math.abs(Cartesian3.magnitudeSquared(r.alignedAxis)-1)<CesiumMath.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&1===l;let d=0;const h=r._imageIndex;if(-1!==h){d=n[h].height}const p=e._textureAtlas.texture.dimensions,f=Math.round(defaultValue(r.height,p.y*d));e._maxSize=Math.max(e._maxSize,f);let m=defaultValue(r._labelHorizontalOrigin,-2);m+=2;const g=f*LEFT_SHIFT2+m;let _=Color.floatToByte(s.red),y=Color.floatToByte(s.green),C=Color.floatToByte(s.blue);const T=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+C;_=Color.floatToByte(c.red),y=Color.floatToByte(c.green),C=Color.floatToByte(c.blue);const S=_*LEFT_SHIFT16$1+y*LEFT_SHIFT8$1+C;let A=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(c.alpha)*LEFT_SHIFT8$1;A+=2*l+u,e._instanced?(o=r._index,a(o,T,S,A,g)):(o=4*r._index,a(o+0,T,S,A,g),a(o+1,T,S,A,g),a(o+2,T,S,A,g),a(o+3,T,S,A,g))}function writeEyeOffset(e,t,n,i,r){let o;const a=i[attributeLocations$6.eyeOffset],s=r.eyeOffset;let c=s.z;if(r._heightReference!==HeightReference$1.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(s.x),Math.abs(s.y),Math.abs(c)),e._instanced){let e=0,t=0;const i=r._imageIndex;if(-1!==i){const r=n[i];e=r.width,t=r.height}scratchCartesian2$3.x=e,scratchCartesian2$3.y=t;const l=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3);o=r._index,a(o,s.x,s.y,c,l)}else o=4*r._index,a(o+0,s.x,s.y,c,0),a(o+1,s.x,s.y,c,0),a(o+2,s.x,s.y,c,0),a(o+3,s.x,s.y,c,0)}function writeScaleByDistance$1(e,t,n,i,r){let o;const a=i[attributeLocations$6.scaleByDistance];let s=0,c=1,l=1,u=1;const d=r.scaleByDistance;defined(d)&&(s=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderScaleByDistance=!0)),e._instanced?(o=r._index,a(o,s,c,l,u)):(o=4*r._index,a(o+0,s,c,l,u),a(o+1,s,c,l,u),a(o+2,s,c,l,u),a(o+3,s,c,l,u))}function writePixelOffsetScaleByDistance(e,t,n,i,r){let o;const a=i[attributeLocations$6.pixelOffsetScaleByDistance];let s=0,c=1,l=1,u=1;const d=r.pixelOffsetScaleByDistance;defined(d)&&(s=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(o=r._index,a(o,s,c,l,u)):(o=4*r._index,a(o+0,s,c,l,u),a(o+1,s,c,l,u),a(o+2,s,c,l,u),a(o+3,s,c,l,u))}function writeCompressedAttribute3(e,t,n,i,r){let o;const a=i[attributeLocations$6.compressedAttribute3];let s=0,c=Number.MAX_VALUE;const l=r.distanceDisplayCondition;defined(l)&&(s=l.near,c=l.far,s*=s,c*=c,e._shaderDistanceDisplayCondition=!0);let u=r.disableDepthTestDistance;const d=r.heightReference===HeightReference$1.CLAMP_TO_GROUND&&t.context.depthTexture;let h,p;if(defined(u)||(u=d?5e3:0),u*=u,(d||u>0)&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),defined(r._labelDimensions))p=r._labelDimensions.x,h=r._labelDimensions.y;else{let t=0,i=0;const o=r._imageIndex;if(-1!==o){const e=n[o];t=e.height,i=e.width}h=Math.round(defaultValue(r.height,e._textureAtlas.texture.dimensions.y*t));const a=e._textureAtlas.texture.width;p=Math.round(defaultValue(r.width,a*i))}const f=Math.floor(CesiumMath.clamp(p,0,LEFT_SHIFT12)),m=Math.floor(CesiumMath.clamp(h,0,LEFT_SHIFT12)),g=f*LEFT_SHIFT12+m;e._instanced?(o=r._index,a(o,s,c,u,g)):(o=4*r._index,a(o+0,s,c,u,g),a(o+1,s,c,u,g),a(o+2,s,c,u,g),a(o+3,s,c,u,g))}function writeTextureCoordinateBoundsOrLabelTranslate(e,t,n,i,r){if(r.heightReference===HeightReference$1.CLAMP_TO_GROUND){const n=e._scene,i=t.context,r=t.globeTranslucencyState.translucent,o=defined(n.globe)&&n.globe.depthTestAgainstTerrain;e._shaderClampToGround=i.depthTexture&&!r&&o}let o;const a=i[attributeLocations$6.textureCoordinateBoundsOrLabelTranslate];if(ContextLimits.maximumVertexTextureImageUnits>0){let t=0,n=0;return defined(r._labelTranslate)&&(t=r._labelTranslate.x,n=r._labelTranslate.y),void(e._instanced?(o=r._index,a(o,t,n,0,0)):(o=4*r._index,a(o+0,t,n,0,0),a(o+1,t,n,0,0),a(o+2,t,n,0,0),a(o+3,t,n,0,0)))}let s=0,c=0,l=0,u=0;const d=r._imageIndex;if(-1!==d){const e=n[d];s=e.x,c=e.y,l=e.width,u=e.height}const h=s+l,p=c+u;e._instanced?(o=r._index,a(o,s,c,h,p)):(o=4*r._index,a(o+0,s,c,h,p),a(o+1,s,c,h,p),a(o+2,s,c,h,p),a(o+3,s,c,h,p))}function writeBatchId(e,t,n,i,r){if(!defined(e._batchTable))return;const o=i[attributeLocations$6.a_batchId],a=r._batchIndex;let s;e._instanced?(s=r._index,o(s,a)):(s=4*r._index,o(s+0,a),o(s+1,a),o(s+2,a),o(s+3,a))}function writeSDF(e,t,n,i,r){if(!e._sdf)return;let o;const a=i[attributeLocations$6.sdf],s=r.outlineColor,c=r.outlineWidth,l=Color.floatToByte(s.red),u=Color.floatToByte(s.green),d=Color.floatToByte(s.blue),h=l*LEFT_SHIFT16$1+u*LEFT_SHIFT8$1+d,p=c/SDFSettings$1.RADIUS,f=Color.floatToByte(s.alpha)*LEFT_SHIFT16$1+Color.floatToByte(p)*LEFT_SHIFT8$1;e._instanced?(o=r._index,a(o,h,f)):(o=4*r._index,a(o+0,h+LOWER_LEFT,f),a(o+1,h+LOWER_RIGHT,f),a(o+2,h+UPPER_RIGHT,f),a(o+3,h+UPPER_LEFT,f))}function writeBillboard(e,t,n,i,r){writePositionScaleAndRotation(e,t,n,i,r),writeCompressedAttrib0$1(e,t,n,i,r),writeCompressedAttrib1$1(e,t,n,i,r),writeCompressedAttrib2(e,t,n,i,r),writeEyeOffset(e,t,n,i,r),writeScaleByDistance$1(e,t,n,i,r),writePixelOffsetScaleByDistance(e,t,n,i,r),writeCompressedAttribute3(e,t,n,i,r),writeTextureCoordinateBoundsOrLabelTranslate(e,t,n,i,r),writeBatchId(e,t,n,i,r),writeSDF(e,t,n,i,r)}function recomputeActualPositions$1(e,t,n,i,r,o){let a;i.mode===SceneMode$1.SCENE3D?(a=e._baseVolume,e._boundingVolumeDirty=!0):a=e._baseVolume2D;const s=[];for(let e=0;e<n;++e){const n=t[e],c=n.position,l=Billboard._computeActualPosition(n,c,i,r);defined(l)&&(n._setActualPosition(l),o?s.push(l):BoundingSphere.expand(a,l,a))}o&&BoundingSphere.fromPoints(s,a)}function updateMode$2(e,t){const n=t.mode,i=e._billboards,r=e._billboardsToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==SceneMode$1.SCENE3D&&!Matrix4.equals(o,e.modelMatrix)?(e._mode=n,Matrix4.clone(e.modelMatrix,o),e._createVertexArray=!0,n!==SceneMode$1.SCENE3D&&n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,i,i.length,t,o,!0)):n===SceneMode$1.MORPHING?recomputeActualPositions$1(e,i,i.length,t,o,!0):n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,r,e._billboardsToUpdateIndex,t,o,!1)}function updateBoundingVolume$1(e,t,n){let i=1;e._allSizedInMeters&&0===e._maxPixelOffset||(i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let r=i*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(r*=.5);const o=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=r+o}function createDebugCommand(e,t){const n=t.createViewportQuadCommand("uniform sampler2D billboard_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n gl_FragColor = texture2D(billboard_texture, v_textureCoordinates); \n} \n",{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return n.pass=Pass$1.OVERLAY,n}const scratchWriterArray$2=[];function createBillboardPointCallback(e,t,n,i,r){return function(){const o=document.createElement("canvas"),a=r+2*i;o.height=o.width=a;const s=o.getContext("2d");return s.clearRect(0,0,a,a),0!==i&&(s.beginPath(),s.arc(a/2,a/2,a/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=n,s.fill(),e<1&&(s.save(),s.globalCompositeOperation="destination-out",s.beginPath(),s.arc(a/2,a/2,r/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle="black",s.fill(),s.restore())),s.beginPath(),s.arc(a/2,a/2,r/2,0,2*Math.PI,!0),s.closePath(),s.fillStyle=t,s.fill(),o}}function Cesium3DTilePointFeature(e,t,n,i,r){this._content=e,this._billboard=n,this._label=i,this._polyline=r,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),setBillboardImage(this)}BillboardCollection.prototype.update=function(e){if(removeBillboards(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,attributeLocations$6=this._instanced?attributeLocationsInstanced$1:attributeLocationsBatched$1,getIndexBuffer$1=this._instanced?getIndexBufferInstanced$1:getIndexBufferBatched$1;let r=this._textureAtlas;if(!defined(r)){r=this._textureAtlas=new TextureAtlas({context:i});for(let e=0;e<n;++e)t[e]._loadImage()}const o=r.textureCoordinates;if(0===o.length)return;updateMode$2(this,e),t=this._billboards,n=t.length;const a=this._billboardsToUpdate,s=this._billboardsToUpdateIndex,c=this._propertiesChanged,l=r.guid,u=this._createVertexArray||this._textureAtlasGUID!==l;let d;this._textureAtlasGUID=l;const h=e.passes,p=h.pick;if(u||!p&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<NUMBER_OF_PROPERTIES$4;++e)c[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=createVAF$2(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),d=this._vaf.writers;for(let t=0;t<n;++t){const n=this._billboards[t];n._dirty=!1,writeBillboard(this,e,o,d,n)}this._vaf.commit(getIndexBuffer$1(i))}this._billboardsToUpdateIndex=0}else if(s>0){const t=scratchWriterArray$2;t.length=0,(c[POSITION_INDEX$6]||c[ROTATION_INDEX]||c[SCALE_INDEX$2])&&t.push(writePositionScaleAndRotation),(c[IMAGE_INDEX_INDEX]||c[PIXEL_OFFSET_INDEX]||c[HORIZONTAL_ORIGIN_INDEX]||c[VERTICAL_ORIGIN_INDEX]||c[SHOW_INDEX$6])&&(t.push(writeCompressedAttrib0$1),this._instanced&&t.push(writeEyeOffset)),(c[IMAGE_INDEX_INDEX]||c[ALIGNED_AXIS_INDEX]||c[TRANSLUCENCY_BY_DISTANCE_INDEX$2])&&(t.push(writeCompressedAttrib1$1),t.push(writeCompressedAttrib2)),(c[IMAGE_INDEX_INDEX]||c[COLOR_INDEX$4])&&t.push(writeCompressedAttrib2),c[EYE_OFFSET_INDEX]&&t.push(writeEyeOffset),c[SCALE_BY_DISTANCE_INDEX$2]&&t.push(writeScaleByDistance$1),c[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX]&&t.push(writePixelOffsetScaleByDistance),(c[DISTANCE_DISPLAY_CONDITION_INDEX$2]||c[DISABLE_DEPTH_DISTANCE]||c[IMAGE_INDEX_INDEX]||c[POSITION_INDEX$6])&&t.push(writeCompressedAttribute3),(c[IMAGE_INDEX_INDEX]||c[POSITION_INDEX$6])&&t.push(writeTextureCoordinateBoundsOrLabelTranslate),c[SDF_INDEX]&&t.push(writeSDF);const r=t.length;if(d=this._vaf.writers,s/n>.1){for(let n=0;n<s;++n){const i=a[n];i._dirty=!1;for(let n=0;n<r;++n)t[n](this,e,o,d,i)}this._vaf.commit(getIndexBuffer$1(i))}else{for(let n=0;n<s;++n){const i=a[n];i._dirty=!1;for(let n=0;n<r;++n)t[n](this,e,o,d,i);this._instanced?this._vaf.subCommit(i._index,1):this._vaf.subCommit(4*i._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(s>1.5*n&&(a.length=n),!defined(this._vaf)||!defined(this._vaf.va))return;let f;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(m=this.modelMatrix,f=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):f=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume$1(this,e,f);const g=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,g){this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!0}):this._rsOpaque=void 0;const e=this._blendOption===BlendOption$1.TRANSLUCENT;this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:e?WebGLConstants$1.LEQUAL:WebGLConstants$1.LESS},depthMask:e,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0}let _,y,C,T,S;this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance;const A=ContextLimits.maximumVertexTextureImageUnits>0;if(g||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){_=BillboardCollectionVS,y=BillboardCollectionFS,S=[],defined(this._batchTable)&&(S.push("VECTOR_TILE"),_=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(_),y=this._batchTable.getFragmentShaderCallback(!1,void 0)(y)),C=new ShaderSource({defines:S,sources:[_]}),this._instanced&&C.defines.push("INSTANCED"),this._shaderRotation&&C.defines.push("ROTATION"),this._shaderAlignedAxis&&C.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&C.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&C.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&C.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&C.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&C.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(A?C.defines.push("VERTEX_DEPTH_CHECK"):C.defines.push("FRAGMENT_DEPTH_CHECK"));const e=1-SDFSettings$1.CUTOFF;this._sdf&&C.defines.push("SDF");const t=defined(this._batchTable)?"VECTOR_TILE":"";this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(T=new ShaderSource({defines:["OPAQUE",t],sources:[y]}),this._shaderClampToGround&&(A?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push("SDF_EDGE "+e)),this._sp=ShaderProgram.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6}),T=new ShaderSource({defines:["TRANSLUCENT",t],sources:[y]}),this._shaderClampToGround&&(A?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push("SDF_EDGE "+e)),this._spTranslucent=ShaderProgram.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.OPAQUE&&(T=new ShaderSource({defines:[t],sources:[y]}),this._shaderClampToGround&&(A?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push("SDF_EDGE "+e)),this._sp=ShaderProgram.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._blendOption===BlendOption$1.TRANSLUCENT&&(T=new ShaderSource({defines:[t],sources:[y]}),this._shaderClampToGround&&(A?T.defines.push("VERTEX_DEPTH_CHECK"):T.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(T.defines.push("SDF"),T.defines.push("SDF_EDGE "+e)),this._spTranslucent=ShaderProgram.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:attributeLocations$6})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}const v=e.commandList;if(h.render||h.pick){const t=this._colorCommands,i=this._blendOption===BlendOption$1.OPAQUE,r=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT,o=this._vaf.va,a=o.length;let s,c=this._uniforms;defined(this._batchTable)?(c=this._batchTable.getUniformMapCallback()(c),s=this._batchTable.getPickId()):s="v_pickColor",t.length=a;const l=r?2*a:a;for(let e=0;e<l;++e){let a=t[e];defined(a)||(a=t[e]=new DrawCommand);const l=i||r&&e%2==0;a.pass=l||!r?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,a.owner=this;const u=r?Math.floor(e/2):e;a.boundingVolume=f,a.modelMatrix=m,a.count=o[u].indicesCount,a.shaderProgram=l?this._sp:this._spTranslucent,a.uniformMap=c,a.vertexArray=o[u].va,a.renderState=l?this._rsOpaque:this._rsTranslucent,a.debugShowBoundingVolume=this.debugShowBoundingVolume,a.pickId=s,this._instanced&&(a.count=6,a.instanceCount=n),v.push(a)}this.debugShowTextureAtlas&&(defined(this.debugCommand)||(this.debugCommand=createDebugCommand(this,e.context)),v.push(this.debugCommand))}},BillboardCollection.prototype.isDestroyed=function(){return!1},BillboardCollection.prototype.destroy=function(){return defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyBillboards(this._billboards),destroyObject(this)};const scratchCartographic$b=new Cartographic;function setBillboardImage(e){const t=e._billboard;if(defined(e._billboardImage)&&e._billboardImage!==t.image)return void(t.image=e._billboardImage);if(defined(e._billboardImage))return;const n=defaultValue(e._color,Cesium3DTilePointFeature.defaultColor),i=defaultValue(e._pointOutlineColor,Cesium3DTilePointFeature.defaultPointOutlineColor),r=defaultValue(e._pointOutlineWidth,Cesium3DTilePointFeature.defaultPointOutlineWidth),o=defaultValue(e._pointSize,Cesium3DTilePointFeature.defaultPointSize),a=e._billboardColor,s=e._billboardOutlineColor,c=e._billboardOutlineWidth,l=e._billboardSize;if(Color.equals(n,a)&&Color.equals(i,s)&&r===c&&o===l)return;e._billboardColor=Color.clone(n,e._billboardColor),e._billboardOutlineColor=Color.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=r,e._billboardSize=o;const u=n.alpha,d=n.toCssColorString(),h=i.toCssColorString(),p=JSON.stringify([d,o,h,r]);t.setImage(p,createBillboardPointCallback(u,d,h,r,o))}Object.defineProperties(Cesium3DTilePointFeature.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=Color.clone(e,this._color),setBillboardImage(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,setBillboardImage(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Color.clone(e,this._pointOutlineColor),setBillboardImage(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,setBillboardImage(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){defined(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){const t=defaultValue(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,scratchCartographic$b);i.height=i.height-t+e;const r=n.cartographicToCartesian(i);this._billboard.position=r,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],r],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=Color.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&setBillboardImage(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}}),Cesium3DTilePointFeature.defaultColor=Color.WHITE,Cesium3DTilePointFeature.defaultPointOutlineColor=Color.BLACK,Cesium3DTilePointFeature.defaultPointOutlineWidth=0,Cesium3DTilePointFeature.defaultPointSize=8,Cesium3DTilePointFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTilePointFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyInherited=function(e){return Cesium3DTileFeature.getPropertyInherited(this._content,this._batchId,e)},Cesium3DTilePointFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTilePointFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var clamp_1=clamp;function clamp(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}var bitmapSdf=calcSDF,INF=1e20;function calcSDF(e,t){t||(t={});var n,i,r,o,a,s,c,l,u,d,h,p=null==t.cutoff?.25:t.cutoff,f=null==t.radius?8:t.radius,m=t.channel||0;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");n=t.width,i=t.height,o=e,s=t.stride?t.stride:Math.floor(e.length/n/i)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(c=(l=e).getContext("2d"),n=l.width,i=l.height,o=(u=c.getImageData(0,0,n,i)).data,s=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(c=e,n=(l=e.canvas).width,i=l.height,o=(u=c.getImageData(0,0,n,i)).data,s=4):window.ImageData&&e instanceof window.ImageData&&(u=e,n=e.width,i=e.height,o=u.data,s=4);if(r=Math.max(n,i),window.Uint8ClampedArray&&o instanceof window.Uint8ClampedArray||window.Uint8Array&&o instanceof window.Uint8Array)for(a=o,o=Array(n*i),d=0,h=a.length;d<h;d++)o[d]=a[d*s+m]/255;else if(1!==s)throw Error("Raw data can have only 1 value per pixel");var g=Array(n*i),_=Array(n*i),y=Array(r),C=Array(r),T=Array(r+1),S=Array(r);for(d=0,h=n*i;d<h;d++){var A=o[d];g[d]=1===A?0:0===A?INF:Math.pow(Math.max(0,.5-A),2),_[d]=1===A?INF:0===A?0:Math.pow(Math.max(0,A-.5),2)}edt(g,n,i,y,C,S,T),edt(_,n,i,y,C,S,T);var v=window.Float32Array?new Float32Array(n*i):new Array(n*i);for(d=0,h=n*i;d<h;d++)v[d]=clamp_1(1-((g[d]-_[d])/f+p),0,1);return v}function edt(e,t,n,i,r,o,a){for(var s=0;s<t;s++){for(var c=0;c<n;c++)i[c]=e[c*t+s];for(edt1d(i,r,o,a,n),c=0;c<n;c++)e[c*t+s]=r[c]}for(c=0;c<n;c++){for(s=0;s<t;s++)i[s]=e[c*t+s];for(edt1d(i,r,o,a,t),s=0;s<t;s++)e[c*t+s]=Math.sqrt(r[s])}}function edt1d(e,t,n,i,r){n[0]=0,i[0]=-INF,i[1]=+INF;for(var o=1,a=0;o<r;o++){for(var s=(e[o]+o*o-(e[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);s<=i[a];)a--,s=(e[o]+o*o-(e[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);n[++a]=o,i[a]=s,i[a+1]=+INF}for(o=0,a=0;o<r;o++){for(;i[a+1]<o;)a++;t[o]=(o-n[a])*(o-n[a])+e[n[a]]}}const LabelStyle={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2};var LabelStyle$1=Object.freeze(LabelStyle);const fontInfoCache={};let fontInfoCacheLength=0;const fontInfoCacheMaxSize=256,defaultBackgroundColor$2=new Color(.165,.165,.165,.8),defaultBackgroundPadding$1=new Cartesian2(7,5),textTypes=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function rebindAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function repositionAllGlyphs$1(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function getCSSValue(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function parseFont(e){let t=fontInfoCache[e._font];if(!defined(t)){const n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(getCSSValue(n,"line-height"));isNaN(i)&&(i=void 0),t={family:getCSSValue(n,"font-family"),size:getCSSValue(n,"font-size").replace("px",""),style:getCSSValue(n,"font-style"),weight:getCSSValue(n,"font-weight"),lineHeight:i},document.body.removeChild(n),fontInfoCacheLength<fontInfoCacheMaxSize&&(fontInfoCache[e._font]=t,fontInfoCacheLength++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Label(e,t){let n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,i=e.pixelOffsetScaleByDistance,r=e.scaleByDistance,o=e.distanceDisplayCondition;defined(n)&&(n=NearFarScalar.clone(n)),defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(o)&&(o=DistanceDisplayCondition.clone(o)),this._renderedText=void 0,this._text=void 0,this._show=defaultValue(e.show,!0),this._font=defaultValue(e.font,"30px sans-serif"),this._fillColor=Color.clone(defaultValue(e.fillColor,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,1),this._showBackground=defaultValue(e.showBackground,!1),this._backgroundColor=Color.clone(defaultValue(e.backgroundColor,defaultBackgroundColor$2)),this._backgroundPadding=Cartesian2.clone(defaultValue(e.backgroundPadding,defaultBackgroundPadding$1)),this._style=defaultValue(e.style,LabelStyle$1.FILL),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.BASELINE),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.LEFT),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._scale=defaultValue(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=r,this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._distanceDisplayCondition=o,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=defaultValue(e.text,""),this._relativeSize=1,parseFont(this),this._updateClamping()}function convertTextToTypes(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,r=[];let o="",a=textTypes.LTR,s="";const c=e.length;for(let l=0;l<c;++l){const c=e.charAt(l);s=t.test(c)?textTypes.RTL:n.test(c)?textTypes.LTR:i.test(c)?textTypes.BRACKETS:textTypes.WEAK,0===l&&(a=s),a===s&&s!==textTypes.BRACKETS?o+=c:(""!==o&&r.push({Type:a,Word:o}),a=s,o=c)}return r.push({Type:s,Word:o}),r}function reverseWord(e){return e.split("").reverse().join("")}function spliceWord(e,t,n){return e.slice(0,t)+n+e.slice(t)}function reverseBrackets(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}Object.defineProperties(Label.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n].billboard;defined(i)&&(i.show=e)}const n=this._backgroundBillboard;defined(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){const t=this._position;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t].billboard;defined(i)&&(i.position=e)}const i=this._backgroundBillboard;defined(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n].billboard;defined(i)&&(i.heightReference=e)}const n=this._backgroundBillboard;defined(n)&&(n.heightReference=e),repositionAllGlyphs$1(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=Label.enableRightToLeftDetection?reverseRtl(t):t,rebindAllGlyphs$1(this)}}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,rebindAllGlyphs$1(this),parseFont(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){const t=this._fillColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs$1(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,rebindAllGlyphs$1(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){this._showBackground!==e&&(this._showBackground=e,rebindAllGlyphs$1(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){const t=this._backgroundColor;if(!Color.equals(t,e)){Color.clone(e,t);const n=this._backgroundBillboard;defined(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){const t=this._backgroundPadding;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),repositionAllGlyphs$1(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,rebindAllGlyphs$1(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){const t=this._pixelOffset;if(!Cartesian2.equals(t,e)){Cartesian2.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t];defined(i.billboard)&&(i.billboard.pixelOffset=e)}const i=this._backgroundBillboard;defined(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;if(!NearFarScalar.equals(t,e)){this._translucencyByDistance=NearFarScalar.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t];defined(i.billboard)&&(i.billboard.translucencyByDistance=e)}const i=this._backgroundBillboard;defined(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){const t=this._pixelOffsetScaleByDistance;if(!NearFarScalar.equals(t,e)){this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t];defined(i.billboard)&&(i.billboard.pixelOffsetScaleByDistance=e)}const i=this._backgroundBillboard;defined(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;if(!NearFarScalar.equals(t,e)){this._scaleByDistance=NearFarScalar.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t];defined(i.billboard)&&(i.billboard.scaleByDistance=e)}const i=this._backgroundBillboard;defined(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){const t=this._eyeOffset;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);const n=this._glyphs;for(let t=0,i=n.length;t<i;t++){const i=n[t];defined(i.billboard)&&(i.billboard.eyeOffset=e)}const i=this._backgroundBillboard;defined(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,repositionAllGlyphs$1(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.verticalOrigin=e)}const n=this._backgroundBillboard;defined(n)&&(n.verticalOrigin=e),repositionAllGlyphs$1(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.scale=e*this._relativeSize)}const n=this._backgroundBillboard;defined(n)&&(n.scale=e*this._relativeSize),repositionAllGlyphs$1(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.distanceDisplayCondition=e)}const n=this._backgroundBillboard;defined(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){this._disableDepthTestDistance=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.disableDepthTestDistance=e)}const n=this._backgroundBillboard;defined(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.id=e)}const n=this._backgroundBillboard;defined(n)&&(n.id=e)}}},pickId:{get:function(){if(0!==this._glyphs.length&&defined(this._glyphs[0].billboard))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard._clampedPosition=e)}const n=this._backgroundBillboard;defined(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let n=0,i=t.length;n<i;n++){const i=t[n];defined(i.billboard)&&(i.billboard.clusterShow=e)}const n=this._backgroundBillboard;defined(n)&&(n.clusterShow=e)}}}}),Label.prototype._updateClamping=function(){Billboard._updateClamping(this._labelCollection,this)},Label.prototype.computeScreenSpacePosition=function(e,t){defined(t)||(t=new Cartesian2);const n=this._labelCollection.modelMatrix,i=defined(this._actualClampedPosition)?this._actualClampedPosition:this._position;return Billboard._computeScreenSpacePosition(n,i,this._eyeOffset,this._pixelOffset,e,t)},Label.getScreenSpaceBoundingBox=function(e,t,n){let i=0,r=0,o=0,a=0;const s=e.totalScale,c=e._backgroundBillboard;if(defined(c))i=t.x+c._translate.x,r=t.y-c._translate.y,o=c.width*s,a=c.height*s,e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?r-=a:e.verticalOrigin===VerticalOrigin$1.CENTER&&(r-=.5*a);else{i=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;let n=0,c=0;const l=e._glyphs,u=l.length;for(let o=0;o<u;++o){const a=l[o],u=a.billboard;if(!defined(u))continue;const d=t.x+u._translate.x;let h=t.y-u._translate.y;const p=a.dimensions.width*s,f=a.dimensions.height*s;e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?h-=f:e.verticalOrigin===VerticalOrigin$1.CENTER&&(h-=.5*f),e._verticalOrigin===VerticalOrigin$1.TOP?h+=SDFSettings$1.PADDING*s:e._verticalOrigin!==VerticalOrigin$1.BOTTOM&&e._verticalOrigin!==VerticalOrigin$1.BASELINE||(h-=SDFSettings$1.PADDING*s),i=Math.min(i,d),r=Math.min(r,h),n=Math.max(n,d+p),c=Math.max(c,h+f)}o=n-i,a=c-r}return defined(n)||(n=new BoundingRectangle),n.x=i,n.y=r,n.width=o,n.height=a,n},Label.prototype.equals=function(e){return this===e||defined(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._fillColor,e._fillColor)&&Color.equals(this._outlineColor,e._outlineColor)&&Color.equals(this._backgroundColor,e._backgroundColor)&&Cartesian2.equals(this._backgroundPadding,e._backgroundPadding)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id},Label.prototype.isDestroyed=function(){return!1},Label.enableRightToLeftDetection=!1;const hebrew="א-ת",arabic="؀-ۿݐ-ݿࢠ-ࣿ",rtlChars=new RegExp("["+hebrew+arabic+"]");function reverseRtl(e){const t=e.split("\n");let n="";for(let e=0;e<t.length;e++){const i=t[e],r=rtlChars.test(i.charAt(0)),o=convertTextToTypes(i,rtlChars);let a=0,s="";for(let e=0;e<o.length;++e){const t=o[e],n=t.Type===textTypes.BRACKETS?reverseBrackets(t.Word):reverseWord(t.Word);r?t.Type===textTypes.RTL?(s=n+s,a=0):t.Type===textTypes.LTR?(s=spliceWord(s,a,t.Word),a+=t.Word.length):t.Type!==textTypes.WEAK&&t.Type!==textTypes.BRACKETS||(t.Type===textTypes.WEAK&&o[e-1].Type===textTypes.BRACKETS?s=n+s:o[e-1].Type===textTypes.RTL?(s=n+s,a=0):o.length>e+1?o[e+1].Type===textTypes.RTL?(s=n+s,a=0):(s=spliceWord(s,a,t.Word),a+=t.Word.length):s=spliceWord(s,0,n)):t.Type===textTypes.RTL?s=spliceWord(s,a,n):t.Type===textTypes.LTR?(s+=t.Word,a=s.length):t.Type!==textTypes.WEAK&&t.Type!==textTypes.BRACKETS||(e>0&&o[e-1].Type===textTypes.RTL?o.length>e+1?o[e+1].Type===textTypes.RTL?s=spliceWord(s,a,n):(s+=t.Word,a=s.length):s+=t.Word:(s+=t.Word,a=s.length))}n+=s,e<t.length-1&&(n+="\n")}return n}var graphemeSplitter=createCommonjsModule((function(e){e.exports&&(e.exports=function(){var e=3,t=4,n=12,i=13,r=16,o=17;function a(e,t){void 0===t&&(t=0);var n=e.charCodeAt(t);if(55296<=n&&n<=56319&&t<e.length-1){var i=n;return 56320<=(r=e.charCodeAt(t+1))&&r<=57343?1024*(i-55296)+(r-56320)+65536:i}if(56320<=n&&n<=57343&&t>=1){var r=n;return 55296<=(i=e.charCodeAt(t-1))&&i<=56319?1024*(i-55296)+(r-56320)+65536:r}return n}function s(a,s,c){var l=[a].concat(s).concat([c]),u=l[l.length-2],d=c,h=l.lastIndexOf(14);if(h>1&&l.slice(1,h).every((function(t){return t==e}))&&-1==[e,i,o].indexOf(a))return 2;var p=l.lastIndexOf(t);if(p>0&&l.slice(1,p).every((function(e){return e==t}))&&-1==[n,t].indexOf(u))return l.filter((function(e){return e==t})).length%2==1?3:4;if(0==u&&1==d)return 0;if(2==u||0==u||1==u)return 14==d&&s.every((function(t){return t==e}))?2:1;if(2==d||0==d||1==d)return 1;if(6==u&&(6==d||7==d||9==d||10==d))return 0;if(!(9!=u&&7!=u||7!=d&&8!=d))return 0;if((10==u||8==u)&&8==d)return 0;if(d==e||15==d)return 0;if(5==d)return 0;if(u==n)return 0;var f=-1!=l.indexOf(e)?l.lastIndexOf(e)-1:l.length-2;return-1!=[i,o].indexOf(l[f])&&l.slice(f+1,-1).every((function(t){return t==e}))&&14==d||15==u&&-1!=[r,o].indexOf(d)?0:-1!=s.indexOf(t)?2:u==t&&d==t?0:1}function c(a){return 1536<=a&&a<=1541||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&a<=70083||72250==a||72326<=a&&a<=72329||73030==a?n:13==a?0:10==a?1:0<=a&&a<=9||11<=a&&a<=12||14<=a&&a<=31||127<=a&&a<=159||173==a||1564==a||6158==a||8203==a||8206<=a&&a<=8207||8232==a||8233==a||8234<=a&&a<=8238||8288<=a&&a<=8292||8293==a||8294<=a&&a<=8303||55296<=a&&a<=57343||65279==a||65520<=a&&a<=65528||65529<=a&&a<=65531||113824<=a&&a<=113827||119155<=a&&a<=119162||917504==a||917505==a||917506<=a&&a<=917535||917632<=a&&a<=917759||918e3<=a&&a<=921599?2:768<=a&&a<=879||1155<=a&&a<=1159||1160<=a&&a<=1161||1425<=a&&a<=1469||1471==a||1473<=a&&a<=1474||1476<=a&&a<=1477||1479==a||1552<=a&&a<=1562||1611<=a&&a<=1631||1648==a||1750<=a&&a<=1756||1759<=a&&a<=1764||1767<=a&&a<=1768||1770<=a&&a<=1773||1809==a||1840<=a&&a<=1866||1958<=a&&a<=1968||2027<=a&&a<=2035||2070<=a&&a<=2073||2075<=a&&a<=2083||2085<=a&&a<=2087||2089<=a&&a<=2093||2137<=a&&a<=2139||2260<=a&&a<=2273||2275<=a&&a<=2306||2362==a||2364==a||2369<=a&&a<=2376||2381==a||2385<=a&&a<=2391||2402<=a&&a<=2403||2433==a||2492==a||2494==a||2497<=a&&a<=2500||2509==a||2519==a||2530<=a&&a<=2531||2561<=a&&a<=2562||2620==a||2625<=a&&a<=2626||2631<=a&&a<=2632||2635<=a&&a<=2637||2641==a||2672<=a&&a<=2673||2677==a||2689<=a&&a<=2690||2748==a||2753<=a&&a<=2757||2759<=a&&a<=2760||2765==a||2786<=a&&a<=2787||2810<=a&&a<=2815||2817==a||2876==a||2878==a||2879==a||2881<=a&&a<=2884||2893==a||2902==a||2903==a||2914<=a&&a<=2915||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&a<=3136||3142<=a&&a<=3144||3146<=a&&a<=3149||3157<=a&&a<=3158||3170<=a&&a<=3171||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&a<=3277||3285<=a&&a<=3286||3298<=a&&a<=3299||3328<=a&&a<=3329||3387<=a&&a<=3388||3390==a||3393<=a&&a<=3396||3405==a||3415==a||3426<=a&&a<=3427||3530==a||3535==a||3538<=a&&a<=3540||3542==a||3551==a||3633==a||3636<=a&&a<=3642||3655<=a&&a<=3662||3761==a||3764<=a&&a<=3769||3771<=a&&a<=3772||3784<=a&&a<=3789||3864<=a&&a<=3865||3893==a||3895==a||3897==a||3953<=a&&a<=3966||3968<=a&&a<=3972||3974<=a&&a<=3975||3981<=a&&a<=3991||3993<=a&&a<=4028||4038==a||4141<=a&&a<=4144||4146<=a&&a<=4151||4153<=a&&a<=4154||4157<=a&&a<=4158||4184<=a&&a<=4185||4190<=a&&a<=4192||4209<=a&&a<=4212||4226==a||4229<=a&&a<=4230||4237==a||4253==a||4957<=a&&a<=4959||5906<=a&&a<=5908||5938<=a&&a<=5940||5970<=a&&a<=5971||6002<=a&&a<=6003||6068<=a&&a<=6069||6071<=a&&a<=6077||6086==a||6089<=a&&a<=6099||6109==a||6155<=a&&a<=6157||6277<=a&&a<=6278||6313==a||6432<=a&&a<=6434||6439<=a&&a<=6440||6450==a||6457<=a&&a<=6459||6679<=a&&a<=6680||6683==a||6742==a||6744<=a&&a<=6750||6752==a||6754==a||6757<=a&&a<=6764||6771<=a&&a<=6780||6783==a||6832<=a&&a<=6845||6846==a||6912<=a&&a<=6915||6964==a||6966<=a&&a<=6970||6972==a||6978==a||7019<=a&&a<=7027||7040<=a&&a<=7041||7074<=a&&a<=7077||7080<=a&&a<=7081||7083<=a&&a<=7085||7142==a||7144<=a&&a<=7145||7149==a||7151<=a&&a<=7153||7212<=a&&a<=7219||7222<=a&&a<=7223||7376<=a&&a<=7378||7380<=a&&a<=7392||7394<=a&&a<=7400||7405==a||7412==a||7416<=a&&a<=7417||7616<=a&&a<=7673||7675<=a&&a<=7679||8204==a||8400<=a&&a<=8412||8413<=a&&a<=8416||8417==a||8418<=a&&a<=8420||8421<=a&&a<=8432||11503<=a&&a<=11505||11647==a||11744<=a&&a<=11775||12330<=a&&a<=12333||12334<=a&&a<=12335||12441<=a&&a<=12442||42607==a||42608<=a&&a<=42610||42612<=a&&a<=42621||42654<=a&&a<=42655||42736<=a&&a<=42737||43010==a||43014==a||43019==a||43045<=a&&a<=43046||43204<=a&&a<=43205||43232<=a&&a<=43249||43302<=a&&a<=43309||43335<=a&&a<=43345||43392<=a&&a<=43394||43443==a||43446<=a&&a<=43449||43452==a||43493==a||43561<=a&&a<=43566||43569<=a&&a<=43570||43573<=a&&a<=43574||43587==a||43596==a||43644==a||43696==a||43698<=a&&a<=43700||43703<=a&&a<=43704||43710<=a&&a<=43711||43713==a||43756<=a&&a<=43757||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&a<=65039||65056<=a&&a<=65071||65438<=a&&a<=65439||66045==a||66272==a||66422<=a&&a<=66426||68097<=a&&a<=68099||68101<=a&&a<=68102||68108<=a&&a<=68111||68152<=a&&a<=68154||68159==a||68325<=a&&a<=68326||69633==a||69688<=a&&a<=69702||69759<=a&&a<=69761||69811<=a&&a<=69814||69817<=a&&a<=69818||69888<=a&&a<=69890||69927<=a&&a<=69931||69933<=a&&a<=69940||70003==a||70016<=a&&a<=70017||70070<=a&&a<=70078||70090<=a&&a<=70092||70191<=a&&a<=70193||70196==a||70198<=a&&a<=70199||70206==a||70367==a||70371<=a&&a<=70378||70400<=a&&a<=70401||70460==a||70462==a||70464==a||70487==a||70502<=a&&a<=70508||70512<=a&&a<=70516||70712<=a&&a<=70719||70722<=a&&a<=70724||70726==a||70832==a||70835<=a&&a<=70840||70842==a||70845==a||70847<=a&&a<=70848||70850<=a&&a<=70851||71087==a||71090<=a&&a<=71093||71100<=a&&a<=71101||71103<=a&&a<=71104||71132<=a&&a<=71133||71219<=a&&a<=71226||71229==a||71231<=a&&a<=71232||71339==a||71341==a||71344<=a&&a<=71349||71351==a||71453<=a&&a<=71455||71458<=a&&a<=71461||71463<=a&&a<=71467||72193<=a&&a<=72198||72201<=a&&a<=72202||72243<=a&&a<=72248||72251<=a&&a<=72254||72263==a||72273<=a&&a<=72278||72281<=a&&a<=72283||72330<=a&&a<=72342||72344<=a&&a<=72345||72752<=a&&a<=72758||72760<=a&&a<=72765||72767==a||72850<=a&&a<=72871||72874<=a&&a<=72880||72882<=a&&a<=72883||72885<=a&&a<=72886||73009<=a&&a<=73014||73018==a||73020<=a&&a<=73021||73023<=a&&a<=73029||73031==a||92912<=a&&a<=92916||92976<=a&&a<=92982||94095<=a&&a<=94098||113821<=a&&a<=113822||119141==a||119143<=a&&a<=119145||119150<=a&&a<=119154||119163<=a&&a<=119170||119173<=a&&a<=119179||119210<=a&&a<=119213||119362<=a&&a<=119364||121344<=a&&a<=121398||121403<=a&&a<=121452||121461==a||121476==a||121499<=a&&a<=121503||121505<=a&&a<=121519||122880<=a&&a<=122886||122888<=a&&a<=122904||122907<=a&&a<=122913||122915<=a&&a<=122916||122918<=a&&a<=122922||125136<=a&&a<=125142||125252<=a&&a<=125258||917536<=a&&a<=917631||917760<=a&&a<=917999?e:127462<=a&&a<=127487?t:2307==a||2363==a||2366<=a&&a<=2368||2377<=a&&a<=2380||2382<=a&&a<=2383||2434<=a&&a<=2435||2495<=a&&a<=2496||2503<=a&&a<=2504||2507<=a&&a<=2508||2563==a||2622<=a&&a<=2624||2691==a||2750<=a&&a<=2752||2761==a||2763<=a&&a<=2764||2818<=a&&a<=2819||2880==a||2887<=a&&a<=2888||2891<=a&&a<=2892||3007==a||3009<=a&&a<=3010||3014<=a&&a<=3016||3018<=a&&a<=3020||3073<=a&&a<=3075||3137<=a&&a<=3140||3202<=a&&a<=3203||3262==a||3264<=a&&a<=3265||3267<=a&&a<=3268||3271<=a&&a<=3272||3274<=a&&a<=3275||3330<=a&&a<=3331||3391<=a&&a<=3392||3398<=a&&a<=3400||3402<=a&&a<=3404||3458<=a&&a<=3459||3536<=a&&a<=3537||3544<=a&&a<=3550||3570<=a&&a<=3571||3635==a||3763==a||3902<=a&&a<=3903||3967==a||4145==a||4155<=a&&a<=4156||4182<=a&&a<=4183||4228==a||6070==a||6078<=a&&a<=6085||6087<=a&&a<=6088||6435<=a&&a<=6438||6441<=a&&a<=6443||6448<=a&&a<=6449||6451<=a&&a<=6456||6681<=a&&a<=6682||6741==a||6743==a||6765<=a&&a<=6770||6916==a||6965==a||6971==a||6973<=a&&a<=6977||6979<=a&&a<=6980||7042==a||7073==a||7078<=a&&a<=7079||7082==a||7143==a||7146<=a&&a<=7148||7150==a||7154<=a&&a<=7155||7204<=a&&a<=7211||7220<=a&&a<=7221||7393==a||7410<=a&&a<=7411||7415==a||43043<=a&&a<=43044||43047==a||43136<=a&&a<=43137||43188<=a&&a<=43203||43346<=a&&a<=43347||43395==a||43444<=a&&a<=43445||43450<=a&&a<=43451||43453<=a&&a<=43456||43567<=a&&a<=43568||43571<=a&&a<=43572||43597==a||43755==a||43758<=a&&a<=43759||43765==a||44003<=a&&a<=44004||44006<=a&&a<=44007||44009<=a&&a<=44010||44012==a||69632==a||69634==a||69762==a||69808<=a&&a<=69810||69815<=a&&a<=69816||69932==a||70018==a||70067<=a&&a<=70069||70079<=a&&a<=70080||70188<=a&&a<=70190||70194<=a&&a<=70195||70197==a||70368<=a&&a<=70370||70402<=a&&a<=70403||70463==a||70465<=a&&a<=70468||70471<=a&&a<=70472||70475<=a&&a<=70477||70498<=a&&a<=70499||70709<=a&&a<=70711||70720<=a&&a<=70721||70725==a||70833<=a&&a<=70834||70841==a||70843<=a&&a<=70844||70846==a||70849==a||71088<=a&&a<=71089||71096<=a&&a<=71099||71102==a||71216<=a&&a<=71218||71227<=a&&a<=71228||71230==a||71340==a||71342<=a&&a<=71343||71350==a||71456<=a&&a<=71457||71462==a||72199<=a&&a<=72200||72249==a||72279<=a&&a<=72280||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&a<=94078||119142==a||119149==a?5:4352<=a&&a<=4447||43360<=a&&a<=43388?6:4448<=a&&a<=4519||55216<=a&&a<=55238?7:4520<=a&&a<=4607||55243<=a&&a<=55291?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a||45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468==a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47e3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a||47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296==a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a||50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124==a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a||53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54e3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952==a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&a<=44059||44061<=a&&a<=44087||44089<=a&&a<=44115||44117<=a&&a<=44143||44145<=a&&a<=44171||44173<=a&&a<=44199||44201<=a&&a<=44227||44229<=a&&a<=44255||44257<=a&&a<=44283||44285<=a&&a<=44311||44313<=a&&a<=44339||44341<=a&&a<=44367||44369<=a&&a<=44395||44397<=a&&a<=44423||44425<=a&&a<=44451||44453<=a&&a<=44479||44481<=a&&a<=44507||44509<=a&&a<=44535||44537<=a&&a<=44563||44565<=a&&a<=44591||44593<=a&&a<=44619||44621<=a&&a<=44647||44649<=a&&a<=44675||44677<=a&&a<=44703||44705<=a&&a<=44731||44733<=a&&a<=44759||44761<=a&&a<=44787||44789<=a&&a<=44815||44817<=a&&a<=44843||44845<=a&&a<=44871||44873<=a&&a<=44899||44901<=a&&a<=44927||44929<=a&&a<=44955||44957<=a&&a<=44983||44985<=a&&a<=45011||45013<=a&&a<=45039||45041<=a&&a<=45067||45069<=a&&a<=45095||45097<=a&&a<=45123||45125<=a&&a<=45151||45153<=a&&a<=45179||45181<=a&&a<=45207||45209<=a&&a<=45235||45237<=a&&a<=45263||45265<=a&&a<=45291||45293<=a&&a<=45319||45321<=a&&a<=45347||45349<=a&&a<=45375||45377<=a&&a<=45403||45405<=a&&a<=45431||45433<=a&&a<=45459||45461<=a&&a<=45487||45489<=a&&a<=45515||45517<=a&&a<=45543||45545<=a&&a<=45571||45573<=a&&a<=45599||45601<=a&&a<=45627||45629<=a&&a<=45655||45657<=a&&a<=45683||45685<=a&&a<=45711||45713<=a&&a<=45739||45741<=a&&a<=45767||45769<=a&&a<=45795||45797<=a&&a<=45823||45825<=a&&a<=45851||45853<=a&&a<=45879||45881<=a&&a<=45907||45909<=a&&a<=45935||45937<=a&&a<=45963||45965<=a&&a<=45991||45993<=a&&a<=46019||46021<=a&&a<=46047||46049<=a&&a<=46075||46077<=a&&a<=46103||46105<=a&&a<=46131||46133<=a&&a<=46159||46161<=a&&a<=46187||46189<=a&&a<=46215||46217<=a&&a<=46243||46245<=a&&a<=46271||46273<=a&&a<=46299||46301<=a&&a<=46327||46329<=a&&a<=46355||46357<=a&&a<=46383||46385<=a&&a<=46411||46413<=a&&a<=46439||46441<=a&&a<=46467||46469<=a&&a<=46495||46497<=a&&a<=46523||46525<=a&&a<=46551||46553<=a&&a<=46579||46581<=a&&a<=46607||46609<=a&&a<=46635||46637<=a&&a<=46663||46665<=a&&a<=46691||46693<=a&&a<=46719||46721<=a&&a<=46747||46749<=a&&a<=46775||46777<=a&&a<=46803||46805<=a&&a<=46831||46833<=a&&a<=46859||46861<=a&&a<=46887||46889<=a&&a<=46915||46917<=a&&a<=46943||46945<=a&&a<=46971||46973<=a&&a<=46999||47001<=a&&a<=47027||47029<=a&&a<=47055||47057<=a&&a<=47083||47085<=a&&a<=47111||47113<=a&&a<=47139||47141<=a&&a<=47167||47169<=a&&a<=47195||47197<=a&&a<=47223||47225<=a&&a<=47251||47253<=a&&a<=47279||47281<=a&&a<=47307||47309<=a&&a<=47335||47337<=a&&a<=47363||47365<=a&&a<=47391||47393<=a&&a<=47419||47421<=a&&a<=47447||47449<=a&&a<=47475||47477<=a&&a<=47503||47505<=a&&a<=47531||47533<=a&&a<=47559||47561<=a&&a<=47587||47589<=a&&a<=47615||47617<=a&&a<=47643||47645<=a&&a<=47671||47673<=a&&a<=47699||47701<=a&&a<=47727||47729<=a&&a<=47755||47757<=a&&a<=47783||47785<=a&&a<=47811||47813<=a&&a<=47839||47841<=a&&a<=47867||47869<=a&&a<=47895||47897<=a&&a<=47923||47925<=a&&a<=47951||47953<=a&&a<=47979||47981<=a&&a<=48007||48009<=a&&a<=48035||48037<=a&&a<=48063||48065<=a&&a<=48091||48093<=a&&a<=48119||48121<=a&&a<=48147||48149<=a&&a<=48175||48177<=a&&a<=48203||48205<=a&&a<=48231||48233<=a&&a<=48259||48261<=a&&a<=48287||48289<=a&&a<=48315||48317<=a&&a<=48343||48345<=a&&a<=48371||48373<=a&&a<=48399||48401<=a&&a<=48427||48429<=a&&a<=48455||48457<=a&&a<=48483||48485<=a&&a<=48511||48513<=a&&a<=48539||48541<=a&&a<=48567||48569<=a&&a<=48595||48597<=a&&a<=48623||48625<=a&&a<=48651||48653<=a&&a<=48679||48681<=a&&a<=48707||48709<=a&&a<=48735||48737<=a&&a<=48763||48765<=a&&a<=48791||48793<=a&&a<=48819||48821<=a&&a<=48847||48849<=a&&a<=48875||48877<=a&&a<=48903||48905<=a&&a<=48931||48933<=a&&a<=48959||48961<=a&&a<=48987||48989<=a&&a<=49015||49017<=a&&a<=49043||49045<=a&&a<=49071||49073<=a&&a<=49099||49101<=a&&a<=49127||49129<=a&&a<=49155||49157<=a&&a<=49183||49185<=a&&a<=49211||49213<=a&&a<=49239||49241<=a&&a<=49267||49269<=a&&a<=49295||49297<=a&&a<=49323||49325<=a&&a<=49351||49353<=a&&a<=49379||49381<=a&&a<=49407||49409<=a&&a<=49435||49437<=a&&a<=49463||49465<=a&&a<=49491||49493<=a&&a<=49519||49521<=a&&a<=49547||49549<=a&&a<=49575||49577<=a&&a<=49603||49605<=a&&a<=49631||49633<=a&&a<=49659||49661<=a&&a<=49687||49689<=a&&a<=49715||49717<=a&&a<=49743||49745<=a&&a<=49771||49773<=a&&a<=49799||49801<=a&&a<=49827||49829<=a&&a<=49855||49857<=a&&a<=49883||49885<=a&&a<=49911||49913<=a&&a<=49939||49941<=a&&a<=49967||49969<=a&&a<=49995||49997<=a&&a<=50023||50025<=a&&a<=50051||50053<=a&&a<=50079||50081<=a&&a<=50107||50109<=a&&a<=50135||50137<=a&&a<=50163||50165<=a&&a<=50191||50193<=a&&a<=50219||50221<=a&&a<=50247||50249<=a&&a<=50275||50277<=a&&a<=50303||50305<=a&&a<=50331||50333<=a&&a<=50359||50361<=a&&a<=50387||50389<=a&&a<=50415||50417<=a&&a<=50443||50445<=a&&a<=50471||50473<=a&&a<=50499||50501<=a&&a<=50527||50529<=a&&a<=50555||50557<=a&&a<=50583||50585<=a&&a<=50611||50613<=a&&a<=50639||50641<=a&&a<=50667||50669<=a&&a<=50695||50697<=a&&a<=50723||50725<=a&&a<=50751||50753<=a&&a<=50779||50781<=a&&a<=50807||50809<=a&&a<=50835||50837<=a&&a<=50863||50865<=a&&a<=50891||50893<=a&&a<=50919||50921<=a&&a<=50947||50949<=a&&a<=50975||50977<=a&&a<=51003||51005<=a&&a<=51031||51033<=a&&a<=51059||51061<=a&&a<=51087||51089<=a&&a<=51115||51117<=a&&a<=51143||51145<=a&&a<=51171||51173<=a&&a<=51199||51201<=a&&a<=51227||51229<=a&&a<=51255||51257<=a&&a<=51283||51285<=a&&a<=51311||51313<=a&&a<=51339||51341<=a&&a<=51367||51369<=a&&a<=51395||51397<=a&&a<=51423||51425<=a&&a<=51451||51453<=a&&a<=51479||51481<=a&&a<=51507||51509<=a&&a<=51535||51537<=a&&a<=51563||51565<=a&&a<=51591||51593<=a&&a<=51619||51621<=a&&a<=51647||51649<=a&&a<=51675||51677<=a&&a<=51703||51705<=a&&a<=51731||51733<=a&&a<=51759||51761<=a&&a<=51787||51789<=a&&a<=51815||51817<=a&&a<=51843||51845<=a&&a<=51871||51873<=a&&a<=51899||51901<=a&&a<=51927||51929<=a&&a<=51955||51957<=a&&a<=51983||51985<=a&&a<=52011||52013<=a&&a<=52039||52041<=a&&a<=52067||52069<=a&&a<=52095||52097<=a&&a<=52123||52125<=a&&a<=52151||52153<=a&&a<=52179||52181<=a&&a<=52207||52209<=a&&a<=52235||52237<=a&&a<=52263||52265<=a&&a<=52291||52293<=a&&a<=52319||52321<=a&&a<=52347||52349<=a&&a<=52375||52377<=a&&a<=52403||52405<=a&&a<=52431||52433<=a&&a<=52459||52461<=a&&a<=52487||52489<=a&&a<=52515||52517<=a&&a<=52543||52545<=a&&a<=52571||52573<=a&&a<=52599||52601<=a&&a<=52627||52629<=a&&a<=52655||52657<=a&&a<=52683||52685<=a&&a<=52711||52713<=a&&a<=52739||52741<=a&&a<=52767||52769<=a&&a<=52795||52797<=a&&a<=52823||52825<=a&&a<=52851||52853<=a&&a<=52879||52881<=a&&a<=52907||52909<=a&&a<=52935||52937<=a&&a<=52963||52965<=a&&a<=52991||52993<=a&&a<=53019||53021<=a&&a<=53047||53049<=a&&a<=53075||53077<=a&&a<=53103||53105<=a&&a<=53131||53133<=a&&a<=53159||53161<=a&&a<=53187||53189<=a&&a<=53215||53217<=a&&a<=53243||53245<=a&&a<=53271||53273<=a&&a<=53299||53301<=a&&a<=53327||53329<=a&&a<=53355||53357<=a&&a<=53383||53385<=a&&a<=53411||53413<=a&&a<=53439||53441<=a&&a<=53467||53469<=a&&a<=53495||53497<=a&&a<=53523||53525<=a&&a<=53551||53553<=a&&a<=53579||53581<=a&&a<=53607||53609<=a&&a<=53635||53637<=a&&a<=53663||53665<=a&&a<=53691||53693<=a&&a<=53719||53721<=a&&a<=53747||53749<=a&&a<=53775||53777<=a&&a<=53803||53805<=a&&a<=53831||53833<=a&&a<=53859||53861<=a&&a<=53887||53889<=a&&a<=53915||53917<=a&&a<=53943||53945<=a&&a<=53971||53973<=a&&a<=53999||54001<=a&&a<=54027||54029<=a&&a<=54055||54057<=a&&a<=54083||54085<=a&&a<=54111||54113<=a&&a<=54139||54141<=a&&a<=54167||54169<=a&&a<=54195||54197<=a&&a<=54223||54225<=a&&a<=54251||54253<=a&&a<=54279||54281<=a&&a<=54307||54309<=a&&a<=54335||54337<=a&&a<=54363||54365<=a&&a<=54391||54393<=a&&a<=54419||54421<=a&&a<=54447||54449<=a&&a<=54475||54477<=a&&a<=54503||54505<=a&&a<=54531||54533<=a&&a<=54559||54561<=a&&a<=54587||54589<=a&&a<=54615||54617<=a&&a<=54643||54645<=a&&a<=54671||54673<=a&&a<=54699||54701<=a&&a<=54727||54729<=a&&a<=54755||54757<=a&&a<=54783||54785<=a&&a<=54811||54813<=a&&a<=54839||54841<=a&&a<=54867||54869<=a&&a<=54895||54897<=a&&a<=54923||54925<=a&&a<=54951||54953<=a&&a<=54979||54981<=a&&a<=55007||55009<=a&&a<=55035||55037<=a&&a<=55063||55065<=a&&a<=55091||55093<=a&&a<=55119||55121<=a&&a<=55147||55149<=a&&a<=55175||55177<=a&&a<=55203?10:9757==a||9977==a||9994<=a&&a<=9997||127877==a||127938<=a&&a<=127940||127943==a||127946<=a&&a<=127948||128066<=a&&a<=128067||128070<=a&&a<=128080||128110==a||128112<=a&&a<=128120||128124==a||128129<=a&&a<=128131||128133<=a&&a<=128135||128170==a||128372<=a&&a<=128373||128378==a||128400==a||128405<=a&&a<=128406||128581<=a&&a<=128583||128587<=a&&a<=128591||128675==a||128692<=a&&a<=128694||128704==a||128716==a||129304<=a&&a<=129308||129310<=a&&a<=129311||129318==a||129328<=a&&a<=129337||129341<=a&&a<=129342||129489<=a&&a<=129501?i:127995<=a&&a<=127999?14:8205==a?15:9792==a||9794==a||9877<=a&&a<=9878||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&a<=128188||128295==a||128300==a||128488==a||128640==a||128658==a?r:128102<=a&&a<=128105?o:11}return this.nextBreak=function(e,t){if(void 0===t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(var n,i,r=c(a(e,t)),o=[],l=t+1;l<e.length;l++)if(i=l-1,!(55296<=(n=e).charCodeAt(i)&&n.charCodeAt(i)<=56319&&56320<=n.charCodeAt(i+1)&&n.charCodeAt(i+1)<=57343)){var u=c(a(e,l));if(s(r,o,u))return l;o.push(u)}return e.length},this.splitGraphemes=function(e){for(var t,n=[],i=0;(t=this.nextBreak(e,i))<e.length;)n.push(e.slice(i,t)),i=t;return i<e.length&&n.push(e.slice(i)),n},this.iterateGraphemes=function(e){var t=0,n={next:function(){var n,i;return(i=this.nextBreak(e,t))<e.length?(n=e.slice(t,i),t=i,{value:n,done:!1}):t<e.length?(n=e.slice(t),t=e.length,{value:n,done:!1}):{value:void 0,done:!0}}.bind(this)};return"undefined"!=typeof Symbol&&Symbol.iterator&&(n[Symbol.iterator]=function(){return n}),n},this.countGraphemes=function(e){for(var t,n=0,i=0;(t=this.nextBreak(e,i))<e.length;)i=t,n++;return i<e.length&&n++,n},this})}));function Glyph(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function GlyphTextureInfo(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const defaultLineSpacingPercent=1.2,whitePixelCanvasId="ID_WHITE_PIXEL",whitePixelSize=new Cartesian2(4,4),whitePixelBoundingRegion=new BoundingRectangle(1,1,1,1);function addWhitePixelCanvas(e,t){const n=document.createElement("canvas");n.width=whitePixelSize.x,n.height=whitePixelSize.y;const i=n.getContext("2d");i.fillStyle="#fff",i.fillRect(0,0,n.width,n.height),e.addImage(whitePixelCanvasId,n).then((function(e){t._whitePixelIndex=e}))}const writeTextToCanvasParameters={};function createGlyphCanvas(e,t,n,i,r,o,a){return writeTextToCanvasParameters.font=t,writeTextToCanvasParameters.fillColor=n,writeTextToCanvasParameters.strokeColor=i,writeTextToCanvasParameters.strokeWidth=r,writeTextToCanvasParameters.padding=SDFSettings$1.PADDING,a===VerticalOrigin$1.CENTER?writeTextToCanvasParameters.textBaseline="middle":a===VerticalOrigin$1.TOP?writeTextToCanvasParameters.textBaseline="top":writeTextToCanvasParameters.textBaseline="bottom",writeTextToCanvasParameters.fill=o===LabelStyle$1.FILL||o===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.stroke=o===LabelStyle$1.OUTLINE||o===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.backgroundColor=Color.BLACK,writeTextToCanvas(e,writeTextToCanvasParameters)}function unbindGlyph(e,t){t.textureInfo=void 0,t.dimensions=void 0;const n=t.billboard;defined(n)&&(n.show=!1,n.image=void 0,defined(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function addGlyphToTextureAtlas(e,t,n,i){e.addImage(t,n).then((function(e){i.index=e}))}const splitter=new graphemeSplitter;function rebindAllGlyphs(e,t){const n=t._renderedText,i=splitter.splitGraphemes(n),r=i.length,o=t._glyphs,a=o.length;let s,c,l;if(t._relativeSize=t._fontSize/SDFSettings$1.FONT_SIZE,r<a)for(c=r;c<a;++c)unbindGlyph(e,o[c]);o.length=r;const u=t._showBackground&&n.split("\n").join("").length>0;let d=t._backgroundBillboard;const h=e._backgroundBillboardCollection;u?(defined(d)||(d=h.add({collection:e,image:whitePixelCanvasId,imageSubRegion:whitePixelBoundingRegion}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=HorizontalOrigin$1.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):defined(d)&&(h.remove(d),t._backgroundBillboard=d=void 0);const p=e._glyphTextureCache;for(l=0;l<r;++l){const n=i[l],r=t._verticalOrigin,a=JSON.stringify([n,t._fontFamily,t._fontStyle,t._fontWeight,+r]);let c=p[a];if(!defined(c)){const i=createGlyphCanvas(n,t._fontStyle+" "+t._fontWeight+" "+SDFSettings$1.FONT_SIZE+"px "+t._fontFamily,Color.WHITE,Color.WHITE,0,LabelStyle$1.FILL,r);if(c=new GlyphTextureInfo(e,-1,i.dimensions),p[a]=c,i.width>0&&i.height>0){const t=bitmapSdf(i,{cutoff:SDFSettings$1.CUTOFF,radius:SDFSettings$1.RADIUS}),r=i.getContext("2d"),o=i.width,s=i.height,l=r.getImageData(0,0,o,s);for(let e=0;e<o;e++)for(let n=0;n<s;n++){const i=n*o+e,r=255*t[i],a=4*i;l.data[a+0]=r,l.data[a+1]=r,l.data[a+2]=r,l.data[a+3]=r}r.putImageData(l,0,0)," "!==n&&addGlyphToTextureAtlas(e._textureAtlas,a,i,c)}}if(s=o[l],defined(s)?-1===c.index?unbindGlyph(e,s):defined(s.textureInfo)&&(s.textureInfo=void 0):(s=new Glyph,o[l]=s),s.textureInfo=c,s.dimensions=c.dimensions,-1!==c.index){let n=s.billboard;const i=e._spareBillboards;defined(n)||(i.length>0?n=i.pop():(n=e._billboardCollection.add({collection:e}),n._labelDimensions=new Cartesian2,n._labelTranslate=new Cartesian2),s.billboard=n),n.show=t._show,n.position=t._position,n.eyeOffset=t._eyeOffset,n.pixelOffset=t._pixelOffset,n.horizontalOrigin=HorizontalOrigin$1.LEFT,n.verticalOrigin=t._verticalOrigin,n.heightReference=t._heightReference,n.scale=t.totalScale,n.pickPrimitive=t,n.id=t._id,n.image=a,n.translucencyByDistance=t._translucencyByDistance,n.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,n.scaleByDistance=t._scaleByDistance,n.distanceDisplayCondition=t._distanceDisplayCondition,n.disableDepthTestDistance=t._disableDepthTestDistance,n._batchIndex=t._batchIndex,n.outlineColor=t.outlineColor,t.style===LabelStyle$1.FILL_AND_OUTLINE?(n.color=t._fillColor,n.outlineWidth=t.outlineWidth):t.style===LabelStyle$1.FILL?(n.color=t._fillColor,n.outlineWidth=0):t.style===LabelStyle$1.OUTLINE&&(n.color=Color.TRANSPARENT,n.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function calculateWidthOffset(e,t,n){return t===HorizontalOrigin$1.CENTER?-e/2:t===HorizontalOrigin$1.RIGHT?-(e+n.x):n.x}const glyphPixelOffset=new Cartesian2,scratchBackgroundPadding=new Cartesian2;function repositionAllGlyphs(e){const t=e._glyphs,n=e._renderedText;let i,r,o=0,a=0;const s=[];let c,l=Number.NEGATIVE_INFINITY,u=0,d=1;const h=t.length,p=e._backgroundBillboard,f=Cartesian2.clone(defined(p)?e._backgroundPadding:Cartesian2.ZERO,scratchBackgroundPadding);for(f.x/=e._relativeSize,f.y/=e._relativeSize,c=0;c<h;++c)"\n"===n.charAt(c)?(s.push(o),++d,o=0):(i=t[c],r=i.dimensions,u=Math.max(u,r.height-r.descent),l=Math.max(l,r.descent),o+=r.width-r.minx,c<h-1&&(o+=t[c+1].dimensions.minx),a=Math.max(a,o));s.push(o);const m=u+l,g=e.totalScale,_=e._horizontalOrigin,y=e._verticalOrigin;let C=0,T=s[C],S=calculateWidthOffset(T,_,f);const A=(defined(e._lineHeight)?e._lineHeight:defaultLineSpacingPercent*e._fontSize)/e._relativeSize,v=A*(d-1);let E=a,b=m+v;defined(p)&&(E+=2*f.x,b+=2*f.y,p._labelHorizontalOrigin=_),glyphPixelOffset.x=S*g,glyphPixelOffset.y=0;let x=!0,P=0;for(c=0;c<h;++c)if("\n"===n.charAt(c))++C,P+=A,T=s[C],S=calculateWidthOffset(T,_,f),glyphPixelOffset.x=S*g,x=!0;else if(i=t[c],r=i.dimensions,y===VerticalOrigin$1.TOP?(glyphPixelOffset.y=r.height-u-f.y,glyphPixelOffset.y+=SDFSettings$1.PADDING):y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(v+r.height-u)/2:y===VerticalOrigin$1.BASELINE?(glyphPixelOffset.y=v,glyphPixelOffset.y-=SDFSettings$1.PADDING):(glyphPixelOffset.y=v+l+f.y,glyphPixelOffset.y-=SDFSettings$1.PADDING),glyphPixelOffset.y=(glyphPixelOffset.y-r.descent-P)*g,x&&(glyphPixelOffset.x-=SDFSettings$1.PADDING*g,x=!1),defined(i.billboard)&&(i.billboard._setTranslate(glyphPixelOffset),i.billboard._labelDimensions.x=E,i.billboard._labelDimensions.y=b,i.billboard._labelHorizontalOrigin=_),c<h-1){const e=t[c+1];glyphPixelOffset.x+=(r.width-r.minx+e.dimensions.minx)*g}if(defined(p)&&n.split("\n").join("").length>0&&(S=_===HorizontalOrigin$1.CENTER?-a/2-f.x:_===HorizontalOrigin$1.RIGHT?-(a+2*f.x):0,glyphPixelOffset.x=S*g,y===VerticalOrigin$1.TOP?glyphPixelOffset.y=m-u-l:y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(m-u)/2-l:y===VerticalOrigin$1.BASELINE?glyphPixelOffset.y=-f.y-l:glyphPixelOffset.y=0,glyphPixelOffset.y=glyphPixelOffset.y*g,p.width=E,p.height=b,p._setTranslate(glyphPixelOffset),p._labelTranslate=Cartesian2.clone(glyphPixelOffset,p._labelTranslate)),e.heightReference===HeightReference$1.CLAMP_TO_GROUND)for(c=0;c<h;++c){i=t[c];const e=i.billboard;defined(e)&&(e._labelTranslate=Cartesian2.clone(glyphPixelOffset,e._labelTranslate))}}function destroyLabel(e,t){const n=t._glyphs;for(let t=0,i=n.length;t<i;++t)unbindGlyph(e,n[t]);defined(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),destroyObject(t)}function LabelCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._whitePixelIndex=void 0,this._backgroundBillboardCollection=new BillboardCollection({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new BillboardCollection({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=Color.clone(Color.WHITE),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(LabelCollection.prototype,{length:{get:function(){return this._labels.length}}}),LabelCollection.prototype.add=function(e){const t=new Label(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},LabelCollection.prototype.remove=function(e){if(defined(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),destroyLabel(this,e),!0}return!1},LabelCollection.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)destroyLabel(this,e[t]);e.length=0},LabelCollection.prototype.contains=function(e){return defined(e)&&e._labelCollection===this},LabelCollection.prototype.get=function(e){return this._labels[e]},LabelCollection.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;const i=e.context;defined(this._textureAtlas)||(this._textureAtlas=new TextureAtlas({context:i}),t.textureAtlas=this._textureAtlas),defined(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new TextureAtlas({context:i,initialSize:whitePixelSize}),n.textureAtlas=this._backgroundTextureAtlas,addWhitePixelCanvas(this._backgroundTextureAtlas,this));const r=this._labelsToUpdate.length;for(let e=0;e<r;++e){const t=this._labelsToUpdate[e];if(t.isDestroyed())continue;const n=t._glyphs.length;t._rebindAllGlyphs&&(rebindAllGlyphs(this,t),t._rebindAllGlyphs=!1),t._repositionAllGlyphs&&(repositionAllGlyphs(t),t._repositionAllGlyphs=!1);const i=t._glyphs.length-n;this._totalGlyphCount+=i}const o=n.length>0?BlendOption$1.TRANSLUCENT:this.blendOption;t.blendOption=o,n.blendOption=o,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)},LabelCollection.prototype.isDestroyed=function(){return!1},LabelCollection.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),destroyObject(this)};var PolylineVS="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 texCoordExpandAndBatchIndex;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 v_pickColor;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat texCoord = texCoordExpandAndBatchIndex.x;\nfloat expandDir = texCoordExpandAndBatchIndex.y;\nbool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\nfloat batchTableIndex = texCoordExpandAndBatchIndex.w;\nvec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\nfloat width = widthAndShow.x + 0.5;\nfloat show = widthAndShow.y;\nif (width < 1.0)\n{\nshow = 0.0;\n}\nvec4 pickColor = batchTable_getPickColor(batchTableIndex);\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}\n#ifdef DISTANCE_DISPLAY_CONDITION\nvec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\nvec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\nvec3 centerLow = centerLowAndRadius.xyz;\nfloat radius = centerLowAndRadius.w;\nvec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nvec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\nlengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n}\nfloat nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\nfloat farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\nshow = 0.0;\n}\n#endif\nfloat polylineAngle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st.s = texCoord;\nv_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\nv_width = width;\nv_pickColor = pickColor;\nv_polylineAngle = polylineAngle;\n}\n";function Polyline(e,t){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._width=defaultValue(e.width,1),this._loop=defaultValue(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,defined(this._material)||(this._material=Material$4.fromType(Material$4.ColorType,{color:new Color(1,1,1,1)}));let n,i=e.positions;defined(i)||(i=[]),this._positions=i,this._actualPositions=arrayRemoveDuplicates(i,Cartesian3.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=i.slice()),this._actualPositions.push(Cartesian3.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id,defined(t)&&(n=Matrix4.clone(t.modelMatrix)),this._modelMatrix=n,this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,n),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$3),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new BoundingSphere}const POSITION_INDEX$5=Polyline.POSITION_INDEX=0,SHOW_INDEX$5=Polyline.SHOW_INDEX=1,WIDTH_INDEX$1=Polyline.WIDTH_INDEX=2,MATERIAL_INDEX$1=Polyline.MATERIAL_INDEX=3,POSITION_SIZE_INDEX$1=Polyline.POSITION_SIZE_INDEX=4,DISTANCE_DISPLAY_CONDITION$1=Polyline.DISTANCE_DISPLAY_CONDITION=5,NUMBER_OF_PROPERTIES$3=Polyline.NUMBER_OF_PROPERTIES=6;function makeDirty$2(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;defined(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(Polyline.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,makeDirty$2(this,SHOW_INDEX$5))}},positions:{get:function(){return this._positions},set:function(e){let t=arrayRemoveDuplicates(e,Cartesian3.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(Cartesian3.clone(t[0]))),this._actualPositions.length===t.length&&this._actualPositions.length===this._length||makeDirty$2(this,POSITION_SIZE_INDEX$1),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),makeDirty$2(this,POSITION_INDEX$5),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeDirty$2(this,MATERIAL_INDEX$1))}},width:{get:function(){return this._width},set:function(e){e!==this._width&&(this._width=e,makeDirty$2(this,WIDTH_INDEX$1))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!Cartesian3.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(Cartesian3.clone(t[0]))):t.length>2&&Cartesian3.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,makeDirty$2(this,POSITION_SIZE_INDEX$1)}}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!defined(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$2(this,DISTANCE_DISPLAY_CONDITION$1))}}}),Polyline.prototype.update=function(){let e=Matrix4.IDENTITY;defined(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[POSITION_INDEX$5]>0||this._propertiesChanged[POSITION_SIZE_INDEX$1]>0;if(Matrix4.equals(e,this._modelMatrix)&&!i||(this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=Matrix4.clone(e,this._modelMatrix),this._segments.positions.length!==t)makeDirty$2(this,POSITION_SIZE_INDEX$1);else{const e=n.length;for(let t=0;t<e;++t)if(n[t]!==this._segments.lengths[t]){makeDirty$2(this,POSITION_SIZE_INDEX$1);break}}},Polyline.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},Polyline.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<NUMBER_OF_PROPERTIES$3-1;++t)e[t]=0},Polyline.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const SHOW_INDEX$4=Polyline.SHOW_INDEX,WIDTH_INDEX=Polyline.WIDTH_INDEX,POSITION_INDEX$4=Polyline.POSITION_INDEX,MATERIAL_INDEX=Polyline.MATERIAL_INDEX,POSITION_SIZE_INDEX=Polyline.POSITION_SIZE_INDEX,DISTANCE_DISPLAY_CONDITION=Polyline.DISTANCE_DISPLAY_CONDITION,NUMBER_OF_PROPERTIES$2=Polyline.NUMBER_OF_PROPERTIES,attributeLocations$5={texCoordExpandAndBatchIndex: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};function PolylineCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$2),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:BufferUsage$1.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=Color.clone(Color.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}function createBatchTable(e,t){defined(e._batchTable)&&e._batchTable.destroy();const n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2}];e._batchTable=new BatchTable(t,n,e._polylines.length)}Object.defineProperties(PolylineCollection.prototype,{length:{get:function(){return removePolylines(this),this._polylines.length}}}),PolylineCollection.prototype.add=function(e){const t=new Polyline(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t},PolylineCollection.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,defined(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1},PolylineCollection.prototype.removeAll=function(){releaseShaders(this),destroyPolylines(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},PolylineCollection.prototype.contains=function(e){return defined(e)&&e._polylineCollection===this},PolylineCollection.prototype.get=function(e){return removePolylines(this),this._polylines[e]};const scratchUpdatePolylineEncodedCartesian=new EncodedCartesian3,scratchUpdatePolylineCartesian4=new Cartesian4,scratchNearFarCartesian2=new Cartesian2;PolylineCollection.prototype.update=function(e){if(removePolylines(this),0===this._polylines.length||!this.show)return;updateMode$1(this,e);const t=e.context,n=e.mapProjection;let i,r=this._propertiesChanged;if(this._createBatchTable){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");createBatchTable(this,t),this._createBatchTable=!1}if(this._createVertexArray||computeNewBuffersUsage(this))createVertexArrays(this,t,n);else if(this._polylinesUpdated){const o=this._polylinesToUpdate;if(this._mode!==SceneMode$1.SCENE3D){const e=o.length;for(let t=0;t<e;++t)i=o[t],i.update()}if(r[POSITION_SIZE_INDEX]||r[MATERIAL_INDEX])createVertexArrays(this,t,n);else{const t=o.length,a=this._polylineBuckets;for(let s=0;s<t;++s){i=o[s],r=i._propertiesChanged;const t=i._bucket;let c=0;for(const e in a)if(a.hasOwnProperty(e)){if(a[e]===t){r[POSITION_INDEX$4]&&t.writeUpdate(c,i,this._positionBuffer,n);break}c+=a[e].lengthOfPositions}if((r[SHOW_INDEX$4]||r[WIDTH_INDEX])&&this._batchTable.setBatchedAttribute(i._index,0,new Cartesian2(i._width,i._show)),this._batchTable.attributes.length>2){if(r[POSITION_INDEX$4]||r[POSITION_SIZE_INDEX]){const t=e.mode===SceneMode$1.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,n=EncodedCartesian3.fromCartesian(t.center,scratchUpdatePolylineEncodedCartesian),r=Cartesian4.fromElements(n.low.x,n.low.y,n.low.z,t.radius,scratchUpdatePolylineCartesian4);this._batchTable.setBatchedAttribute(i._index,2,n.high),this._batchTable.setBatchedAttribute(i._index,3,r)}if(r[DISTANCE_DISPLAY_CONDITION]){const e=scratchNearFarCartesian2;e.x=0,e.y=Number.MAX_VALUE;const t=i.distanceDisplayCondition;defined(t)&&(e.x=t.near,e.y=t.far),this._batchTable.setBatchedAttribute(i._index,4,e)}}i._clean()}}o.length=0,this._polylinesUpdated=!1}r=this._propertiesChanged;for(let e=0;e<NUMBER_OF_PROPERTIES$2;++e)r[e]=0;let o=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D&&(o=this.modelMatrix);const a=e.passes,s=0!==e.morphTime;if(defined(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===s||(this._opaqueRS=RenderState.fromCache({depthMask:s,depthTest:{enabled:s}})),defined(this._translucentRS)&&this._translucentRS.depthTest.enabled===s||(this._translucentRS=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!s,depthTest:{enabled:s}})),this._batchTable.update(e),a.render||a.pick){createCommandLists(this,e,this._colorCommands,o)}};const boundingSphereScratch$2=new BoundingSphere,boundingSphereScratch2=new BoundingSphere;function createCommandLists(e,t,n,i){const r=t.context,o=t.commandList,a=n.length;let s=0,c=!0;const l=e._vertexArrays,u=e.debugShowBoundingVolume,d=e._batchTable.getUniformMapCallback(),h=l.length;for(let p=0;p<h;++p){const h=l[p],f=h.buckets,m=f.length;for(let l=0;l<m;++l){const p=f[l];let m=p.offset;const g=p.bucket.shaderProgram,_=p.bucket.polylines,y=_.length;let C,T,S,A,v=0;for(let l=0;l<y;++l){const f=_[l],y=createMaterialId(f._material);if(y!==C){if(defined(C)&&v>0){const t=T.isTranslucent();s>=a?(S=new DrawCommand({owner:e}),n.push(S)):S=n[s],++s,A=combine$2(d(T._uniforms),e._uniformMap),S.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=g,S.vertexArray=h.va,S.renderState=t?e._translucentRS:e._opaqueRS,S.pass=t?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,S.debugShowBoundingVolume=u,S.pickId="v_pickColor",S.uniformMap=A,S.count=v,S.offset=m,m+=v,v=0,c=!0,o.push(S)}T=f._material,T.update(r),C=y}const E=f._locatorBuckets,b=E.length;for(let e=0;e<b;++e){const t=E[e];t.locator===p&&(v+=t.count)}let x;t.mode===SceneMode$1.SCENE3D?x=f._boundingVolumeWC:t.mode===SceneMode$1.COLUMBUS_VIEW?x=f._boundingVolume2D:t.mode===SceneMode$1.SCENE2D?defined(f._boundingVolume2D)&&(x=BoundingSphere.clone(f._boundingVolume2D,boundingSphereScratch2),x.center.x=0):defined(f._boundingVolumeWC)&&defined(f._boundingVolume2D)&&(x=BoundingSphere.union(f._boundingVolumeWC,f._boundingVolume2D,boundingSphereScratch2)),c?(c=!1,BoundingSphere.clone(x,boundingSphereScratch$2)):BoundingSphere.union(x,boundingSphereScratch$2,boundingSphereScratch$2)}defined(C)&&v>0&&(s>=a?(S=new DrawCommand({owner:e}),n.push(S)):S=n[s],++s,A=combine$2(d(T._uniforms),e._uniformMap),S.boundingVolume=BoundingSphere.clone(boundingSphereScratch$2,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=g,S.vertexArray=h.va,S.renderState=T.isTranslucent()?e._translucentRS:e._opaqueRS,S.pass=T.isTranslucent()?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,S.debugShowBoundingVolume=u,S.pickId="v_pickColor",S.uniformMap=A,S.count=v,S.offset=m,c=!0,o.push(S)),C=void 0}}n.length=s}function computeNewBuffersUsage(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[POSITION_INDEX$4]?i.bufferUsage!==BufferUsage$1.STREAM_DRAW?(t=!0,i.bufferUsage=BufferUsage$1.STREAM_DRAW,i.frameCount=100):i.frameCount=100:i.bufferUsage!==BufferUsage$1.STATIC_DRAW&&(0===i.frameCount?(t=!0,i.bufferUsage=BufferUsage$1.STATIC_DRAW):i.frameCount--),t}PolylineCollection.prototype.isDestroyed=function(){return!1},PolylineCollection.prototype.destroy=function(){return destroyVertexArrays(this),releaseShaders(this),destroyPolylines(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};const emptyVertexBuffer=[0,0,0];function createVertexArrays(e,t,n){e._createVertexArray=!1,releaseShaders(e),destroyVertexArrays(e),sortPolylinesIntoBuckets(e);const i=[[]];let r=i[0];const o=e._batchTable,a=e._useHighlightColor,s=[0];let c=0;const l=[[]];let u=0;const d=e._polylineBuckets;let h,p;for(h in d)d.hasOwnProperty(h)&&(p=d[h],p.updateShader(t,o,a),u+=p.lengthOfPositions);if(u>0){const a=e._mode,f=new Float32Array(6*u*3),m=new Float32Array(4*u);let g,_=0,y=0,C=0;for(h in d)if(d.hasOwnProperty(h)){p=d[h],p.write(f,m,_,y,C,o,t,n),a===SceneMode$1.MORPHING&&(defined(g)||(g=new Float32Array(6*u*3)),p.writeForMorph(g,_));const e=p.lengthOfPositions;_+=6*e*3,y+=4*e,C+=4*e,c=p.updateIndices(i,s,l,c)}const T=e._positionBufferUsage.bufferUsage,S=BufferUsage$1.STATIC_DRAW;let A;e._positionBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:f,usage:T}),defined(g)&&(A=Buffer$1.createVertexBuffer({context:t,typedArray:g,usage:T})),e._texCoordExpandAndBatchIndexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:m,usage:S});const v=3*Float32Array.BYTES_PER_ELEMENT,E=4*Float32Array.BYTES_PER_ELEMENT;let b=0;const x=i.length;for(let n=0;n<x;++n)if(r=i[n],r.length>0){const i=new Uint16Array(r),o=Buffer$1.createIndexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});b+=s[n];const c=6*(n*(v*CesiumMath.SIXTY_FOUR_KILOBYTES)-b*v),u=v+c,d=v+u,h=v+d,p=v+h,f=v+p,m=n*(E*CesiumMath.SIXTY_FOUR_KILOBYTES)-b*E,g=[{index:attributeLocations$5.position3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:c,strideInBytes:6*v},{index:attributeLocations$5.position3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:u,strideInBytes:6*v},{index:attributeLocations$5.position2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:c,strideInBytes:6*v},{index:attributeLocations$5.position2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:u,strideInBytes:6*v},{index:attributeLocations$5.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:d,strideInBytes:6*v},{index:attributeLocations$5.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:h,strideInBytes:6*v},{index:attributeLocations$5.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:d,strideInBytes:6*v},{index:attributeLocations$5.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:h,strideInBytes:6*v},{index:attributeLocations$5.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:p,strideInBytes:6*v},{index:attributeLocations$5.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:f,strideInBytes:6*v},{index:attributeLocations$5.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:p,strideInBytes:6*v},{index:attributeLocations$5.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:f,strideInBytes:6*v},{index:attributeLocations$5.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:m}];let _,y,C,T;a===SceneMode$1.SCENE3D?(y=e._positionBuffer,_="vertexBuffer",C=emptyVertexBuffer,T="value"):a===SceneMode$1.SCENE2D||a===SceneMode$1.COLUMBUS_VIEW?(y=emptyVertexBuffer,_="value",C=e._positionBuffer,T="vertexBuffer"):(y=A,_="vertexBuffer",C=e._positionBuffer,T="vertexBuffer"),g[0][_]=y,g[1][_]=y,g[2][T]=C,g[3][T]=C,g[4][_]=y,g[5][_]=y,g[6][T]=C,g[7][T]=C,g[8][_]=y,g[9][_]=y,g[10][T]=C,g[11][T]=C;const S=new VertexArray({context:t,attributes:g,indexBuffer:o});e._vertexArrays.push({va:S,buckets:l[n]})}}}function replacer(e,t){return t instanceof Texture?t.id:t}const scratchUniformArray=[];function createMaterialId(e){const t=Material$4._uniformList[e.type],n=t.length;scratchUniformArray.length=2*n;let i=0;for(let r=0;r<n;++r){const n=t[r];scratchUniformArray[i]=n,scratchUniformArray[i+1]=e._uniforms[n](),i+=2}return e.type+":"+JSON.stringify(scratchUniformArray,replacer)}function sortPolylinesIntoBuckets(e){const t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},r=e._polylines,o=r.length;for(let e=0;e<o;++e){const o=r[e];if(o._actualPositions.length>1){o.update();const e=o.material;let r=i[e.type];defined(r)||(r=i[e.type]=new PolylineBucket(e,t,n)),r.addPolyline(o)}}}function updateMode$1(e,t){const n=t.mode;e._mode===n&&Matrix4.equals(e._modelMatrix,e.modelMatrix)||(e._mode=n,e._modelMatrix=Matrix4.clone(e.modelMatrix),e._createVertexArray=!0)}function removePolylines(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i,r=0;const o=e._polylines.length;for(let a=0;a<o;++a)i=e._polylines[a],i.isDestroyed||(i._index=r++,n.push(i),t.push(i));e._polylines=t,e._polylinesToUpdate=n}}function releaseShaders(e){const t=e._polylines,n=t.length;for(let e=0;e<n;++e)if(!t[e].isDestroyed){const n=t[e]._bucket;defined(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function destroyVertexArrays(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}function destroyPolylines(e){const t=e._polylines,n=t.length;for(let e=0;e<n;++e)t[e].isDestroyed||t[e]._destroy()}function VertexArrayBucketLocator(e,t,n){this.count=e,this.offset=t,this.bucket=n}function PolylineBucket(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}function intersectsIDL(e){return Cartesian3.dot(Cartesian3.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Plane.ORIGIN_ZX_PLANE)===Intersect$1.INTERSECTING}PolylineCollection.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},PolylineBucket.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},PolylineBucket.prototype.updateShader=function(e,t,n){if(defined(this.shaderProgram))return;const i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&i.push("POLYLINE_DASH"),FeatureDetection.isInternetExplorer()||i.push("CLIP_POLYLINE");const r=new ShaderSource({defines:i,sources:["varying vec4 v_pickColor;\n",this.material.shaderSource,PolylineFS$1]}),o=t.getVertexShaderCallback()(PolylineVS),a=new ShaderSource({defines:i,sources:[PolylineCommon,o]});this.shaderProgram=ShaderProgram.fromCache({context:e,vertexShaderSource:a,fragmentShaderSource:r,attributeLocations:attributeLocations$5})},PolylineBucket.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===SceneMode$1.SCENE3D||!intersectsIDL(e))return t=e._actualPositions.length,4*t-4;let n=0;const i=e._segments.lengths;t=i.length;for(let e=0;e<t;++e)n+=4*i[e]-4;return n};const scratchWritePosition=new Cartesian3,scratchWritePrevPosition=new Cartesian3,scratchWriteNextPosition=new Cartesian3,scratchWriteVector=new Cartesian3,scratchPickColorCartesian=new Cartesian4,scratchWidthShowCartesian=new Cartesian2;PolylineBucket.prototype.write=function(e,t,n,i,r,o,a,s){const c=this.mode,l=s.ellipsoid.maximumRadius*CesiumMath.PI,u=this.polylines,d=u.length;for(let i=0;i<d;++i){const d=u[i],h=d.width,p=d.show&&h>0,f=d._index,m=this.getSegments(d,s),g=m.positions,_=m.lengths,y=g.length,C=d.getPickId(a).color;let T,S=0,A=0;for(let i=0;i<y;++i){0===i?d._loop?T=g[y-2]:(T=scratchWriteVector,Cartesian3.subtract(g[0],g[1],T),Cartesian3.add(g[0],T,T)):T=g[i-1],Cartesian3.clone(T,scratchWritePrevPosition),Cartesian3.clone(g[i],scratchWritePosition),i===y-1?d._loop?T=g[1]:(T=scratchWriteVector,Cartesian3.subtract(g[y-1],g[y-2],T),Cartesian3.add(g[y-1],T,T)):T=g[i+1],Cartesian3.clone(T,scratchWriteNextPosition);const o=_[S];i===A+o&&(A+=o,++S);const a=i-A==0,s=i===A+_[S]-1;c===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),c!==SceneMode$1.SCENE2D&&c!==SceneMode$1.MORPHING||(a||s)&&l-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));const u=s?2:4;for(let o=a?2:0;o<u;++o){EncodedCartesian3.writeElements(scratchWritePosition,e,n),EncodedCartesian3.writeElements(scratchWritePrevPosition,e,n+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,e,n+12);const a=o-2<0?-1:1;t[r]=i/(y-1),t[r+1]=o%2*2-1,t[r+2]=a,t[r+3]=f,n+=18,r+=4}}const v=scratchPickColorCartesian;v.x=Color.floatToByte(C.red),v.y=Color.floatToByte(C.green),v.z=Color.floatToByte(C.blue),v.w=Color.floatToByte(C.alpha);const E=scratchWidthShowCartesian;E.x=h,E.y=p?1:0;const b=c===SceneMode$1.SCENE2D?d._boundingVolume2D:d._boundingVolumeWC,x=EncodedCartesian3.fromCartesian(b.center,scratchUpdatePolylineEncodedCartesian),P=x.high,D=Cartesian4.fromElements(x.low.x,x.low.y,x.low.z,b.radius,scratchUpdatePolylineCartesian4),w=scratchNearFarCartesian2;w.x=0,w.y=Number.MAX_VALUE;const M=d.distanceDisplayCondition;defined(M)&&(w.x=M.near,w.y=M.far),o.setBatchedAttribute(f,0,E),o.setBatchedAttribute(f,1,v),o.attributes.length>2&&(o.setBatchedAttribute(f,2,P),o.setBatchedAttribute(f,3,D),o.setBatchedAttribute(f,4,w))}};const morphPositionScratch=new Cartesian3,morphPrevPositionScratch=new Cartesian3,morphNextPositionScratch=new Cartesian3,morphVectorScratch=new Cartesian3;PolylineBucket.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,r=i.length;for(let o=0;o<r;++o){const r=i[o],a=r._segments.positions,s=r._segments.lengths,c=a.length;let l=0,u=0;for(let i=0;i<c;++i){let o;0===i?r._loop?o=a[c-2]:(o=morphVectorScratch,Cartesian3.subtract(a[0],a[1],o),Cartesian3.add(a[0],o,o)):o=a[i-1],o=Matrix4.multiplyByPoint(n,o,morphPrevPositionScratch);const d=Matrix4.multiplyByPoint(n,a[i],morphPositionScratch);let h;i===c-1?r._loop?h=a[1]:(h=morphVectorScratch,Cartesian3.subtract(a[c-1],a[c-2],h),Cartesian3.add(a[c-1],h,h)):h=a[i+1],h=Matrix4.multiplyByPoint(n,h,morphNextPositionScratch);const p=s[l];i===u+p&&(u+=p,++l);const f=i-u==0,m=i===u+s[l]-1?2:4;for(let n=f?2:0;n<m;++n)EncodedCartesian3.writeElements(d,e,t),EncodedCartesian3.writeElements(o,e,t+6),EncodedCartesian3.writeElements(h,e,t+12),t+=18}}};const scratchSegmentLengths=new Array(1);PolylineBucket.prototype.updateIndices=function(e,t,n,i){let r=n.length-1,o=new VertexArrayBucketLocator(0,i,this);n[r].push(o);let a=0,s=e[e.length-1],c=0;s.length>0&&(c=s[s.length-1]+1);const l=this.polylines,u=l.length;for(let d=0;d<u;++d){const u=l[d];let h;if(u._locatorBuckets=[],this.mode===SceneMode$1.SCENE3D){h=scratchSegmentLengths;const e=u._actualPositions.length;if(!(e>0))continue;h[0]=e}else h=u._segments.lengths;const p=h.length;if(p>0){let l=0;for(let d=0;d<p;++d){const p=h[d]-1;for(let d=0;d<p;++d)c+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(u._locatorBuckets.push({locator:o,count:l}),l=0,t.push(4),s=[],e.push(s),c=0,o.count=a,a=0,i=0,o=new VertexArrayBucketLocator(0,0,this),n[++r]=[o]),s.push(c,c+2,c+1),s.push(c+1,c+2,c+3),l+=6,a+=6,i+=6,c+=4}u._locatorBuckets.push({locator:o,count:l}),c+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(0),s=[],e.push(s),c=0,o.count=a,i=0,a=0,o=new VertexArrayBucketLocator(0,0,this),n[++r]=[o])}u._clean()}return o.count=a,i},PolylineBucket.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let r=0;r<i;++r){const i=t[r];if(i===e)break;n+=i._actualLength}return n};const scratchSegments={positions:void 0,lengths:void 0},scratchLengths=new Array(1),pscratch=new Cartesian3,scratchCartographic$a=new Cartographic;let scratchPositionsArray;function Vector3DTilePoints(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=void 0,this._labelCollection=void 0,this._polylineCollection=void 0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=when.defer(),this._resolvedPromise=!1}function packBuffer$3(e,t){const n=e._rectangle,i=e._minHeight,r=e._maxHeight,o=2+Rectangle.packedLength+Ellipsoid.packedLength,a=new Float64Array(o);let s=0;return a[s++]=i,a[s++]=r,Rectangle.pack(n,a,s),s+=Rectangle.packedLength,Ellipsoid.pack(t,a,s),a}PolylineBucket.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===SceneMode$1.SCENE3D)return scratchLengths[0]=n.length,scratchSegments.positions=n,scratchSegments.lengths=scratchLengths,scratchSegments;intersectsIDL(e)&&(n=e._segments.positions);const i=t.ellipsoid,r=[],o=this.modelMatrix,a=n.length;let s,c=pscratch;for(let e=0;e<a;++e)s=n[e],c=Matrix4.multiplyByPoint(o,s,c),r.push(t.project(i.cartesianToCartographic(c,scratchCartographic$a)));if(r.length>0){e._boundingVolume2D=BoundingSphere.fromPoints(r,e._boundingVolume2D);const t=e._boundingVolume2D.center;e._boundingVolume2D.center=new Cartesian3(t.z,t.x,t.y)}return scratchSegments.positions=r,scratchSegments.lengths=e._segments.lengths,scratchSegments},PolylineBucket.prototype.writeUpdate=function(e,t,n,i){const r=this.mode,o=i.ellipsoid.maximumRadius*CesiumMath.PI;let a=t._actualLength;if(a){e+=this.getPolylineStartIndex(t);let s=scratchPositionsArray;const c=6*a*3;!defined(s)||s.length<c?s=scratchPositionsArray=new Float32Array(c):s.length>c&&(s=new Float32Array(s.buffer,0,c));const l=this.getSegments(t,i),u=l.positions,d=l.lengths;let h,p=0,f=0,m=0;a=u.length;for(let e=0;e<a;++e){0===e?t._loop?h=u[a-2]:(h=scratchWriteVector,Cartesian3.subtract(u[0],u[1],h),Cartesian3.add(u[0],h,h)):h=u[e-1],Cartesian3.clone(h,scratchWritePrevPosition),Cartesian3.clone(u[e],scratchWritePosition),e===a-1?t._loop?h=u[1]:(h=scratchWriteVector,Cartesian3.subtract(u[a-1],u[a-2],h),Cartesian3.add(u[a-1],h,h)):h=u[e+1],Cartesian3.clone(h,scratchWriteNextPosition);const n=d[f];e===m+n&&(m+=n,++f);const i=e-m==0,c=e===m+d[f]-1;r===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),r!==SceneMode$1.SCENE2D&&r!==SceneMode$1.MORPHING||(i||c)&&o-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&scratchWritePrevPosition.x>0||scratchWritePosition.x>0&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&scratchWriteNextPosition.x>0||scratchWritePosition.x>0&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));const l=c?2:4;for(let e=i?2:0;e<l;++e)EncodedCartesian3.writeElements(scratchWritePosition,s,p),EncodedCartesian3.writeElements(scratchWritePrevPosition,s,p+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,s,p+12),p+=18}n.copyFromArrayView(s,18*Float32Array.BYTES_PER_ELEMENT*e)}},Object.defineProperties(Vector3DTilePoints.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){return this._billboardCollection.textureAtlas.texture.sizeInBytes+this._labelCollection._textureAtlas.texture.sizeInBytes}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$3=new TaskProcessor("createVectorTilePoints",5),scratchPosition$4=new Cartesian3;function createPoints(e,t){if(defined(e._billboardCollection))return;let n;if(!defined(e._verticesPromise)){n=e._positions;let i=e._packedBuffer;defined(i)||(n=e._positions=arraySlice(n),e._batchIds=arraySlice(e._batchIds),i=e._packedBuffer=packBuffer$3(e,t));const r=[n.buffer,i.buffer],o={positions:n.buffer,packedBuffer:i.buffer},a=e._verticesPromise=createVerticesTaskProcessor$3.scheduleTask(o,r);if(!defined(a))return;a.then((function(t){e._positions=new Float64Array(t.positions),e._ready=!0}))}if(e._ready&&!defined(e._billboardCollection)){n=e._positions;const t=e._batchTable,i=e._batchIds,r=e._billboardCollection=new BillboardCollection({batchTable:t}),o=e._labelCollection=new LabelCollection({batchTable:t}),a=e._polylineCollection=new PolylineCollection;a._useHighlightColor=!0;const s=n.length/3;for(let e=0;e<s;++e){const t=i[e],s=Cartesian3.unpack(n,3*e,scratchPosition$4),c=r.add();c.position=s,c._batchIndex=t;const l=o.add();l.text=" ",l.position=s,l._batchIndex=t;a.add().positions=[Cartesian3.clone(s),Cartesian3.clone(s)]}e._positions=void 0,e._packedBuffer=void 0}}function clearStyle$2(e,t){const n=e._batchIds,i=n.length;for(let e=0;e<i;++e){const i=t[n[e]];i.show=!0,i.pointSize=Cesium3DTilePointFeature.defaultPointSize,i.color=Cesium3DTilePointFeature.defaultColor,i.pointOutlineColor=Cesium3DTilePointFeature.defaultPointOutlineColor,i.pointOutlineWidth=Cesium3DTilePointFeature.defaultPointOutlineWidth,i.labelColor=Color.WHITE,i.labelOutlineColor=Color.WHITE,i.labelOutlineWidth=1,i.font="30px sans-serif",i.labelStyle=LabelStyle$1.FILL,i.labelText=void 0,i.backgroundColor=new Color(.165,.165,.165,.8),i.backgroundPadding=new Cartesian2(7,5),i.backgroundEnabled=!1,i.scaleByDistance=void 0,i.translucencyByDistance=void 0,i.distanceDisplayCondition=void 0,i.heightOffset=0,i.anchorLineEnabled=!1,i.anchorLineColor=Color.WHITE,i.image=void 0,i.disableDepthTestDistance=0,i.horizontalOrigin=HorizontalOrigin$1.CENTER,i.verticalOrigin=VerticalOrigin$1.CENTER,i.labelHorizontalOrigin=HorizontalOrigin$1.RIGHT,i.labelVerticalOrigin=VerticalOrigin$1.BASELINE}}Vector3DTilePoints.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,r=this._polylineCollection,o=this._batchIds,a=o.length;for(let s=0;s<a;++s){const a=o[s],c=n.get(s),l=i.get(s),u=r.get(s);t[a]=new Cesium3DTilePointFeature(e,a,c,l,u)}},Vector3DTilePoints.prototype.applyDebugSettings=function(e,t){e?(Color.clone(t,this._billboardCollection._highlightColor),Color.clone(t,this._labelCollection._highlightColor),Color.clone(t,this._polylineCollection._highlightColor)):(Color.clone(Color.WHITE,this._billboardCollection._highlightColor),Color.clone(Color.WHITE,this._labelCollection._highlightColor),Color.clone(Color.WHITE,this._polylineCollection._highlightColor))};const scratchColor$i=new Color,scratchColor2=new Color,scratchColor3=new Color,scratchColor4=new Color,scratchColor5=new Color,scratchColor6=new Color,scratchScaleByDistance=new NearFarScalar,scratchTranslucencyByDistance=new NearFarScalar,scratchDistanceDisplayCondition=new DistanceDisplayCondition;function Vector3DTilePolygons(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=defaultValue(e.center,Cartesian3.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$2(e){const t=new Float64Array(3+Cartesian3.packedLength+Ellipsoid.packedLength+Rectangle.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,Cartesian3.pack(e._center,t,n),n+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,n),n+=Ellipsoid.packedLength,Rectangle.pack(e._rectangle,t,n),t}function unpackBuffer(e,t){let n=1;const i=t[n++],r=e._boundingVolumes=new Array(i);for(let e=0;e<i;++e)r[e]=OrientedBoundingBox.unpack(t,n),n+=OrientedBoundingBox.packedLength;const o=t[n++],a=e._batchedIndices=new Array(o);for(let e=0;e<o;++e){const i=Color.unpack(t,n);n+=Color.packedLength;const r=t[n++],o=t[n++],s=t[n++],c=new Array(s);for(let e=0;e<s;++e)c[e]=t[n++];a[e]=new Vector3DTileBatch({color:i,offset:r,count:o,batchIds:c})}}Vector3DTilePoints.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$2(this,t);const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=t[n[r]];if(defined(e.show)&&(i.show=e.show.evaluate(i)),defined(e.pointSize)&&(i.pointSize=e.pointSize.evaluate(i)),defined(e.color)&&(i.color=e.color.evaluateColor(i,scratchColor$i)),defined(e.pointOutlineColor)&&(i.pointOutlineColor=e.pointOutlineColor.evaluateColor(i,scratchColor2)),defined(e.pointOutlineWidth)&&(i.pointOutlineWidth=e.pointOutlineWidth.evaluate(i)),defined(e.labelColor)&&(i.labelColor=e.labelColor.evaluateColor(i,scratchColor3)),defined(e.labelOutlineColor)&&(i.labelOutlineColor=e.labelOutlineColor.evaluateColor(i,scratchColor4)),defined(e.labelOutlineWidth)&&(i.labelOutlineWidth=e.labelOutlineWidth.evaluate(i)),defined(e.font)&&(i.font=e.font.evaluate(i)),defined(e.labelStyle)&&(i.labelStyle=e.labelStyle.evaluate(i)),defined(e.labelText)?i.labelText=e.labelText.evaluate(i):i.labelText=void 0,defined(e.backgroundColor)&&(i.backgroundColor=e.backgroundColor.evaluateColor(i,scratchColor5)),defined(e.backgroundPadding)&&(i.backgroundPadding=e.backgroundPadding.evaluate(i)),defined(e.backgroundEnabled)&&(i.backgroundEnabled=e.backgroundEnabled.evaluate(i)),defined(e.scaleByDistance)){const t=e.scaleByDistance.evaluate(i);scratchScaleByDistance.near=t.x,scratchScaleByDistance.nearValue=t.y,scratchScaleByDistance.far=t.z,scratchScaleByDistance.farValue=t.w,i.scaleByDistance=scratchScaleByDistance}else i.scaleByDistance=void 0;if(defined(e.translucencyByDistance)){const t=e.translucencyByDistance.evaluate(i);scratchTranslucencyByDistance.near=t.x,scratchTranslucencyByDistance.nearValue=t.y,scratchTranslucencyByDistance.far=t.z,scratchTranslucencyByDistance.farValue=t.w,i.translucencyByDistance=scratchTranslucencyByDistance}else i.translucencyByDistance=void 0;if(defined(e.distanceDisplayCondition)){const t=e.distanceDisplayCondition.evaluate(i);scratchDistanceDisplayCondition.near=t.x,scratchDistanceDisplayCondition.far=t.y,i.distanceDisplayCondition=scratchDistanceDisplayCondition}else i.distanceDisplayCondition=void 0;defined(e.heightOffset)&&(i.heightOffset=e.heightOffset.evaluate(i)),defined(e.anchorLineEnabled)&&(i.anchorLineEnabled=e.anchorLineEnabled.evaluate(i)),defined(e.anchorLineColor)&&(i.anchorLineColor=e.anchorLineColor.evaluateColor(i,scratchColor6)),defined(e.image)?i.image=e.image.evaluate(i):i.image=void 0,defined(e.disableDepthTestDistance)&&(i.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(i)),defined(e.horizontalOrigin)&&(i.horizontalOrigin=e.horizontalOrigin.evaluate(i)),defined(e.verticalOrigin)&&(i.verticalOrigin=e.verticalOrigin.evaluate(i)),defined(e.labelHorizontalOrigin)&&(i.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(i)),defined(e.labelVerticalOrigin)&&(i.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(i))}},Vector3DTilePoints.prototype.update=function(e){createPoints(this,e.mapProjection.ellipsoid),this._ready&&(this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e),this._resolvedPromise||(this._readyPromise.resolve(),this._resolvedPromise=!0))},Vector3DTilePoints.prototype.isDestroyed=function(){return!1},Vector3DTilePoints.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTilePolygons.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$2=new TaskProcessor("createVectorTilePolygons",5),scratchColor$h=new Color;function createPrimitive(e){if(!defined(e._primitive)){if(!defined(e._verticesPromise)){let t=e._positions,n=e._counts,i=e._indexCounts,r=e._indices,o=e._transferrableBatchIds,a=e._batchTableColors,s=e._packedBuffer;if(!defined(a)){t=e._positions=arraySlice(e._positions),n=e._counts=arraySlice(e._counts),i=e._indexCounts=arraySlice(e._indexCounts),r=e._indices=arraySlice(e._indices),e._center=e._ellipsoid.cartographicToCartesian(Rectangle.center(e._rectangle)),o=e._transferrableBatchIds=new Uint32Array(e._batchIds),a=e._batchTableColors=new Uint32Array(o.length);const c=e._batchTable,l=a.length;for(let e=0;e<l;++e){const t=c.getColor(e,scratchColor$h);a[e]=t.toRgba()}s=e._packedBuffer=packBuffer$2(e)}const c=[t.buffer,n.buffer,i.buffer,r.buffer,o.buffer,a.buffer,s.buffer],l={packedBuffer:s.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:r.buffer,batchIds:o.buffer,batchTableColors:a.buffer};let u=e._polygonMinimumHeights,d=e._polygonMaximumHeights;defined(u)&&defined(d)&&(u=arraySlice(u),d=arraySlice(d),c.push(u.buffer,d.buffer),l.minimumHeights=u,l.maximumHeights=d);const h=e._verticesPromise=createVerticesTaskProcessor$2.scheduleTask(l,c);if(!defined(h))return;when(h,(function(t){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const n=new Float64Array(t.packedBuffer),i=n[0];unpackBuffer(e,n),e._indices=2===IndexDatatype$1.getSizeInBytes(i)?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._batchedPositions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.batchIds),e._ready=!0}))}e._ready&&!defined(e._primitive)&&(e._primitive=new Vector3DTilePrimitive({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._verticesPromise=void 0,e._readyPromise.resolve())}}Vector3DTilePolygons.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTilePolygons.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTilePolygons.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTilePolygons.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTilePolygons.prototype.update=function(e){createPrimitive(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTilePolygons.prototype.isDestroyed=function(){return!1},Vector3DTilePolygons.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var Vector3DTilePolylinesVS="attribute vec4 currentPosition;\nattribute vec4 previousPosition;\nattribute vec4 nextPosition;\nattribute vec2 expandAndWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = u_modifiedModelView * currentPosition;\nvec4 prev = u_modifiedModelView * previousPosition;\nvec4 next = u_modifiedModelView * nextPosition;\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n";function Vector3DTilePolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0}function packBuffer$1(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,r=e._ellipsoid,o=e._center,a=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(a);let c=0;return s[c++]=n,s[c++]=i,Rectangle.pack(t,s,c),c+=Rectangle.packedLength,Ellipsoid.pack(r,s,c),c+=Ellipsoid.packedLength,Cartesian3.pack(o,s,c),s}Object.defineProperties(Vector3DTilePolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor$1=new TaskProcessor("createVectorTilePolylines",5),attributeLocations$4={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function createVertexArray$2(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){let t=e._positions,n=e._widths,i=e._counts,r=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(t=e._positions=arraySlice(t),n=e._widths=arraySlice(n),i=e._counts=arraySlice(i),r=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer$1(e));const a=[t.buffer,n.buffer,i.buffer,r.buffer,o.buffer],s={positions:t.buffer,widths:n.buffer,counts:i.buffer,batchIds:r.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor$1.scheduleTask(s,a);if(!defined(c))return;when(c).then((function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._currentPositions=new Float32Array(t.currentPositions),e._previousPositions=new Float32Array(t.previousPositions),e._nextPositions=new Float32Array(t.nextPositions),e._expandAndWidth=new Float32Array(t.expandAndWidth),e._vertexBatchIds=new Uint16Array(t.batchIds);const n=t.indexDatatype;e._indices=n===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).otherwise((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){const n=e._currentPositions,i=e._previousPositions,r=e._nextPositions,o=e._expandAndWidth,a=e._vertexBatchIds,s=e._indices;let c=i.byteLength+n.byteLength+r.byteLength;c+=o.byteLength+a.byteLength+s.byteLength,e._trianglesLength=s.length/3,e._geometryByteLength=c;const l=Buffer$1.createVertexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),u=Buffer$1.createVertexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW}),d=Buffer$1.createVertexBuffer({context:t,typedArray:r,usage:BufferUsage$1.STATIC_DRAW}),h=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW}),p=Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),f=Buffer$1.createIndexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===s.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),m=[{index:attributeLocations$4.previousPosition,vertexBuffer:l,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.currentPosition,vertexBuffer:u,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.nextPosition,vertexBuffer:d,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$4.expandAndWidth,vertexBuffer:h,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2},{index:attributeLocations$4.a_batchId,vertexBuffer:p,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:m,indexBuffer:f}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}const modifiedModelViewScratch$2=new Matrix4,rtcScratch$2=new Cartesian3;function createUniformMap$3(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return Matrix4.clone(n,modifiedModelViewScratch$2),Matrix4.multiplyByPoint(modifiedModelViewScratch$2,e._center,rtcScratch$2),Matrix4.setTranslation(modifiedModelViewScratch$2,rtcScratch$2,modifiedModelViewScratch$2),modifiedModelViewScratch$2},u_highlightColor:function(){return e._highlightColor}})}function createRenderStates$2(e){if(defined(e._rs))return;e._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:{enabled:!0,factor:-5,units:-5}})}const PolylineFS="uniform vec4 u_highlightColor; \nvoid main()\n{\n gl_FragColor = u_highlightColor;\n}\n";function createShaders$1(e,t){if(defined(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTilePolylinesVS),r=n.getFragmentShaderCallback(!1,void 0,!1)(PolylineFS),o=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,i]}),a=new ShaderSource({defines:["VECTOR_TILE"],sources:[r]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:attributeLocations$4})}function queueCommands$1(e,t){if(!defined(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:Pass$1.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}function clearStyle$1(e,t){const n=e._batchIds,i=n.length;for(let e=0;e<i;++e){const i=t[n[e]];i.show=!0,i.color=Color.WHITE}}Vector3DTilePolylines.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,r=e._decodedPositionOffsets;if(!defined(n)||!defined(i))return;let o,a;const s=n.length;let c=0,l=0;for(o=0;o<s;++o)n[o]===t&&(c+=r[o+1]-r[o]);if(0===c)return;const u=new Float64Array(3*c);for(o=0;o<s;++o)if(n[o]===t){const e=r[o],t=r[o+1]-e;for(a=0;a<t;++a){const t=3*(e+a);u[l++]=i[t],u[l++]=i[t+1],u[l++]=i[t+2]}}return u},Vector3DTilePolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTilePolylines.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=n[r];t[i]=new Cesium3DTileFeature(e,i)}},Vector3DTilePolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$g=new Color,DEFAULT_COLOR_VALUE$1=Color.WHITE,DEFAULT_SHOW_VALUE$1=!0;Vector3DTilePolylines.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle$1(this,t);const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=t[n[r]];i.color=defined(e.color)?e.color.evaluateColor(i,scratchColor$g):DEFAULT_COLOR_VALUE$1,i.show=defined(e.show)?e.show.evaluate(i):DEFAULT_SHOW_VALUE$1}},Vector3DTilePolylines.prototype.update=function(e){const t=e.context;if(createVertexArray$2(this,t),createUniformMap$3(this,t),createShaders$1(this,t),createRenderStates$2(this),!this._ready)return;const n=e.passes;(n.render||n.pick)&&queueCommands$1(this,e)},Vector3DTilePolylines.prototype.isDestroyed=function(){return!1},Vector3DTilePolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)};var Vector3DTileClampedPolylinesVS="attribute vec3 startEllipsoidNormal;\nattribute vec3 endEllipsoidNormal;\nattribute vec4 startPositionAndHeight;\nattribute vec4 endPositionAndHeight;\nattribute vec4 startFaceNormalAndVertexCorner;\nattribute vec4 endFaceNormalAndHalfWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nuniform vec2 u_minimumMaximumVectorHeights;\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nvoid main()\n{\nfloat isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251);\nfloat isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd));\nvec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;\nvec3 right = normalize(cross(forward, startEllipsoidNormal));\nvec4 position = vec4(startPositionAndHeight.xyz, 1.0);\nposition.xyz += forward * isEnd;\nv_volumeUpEC = czm_normal * normalize(cross(right, forward));\nfloat offset;\nvec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);\noffset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);\noffset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;\nposition.xyz += offset * ellipsoidNormal;\nposition = u_modifiedModelView * position;\nright = czm_normal * right;\nvec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);\nscratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));\nvec3 miterPushNormal = czm_normal * normalize(scratchNormal);\noffset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position));\noffset = offset / dot(miterPushNormal, right);\nposition.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));\ngl_Position = czm_depthClamp(czm_projection * position);\nposition = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);\nvec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;\nv_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));\nv_rightPlaneEC = vec4(right, -dot(right, position.xyz));\nposition = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);\nvec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;\nv_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));\nv_halfWidth = endFaceNormalAndHalfWidth.w;\n}\n",Vector3DTileClampedPolylinesFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\nuniform vec4 u_highlightColor;\nvoid main()\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);\nhalfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\ngl_FragColor = u_highlightColor;\nczm_writeDepthClamp();\n}\n";function Vector3DTileClampedPolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new Cartesian2(ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight),this._boundingVolume=OrientedBoundingBox.fromRectangle(e.rectangle,ApproximateTerrainHeights._defaultMinTerrainHeight,ApproximateTerrainHeights._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0;const t=this;ApproximateTerrainHeights.initialize().then((function(){updateMinimumMaximumHeights(t,t._rectangle,t._ellipsoid)})).otherwise((function(e){this._readyPromise.reject(e)}))}function updateMinimumMaximumHeights(e,t,n){const i=ApproximateTerrainHeights.getMinimumMaximumHeights(t,n),r=i.minimumTerrainHeight,o=i.maximumTerrainHeight,a=e._minimumMaximumVectorHeights;a.x=r,a.y=o;const s=e._boundingVolume,c=e._rectangle;OrientedBoundingBox.fromRectangle(c,r,o,n,s)}function packBuffer(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,r=e._ellipsoid,o=e._center,a=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(a);let c=0;return s[c++]=n,s[c++]=i,Rectangle.pack(t,s,c),c+=Rectangle.packedLength,Ellipsoid.pack(r,s,c),c+=Ellipsoid.packedLength,Cartesian3.pack(o,s,c),s}Object.defineProperties(Vector3DTileClampedPolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});const createVerticesTaskProcessor=new TaskProcessor("createVectorTileClampedPolylines"),attributeLocations$3={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function createVertexArray$1(e,t){if(!defined(e._va)){if(!defined(e._verticesPromise)){let t=e._positions,n=e._widths,i=e._counts,r=e._transferrableBatchIds,o=e._packedBuffer;defined(o)||(t=e._positions=arraySlice(t),n=e._widths=arraySlice(n),i=e._counts=arraySlice(i),r=e._transferrableBatchIds=arraySlice(e._batchIds),o=e._packedBuffer=packBuffer(e));const a=[t.buffer,n.buffer,i.buffer,r.buffer,o.buffer],s={positions:t.buffer,widths:n.buffer,counts:i.buffer,batchIds:r.buffer,packedBuffer:o.buffer,keepDecodedPositions:e._keepDecodedPositions},c=e._verticesPromise=createVerticesTaskProcessor.scheduleTask(s,a);if(!defined(c))return;when(c,(function(t){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(t.decodedPositions),e._decodedPositionOffsets=new Uint32Array(t.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(t.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(t.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(t.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(t.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(t.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(t.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds);const n=t.indexDatatype;e._indices=n===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(t.indices):new Uint32Array(t.indices),e._ready=!0})).otherwise((function(t){e._readyPromise.reject(t)}))}if(e._ready&&!defined(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,r=e._startPositionAndHeights,o=e._endPositionAndHeights,a=e._startFaceNormalAndVertexCornerIds,s=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,l=e._indices;let u=n.byteLength+i.byteLength;u+=r.byteLength+o.byteLength,u+=a.byteLength+s.byteLength,u+=c.byteLength+l.byteLength,e._trianglesLength=l.length/3,e._geometryByteLength=u;const d=Buffer$1.createVertexBuffer({context:t,typedArray:n,usage:BufferUsage$1.STATIC_DRAW}),h=Buffer$1.createVertexBuffer({context:t,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),p=Buffer$1.createVertexBuffer({context:t,typedArray:r,usage:BufferUsage$1.STATIC_DRAW}),f=Buffer$1.createVertexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW}),m=Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),g=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW}),_=Buffer$1.createVertexBuffer({context:t,typedArray:c,usage:BufferUsage$1.STATIC_DRAW}),y=Buffer$1.createIndexBuffer({context:t,typedArray:l,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===l.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),C=[{index:attributeLocations$3.startEllipsoidNormal,vertexBuffer:d,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.endEllipsoidNormal,vertexBuffer:h,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.startPositionAndHeight,vertexBuffer:p,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endPositionAndHeight,vertexBuffer:f,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.startFaceNormalAndVertexCorner,vertexBuffer:m,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.endFaceNormalAndHalfWidth,vertexBuffer:g,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{index:attributeLocations$3.a_batchId,vertexBuffer:_,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:C,indexBuffer:y}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0,e._readyPromise.resolve()}}}const modifiedModelViewScratch$1=new Matrix4,rtcScratch$1=new Cartesian3;function createUniformMap$2(e,t){defined(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return Matrix4.clone(n,modifiedModelViewScratch$1),Matrix4.multiplyByPoint(modifiedModelViewScratch$1,e._center,rtcScratch$1),Matrix4.setTranslation(modifiedModelViewScratch$1,rtcScratch$1,modifiedModelViewScratch$1),modifiedModelViewScratch$1},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function getRenderState(e){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},blending:BlendingState$1.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createRenderStates$1(e){defined(e._rs)||(e._rs=getRenderState(!1),e._rs3DTiles=getRenderState(!0))}function createShaders(e,t){if(defined(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTileClampedPolylinesVS),r=n.getFragmentShaderCallback(!1,void 0,!0)(Vector3DTileClampedPolylinesFS),o=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,i]}),a=new ShaderSource({defines:["VECTOR_TILE"],sources:[r]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:o,fragmentShaderSource:a,attributeLocations:attributeLocations$3})}function queueCommands(e,t){let n=e._command;if(!defined(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:Pass$1.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const i=DrawCommand.shallowClone(n,n.derivedCommands.tileset);i.renderState=e._rs3DTiles,i.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=i}const i=e._classificationType;i!==ClassificationType$1.TERRAIN&&i!==ClassificationType$1.BOTH||t.commandList.push(n),i!==ClassificationType$1.CESIUM_3D_TILE&&i!==ClassificationType$1.BOTH||t.commandList.push(n.derivedCommands.tileset)}function clearStyle(e,t){const n=e._batchIds,i=n.length;for(let e=0;e<i;++e){const i=t[n[e]];i.show=!0,i.color=Color.WHITE}}Vector3DTileClampedPolylines.prototype.getPositions=function(e){return Vector3DTilePolylines.getPolylinePositions(this,e)},Vector3DTileClampedPolylines.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=n[r];t[i]=new Cesium3DTileFeature(e,i)}},Vector3DTileClampedPolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const scratchColor$f=new Color,DEFAULT_COLOR_VALUE=Color.WHITE,DEFAULT_SHOW_VALUE=!0;function Vector3DTileContent(e,t,n,i,r){this._tileset=e,this._tile=t,this._resource=n,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._groupMetadata=void 0,initialize$3(this,i,r)}function createColorChangedCallback(e){return function(t,n){defined(e._polygons)&&e._polygons.updateCommands(t,n)}}function getBatchIds(e,t){let n,i,r,o;const a=defaultValue(e.POLYGONS_LENGTH,0),s=defaultValue(e.POLYLINES_LENGTH,0),c=defaultValue(e.POINTS_LENGTH,0);if(a>0&&defined(e.POLYGON_BATCH_IDS)){const i=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,a)}if(s>0&&defined(e.POLYLINE_BATCH_IDS)){const n=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,s)}if(c>0&&defined(e.POINT_BATCH_IDS)){const n=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,n,c)}const l=defined(n)||defined(i)||defined(r),u=a>0&&!defined(n)||s>0&&!defined(i)||c>0&&!defined(r);if(l&&u)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!defined(n)&&!defined(i)&&!defined(r)){let e=0;if(!defined(n)&&a>0)for(n=new Uint16Array(a),o=0;o<a;++o)n[o]=e++;if(!defined(i)&&s>0)for(i=new Uint16Array(s),o=0;o<s;++o)i[o]=e++;if(!defined(r)&&c>0)for(r=new Uint16Array(c),o=0;o<c;++o)r[o]=e++}return{polygons:n,polylines:i,points:r}}Vector3DTileClampedPolylines.prototype.applyStyle=function(e,t){if(!defined(e))return void clearStyle(this,t);const n=this._batchIds,i=n.length;for(let r=0;r<i;++r){const i=t[n[r]];i.color=defined(e.color)?e.color.evaluateColor(i,scratchColor$f):DEFAULT_COLOR_VALUE,i.show=defined(e.show)?e.show.evaluate(i):DEFAULT_SHOW_VALUE}},Vector3DTileClampedPolylines.prototype.update=function(e){const t=e.context;if(createVertexArray$1(this,t),createUniformMap$2(this,t),createShaders(this,t),createRenderStates$1(this),!this._ready)return;const n=e.passes;(n.render||n.pick)&&queueCommands(this,e)},Vector3DTileClampedPolylines.prototype.isDestroyed=function(){return!1},Vector3DTileClampedPolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)},Object.defineProperties(Vector3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return defined(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return defined(this._polygons)&&(e+=this._polygons.trianglesLength),defined(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return defined(this._polygons)&&(e+=this._polygons.geometryByteLength),defined(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return defined(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}});const sizeOfUint32=Uint32Array.BYTES_PER_ELEMENT;function createFloatingPolylines(e){return new Vector3DTilePolylines(e)}function createClampedPolylines(e){return new Vector3DTileClampedPolylines(e)}function initialize$3(e,t,n){n=defaultValue(n,0);const i=new Uint8Array(t),r=new DataView(t);n+=sizeOfUint32;const o=r.getUint32(n,!0);if(1!==o)throw new RuntimeError("Only Vector tile version 1 is supported. Version "+o+" is not.");n+=sizeOfUint32;const a=r.getUint32(n,!0);if(n+=sizeOfUint32,0===a)return void e._readyPromise.resolve(e);const s=r.getUint32(n,!0);if(n+=sizeOfUint32,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");const c=r.getUint32(n,!0);n+=sizeOfUint32;const l=r.getUint32(n,!0);n+=sizeOfUint32;const u=r.getUint32(n,!0);n+=sizeOfUint32;const d=r.getUint32(n,!0);n+=sizeOfUint32;const h=r.getUint32(n,!0);n+=sizeOfUint32;const p=r.getUint32(n,!0);n+=sizeOfUint32;const f=r.getUint32(n,!0),m=getJsonFromTypedArray(i,n+=sizeOfUint32,s);n+=s;const g=new Uint8Array(t,n,c);let _,y;n+=c,l>0&&(_=getJsonFromTypedArray(i,n,l),n+=l,u>0&&(y=new Uint8Array(t,n,u),y=new Uint8Array(y),n+=u));const C=defaultValue(m.POLYGONS_LENGTH,0),T=defaultValue(m.POLYLINES_LENGTH,0),S=defaultValue(m.POINTS_LENGTH,0),A=C+T+S,v=new Cesium3DTileBatchTable(e,A,_,y,createColorChangedCallback(e));if(e._batchTable=v,0===A)return;const E=new Cesium3DTileFeatureTable(m,g),b=E.getGlobalProperty("REGION");if(!defined(b))throw new RuntimeError("Feature table global property: REGION must be defined");const x=Rectangle.unpack(b),P=b[4],D=b[5],w=e._tile.computedTransform;let M=E.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(M)?(M=Cartesian3.unpack(M),Matrix4.multiplyByPoint(w,M,M)):(M=Rectangle.center(x),M.height=CesiumMath.lerp(P,D,.5),M=Ellipsoid.WGS84.cartographicToCartesian(M));const I=getBatchIds(m,g);if(n+=(4-n%4)%4,C>0){E.featuresLength=C;const i=defaultValue(E.getPropertyArray("POLYGON_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(i))throw new RuntimeError("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const r=defaultValue(E.getPropertyArray("POLYGON_INDEX_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_INDEX_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(r))throw new RuntimeError("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const o=i.reduce((function(e,t){return e+2*t}),0),a=r.reduce((function(e,t){return e+t}),0),s=new Uint32Array(t,n,a);n+=d;const c=new Uint16Array(t,n,o);let l,u;n+=h,defined(m.POLYGON_MINIMUM_HEIGHTS)&&defined(m.POLYGON_MAXIMUM_HEIGHTS)&&(l=E.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1),u=E.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",ComponentDatatype$1.FLOAT,1)),e._polygons=new Vector3DTilePolygons({positions:c,counts:i,indexCounts:r,indices:s,minimumHeight:P,maximumHeight:D,polygonMinimumHeights:l,polygonMaximumHeights:u,center:M,rectangle:x,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:v,batchIds:I.polygons,modelMatrix:w})}if(T>0){E.featuresLength=T;const i=defaultValue(E.getPropertyArray("POLYLINE_COUNTS",ComponentDatatype$1.UNSIGNED_INT,1),E.getPropertyArray("POLYLINE_COUNT",ComponentDatatype$1.UNSIGNED_INT,1));if(!defined(i))throw new RuntimeError("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let r=E.getPropertyArray("POLYLINE_WIDTHS",ComponentDatatype$1.UNSIGNED_SHORT,1);if(!defined(r)){r=new Uint16Array(T);for(let e=0;e<T;++e)r[e]=2}const o=i.reduce((function(e,t){return e+3*t}),0),a=new Uint16Array(t,n,o);n+=p;const s=e._tileset,c=s.examineVectorLinesFunction;if(defined(c)){examineVectorLines(decodeVectorPolylinePositions(new Uint16Array(a),x,P,D,Ellipsoid.WGS84),i,I.polylines,v,e.url,c)}let l=createFloatingPolylines;defined(s.classificationType)&&(l=createClampedPolylines),e._polylines=l({positions:a,widths:r,counts:i,batchIds:I.polylines,minimumHeight:P,maximumHeight:D,center:M,rectangle:x,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:v,classificationType:s.classificationType,keepDecodedPositions:s.vectorKeepDecodedPositions})}if(S>0){const i=new Uint16Array(t,n,3*S);n+=f,e._points=new Vector3DTilePoints({positions:i,batchIds:I.points,minimumHeight:P,maximumHeight:D,rectangle:x,batchTable:v})}}function createFeatures(e){const t=e.featuresLength;if(!defined(e._features)&&t>0){const n=new Array(t);defined(e._polygons)&&e._polygons.createFeatures(e,n),defined(e._polylines)&&e._polylines.createFeatures(e,n),defined(e._points)&&e._points.createFeatures(e,n),e._features=n}}function examineVectorLines(e,t,n,i,r,o){const a=t.length;let s=0;for(let c=0;c<a;c++){const a=3*t[c],l=e.slice(s,s+a);s+=a,o(l,n[c],r,i)}}function PropertyTable(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Vector3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Vector3DTileContent.prototype.getFeature=function(e){return createFeatures(this),this._features[e]},Vector3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._polygons)&&this._polygons.applyDebugSettings(e,t),defined(this._polylines)&&this._polylines.applyDebugSettings(e,t),defined(this._points)&&this._points.applyDebugSettings(e,t)},Vector3DTileContent.prototype.applyStyle=function(e){createFeatures(this),defined(this._polygons)&&this._polygons.applyStyle(e,this._features),defined(this._polylines)&&this._polylines.applyStyle(e,this._features),defined(this._points)&&this._points.applyStyle(e,this._features)},Vector3DTileContent.prototype.update=function(e,t){let n=!0;if(defined(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons._ready),defined(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines._ready),defined(this._points)&&(this._points.update(t),n=n&&this._points._ready),defined(this._batchTable)&&n&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){const e=defined(this._points)?this._points.readyPromise:void 0,t=defined(this._polygons)?this._polygons.readyPromise:void 0,n=defined(this._polylines)?this._polylines.readyPromise:void 0,i=this;this._contentReadyPromise=when.all([e,t,n]).then((function(){i._readyPromise.resolve(i)})).otherwise((function(e){i._readyPromise.reject(e)}))}},Vector3DTileContent.prototype.getPolylinePositions=function(e){const t=this._polylines;if(defined(t))return t.getPositions(e)},Vector3DTileContent.prototype.isDestroyed=function(){return!1},Vector3DTileContent.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},Object.defineProperties(PropertyTable.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(defined(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTable.prototype.hasProperty=function(e,t){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(t))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(t))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.hasProperty(e,t)))},PropertyTable.prototype.hasPropertyBySemantic=function(e,t){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(t)},PropertyTable.prototype.propertyExists=function(e){return!(!defined(this._metadataTable)||!this._metadataTable.hasProperty(e))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(e))||!(!defined(this._batchTableHierarchy)||!this._batchTableHierarchy.propertyExists(e)))},PropertyTable.prototype.propertyExistsBySemantic=function(e){return!!defined(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(e)};const scratchResults=[];function PropertyTextureProperty(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).property,n=e.classProperty,i=e.textures,r=t.texture,o=GltfLoaderUtil.createModelTextureReader({textureInfo:r,channels:t.channels,texture:i[r.index]});this._textureReader=o,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}function PropertyTexture(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).featureTexture,n=e.class,i=e.textures,r=t.extensions,o=t.extras,a={};if(defined(t.properties))for(const e in t.properties)t.properties.hasOwnProperty(e)&&(a[e]=new PropertyTextureProperty({property:t.properties[e],classProperty:n.properties[e],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=a,this._extras=o,this._extensions=r}function FeatureMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=defined(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}function parseFeatureMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,n=e.schema;let i;const r=[];if(defined(t.propertyTables))for(i=0;i<t.propertyTables.length;i++){const o=t.propertyTables[i],a=n.classes[o.class],s=new MetadataTable({count:o.count,properties:o.properties,class:a,bufferViews:e.bufferViews});r.push(new PropertyTable({id:i,name:o.name,count:o.count,metadataTable:s,extras:o.extras,extensions:o.extensions}))}const o=[];if(defined(t.propertyTextures))for(i=0;i<t.propertyTextures.length;i++){const r=t.propertyTextures[i];o.push(new PropertyTexture({id:i,name:r.name,featureTexture:reformatPropertyTexture(r),class:n.classes[r.class],textures:e.textures}))}return new FeatureMetadata({schema:n,propertyTables:r,propertyTextures:o,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function reformatPropertyTexture(e){const t=clone$1(e),n=clone$1(e);n.properties={};const i=e.properties;for(const e in i)if(i.hasOwnProperty(e)){const r=i[e];n.properties[e]={texture:t,channels:reformatChannels(r)}}return n}function reformatChannels(e){return e.map((function(e){return"rgba".charAt(e)})).join("")}function parseFeatureMetadataLegacy(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,n=e.schema;let i;const r=[];let o;if(defined(t.featureTables))for(o=Object.keys(t.featureTables).sort(),i=0;i<o.length;i++){const a=o[i],s=t.featureTables[a],c=n.classes[s.class],l=new MetadataTable({count:s.count,properties:s.properties,class:c,bufferViews:e.bufferViews});r.push(new PropertyTable({id:a,count:s.count,metadataTable:l,extras:s.extras,extensions:s.extensions}))}const a=[];if(defined(t.featureTextures))for(o=Object.keys(t.featureTextures).sort(),i=0;i<o.length;i++){const r=o[i],s=t.featureTextures[r];a.push(new PropertyTexture({id:r,featureTexture:s,class:n.classes[s.class],textures:e.textures}))}return new FeatureMetadata({schema:n,propertyTables:r,propertyTextures:a,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function GltfFeatureMetadataLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf,n=e.extension,i=e.extensionLegacy,r=e.gltfResource,o=e.baseResource,a=e.supportedImageFormats,s=e.cacheKey,c=defaultValue(e.asynchronous,!0);this._gltfResource=r,this._baseResource=o,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=a,this._cacheKey=s,this._asynchronous=c,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._featureMetadata=void 0,this._state=ResourceLoaderState$1.UNLOADED,this._promise=when.defer()}function gatherBufferViewIdsFromProperties(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=i.bufferView,o=i.arrayOffsetBufferView,a=i.stringOffsetBufferView;defined(r)&&(t[r]=!0),defined(o)&&(t[o]=!0),defined(a)&&(t[a]=!0)}}function gatherUsedBufferViewIds(e){const t=e.propertyTables,n={};if(defined(t))for(let e=0;e<t.length;e++){gatherBufferViewIdsFromProperties(t[e].properties,n)}return n}function gatherUsedBufferViewIdsLegacy(e){const t=e.featureTables,n={};if(defined(t))for(const e in t)if(t.hasOwnProperty(e)){const i=t[e].properties;defined(i)&&gatherBufferViewIdsFromProperties(i,n)}return n}function loadBufferViews(e){let t;t=defined(e._extension)?gatherUsedBufferViewIds(e._extension):gatherUsedBufferViewIdsLegacy(e._extensionLegacy);const n=[],i={};for(const r in t)if(t.hasOwnProperty(r)){const t=ResourceCache.loadBufferView({gltf:e._gltf,bufferViewId:parseInt(r),gltfResource:e._gltfResource,baseResource:e._baseResource});n.push(t.promise),e._bufferViewLoaders.push(t),i[r]=t}return when.all(n).then((function(){const t={};for(const e in i)if(i.hasOwnProperty(e)){const n=i[e],r=new Uint8Array(n.typedArray);t[e]=r}return unloadBufferViews$1(e),t}))}function gatherUsedTextureIds(e){const t={},n=e.propertyTextures;if(defined(n))for(let e=0;e<n.length;e++){const i=n[e];defined(i.properties)&&(t[i.index]=i)}return t}function gatherTextureIdsFromProperties(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n].texture;t[i.index]=i}}function gatherUsedTextureIdsLegacy(e){const t={},n=e.featureTextures;if(defined(n))for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;defined(i)&&gatherTextureIdsFromProperties(i,t)}return t}function loadTextures(e){let t;t=defined(e._extension)?gatherUsedTextureIds(e._extension):gatherUsedTextureIdsLegacy(e._extensionLegacy);const n=e._gltf,i=e._gltfResource,r=e._baseResource,o=e._supportedImageFormats,a=e._asynchronous,s=[],c={};for(const l in t)if(t.hasOwnProperty(l)){const u=ResourceCache.loadTexture({gltf:n,textureInfo:t[l],gltfResource:i,baseResource:r,supportedImageFormats:o,asynchronous:a});s.push(u.promise),e._textureLoaders.push(u),c[l]=u}return when.all(s).then((function(){const e={};for(const t in c)if(c.hasOwnProperty(t)){const n=c[t];e[t]=n.texture}return e}))}function loadSchema(e){const t=defaultValue(e._extension,e._extensionLegacy);let n;if(defined(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=ResourceCache.loadSchema({resource:i})}else n=ResourceCache.loadSchema({schema:t.schema});return e._schemaLoader=n,n.promise.then((function(e){return e.schema}))}function unloadBufferViews$1(e){const t=e._bufferViewLoaders,n=t.length;for(let e=0;e<n;++e)ResourceCache.unload(t[e]);e._bufferViewLoaders.length=0}function unloadTextures$1(e){const t=e._textureLoaders,n=t.length;for(let e=0;e<n;++e)ResourceCache.unload(t[e]);e._textureLoaders.length=0}PropertyTable.prototype.getPropertyIds=function(e,t){return(t=defined(t)?t:[]).length=0,defined(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(scratchResults)),defined(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(scratchResults)),defined(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,scratchResults)),t},PropertyTable.prototype.getProperty=function(e,t){let n;return defined(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),defined(n))||defined(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),defined(n))||defined(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),defined(n))?n:void 0},PropertyTable.prototype.setProperty=function(e,t,n){return!(!defined(this._metadataTable)||!this._metadataTable.setProperty(e,t,n))||(!(!defined(this._jsonMetadataTable)||!this._jsonMetadataTable.setProperty(e,t,n))||defined(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))},PropertyTable.prototype.getPropertyBySemantic=function(e,t){if(defined(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)},PropertyTable.prototype.setPropertyBySemantic=function(e,t,n){return!!defined(this._metadataTable)&&this._metadataTable.setPropertyBySemantic(e,t,n)},PropertyTable.prototype.getPropertyTypedArray=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)},PropertyTable.prototype.getPropertyTypedArrayBySemantic=function(e){if(defined(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)},Object.defineProperties(PropertyTextureProperty.prototype,{textureReader:{get:function(){return this._textureReader}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(PropertyTexture.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),PropertyTexture.prototype.getProperty=function(e){return this._properties[e]},Object.defineProperties(FeatureMetadata.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}}}),FeatureMetadata.prototype.getPropertyTable=function(e){return this._propertyTables[e]},FeatureMetadata.prototype.getPropertyTexture=function(e){return this._propertyTextures[e]},defined(Object.create)&&(GltfFeatureMetadataLoader.prototype=Object.create(ResourceLoader.prototype),GltfFeatureMetadataLoader.prototype.constructor=GltfFeatureMetadataLoader),Object.defineProperties(GltfFeatureMetadataLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){return this._cacheKey}},featureMetadata:{get:function(){return this._featureMetadata}}}),GltfFeatureMetadataLoader.prototype.load=function(){const e=loadBufferViews(this),t=loadTextures(this),n=loadSchema(this);this._gltf=void 0,this._state=ResourceLoaderState$1.LOADING;const i=this;when.all([e,t,n]).then((function(e){if(i.isDestroyed())return;const t=e[0],n=e[1],r=e[2];defined(i._extension)?i._featureMetadata=parseFeatureMetadata({extension:i._extension,schema:r,bufferViews:t,textures:n}):i._featureMetadata=parseFeatureMetadataLegacy({extension:i._extensionLegacy,schema:r,bufferViews:t,textures:n}),i._state=ResourceLoaderState$1.READY,i._promise.resolve(i)})).otherwise((function(e){if(i.isDestroyed())return;i.unload(),i._state=ResourceLoaderState$1.FAILED;i._promise.reject(i.getError("Failed to load feature metadata",e))}))},GltfFeatureMetadataLoader.prototype.process=function(e){if(this._state!==ResourceLoaderState$1.LOADING)return;const t=this._textureLoaders,n=t.length;for(let i=0;i<n;++i){t[i].process(e)}},GltfFeatureMetadataLoader.prototype.unload=function(){unloadBufferViews$1(this),unloadTextures$1(this),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),this._schemaLoader=void 0,this._featureMetadata=void 0};const InstanceAttributeSemantic={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"FEATURE_ID",fromGltfSemantic:function(e){let t=e;const n=/^(\w+)_\d+$/.exec(e);switch(null!==n&&(t=n[1]),t){case"TRANSLATION":return InstanceAttributeSemantic.TRANSLATION;case"ROTATION":return InstanceAttributeSemantic.ROTATION;case"SCALE":return InstanceAttributeSemantic.SCALE;case"_FEATURE_ID":case"FEATURE_ID":return InstanceAttributeSemantic.FEATURE_ID}}};var InstanceAttributeSemantic$1=Object.freeze(InstanceAttributeSemantic);function SupportedImageFormats(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.webp=defaultValue(e.webp,!1),this.basis=defaultValue(e.basis,!1)}const Attribute$2=ModelComponents.Attribute,Indices=ModelComponents.Indices,FeatureIdAttribute$3=ModelComponents.FeatureIdAttribute,FeatureIdTexture=ModelComponents.FeatureIdTexture,MorphTarget=ModelComponents.MorphTarget,Primitive$1=ModelComponents.Primitive,Instances$1=ModelComponents.Instances,Skin=ModelComponents.Skin,Node$2=ModelComponents.Node,Scene$2=ModelComponents.Scene,Components$1=ModelComponents.Components,MetallicRoughness$2=ModelComponents.MetallicRoughness,SpecularGlossiness$1=ModelComponents.SpecularGlossiness,Material$2=ModelComponents.Material,GltfLoaderState={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,PROCESSED:4,READY:4,FAILED:5};function GltfLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltfResource;let n=e.baseResource;const i=e.typedArray,r=defaultValue(e.releaseGltfJson,!1),o=defaultValue(e.asynchronous,!0),a=defaultValue(e.incrementallyLoadTextures,!0),s=defaultValue(e.upAxis,Axis$1.Y),c=defaultValue(e.forwardAxis,Axis$1.Z),l=defaultValue(e.loadAsTypedArray,!1),u=defaultValue(e.renameBatchIdSemantic,!1);n=defined(n)?n:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=n,this._typedArray=i,this._releaseGltfJson=r,this._asynchronous=o,this._incrementallyLoadTextures=a,this._upAxis=s,this._forwardAxis=c,this._loadAsTypedArray=l,this._renameBatchIdSemantic=u,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=GltfLoaderState.UNLOADED,this._textureState=GltfLoaderState.UNLOADED,this._promise=when.defer(),this._texturesLoadedPromise=when.defer(),this._textureLoaders=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._featureMetadataLoader=void 0,this._components=void 0}function handleError$2(e,t){e.unload(),e._state=GltfLoaderState.FAILED,e._textureState=GltfLoaderState.FAILED;t=e.getError("Failed to load glTF",t),e._promise.reject(t),e._texturesLoadedPromise.reject(t)}function process$1(e,t){let n;const i=e._textureLoaders,r=i.length;for(n=0;n<r;++n)i[n].process(t);const o=e._bufferViewLoaders,a=o.length;for(n=0;n<a;++n)o[n].process(t);const s=e._geometryLoaders,c=s.length;for(n=0;n<c;++n)s[n].process(t);defined(e._featureMetadataLoader)&&e._featureMetadataLoader.process(t)}function loadVertexBuffer(e,t,n,i,r,o,a){const s=t.accessors[n].bufferView,c=ResourceCache.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,bufferViewId:s,draco:r,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,dequantize:o,loadAsTypedArray:a});return e._geometryLoaders.push(c),c}function loadIndexBuffer(e,t,n,i,r){const o=ResourceCache.loadIndexBuffer({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,draco:i,asynchronous:e._asynchronous,loadAsTypedArray:r});return e._geometryLoaders.push(o),o}function loadBufferView(e,t,n){const i=ResourceCache.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function getPackedTypedArray(e,t,n){let i=t.byteOffset;const r=getAccessorByteStride(e,t),o=t.count,a=numberOfComponentsForType(t.type),s=t.componentType,c=ComponentDatatype$1.getSizeInBytes(s),l=o*a;if(r===c*a)return n=new Uint8Array(n),ComponentDatatype$1.createArrayBufferView(s,n.buffer,n.byteOffset+i,l);const u=ComponentDatatype$1.createTypedArray(s,l),d=new DataView(n.buffer),h=new Array(a),p=getComponentReader(t.componentType);i=n.byteOffset+i;for(let e=0;e<o;++e){p(d,i,a,c,h);for(let t=0;t<a;++t)u[e*a+t]=h[t];i+=r}return u}function fromArray(e,t){if(defined(t))return e===Number?t[0]:e.unpack(t)}function getDefault(e){return e===Number?0:new e}function createAttribute(e,t,n,i,r){const o=e.accessors[t],a=AttributeType$1.getMathType(o.type),s=new Attribute$2;return s.name=n,s.semantic=i,s.setIndex=r,s.constant=getDefault(a),s.componentDatatype=o.componentType,s.normalized=defaultValue(o.normalized,!1),s.count=o.count,s.type=o.type,s.min=fromArray(a,o.min),s.max=fromArray(a,o.max),s.byteOffset=o.byteOffset,s.byteStride=getAccessorByteStride(e,o),s}function getSetIndex(e){const t=/^\w+_(\d+)$/.exec(e);if(null!==t)return parseInt(t[1])}function loadAttribute(e,t,n,i,r,o,a,s,c){const l=t.accessors[n],u=l.bufferView;let d=r;!e._renameBatchIdSemantic||"_BATCHID"!==r&&"BATCHID"!==r||(d="FEATURE_ID_0");const h=r,p=i.fromGltfSemantic(d),f=defined(p)?getSetIndex(d):void 0,m=createAttribute(t,n,h,p,f);if(!defined(o)&&!defined(u))return m;return loadVertexBuffer(e,t,n,r,o,a,s).promise.then((function(n){if(!e.isDestroyed()){if(c){const e=n.typedArray;m.packedTypedArray=getPackedTypedArray(t,l,e),m.byteOffset=0,m.byteStride=void 0}else s?m.typedArray=n.typedArray:m.buffer=n.buffer;defined(o)&&defined(o.attributes)&&defined(o.attributes[r])&&(m.byteOffset=0,m.byteStride=void 0,m.quantization=n.quantization)}})),m}function loadVertexAttribute(e,t,n,i,r){return loadAttribute(e,t,n,VertexAttributeSemantic$1,i,r,!1,e._loadAsTypedArray,!1)}function loadInstancedAttribute(e,t,n,i,r){return loadAttribute(e,t,n,InstanceAttributeSemantic$1,i,void 0,!0,r,r)}function loadIndices(e,t,n,i){const r=t.accessors[n],o=r.bufferView;if(!defined(i)&&!defined(o))return;const a=new Indices;a.count=r.count;const s=e._loadAsTypedArray;return loadIndexBuffer(e,t,n,i,s).promise.then((function(t){e.isDestroyed()||(a.indexDatatype=t.indexDatatype,s?a.typedArray=t.typedArray:a.buffer=t.buffer)})),a}function loadTexture(e,t,n,i,r){if(!defined(GltfLoaderUtil.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i})))return;const o=ResourceCache.loadTexture({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,asynchronous:e._asynchronous});e._textureLoaders.push(o);const a=GltfLoaderUtil.createModelTextureReader({textureInfo:n});return o.promise.then((function(t){e.isDestroyed()||(a.texture=t.texture,defined(r)&&(a.texture.sampler=r))})),a}function loadMaterial(e,t,n,i){const r=new Material$2,o=defaultValue(n.extensions,defaultValue.EMPTY_OBJECT),a=o.KHR_materials_pbrSpecularGlossiness,s=n.pbrMetallicRoughness;if(r.unlit=defined(o.KHR_materials_unlit),defined(a)){const n=new SpecularGlossiness$1;r.specularGlossiness=n,defined(a.diffuseTexture)&&(n.diffuseTexture=loadTexture(e,t,a.diffuseTexture,i)),defined(a.specularGlossinessTexture)&&defined(a.specularGlossinessTexture)&&(n.specularGlossinessTexture=loadTexture(e,t,a.specularGlossinessTexture,i)),n.diffuseFactor=fromArray(Cartesian4,a.diffuseFactor),n.specularFactor=fromArray(Cartesian3,a.specularFactor),n.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(defined(s)){const n=new MetallicRoughness$2;r.metallicRoughness=n,defined(s.baseColorTexture)&&(n.baseColorTexture=loadTexture(e,t,s.baseColorTexture,i)),defined(s.metallicRoughnessTexture)&&(n.metallicRoughnessTexture=loadTexture(e,t,s.metallicRoughnessTexture,i)),n.baseColorFactor=fromArray(Cartesian4,s.baseColorFactor),n.metallicFactor=s.metallicFactor,n.roughnessFactor=s.roughnessFactor,r.pbrMetallicRoughness=s}return defined(n.emissiveTexture)&&(r.emissiveTexture=loadTexture(e,t,n.emissiveTexture,i)),defined(n.normalTexture)&&(r.normalTexture=loadTexture(e,t,n.normalTexture,i)),defined(n.occlusionTexture)&&(r.occlusionTexture=loadTexture(e,t,n.occlusionTexture,i)),r.emissiveFactor=fromArray(Cartesian3,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function loadFeatureIdAttribute(e,t){const n=new FeatureIdAttribute$3;return n.propertyTableId=t,n.setIndex=e.attribute,n.offset=defaultValue(e.offset,0),n.repeat=e.repeat,n}function loadFeatureIdAttributeLegacy(e,t){const n=new FeatureIdAttribute$3,i=e.featureIds;n.propertyTableId=t,n.setIndex=getSetIndex(i.attribute),n.offset=defaultValue(i.constant,0);const r=defaultValue(i.divisor,0);return n.repeat=0===r?void 0:r,n}function loadFeatureIdTexture(e,t,n,i,r){const o=new FeatureIdTexture,a=n;o.propertyTableId=i,o.textureReader=loadTexture(e,t,a,r,Sampler.NEAREST);const s="rgba".charAt(n.channel);return o.textureReader.channels=s,o}function loadFeatureIdTextureLegacy(e,t,n,i,r){const o=new FeatureIdTexture,a=n.featureIds,s=a.texture;return o.propertyTableId=i,o.textureReader=loadTexture(e,t,s,r,Sampler.NEAREST),o.textureReader.channels=a.channels,o}function loadMorphTarget(e,t,n){const i=new MorphTarget;for(const r in n)if(n.hasOwnProperty(r)){const o=n[r];i.attributes.push(loadVertexAttribute(e,t,o,r,void 0))}return i}function loadPrimitive(e,t,n,i,r){const o=new Primitive$1,a=n.material;defined(a)&&(o.material=loadMaterial(e,t,t.materials[a],r));const s=defaultValue(n.extensions,defaultValue.EMPTY_OBJECT),c=s.KHR_draco_mesh_compression,l=n.attributes;if(defined(l))for(const n in l)if(l.hasOwnProperty(n)){const i=l[n];o.attributes.push(loadVertexAttribute(e,t,i,n,c))}const u=n.targets;if(defined(u)){const n=u.length;for(let i=0;i<n;++i)o.morphTargets.push(loadMorphTarget(e,t,u[i]));o.morphWeights=defined(i)?i.slice():arrayFill(new Array(n),0)}const d=n.indices;defined(d)&&(o.indices=loadIndices(e,t,d,c));const h=s.EXT_mesh_features,p=s.EXT_feature_metadata;return defined(h)?loadPrimitiveMetadata(e,t,o,h,r):defined(p)&&loadPrimitiveMetadataLegacy(e,t,o,p,r),o.primitiveType=n.mode,o}function loadPrimitiveMetadata(e,t,n,i,r){let o;const a=[],s=[],c=i.featureIds,l=i.propertyTables;if(defined(c))for(o=0;o<c.length;o++){const e=c[o];defined(e.channel)?s.push(e):a.push(e)}const u=a.length;for(o=0;o<u;++o)n.featureIdAttributes.push(loadFeatureIdAttribute(a[o],l[o]));const d=s.length;for(o=0;o<d;++o)n.featureIdTextures.push(loadFeatureIdTexture(e,t,s[o],l[o],r));defined(i.propertyTextures)&&(n.featureTextureIds=i.propertyTextures)}function loadPrimitiveMetadataLegacy(e,t,n,i,r){let o;const a=i.featureIdAttributes;if(defined(a)){const t=a.length;for(o=0;o<t;++o){const t=a[o];n.featureIdAttributes.push(loadFeatureIdAttributeLegacy(t,e._sortedPropertyTableIds.indexOf(t.featureTable)))}}const s=i.featureIdTextures;if(defined(s)){const i=s.length;for(o=0;o<i;++o){const i=s[o];n.featureIdTextures.push(loadFeatureIdTextureLegacy(e,t,i,e._sortedPropertyTableIds.indexOf(i.featureTable),r))}}defined(i.featureTextures)&&(n.featureTextureIds=i.featureTextures.map((function(t){return e._sortedFeatureTextureIds.indexOf(t)})))}function loadInstances(e,t,n,i){const r=n.EXT_mesh_gpu_instancing,o=new Instances$1,a=r.attributes;if(defined(a)){const n=defined(a.ROTATION),r=defined(a.TRANSLATION)&&defined(t.accessors[a.TRANSLATION].min)&&defined(t.accessors[a.TRANSLATION].max);for(const s in a)if(a.hasOwnProperty(s)){const c=e._loadAsTypedArray||!i.context.instancedArrays||(n||!r)&&(s===InstanceAttributeSemantic$1.TRANSLATION||s===InstanceAttributeSemantic$1.ROTATION||s===InstanceAttributeSemantic$1.SCALE)||s.indexOf(InstanceAttributeSemantic$1.FEATURE_ID)>=0,l=a[s];o.attributes.push(loadInstancedAttribute(e,t,l,s,c))}}const s=defaultValue(r.extensions,defaultValue.EMPTY_OBJECT),c=n.EXT_mesh_features,l=s.EXT_feature_metadata;return defined(c)?loadInstanceMetadata(o,c):defined(l)&&loadInstanceMetadataLegacy(o,l,e._sortedPropertyTableIds),o}function loadInstanceMetadata(e,t){const n=t.featureIds,i=defined(t.propertyTables)?t.propertyTables:[],r=n.length;for(let t=0;t<r;t++){const r=n[t],o=i[t];e.featureIdAttributes.push(loadFeatureIdAttribute(r,o))}}function loadInstanceMetadataLegacy(e,t,n){const i=t.featureIdAttributes;if(defined(i)){const t=i.length;for(let r=0;r<t;++r){const t=i[r];e.featureIdAttributes.push(loadFeatureIdAttributeLegacy(t,n.indexOf(t.featureTable)))}}}function loadSkin(e,t,n,i){const r=new Skin,o=n.joints,a=o.length,s=new Array(a);for(let e=0;e<a;++e)s[e]=i[o[e]];r.joints=s;const c=n.inverseBindMatrices;if(defined(c)){const n=t.accessors[c],i=n.bufferView;if(defined(i)){loadBufferView(e,t,i).promise.then((function(i){if(e.isDestroyed())return;const o=i.typedArray,s=getPackedTypedArray(t,n,o),c=new Array(a);for(let e=0;e<a;++e)c[e]=Matrix4.unpack(s,16*e);r.inverseBindMatrices=c}))}}else r.inverseBindMatrices=arrayFill(new Array(a),Matrix4.IDENTITY);return r}function loadNode(e,t,n,i,r){const o=new Node$2;o.matrix=fromArray(Matrix4,n.matrix),o.translation=fromArray(Cartesian3,n.translation),o.rotation=fromArray(Quaternion,n.rotation),o.scale=fromArray(Cartesian3,n.scale);const a=n.mesh;if(defined(a)){const r=t.meshes[a],s=defaultValue(n.weights,r.weights),c=r.primitives,l=c.length;for(let n=0;n<l;++n)o.primitives.push(loadPrimitive(e,t,c[n],s,i))}const s=defaultValue(n.extensions,defaultValue.EMPTY_OBJECT);return defined(s.EXT_mesh_gpu_instancing)&&(o.instances=loadInstances(e,t,s,r)),o}function loadNodes(e,t,n,i){let r,o;const a=t.nodes.length,s=new Array(a);for(r=0;r<a;++r)s[r]=loadNode(e,t,t.nodes[r],n,i);for(r=0;r<a;++r){const e=t.nodes[r].children;if(defined(e)){const t=e.length;for(o=0;o<t;++o)s[r].children.push(s[e[o]])}}for(r=0;r<a;++r){const n=t.nodes[r].skin;defined(n)&&(s[r].skin=loadSkin(e,t,t.skins[n],s))}return s}function loadFeatureMetadata(e,t,n,i,r){const o=new GltfFeatureMetadataLoader({gltf:t,extension:n,extensionLegacy:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:r,asynchronous:e._asynchronous});return o.load(),e._featureMetadataLoader=o,o}function getSceneNodeIds(e){let t;return defined(e.scenes)&&defined(e.scene)&&(t=e.scenes[e.scene].nodes),t=defaultValue(t,e.nodes),t=defined(t)?t:[],t}function loadScene(e,t){const n=new Scene$2,i=getSceneNodeIds(e);return n.nodes=i.map((function(e){return t[e]})),n}function parse(e,t,n,i){const r=defaultValue(t.extensions,defaultValue.EMPTY_OBJECT),o=r.EXT_mesh_features,a=r.EXT_feature_metadata;if(a){const t=a.featureTables,n=a.featureTextures,i=defined(t)?t:[],r=defined(n)?n:[];e._sortedPropertyTableIds=Object.keys(i).sort(),e._sortedFeatureTextureIds=Object.keys(r).sort()}const s=loadNodes(e,t,n,i),c=loadScene(t,s),l=new Components$1;if(l.scene=c,l.nodes=s,l.upAxis=e._upAxis,l.forwardAxis=e._forwardAxis,e._components=l,defined(o)||defined(a)){loadFeatureMetadata(e,t,o,a,n).promise.then((function(t){e.isDestroyed()||(l.featureMetadata=t.featureMetadata)}))}const u=[];u.push.apply(u,e._bufferViewLoaders),u.push.apply(u,e._geometryLoaders),defined(e._featureMetadataLoader)&&u.push(e._featureMetadataLoader),e._incrementallyLoadTextures||u.push.apply(u,e._textureLoaders);const d=u.map((function(e){return e.promise})),h=e._textureLoaders.map((function(e){return e.promise}));when.all(d).then((function(){e.isDestroyed()||(e._state=GltfLoaderState.PROCESSED)})).otherwise((function(t){e.isDestroyed()||handleError$2(e,t)})),when.all(h).then((function(){e.isDestroyed()||(e._textureState=GltfLoaderState.PROCESSED)}))}function unloadTextures(e){const t=e._textureLoaders,n=t.length;for(let e=0;e<n;++e)ResourceCache.unload(t[e]);e._textureLoaders.length=0}function unloadBufferViews(e){const t=e._bufferViewLoaders,n=t.length;for(let e=0;e<n;++e)ResourceCache.unload(t[e]);e._bufferViewLoaders.length=0}function unloadGeometry(e){const t=e._geometryLoaders,n=t.length;for(let e=0;e<n;++e)ResourceCache.unload(t[e]);e._geometryLoaders.length=0}function unloadFeatureMetadata(e){defined(e._featureMetadataLoader)&&(e._featureMetadataLoader.destroy(),e._featureMetadataLoader=void 0)}defined(Object.create)&&(GltfLoader.prototype=Object.create(ResourceLoader.prototype),GltfLoader.prototype.constructor=GltfLoader),Object.defineProperties(GltfLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise.promise}}}),GltfLoader.prototype.load=function(){const e=ResourceCache.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=GltfLoaderState.LOADING,this._textureState=GltfLoaderState.LOADING;const t=this;e.promise.then((function(){t.isDestroyed()||(t._state=GltfLoaderState.LOADED,t._textureState=GltfLoaderState.LOADED)})).otherwise((function(e){t.isDestroyed()||handleError$2(t,e)}))},GltfLoader.prototype.process=function(e){if(FeatureDetection.supportsWebP.initialized){if(this._state===GltfLoaderState.LOADED){this._state=GltfLoaderState.PROCESSING;const t=new SupportedImageFormats({webp:FeatureDetection.supportsWebP(),basis:e.context.supportsBasis});let n;n=defined(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson,parse(this,n,t,e),defined(this._gltfJsonLoader)&&this._releaseGltfJson&&(ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0)}this._textureState===GltfLoaderState.LOADED&&(this._textureState=GltfLoaderState.PROCESSING),this._state!==GltfLoaderState.PROCESSING&&this._textureState!==GltfLoaderState.PROCESSING||process$1(this,e),this._state===GltfLoaderState.PROCESSED&&(unloadBufferViews(this),this._state=GltfLoaderState.READY,this._promise.resolve(this)),this._textureState===GltfLoaderState.PROCESSED&&(this._textureState=GltfLoaderState.READY,this._texturesLoadedPromise.resolve(this))}else FeatureDetection.supportsWebP.initialize()},GltfLoader.prototype.unload=function(){defined(this._gltfJsonLoader)&&ResourceCache.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,unloadTextures(this),unloadBufferViews(this),unloadGeometry(this),unloadFeatureMetadata(this),this._components=void 0};var ModelExperimentalFS="#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n#endif\nczm_modelMaterial defaultModelMaterial()\n{\nczm_modelMaterial material;\nmaterial.diffuse = vec3(1.0);\nmaterial.specular = vec3(0.04);\nmaterial.roughness = 0.0;\nmaterial.occlusion = 1.0;\nmaterial.normalEC = vec3(0.0, 0.0, 1.0);\nmaterial.emissive = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\nvec4 handleAlpha(vec3 color, float alpha)\n{\n#ifdef ALPHA_MODE_MASK\nif (alpha < u_alphaCutoff) {\ndiscard;\n}\nreturn vec4(color, 1.0);\n#elif defined(ALPHA_MODE_BLEND)\nreturn vec4(color, alpha);\n#else // OPAQUE\nreturn vec4(color, 1.0);\n#endif\n}\nFeature feature;\nvoid main()\n{\nczm_modelMaterial material = defaultModelMaterial();\nProcessedAttributes attributes;\ngeometryStage(attributes);\n#ifdef HAS_FEATURES\nfeatureStage(feature);\n#endif\n#ifndef CUSTOM_SHADER_REPLACE_MATERIAL\nmaterialStage(material, attributes, feature);\n#endif\n#ifdef HAS_CUSTOM_FRAGMENT_SHADER\ncustomShaderStage(material, attributes);\n#endif\nlightingStage(material);\n#ifdef HAS_FEATURES\ncpuStylingStage(material, feature);\n#endif\n#ifdef HAS_MODEL_COLOR\nmodelColorStage(material);\n#endif\nvec4 color = handleAlpha(material.diffuse, material.alpha);\ngl_FragColor = color;\n}\n",ModelExperimentalVS="precision highp float;\nczm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\nczm_modelVertexOutput vsOutput;\nvsOutput.positionMC = positionMC;\nvsOutput.pointSize = 1.0;\nreturn vsOutput;\n}\nvoid main()\n{\nProcessedAttributes attributes;\ninitializeAttributes(attributes);\n#ifdef USE_DEQUANTIZATION\ndequantizationStage(attributes);\n#endif\n#if defined(HAS_FEATURES) && defined(FEATURE_ID_ATTRIBUTE)\nFeature feature;\nfeatureStage(feature);\ncpuStylingStage(attributes.positionMC, feature);\nupdateFeatureStruct(feature);\n#endif\nmat4 modelView = czm_modelView;\nmat3 normal = czm_normal;\n#ifdef HAS_INSTANCING\n#ifdef USE_LEGACY_INSTANCING\nmat4 instanceModelView;\nmat3 instanceModelViewInverseTranspose;\nlegacyInstancingStage(attributes.positionMC, instanceModelView, instanceModelViewInverseTranspose);\nmodelView = instanceModelView;\nnormal = instanceModelViewInverseTranspose;\n#else\ninstancingStage(attributes.positionMC);\n#endif\n#ifdef USE_PICKING\nv_pickColor = a_pickColor;\n#endif\n#endif\n#ifdef HAS_CUSTOM_VERTEX_SHADER\nczm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\ncustomShaderStage(vsOutput, attributes);\n#endif\ngeometryStage(attributes, modelView, normal);\n#ifdef PRIMITIVE_TYPE_POINTS\n#ifdef HAS_CUSTOM_VERTEX_SHADER\ngl_PointSize = vsOutput.pointSize;\n#elif defined(USE_POINT_CLOUD_ATTENUATION)\ngl_PointSize = pointCloudAttenuationStage(v_positionEC);\n#else\ngl_PointSize = 1.0;\n#endif\n#endif\n}\n";const StyleCommandsNeeded={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2,getStyleCommandsNeeded:function(e,t){return 0===t?StyleCommandsNeeded.ALL_OPAQUE:t===e?StyleCommandsNeeded.ALL_TRANSLUCENT:StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT}};var StyleCommandsNeeded$1=Object.freeze(StyleCommandsNeeded);function buildDrawCommands(e,t){const n=e.shaderBuilder;n.addVertexLines([ModelExperimentalVS]),n.addFragmentLines([ModelExperimentalFS]);const i=defined(e.indices)?e.indices.buffer:void 0,r=new VertexArray({context:t.context,indexBuffer:i,attributes:e.attributes}),o=e.model;o._resources.push(r);let a=e.renderStateOptions;o.opaquePass===Pass$1.CESIUM_3D_TILE&&(a=clone$1(a,!0),a.stencilTest=StencilConstants$1.setCesium3DTileBit(),a.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),a=RenderState.fromCache(a);const s=n.buildShaderProgram(t.context);o._resources.push(s);const c=e.alphaOptions.pass,l=o.sceneGraph,u=Matrix4.multiply(l.computedModelMatrix,e.transform,new Matrix4);BoundingSphere.transform(e.boundingSphere,u,e.boundingSphere);const d=new DrawCommand({boundingVolume:e.boundingSphere,modelMatrix:u,uniformMap:e.uniformMap,renderState:a,vertexArray:r,shaderProgram:s,cull:o.cull,pass:c,count:e.count,pickId:e.pickId,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:o.debugShowBoundingVolume}),h=e.styleCommandsNeeded,p=[];if(defined(h)){const e=createDerivedCommands(d);if(c!==Pass$1.TRANSLUCENT)switch(h){case StyleCommandsNeeded$1.ALL_OPAQUE:p.push(d);break;case StyleCommandsNeeded$1.ALL_TRANSLUCENT:p.push(e.translucent);break;case StyleCommandsNeeded$1.OPAQUE_AND_TRANSLUCENT:p.push(d,e.translucent)}else p.push(d)}else p.push(d);return p}function createDerivedCommands(e){const t={};return t.translucent=deriveTranslucentCommand(e),t}function deriveTranslucentCommand(e){const t=DrawCommand.shallowClone(e);t.pass=Pass$1.TRANSLUCENT;const n=clone$1(e.renderState,!0);return n.cull.enabled=!1,n.depthTest.enabled=!0,n.depthMask=!1,n.blending=BlendingState$1.ALPHA_BLEND,t.renderState=RenderState.fromCache(n),t}var ModelColorStageFS="void modelColorStage(inout czm_modelMaterial material)\n{\nmaterial.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);\nmaterial.alpha *= model_color.a;\n}\n";const ShaderDestination={VERTEX:0,FRAGMENT:1,BOTH:2,includesVertexShader:function(e){return e===ShaderDestination.VERTEX||e===ShaderDestination.BOTH},includesFragmentShader:function(e){return e===ShaderDestination.FRAGMENT||e===ShaderDestination.BOTH}};var ShaderDestination$1=Object.freeze(ShaderDestination);const ModelColorPipelineStage={COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend",process:function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,ShaderDestination$1.FRAGMENT),i.addFragmentLines([ModelColorStageFS]);const r={},o=t.color;o.alpha>0&&o.alpha<1&&(e.alphaOptions.pass=Pass$1.TRANSLUCENT,e.alphaOptions.alphaMode=AlphaMode$1.BLEND),i.addUniform("vec4",ModelColorPipelineStage.COLOR_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),r[ModelColorPipelineStage.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),r[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=combine$2(r,e.uniformMap)}},AlphaPipelineStage={name:"AlphaPipelineStage",process:function(e,t,n){const i=e.alphaOptions,r=e.model;i.pass=defaultValue(i.pass,r.opaquePass);const o=e.renderStateOptions;i.pass===Pass$1.TRANSLUCENT?o.blending=BlendingState$1.ALPHA_BLEND:o.blending=BlendingState$1.DISABLED;const a=e.shaderBuilder,s=e.uniformMap,c=i.alphaMode;c===AlphaMode$1.MASK?(a.addDefine("ALPHA_MODE_MASK",void 0,ShaderDestination$1.FRAGMENT),a.addUniform("float","u_alphaCutoff",ShaderDestination$1.FRAGMENT),s.u_alphaCutoff=function(){return i.alphaCutoff}):c===AlphaMode$1.BLEND?a.addDefine("ALPHA_MODE_BLEND",void 0,ShaderDestination$1.FRAGMENT):a.addDefine("ALPHA_MODE_OPAQUE",void 0,ShaderDestination$1.FRAGMENT)}},BatchTexturePipelineStage={name:"BatchTexturePipelineStage",process:function(e,t,n){const i=e.shaderBuilder,r={},o=e.model,a=o.featureTables[o.featureTableId],s=a.featuresLength;i.addUniform("float","model_featuresLength"),r.model_featuresLength=function(){return s};const c=a.batchTexture;i.addUniform("sampler2D","model_batchTexture"),r.model_batchTexture=function(){return defaultValue(c.batchTexture,c.defaultTexture)},i.addUniform("vec4","model_textureStep"),r.model_textureStep=function(){return c.textureStep},c.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),r.model_textureDimensions=function(){return c.textureDimensions}),e.uniformMap=combine$2(r,e.uniformMap)}},CustomShaderMode={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL",getDefineName:function(e){return"CUSTOM_SHADER_"+e}};var CustomShaderMode$1=Object.freeze(CustomShaderMode),CustomShaderStageVS="void customShaderStage(inout czm_modelVertexOutput vsOutput, inout ProcessedAttributes attributes)\n{\nVertexInput vsInput;\ninitializeInputStruct(vsInput, attributes);\nvertexMain(vsInput, vsOutput);\nattributes.positionMC = vsOutput.positionMC;\n}\n",CustomShaderStageFS="void customShaderStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n{\nFragmentInput fsInput;\ninitializeInputStruct(fsInput, attributes);\nfragmentMain(fsInput, material);\n}\n";function ModelExperimentalUtility(){}ModelExperimentalUtility.getFailedLoadFunction=function(e,t,n){return function(i){let r="Failed to load "+t+": "+n;defined(i)&&(r+="\n"+i.message),e._readyPromise.reject(new RuntimeError(r))}},ModelExperimentalUtility.getNodeTransform=function(e){return defined(e.matrix)?e.matrix:Matrix4.fromTranslationQuaternionRotationScale(defined(e.translation)?e.translation:Cartesian3.ZERO,defined(e.rotation)?e.rotation:Quaternion.IDENTITY,defined(e.scale)?e.scale:Cartesian3.ONE)},ModelExperimentalUtility.getAttributeBySemantic=function(e,t,n){const i=e.attributes,r=i.length;for(let e=0;e<r;++e){const r=i[e],o=!defined(n)||r.setIndex===n;if(r.semantic===t&&o)return r}},ModelExperimentalUtility.hasQuantizedAttributes=function(e){if(!defined(e))return!1;for(let t=0;t<e.length;t++){if(defined(e[t].quantization))return!0}return!1},ModelExperimentalUtility.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,r=!1;defined(t)?(i=VertexAttributeSemantic$1.getVariableName(t,n),r=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());const o=/^color_\d+$/.test(i),a=e.type;let s=AttributeType$1.getGlslType(a);o&&(s="vec4");const c=defined(e.quantization);let l;return c&&(l=o?"vec4":AttributeType$1.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:r,glslType:s,quantizedGlslType:l}};const cartesianMaxScratch=new Cartesian3,cartesianMinScratch=new Cartesian3;ModelExperimentalUtility.createBoundingSphere=function(e,t,n,i){const r=ModelExperimentalUtility.getAttributeBySemantic(e,"POSITION"),o=r.max,a=r.min;let s;if(defined(n)&&defined(i)){const e=Cartesian3.add(a,i,cartesianMinScratch),t=Cartesian3.add(o,n,cartesianMaxScratch);s=BoundingSphere.fromCornerPoints(e,t)}else s=BoundingSphere.fromCornerPoints(a,o);return BoundingSphere.transform(s,t,s),s},ModelExperimentalUtility.correctModelMatrix=function(e,t,n){t===Axis$1.Y?Matrix4.multiplyTransformation(e,Axis$1.Y_UP_TO_Z_UP,e):t===Axis$1.X&&Matrix4.multiplyTransformation(e,Axis$1.X_UP_TO_Z_UP,e),n===Axis$1.Z&&Matrix4.multiplyTransformation(e,Axis$1.Z_UP_TO_X_UP,e)};const CustomShaderPipelineStage={};function getAttributesByName(e){const t={};for(let n=0;n<e.length;n++){const i=e[n],r=ModelExperimentalUtility.getAttributeInfo(i);t[r.variableName]=r}return t}CustomShaderPipelineStage.name="CustomShaderPipelineStage",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS="AttributesVS",CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS="AttributesFS",CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES="Attributes",CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT="VertexInput",CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT="FragmentInput",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS="initializeInputStructVS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS="void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS="initializeInputStructFS",CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS="void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",CustomShaderPipelineStage.process=function(e,t,n){const i=e.shaderBuilder,r=e.model.customShader,o=generateShaderLines(r,t);if(!o.customShaderEnabled)return;if(addLinesToShader(i,r,o),o.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC",void 0,ShaderDestination$1.BOTH),defined(r.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ShaderDestination$1.VERTEX),defined(r.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ShaderDestination$1.FRAGMENT);const e=CustomShaderMode$1.getDefineName(r.mode);i.addDefine(e,void 0,ShaderDestination$1.FRAGMENT)}const a=r.uniforms;for(const e in a)if(a.hasOwnProperty(e)){const t=a[e];i.addUniform(t.type,e)}const s=r.varyings;for(const e in s)if(s.hasOwnProperty(e)){const t=s[e];i.addVarying(t,e)}defined(r.lightingModel)&&(e.lightingOptions.lightingModel=r.lightingModel);const c=e.alphaOptions;r.isTranslucent?(c.pass=Pass$1.TRANSLUCENT,c.alphaMode=AlphaMode$1.BLEND):(c.pass=void 0,c.alphaMode=AlphaMode$1.OPAQUE),e.uniformMap=combine$2(e.uniformMap,r.uniformMap)};const attributeTypeLUT={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},attributeDefaultValueLUT={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function inferAttributeDefaults(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=attributeTypeLUT[t],i=attributeDefaultValueLUT[t];if(defined(n))return{attributeField:[n,e],value:i}}function generateVertexShaderLines(e,t,n){const i=partitionAttributes(t,e.usedVariablesVertex.attributeSet,!1),r=i.addToShader,o=i.missingAttributes;let a,s;const c=[],l=[];for(a in r)if(r.hasOwnProperty(a)){const e=[r[a].glslType,a];c.push(e),s="vsInput.attributes."+a+" = attributes."+a+";",l.push(s)}for(let e=0;e<o.length;e++){a=o[e];const t=inferAttributeDefaults(a);if(!defined(t))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS","Primitive is missing attribute "+a+", disabling custom vertex shader");c.push(t.attributeField),s="vsInput.attributes."+a+" = "+t.value+";",l.push(s)}n.enabled=!0,n.attributeFields=c,n.initializationLines=l}function generatePositionBuiltins(e){const t=[],n=[],i=e.usedVariablesFragment.attributeSet;return i.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),n.push("fsInput.attributes.positionWC = attributes.positionWC;")),i.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),n.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:n}}function generateFragmentShaderLines(e,t,n){const i=partitionAttributes(t,e.usedVariablesFragment.attributeSet,!0),r=i.addToShader,o=i.missingAttributes;let a,s;const c=[],l=[];for(a in r)if(r.hasOwnProperty(a)){const e=[r[a].glslType,a];c.push(e),s="fsInput.attributes."+a+" = attributes."+a+";",l.push(s)}for(let e=0;e<o.length;e++){a=o[e];const t=inferAttributeDefaults(a);if(!defined(t))return void CustomShaderPipelineStage._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS","Primitive is missing attribute "+a+", disabling custom fragment shader.");c.push(t.attributeField),s="fsInput.attributes."+a+" = "+t.value+";",l.push(s)}const u=generatePositionBuiltins(e);n.enabled=!0,n.attributeFields=c.concat(u.attributeFields),n.initializationLines=u.initializationLines.concat(l)}const builtinAttributes={positionWC:!0,positionEC:!0};function partitionAttributes(e,t,n){let i,r;const o={};for(r in e)if(e.hasOwnProperty(r)){const a=e[r];i=r,n&&"normalMC"===r?i="normalEC":n&&"tangentMC"===r&&(i="tangentEC"),t.hasOwnProperty(i)&&(o[i]=a)}const a=[];for(r in t)if(t.hasOwnProperty(r)){if(builtinAttributes.hasOwnProperty(r))continue;i=r,n&&"normalEC"===r?i="normalMC":n&&"tangentEC"===r&&(i="tangentMC"),e.hasOwnProperty(i)||a.push(r)}return{addToShader:o,missingAttributes:a}}function generateShaderLines(e,t){const n={enabled:!1},i={enabled:!1},r=getAttributesByName(t.attributes);defined(e.vertexShaderText)&&generateVertexShaderLines(e,r,n),defined(e.fragmentShaderText)&&generateFragmentShaderLines(e,r,i);const o=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&i.enabled;return{vertexLines:n,fragmentLines:i,vertexLinesEnabled:n.enabled,fragmentLinesEnabled:i.enabled,customShaderEnabled:n.enabled||i.enabled,shouldComputePositionWC:o}}function addVertexLinesToShader(e,t){let n,i=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(i,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.VERTEX);const r=t.attributeFields;for(n=0;n<r.length;n++){const t=r[n],o=t[0],a=t[1];e.addStructField(i,o,a)}i=CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT,e.addStruct(i,CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT,ShaderDestination$1.VERTEX),e.addStructField(i,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes");const o=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(o,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,ShaderDestination$1.VERTEX);const a=t.initializationLines;e.addFunctionLines(o,a)}function addFragmentLinesToShader(e,t){let n,i,r,o,a=CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(a,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,ShaderDestination$1.FRAGMENT);const s=t.attributeFields;for(n=0;n<s.length;n++)i=s[n],r=i[0],o=i[1],e.addStructField(a,r,o);a=CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(a,CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT,ShaderDestination$1.FRAGMENT),e.addStructField(a,CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,"attributes");const c=CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,ShaderDestination$1.FRAGMENT);const l=t.initializationLines;e.addFunctionLines(c,l)}function addLinesToShader(e,t,n){const i=n.vertexLines;i.enabled&&(addVertexLinesToShader(e,i),e.addVertexLines(["#line 0",t.vertexShaderText,CustomShaderStageVS]));const r=n.fragmentLines;r.enabled&&(addFragmentLinesToShader(e,r),e.addFragmentLines(["#line 0",t.fragmentShaderText,CustomShaderStageFS]))}CustomShaderPipelineStage._oneTimeWarning=oneTimeWarning;var FeatureStageCommon="vec2 computeSt(float featureId)\n{\nfloat stepX = model_textureStep.x;\nfloat centerX = model_textureStep.y;\n#ifdef MULTILINE_BATCH_TEXTURE\nfloat stepY = model_textureStep.z;\nfloat centerY = model_textureStep.w;\nfloat xId = mod(featureId, model_textureDimensions.x);\nfloat yId = floor(featureId / model_textureDimensions.x);\nreturn vec2(centerX + (xId * stepX), centerY + (yId * stepY));\n#else\nreturn vec2(centerX + (featureId * stepX), 0.5);\n#endif\n}\n",FeatureStageFS="void featureStage(inout Feature feature)\n{\n#ifdef FEATURE_ID_TEXTURE\nfloat featureId = floor(texture2D(FEATURE_ID_TEXTURE, FEATURE_ID_TEXCOORD).FEATURE_ID_CHANNEL * 255.0 + 0.5);\nvec2 featureSt;\nif (featureId < model_featuresLength)\n{\nfeatureSt = computeSt(featureId);\nfeature.id = int(featureId);\nfeature.st = featureSt;\nfeature.color = texture2D(model_batchTexture, featureSt);\n}\nelse\n{\nfeature.id = int(model_featuresLength) + 1;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n#else\nupdateFeatureStruct(feature);\n#endif\n}\n",FeatureStageVS="void featureStage(inout Feature feature)\n{\nfloat featureId = FEATURE_ID_ATTRIBUTE;\nif (featureId < model_featuresLength)\n{\nvec2 featureSt = computeSt(featureId);\nfeature.id = int(featureId);\nfeature.st = featureSt;\nfeature.color = texture2D(model_batchTexture, featureSt);\n}\nelse\n{\nfeature.id = int(model_featuresLength) + 1;\nfeature.st = vec2(0.0);\nfeature.color = vec4(1.0);\n}\n}\n";const FeatureIdPipelineStage={};function getFeatureIdAttributeInfo(e,t,n){let i,r,o,a=0;if(defined(n))r=n.featureIdAttributes[e],i=n.attributes[0].count,o="a_instanceFeatureId_",a=1;else{r=t.featureIdAttributes[e];i=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.POSITION).count,o="a_featureId_"}return{count:i,attribute:r,prefix:o,instanceDivisor:a}}function updateFeatureStruct(e){e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"int","id"),e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"vec2","st"),e.addStructField(FeatureIdPipelineStage.STRUCT_ID_FEATURE,"vec4","color")}function generateFeatureFunctions(e){e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE,ShaderDestination$1.VERTEX),e.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS,["v_activeFeatureId = float(feature.id);","v_activeFeatureSt = feature.st;","v_activeFeatureColor = feature.color;"]),e.addFunction(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS,FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE,ShaderDestination$1.FRAGMENT),e.addFunctionLines(FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS,["feature.id = int(v_activeFeatureId);","feature.st = v_activeFeatureSt;","feature.color = v_activeFeatureColor;"])}function processFeatureIdAttributes$1(e,t,n){const i=e.shaderBuilder,r=e.model,o=e.runtimeNode.node.instances,a=getFeatureIdAttributeInfo(r.featureIdAttributeIndex,n,o),s=a.attribute,c=a.prefix;let l;defined(s.setIndex)?l=s.setIndex:(l=e.featureIdVertexAttributeSetIndex++,generateFeatureIdAttribute(a,l,t,e)),i.addDefine("FEATURE_ID_ATTRIBUTE",c+l,ShaderDestination$1.VERTEX),i.addVarying("float","v_activeFeatureId"),i.addVarying("vec2","v_activeFeatureSt"),i.addVarying("vec4","v_activeFeatureColor"),generateFeatureFunctions(i),i.addVertexLines([FeatureStageCommon,FeatureStageVS])}function processFeatureIdTextures(e,t,n){const i=e.shaderBuilder,r=e.uniformMap,o=e.model.featureIdTextureIndex,a=n[o].textureReader,s="u_featureIdTexture_"+o;i.addDefine("FEATURE_ID_TEXTURE",s,ShaderDestination$1.FRAGMENT),i.addUniform("sampler2D",s,ShaderDestination$1.FRAGMENT),r[s]=function(){return defaultValue(a.texture,t.context.defaultTexture)},i.addDefine("FEATURE_ID_TEXCOORD","v_texCoord_"+a.texCoord,ShaderDestination$1.FRAGMENT),i.addDefine("FEATURE_ID_CHANNEL",a.channels,ShaderDestination$1.FRAGMENT)}function generateFeatureIdAttribute(e,t,n,i){const r=i.model,o=i.shaderBuilder,a=e.attribute,s=e.prefix;let c,l;if(defined(a.repeat)){const t=generateFeatureIdTypedArray(a,e.count);l=Buffer$1.createVertexBuffer({context:n.context,typedArray:t,usage:BufferUsage$1.STATIC_DRAW}),l.vertexArrayDestroyable=!1,r._resources.push(l)}else c=a.offset;const u={index:i.attributeIndex++,instanceDivisor:e.instanceDivisor,value:c,vertexBuffer:l,normalize:!1,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.FLOAT,strideInBytes:ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),offsetInBytes:0};i.attributes.push(u),o.addAttribute("float",s+t)}function generateFeatureIdTypedArray(e,t){const n=e.offset,i=e.repeat,r=new Float32Array(t);for(let e=0;e<t;e++)r[e]=n+Math.floor(e/i);return r}FeatureIdPipelineStage.name="FeatureIdPipelineStage",FeatureIdPipelineStage.STRUCT_ID_FEATURE="FeatureStruct",FeatureIdPipelineStage.STRUCT_NAME_FEATURE="Feature",FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS="updateFeatureStructVS",FeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS="updateFeatureStructFS",FeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE="void updateFeatureStruct(inout Feature feature)",FeatureIdPipelineStage.process=function(e,t,n){const i=e.shaderBuilder;e.hasFeatureIds=!0,i.addDefine("HAS_FEATURES",void 0,ShaderDestination$1.BOTH),updateFeatureStruct(i);const r=t.featureIdTextures;r.length>0?processFeatureIdTextures(e,n,r):processFeatureIdAttributes$1(e,n,t),i.addFragmentLines([FeatureStageCommon,FeatureStageFS])};var CPUStylingStageVS="void filterByPassType(inout vec3 positionMC, vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\npositionMC *= 0.0;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\npositionMC *= 0.0;\n}\n}\nvoid cpuStylingStage(inout vec3 positionMC, inout Feature feature)\n{\nfloat show = ceil(feature.color.a);\npositionMC *= show;\nfilterByPassType(positionMC, feature.color);\n}\n",CPUStylingStageFS="void filterByPassType(vec4 featureColor)\n{\nbool styleTranslucent = (featureColor.a != 1.0);\nif (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n{\ndiscard;\n}\nelse if (czm_pass != czm_passTranslucent && styleTranslucent)\n{\ndiscard;\n}\n}\nvoid cpuStylingStage(inout czm_modelMaterial material, Feature feature)\n{\nvec4 featureColor = feature.color;\nif (featureColor.a == 0.0)\n{\ndiscard;\n}\n#ifdef FEATURE_ID_TEXTURE\nfilterByPassType(featureColor);\n#endif\nfeatureColor = czm_gammaCorrect(featureColor);\nfloat highlight = ceil(model_colorBlend);\nmaterial.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);\nmaterial.alpha *= featureColor.a;\n}\n";const CPUStylingPipelineStage={name:"CPUStylingPipelineStage",process:function(e,t,n){const i=e.model,r=e.shaderBuilder;r.addVertexLines([CPUStylingStageVS]),r.addFragmentLines([CPUStylingStageFS]),r.addDefine("USE_CPU_STYLING",void 0,ShaderDestination$1.BOTH),defined(i.color)||(r.addUniform("float",ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,ShaderDestination$1.FRAGMENT),e.uniformMap[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME]=function(){return ColorBlendMode$1.getColorBlend(i.colorBlendMode,i.colorBlendAmount)});const o=e.alphaOptions.pass===Pass$1.TRANSLUCENT;r.addUniform("bool","model_commandTranslucent",ShaderDestination$1.BOTH),e.uniformMap.model_commandTranslucent=function(){return o};const a=i.featureTables[i.featureTableId],s=StyleCommandsNeeded$1.getStyleCommandsNeeded(a.featuresLength,a.batchTexture.translucentFeaturesLength);s!==StyleCommandsNeeded$1.ALL_OPAQUE&&(e.alphaOptions.alphaMode=AlphaMode$1.BLEND),e.styleCommandsNeeded=s}},DequantizationPipelineStage={};function addDequantizationUniforms(e,t){const n=e.shaderBuilder,i=e.uniformMap,r=t.variableName,o=t.attribute.quantization;if(o.octEncoded){const e="model_normalizationRange_"+r;n.addUniform("float",e,ShaderDestination$1.VERTEX),i[e]=function(){return o.normalizationRange}}else{const e="model_quantizedVolumeOffset_"+r,a="model_quantizedVolumeStepSize_"+r,s=t.glslType;n.addUniform(s,e,ShaderDestination$1.VERTEX),n.addUniform(s,a,ShaderDestination$1.VERTEX);let c=o.quantizedVolumeOffset,l=o.quantizedVolumeStepSize;/^color_\d+$/.test(r)&&(c=promoteToVec4(c,0),l=promoteToVec4(l,1)),i[e]=function(){return c},i[a]=function(){return l}}}function promoteToVec4(e,t){return e instanceof Cartesian4?e:new Cartesian4(e.x,e.y,e.z,t)}function updateDequantizationFunction(e,t){const n=t.variableName,i=t.attribute.quantization;let r;r=i.octEncoded?generateOctDecodeLine(n,i):generateDequantizeLine(n),e.addFunctionLines(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[r])}function generateOctDecodeLine(e,t){return"attributes."+e+" = czm_octDecode("+("a_quantized_"+e)+", "+("model_normalizationRange_"+e)+")"+(t.octEncodedZXY?".zxy":".xyz")+";"}function generateDequantizeLine(e){return"attributes."+e+" = "+("model_quantizedVolumeOffset_"+e)+" + "+("a_quantized_"+e)+" * "+("model_quantizedVolumeStepSize_"+e)+";"}DequantizationPipelineStage.name="DequantizationPipelineStage",DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS="dequantizationStage",DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS="void dequantizationStage(inout ProcessedAttributes attributes)",DequantizationPipelineStage.process=function(e,t){const n=e.shaderBuilder;n.addFunction(DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,ShaderDestination$1.VERTEX),n.addDefine("USE_DEQUANTIZATION",void 0,ShaderDestination$1.VERTEX);const i=t.attributes;for(let t=0;t<i.length;t++){const r=i[t];if(!defined(r.quantization))continue;const o=ModelExperimentalUtility.getAttributeInfo(r);updateDequantizationFunction(n,o),addDequantizationUniforms(e,o)}};var GeometryStageFS="void geometryStage(out ProcessedAttributes attributes)\n{\nattributes.positionMC = v_positionMC;\nattributes.positionEC = v_positionEC;\n#ifdef COMPUTE_POSITION_WC\nattributes.positionWC = v_positionWC;\n#endif\n#ifdef HAS_NORMALS\nattributes.normalEC = normalize(v_normalEC);\n#endif\n#ifdef HAS_TANGENTS\nattributes.tangentEC = normalize(v_tangentEC);\n#endif\n#ifdef HAS_BITANGENTS\nattributes.bitangentEC = normalize(v_bitangentEC);\n#endif\nsetDynamicVaryings(attributes);\n}\n",GeometryStageVS="void geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)\n{\nvec3 positionMC = attributes.positionMC;\nv_positionMC = positionMC;\nv_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;\ngl_Position = czm_projection * vec4(v_positionEC, 1.0);\n#ifdef COMPUTE_POSITION_WC\nv_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n#endif\n#ifdef HAS_NORMALS\nv_normalEC = normal * attributes.normalMC;\n#endif\n#ifdef HAS_TANGENTS\nv_tangentEC = normalize(normal * attributes.tangentMC);\n#endif\n#ifdef HAS_BITANGENTS\nv_bitangentEC = normalize(normal * attributes.bitangentMC);\n#endif\nsetDynamicVaryings(attributes);\n}\n";const ModelExperimentalType={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",is3DTiles:function(e){switch(e){case ModelExperimentalType.TILE_GLTF:case ModelExperimentalType.TILE_B3DM:case ModelExperimentalType.TILE_I3DM:case ModelExperimentalType.TILE_PNTS:return!0;case ModelExperimentalType.GLTF:return!1}}};var ModelExperimentalType$1=Object.freeze(ModelExperimentalType);const GeometryPipelineStage={};function processAttribute(e,t,n){const i=e.shaderBuilder,r=ModelExperimentalUtility.getAttributeInfo(t);addAttributeToRenderResources(e,t,n),addAttributeDeclaration(i,r),addVaryingDeclaration(i,r),defined(t.semantic)&&addSemanticDefine(i,t);e.model.type===ModelExperimentalType$1.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,ShaderDestination$1.FRAGMENT),updateAttributesStruct(i,r),updateInitialzeAttributesFunction(i,r),updateSetDynamicVaryingsFunction(i,r)}function addSemanticDefine(e,t){const n=t.semantic,i=t.setIndex;switch(n){case VertexAttributeSemantic$1.NORMAL:e.addDefine("HAS_NORMALS");break;case VertexAttributeSemantic$1.TANGENT:e.addDefine("HAS_TANGENTS");break;case VertexAttributeSemantic$1.FEATURE_ID:case VertexAttributeSemantic$1.TEXCOORD:case VertexAttributeSemantic$1.COLOR:e.addDefine("HAS_"+n+"_"+i)}}function addAttributeToRenderResources(e,t,n){const i=t.quantization;let r,o;defined(i)?(r=i.type,o=i.componentDatatype):(r=t.type,o=t.componentDatatype);const a=t.semantic,s=t.setIndex;a===VertexAttributeSemantic$1.FEATURE_ID&&s>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s+1);const c={index:n,value:defined(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(r),componentDatatype:o,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(c)}function addVaryingDeclaration(e,t){const n=t.variableName;let i,r="v_"+n;"normalMC"===n?(r="v_normalEC",i=t.glslType):"tangentMC"===n?(i="vec3",r="v_tangentEC"):i=t.glslType,e.addVarying(i,r)}function addAttributeDeclaration(e,t){const n=t.attribute.semantic,i=t.variableName;let r,o;t.isQuantized?(r="a_quantized_"+i,o=t.quantizedGlslType):(r="a_"+i,o=t.glslType),n===VertexAttributeSemantic$1.POSITION?e.setPositionAttribute(o,r):e.addAttribute(o,r)}function updateAttributesStruct(e,t){const n=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,i=GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;"tangentMC"===r?(e.addStructField(n,"vec3","tangentMC"),e.addStructField(i,"vec3","tangentEC")):"normalMC"===r?(e.addStructField(n,"vec3","normalMC"),e.addStructField(i,"vec3","normalEC")):(e.addStructField(n,t.glslType,r),e.addStructField(i,t.glslType,r))}function updateInitialzeAttributesFunction(e,t){if(t.isQuantized)return;const n=GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,i=t.variableName;let r;r="tangentMC"===i?"attributes.tangentMC = a_tangentMC.xyz;":"attributes."+i+" = a_"+i+";",e.addFunctionLines(n,[r])}function updateSetDynamicVaryingsFunction(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(defined(n)&&!defined(i))return;let r=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const o=t.variableName;let a="v_"+o+" = attributes."+o+";";e.addFunctionLines(r,[a]),r=GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,a="attributes."+o+" = v_"+o+";",e.addFunctionLines(r,[a])}function handleBitangents(e,t){let n=!1,i=!1;for(let e=0;e<t.length;e++){const r=t[e];r.semantic===VertexAttributeSemantic$1.NORMAL?n=!0:r.semantic===VertexAttributeSemantic$1.TANGENT&&(i=!0)}n&&i&&(e.addDefine("HAS_BITANGENTS"),e.addFunctionLines(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,["attributes.bitangentMC = normalize(cross(a_normalMC, a_tangentMC.xyz) * a_tangentMC.w);"]),e.addVarying("vec3","v_bitangentEC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}GeometryPipelineStage.name="GeometryPipelineStage",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS="ProcessedAttributesVS",GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS="ProcessedAttributesFS",GeometryPipelineStage.STRUCT_NAME_PROCESSED_ATTRIBUTES="ProcessedAttributes",GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES="initializeAttributes",GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES="void initializeAttributes(out ProcessedAttributes attributes)",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS="setDynamicVaryingsVS",GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS="setDynamicVaryingsFS",GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS="void setDynamicVaryings(inout ProcessedAttributes attributes)",GeometryPipelineStage.process=function(e,t){const n=e.shaderBuilder;let i;n.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",ShaderDestination$1.VERTEX),n.addStruct(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",ShaderDestination$1.FRAGMENT),n.addStruct(FeatureIdPipelineStage.STRUCT_ID_FEATURE,FeatureIdPipelineStage.STRUCT_NAME_FEATURE,ShaderDestination$1.BOTH),n.addFunction(GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,ShaderDestination$1.VERTEX),n.addVarying("vec3","v_positionWC"),n.addVarying("vec3","v_positionEC"),n.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),n.addStructField(GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),n.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.VERTEX),n.addFunction(GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ShaderDestination$1.FRAGMENT);for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n];i=r.semantic===VertexAttributeSemantic$1.POSITION?0:e.attributeIndex++,processAttribute(e,r,i)}handleBitangents(n,t.attributes),t.primitiveType===PrimitiveType$1.POINTS&&n.addDefine("PRIMITIVE_TYPE_POINTS"),n.addVertexLines([GeometryStageVS]),n.addFragmentLines([GeometryStageFS])};var LightingStageFS="#ifdef LIGHTING_PBR\nvec3 computePbrLighting(czm_modelMaterial inputMaterial)\n{\nczm_pbrParameters pbrParameters;\npbrParameters.diffuseColor = inputMaterial.diffuse;\npbrParameters.f0 = inputMaterial.specular;\npbrParameters.roughness = inputMaterial.roughness;\nvec3 lightColorHdr = czm_lightColorHdr;\nvec3 color = inputMaterial.diffuse;\n#ifdef HAS_NORMALS\ncolor = czm_pbrLighting(\nv_positionEC,\ninputMaterial.normalEC,\nczm_lightDirectionEC,\nlightColorHdr,\npbrParameters\n);\n#endif\ncolor *= inputMaterial.occlusion;\ncolor += inputMaterial.emissive;\n#ifndef HDR\ncolor = czm_acesTonemapping(color);\n#endif\nreturn color;\n}\n#endif\nvoid lightingStage(inout czm_modelMaterial material)\n{\nvec3 color = vec3(0.0);\n#ifdef LIGHTING_PBR\ncolor = computePbrLighting(material);\n#else // unlit\ncolor = material.diffuse;\n#endif\n#ifndef HDR\ncolor = czm_linearToSrgb(color);\n#endif\nmaterial.diffuse = color;\n}\n";const LightingModel={UNLIT:0,PBR:1};var LightingModel$1=Object.freeze(LightingModel);const LightingPipelineStage={name:"LightingPipelineStage",process:function(e,t){const n=e.lightingOptions,i=e.shaderBuilder;n.lightingModel===LightingModel$1.PBR?i.addDefine("LIGHTING_PBR",void 0,ShaderDestination$1.FRAGMENT):i.addDefine("LIGHTING_UNLIT",void 0,ShaderDestination$1.FRAGMENT),i.addFragmentLines([LightingStageFS])}};var MaterialStageFS="bool isDefaultStyleColor(vec3 color)\n{\nreturn all(greaterThan(color, vec3(1.0 - czm_epsilon3)));\n}\nvec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)\n{\nvec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);\nvec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;\nreturn color;\n}\nvec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)\n{\nreturn vec2(textureTransform * vec3(texCoord, 1.0));\n}\n#ifdef HAS_NORMALS\nvec3 computeNormal(ProcessedAttributes attributes)\n{\nvec3 ng = attributes.normalEC;\nvec3 normal = ng;\n#ifdef HAS_NORMAL_TEXTURE\nvec2 normalTexCoords = TEXCOORD_NORMAL;\n#ifdef HAS_NORMAL_TEXTURE_TRANSFORM\nnormalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);\n#endif\n#ifdef HAS_BITANGENTS\nvec3 t = attributes.tangentEC;\nvec3 b = attributes.bitangentEC;\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#elif defined(GL_OES_standard_derivatives)\nvec3 positionEC = attributes.positionEC;\nvec3 pos_dx = dFdx(positionEC);\nvec3 pos_dy = dFdy(positionEC);\nvec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));\nvec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));\nvec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\nt = normalize(t - ng * dot(ng, t));\nvec3 b = normalize(cross(ng, t));\nmat3 tbn = mat3(t, b, ng);\nvec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\nnormal = normalize(tbn * (2.0 * n - 1.0));\n#endif\n#endif\nreturn normal;\n}\n#endif\nvoid materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, Feature feature)\n{\n#ifdef HAS_NORMALS\nmaterial.normalEC = computeNormal(attributes);\n#endif\nvec4 baseColorWithAlpha = vec4(1.0);\n#ifdef HAS_BASE_COLOR_TEXTURE\nvec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;\n#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM\nbaseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);\n#endif\nbaseColorWithAlpha = czm_srgbToLinear(texture2D(u_baseColorTexture, baseColorTexCoords));\n#ifdef HAS_BASE_COLOR_FACTOR\nbaseColorWithAlpha *= u_baseColorFactor;\n#endif\n#elif defined(HAS_BASE_COLOR_FACTOR)\nbaseColorWithAlpha = u_baseColorFactor;\n#endif\n#ifdef HAS_COLOR_0\nvec4 color = attributes.color_0;\n#ifdef HAS_SRGB_COLOR\ncolor = czm_srgbToLinear(color);\n#endif\nbaseColorWithAlpha *= color;\n#endif\nmaterial.diffuse = baseColorWithAlpha.rgb;\nmaterial.alpha = baseColorWithAlpha.a;\n#ifdef USE_CPU_STYLING\nmaterial.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n#endif\n#ifdef HAS_OCCLUSION_TEXTURE\nvec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM\nocclusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);\n#endif\nmaterial.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;\n#endif\n#ifdef HAS_EMISSIVE_TEXTURE\nvec2 emissiveTexCoords = TEXCOORD_EMISSIVE;\n#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM\nemissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);\n#endif\nvec3 emissive = czm_srgbToLinear(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);\n#ifdef HAS_EMISSIVE_FACTOR\nemissive *= u_emissiveFactor;\n#endif\nmaterial.emissive = emissive;\n#elif defined(HAS_EMISSIVE_FACTOR)\nmaterial.emissive = u_emissiveFactor;\n#endif\n#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;\n#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM\nspecularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);\n#endif\nvec4 specularGlossiness = czm_srgbToLinear(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));\nvec3 specular = specularGlossiness.rgb;\nfloat glossiness = specularGlossiness.a;\n#ifdef HAS_SPECULAR_FACTOR\nspecular *= u_specularFactor;\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nglossiness *= u_glossinessFactor;\n#endif\n#else\n#ifdef HAS_SPECULAR_FACTOR\nvec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n#else\nvec3 specular = vec3(1.0);\n#endif\n#ifdef HAS_GLOSSINESS_FACTOR\nfloat glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n#else\nfloat glossiness = 1.0;\n#endif\n#endif\n#ifdef HAS_DIFFUSE_TEXTURE\nvec2 diffuseTexCoords = TEXCOORD_DIFFUSE;\n#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM\ndiffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);\n#endif\nvec4 diffuse = czm_srgbToLinear(texture2D(u_diffuseTexture, diffuseTexCoords));\n#ifdef HAS_DIFFUSE_FACTOR\ndiffuse *= u_diffuseFactor;\n#endif\n#elif defined(HAS_DIFFUSE_FACTOR)\nvec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n#else\nvec4 diffuse = vec4(1.0);\n#endif\nczm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(\ndiffuse.rgb,\nspecular,\nglossiness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.alpha = diffuse.a;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#elif defined(LIGHTING_PBR)\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE\nvec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;\n#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM\nmetallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);\n#endif\nvec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\nfloat metalness = clamp(metallicRoughness.b, 0.0, 1.0);\nfloat roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n#ifdef HAS_METALLIC_FACTOR\nmetalness *= u_metallicFactor;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nroughness *= u_roughnessFactor;\n#endif\n#else\n#ifdef HAS_METALLIC_FACTOR\nfloat metalness = clamp(u_metallicFactor, 0.0, 1.0);\n#else\nfloat metalness = 1.0;\n#endif\n#ifdef HAS_ROUGHNESS_FACTOR\nfloat roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n#else\nfloat roughness = 1.0;\n#endif\n#endif\nczm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(\nmaterial.diffuse,\nmetalness,\nroughness\n);\nmaterial.diffuse = parameters.diffuseColor;\nmaterial.specular = parameters.f0;\nmaterial.roughness = parameters.roughness;\n#endif\n}\n";const Material$1=ModelComponents.Material,MetallicRoughness$1=ModelComponents.MetallicRoughness,SpecularGlossiness=ModelComponents.SpecularGlossiness,MaterialPipelineStage={};function processTextureTransform(e,t,n,i,r){const o="HAS_"+r+"_TEXTURE_TRANSFORM";e.addDefine(o,void 0,ShaderDestination$1.FRAGMENT);const a=i+"Transform";e.addUniform("mat3",a,ShaderDestination$1.FRAGMENT),t[a]=function(){return n.transform}}function processTexture(e,t,n,i,r,o){e.addUniform("sampler2D",i,ShaderDestination$1.FRAGMENT),t[i]=function(){return defaultValue(n.texture,o)};const a="HAS_"+r+"_TEXTURE";e.addDefine(a,void 0,ShaderDestination$1.FRAGMENT);const s="v_texCoord_"+n.texCoord,c="TEXCOORD_"+r;e.addDefine(c,s,ShaderDestination$1.FRAGMENT);const l=n.transform;defined(l)&&!Matrix3.equals(l,Matrix3.IDENTITY)&&processTextureTransform(e,t,n,i,r)}function processMaterialUniforms(e,t,n,i,r,o){const a=e.emissiveTexture;defined(a)&&processTexture(n,t,a,"u_emissiveTexture","EMISSIVE",o);const s=e.emissiveFactor;defined(s)&&!Cartesian3.equals(s,Material$1.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",ShaderDestination$1.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const c=e.normalTexture;defined(c)&&processTexture(n,t,c,"u_normalTexture","NORMAL",r);const l=e.occlusionTexture;defined(l)&&processTexture(n,t,l,"u_occlusionTexture","OCCLUSION",i)}function processSpecularGlossinessUniforms(e,t,n,i){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,ShaderDestination$1.FRAGMENT);const o=r.diffuseTexture;defined(o)&&processTexture(n,t,o,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;defined(a)&&!Cartesian4.equals(a,SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",ShaderDestination$1.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const s=r.specularGlossinessTexture;defined(s)&&processTexture(n,t,s,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const c=r.specularFactor;defined(c)&&!Cartesian3.equals(c,SpecularGlossiness.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",ShaderDestination$1.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const l=r.glossinessFactor;defined(l)&&l!==SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",ShaderDestination$1.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}function processMetallicRoughnessUniforms(e,t,n,i){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,ShaderDestination$1.FRAGMENT);const o=r.baseColorTexture;defined(o)&&processTexture(n,t,o,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;defined(a)&&!Cartesian4.equals(a,MetallicRoughness$1.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",ShaderDestination$1.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const s=r.metallicRoughnessTexture;defined(s)&&processTexture(n,t,s,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const c=r.metallicFactor;defined(c)&&c!==MetallicRoughness$1.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",ShaderDestination$1.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,ShaderDestination$1.FRAGMENT));const l=r.roughnessFactor;defined(l)&&l!==MetallicRoughness$1.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",ShaderDestination$1.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,ShaderDestination$1.FRAGMENT))}MaterialPipelineStage.name="MaterialPipelineStage",MaterialPipelineStage.process=function(e,t,n){const i=t.material,r=e.uniformMap,o=e.shaderBuilder,a=n.context.defaultTexture;processMaterialUniforms(i,r,o,a,n.context.defaultNormalTexture,n.context.defaultEmissiveTexture),defined(i.specularGlossiness)?processSpecularGlossinessUniforms(i,r,o,a):processMetallicRoughnessUniforms(i,r,o,a);const s=e.lightingOptions;i.unlit?s.lightingModel=LightingModel$1.UNLIT:s.lightingModel=LightingModel$1.PBR;const c=!i.doubleSided;e.renderStateOptions.cull={enabled:c};const l=e.alphaOptions;defined(l.alphaMode)||(l.alphaMode=i.alphaMode,i.alphaMode===AlphaMode$1.BLEND?l.pass=Pass$1.TRANSLUCENT:i.alphaMode===AlphaMode$1.MASK&&(l.alphaCutoff=i.alphaCutoff)),o.addFragmentLines([MaterialStageFS])},MaterialPipelineStage._processTexture=processTexture,MaterialPipelineStage._processTextureTransform=processTextureTransform;const PickingPipelineStage={};function buildPickObject(e,t){const n=e.model,i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive};let r;if(ModelExperimentalType$1.is3DTiles(n.type)){const e=n.content;r={content:e,primitive:e.tileset,detail:i}}else r={primitive:n,detail:i};return defined(t)&&(r.instanceId=t),r}function processPickTexture(e,t,n){const i=e.model;let r,o;const a=i.featureIdAttributeIndex;if(defined(i.featureTableId))r=i.featureTableId;else if(defined(n))o=n.featureIdAttributes[a],r=o.propertyTableId;else if(t.featureIdTextures.length>0){const e=i.featureIdTextureIndex;r=t.featureIdTextures[e].propertyTableId}else o=t.featureIdAttributes[a],r=o.propertyTableId;const s=i.featureTables[r];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",ShaderDestination$1.FRAGMENT);const c=s.batchTexture,l={model_pickTexture:function(){return defaultValue(c.pickTexture,c.defaultTexture)}};e.uniformMap=combine$2(l,e.uniformMap),e.pickId="((feature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, feature.st) : vec4(0.0))"}function processInstancedPickIds(e,t,n){const i=e.instanceCount,r=new Array(i),o=new Uint8Array(4*i),a=e.model._resources;for(let t=0;t<i;t++){const i=buildPickObject(e,t),s=n.createPickId(i);a.push(s),r[t]=s;const c=s.color;o[4*t+0]=Color.floatToByte(c.red),o[4*t+1]=Color.floatToByte(c.green),o[4*t+2]=Color.floatToByte(c.blue),o[4*t+3]=Color.floatToByte(c.alpha)}const s=Buffer$1.createVertexBuffer({context:n,typedArray:o,usage:BufferUsage$1.STATIC_DRAW});s.vertexArrayDestroyable=!1,a.push(s);const c={index:e.attributeIndex++,vertexBuffer:s,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(c);const l=e.shaderBuilder;l.addDefine("USE_PICKING",void 0,ShaderDestination$1.BOTH),l.addAttribute("vec4","a_pickColor"),l.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}PickingPipelineStage.name="PickingPipelineStage",PickingPipelineStage.process=function(e,t,n){const i=n.context,r=e.runtimeNode,o=e.shaderBuilder,a=e.model,s=r.node.instances;if(e.hasFeatureIds)processPickTexture(e,t,s);else if(defined(s))processInstancedPickIds(e,s,i);else{const t=buildPickObject(e),n=i.createPickId(t);a._resources.push(n),o.addUniform("vec4","czm_pickColor",ShaderDestination$1.FRAGMENT);e.uniformMap.czm_pickColor=function(){return n.color},e.pickId="czm_pickColor"}};var PointCloudAttenuationStageVS="float pointCloudAttenuationStage(vec3 positionEC) {\nfloat pointSize = model_pointCloudAttenuation.x;\nfloat geometricError = model_pointCloudAttenuation.y;\nfloat depthMultiplier = model_pointCloudAttenuation.z;\nfloat depth = -positionEC.z;\nreturn min((geometricError / depth) * depthMultiplier, pointSize);\n}\n";const PointCloudAttenuationPipelineStage={name:"PointCloudAttenuationPipelineStage"},scratchAttenuationUniform=new Cartesian3;PointCloudAttenuationPipelineStage.process=function(e,t,n){const i=e.shaderBuilder;i.addVertexLines([PointCloudAttenuationStageVS]),i.addDefine("USE_POINT_CLOUD_ATTENUATION",void 0,ShaderDestination$1.VERTEX);const r=e.model,o=r.pointCloudShading;let a,s,c;ModelExperimentalType$1.is3DTiles(r.type)&&(s=!0,a=r.content,c=a.tile.refine===Cesium3DTileRefine$1.ADD),i.addUniform("vec3","model_pointCloudAttenuation",ShaderDestination$1.VERTEX),e.uniformMap.model_pointCloudAttenuation=function(){const i=scratchAttenuationUniform;let r=1;s&&(r=c?5:a.tileset.maximumScreenSpaceError),i.x=defaultValue(o.maximumAttenuation,r),i.x*=n.pixelRatio;const l=getGeometricError$1(e,t,o,a);i.y=l*o.geometricErrorScale;const u=n.context,d=n.camera.frustum;let h;return h=n.mode===SceneMode$1.SCENE2D||d instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:u.drawingBufferHeight/n.camera.frustum.sseDenominator,i.z=h,i}};const scratchDimensions=new Cartesian3;function getGeometricError$1(e,t,n,i){if(defined(i)){const e=i.tile.geometricError;if(e>0)return e}if(defined(n.baseResolution))return n.baseResolution;const r=ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.POSITION),o=r.count,a=e.runtimeNode.transform;let s=Cartesian3.subtract(r.max,r.min,scratchDimensions);s=Matrix4.multiplyByPointAsVector(a,s,scratchDimensions);const c=s.x*s.y*s.z;return CesiumMath.cbrt(c/o)}function ModelExperimentalPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.primitive=e.primitive,this.node=e.node,this.model=e.model,this.pipelineStages=[],this.drawCommands=[],this.boundingSphere=void 0,this.updateStages=[],this.configurePipeline()}ModelExperimentalPrimitive.prototype.configurePipeline=function(){const e=this.pipelineStages;e.length=0;const t=this.primitive,n=this.node,i=this.model,r=i.customShader,o=!(defined(r)&&defined(r.fragmentShaderText))||r.mode!==CustomShaderMode$1.REPLACE_MATERIAL,a=ModelExperimentalUtility.hasQuantizedAttributes(t.attributes),s=i.pointCloudShading,c=defined(s)&&s.attenuation;e.push(GeometryPipelineStage),c&&t.primitiveType===PrimitiveType$1.POINTS&&e.push(PointCloudAttenuationPipelineStage),a&&e.push(DequantizationPipelineStage),o&&e.push(MaterialPipelineStage),defined(i.customShader)&&e.push(CustomShaderPipelineStage),e.push(LightingPipelineStage);const l=i.featureIdAttributeIndex,u=i.featureIdTextureIndex;let d;if(defined(n.instances)&&n.instances.featureIdAttributes.length>0){defined(n.instances.featureIdAttributes[l])&&(d=!0)}const h=defined(ModelExperimentalUtility.getAttributeBySemantic(t,VertexAttributeSemantic$1.FEATURE_ID)),p=defined(t.featureIdTextures[u]);(d||(d||h||p))&&(e.push(FeatureIdPipelineStage),e.push(BatchTexturePipelineStage),e.push(CPUStylingPipelineStage)),i.allowPicking&&e.push(PickingPipelineStage),e.push(AlphaPipelineStage)};var InstancingStageCommon="mat4 getInstancingTransform()\n{\nmat4 instancingTransform;\n#ifdef HAS_INSTANCE_MATRICES\ninstancingTransform = mat4(\na_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0,\na_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0,\na_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0,\na_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0\n);\n#else\nvec3 translation = vec3(0.0, 0.0, 0.0);\nvec3 scale = vec3(1.0, 1.0, 1.0);\n#ifdef HAS_INSTANCE_TRANSLATION\ntranslation = a_instanceTranslation;\n#endif\n#ifdef HAS_INSTANCE_SCALE\nscale = a_instanceScale;\n#endif\ninstancingTransform = mat4(\nscale.x, 0.0, 0.0, 0.0,\n0.0, scale.y, 0.0, 0.0,\n0.0, 0.0, scale.z, 0.0,\ntranslation.x, translation.y, translation.z, 1.0\n);\n#endif\nreturn instancingTransform;\n}\n",InstancingStageVS="void instancingStage(inout vec3 positionMC)\n{\nmat4 instancingTransform = getInstancingTransform();\npositionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;\n}\n",LegacyInstancingStageVS="void legacyInstancingStage(inout vec3 positionMC, out mat4 instanceModelView, out mat3 instanceModelViewInverseTranspose)\n{\nmat4 instancingTransform = getInstancingTransform();\nmat4 instanceModel = instancingTransform * u_instance_nodeTransform;\ninstanceModelView = u_instance_modifiedModelView;\ninstanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);\npositionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;\n}\n";const matrixScratch$1=new Matrix4,InstancingPipelineStage={name:"InstancingPipelineStage",process:function(e,t,n){const i=t.instances,r=i.attributes[0].count;let o=[];const a=e.model.sceneGraph,s=e.shaderBuilder;s.addDefine("HAS_INSTANCING"),s.addVertexLines([InstancingStageCommon]);const c=ModelExperimentalUtility.getAttributeBySemantic(i,InstanceAttributeSemantic$1.TRANSLATION);let l,u;defined(c)&&(l=c.max,u=c.min);if(!defined(ModelExperimentalUtility.getAttributeBySemantic(i,InstanceAttributeSemantic$1.ROTATION))&&defined(l)&&defined(u)){defined(c)&&(o.push({index:e.attributeIndex++,vertexBuffer:c.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(c.type),componentDatatype:c.componentDatatype,normalize:!1,offsetInBytes:c.byteOffset,strideInBytes:c.byteStride,instanceDivisor:1}),e.instancingTranslationMax=l,e.instancingTranslationMin=u,s.addDefine("HAS_INSTANCE_TRANSLATION"),s.addAttribute("vec3","a_instanceTranslation"));const t=ModelExperimentalUtility.getAttributeBySemantic(i,InstanceAttributeSemantic$1.SCALE);defined(t)&&(o.push({index:e.attributeIndex++,vertexBuffer:t.buffer,componentsPerAttribute:AttributeType$1.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,normalize:!1,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,instanceDivisor:1}),s.addDefine("HAS_INSTANCE_SCALE"),s.addAttribute("vec3","a_instanceScale"))}else o=processMatrixAttributes(t,r,e,n);if(processFeatureIdAttributes(e,n,i,o),i.transformInWorldSpace){const t=e.uniformMap;s.addDefine("USE_LEGACY_INSTANCING",void 0,ShaderDestination$1.VERTEX),s.addUniform("mat4","u_instance_modifiedModelView",ShaderDestination$1.VERTEX),s.addUniform("mat4","u_instance_nodeTransform",ShaderDestination$1.VERTEX),t.u_instance_modifiedModelView=function(){return Matrix4.multiply(n.context.uniformState.view,a.components.transform,matrixScratch$1)},t.u_instance_nodeTransform=function(){return e.runtimeNode.axisCorrectedTransform},s.addVertexLines([LegacyInstancingStageVS])}else s.addVertexLines([InstancingStageVS]);e.instanceCount=r,e.attributes.push.apply(e.attributes,o)}},translationScratch$1=new Cartesian3,rotationScratch$2=new Quaternion,scaleScratch=new Cartesian3,transformScratch$1=new Matrix4;function getInstanceTransformsTypedArray(e,t,n){const i=new Float32Array(12*t),r=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.TRANSLATION),o=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.ROTATION),a=ModelExperimentalUtility.getAttributeBySemantic(e,InstanceAttributeSemantic$1.SCALE),s=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=defined(r),u=defined(o),d=defined(a),h=l?r.packedTypedArray:new Float32Array(3*t),p=u?o.packedTypedArray:new Float32Array(4*t);let f;d?f=a.packedTypedArray:(f=new Float32Array(3*t),f.fill(1));for(let e=0;e<t;e++){const t=new Cartesian3(h[3*e],h[3*e+1],h[3*e+2],translationScratch$1);Cartesian3.maximumByComponent(s,t,s),Cartesian3.minimumByComponent(c,t,c);const r=new Quaternion(p[4*e],p[4*e+1],p[4*e+2],u?p[4*e+3]:1,rotationScratch$2),o=new Cartesian3(f[3*e],f[3*e+1],f[3*e+2],scaleScratch),a=Matrix4.fromTranslationQuaternionRotationScale(t,r,o,transformScratch$1),l=12*e;i[l+0]=a[0],i[l+1]=a[4],i[l+2]=a[8],i[l+3]=a[12],i[l+4]=a[1],i[l+5]=a[5],i[l+6]=a[9],i[l+7]=a[13],i[l+8]=a[2],i[l+9]=a[6],i[l+10]=a[10],i[l+11]=a[14],n.instancingTranslationMax=s,n.instancingTranslationMin=c}return i}function processFeatureIdAttributes(e,t,n,i){const r=n.attributes,o=e.model,a=e.shaderBuilder;for(let n=0;n<r.length;n++){const s=r[n];if(s.semantic!==InstanceAttributeSemantic$1.FEATURE_ID)continue;s.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s.setIndex+1);const c=Buffer$1.createVertexBuffer({context:t.context,typedArray:s.packedTypedArray,usage:BufferUsage$1.STATIC_DRAW});c.vertexArrayDestroyable=!1,o._resources.push(c),i.push({index:e.attributeIndex++,vertexBuffer:c,componentsPerAttribute:AttributeType$1.getNumberOfComponents(s.type),componentDatatype:s.componentDatatype,normalize:!1,offsetInBytes:s.byteOffset,strideInBytes:s.byteStride,instanceDivisor:1}),a.addAttribute("float","a_instanceFeatureId_"+s.setIndex)}}function processMatrixAttributes(e,t,n,i){const r=getInstanceTransformsTypedArray(e.instances,t,n),o=Buffer$1.createVertexBuffer({context:i.context,typedArray:r,usage:BufferUsage$1.STATIC_DRAW});o.vertexArrayDestroyable=!1,n.model._resources.push(o);const a=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),s=[{index:n.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:12*a,instanceDivisor:1},{index:n.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*a,strideInBytes:12*a,instanceDivisor:1},{index:n.attributeIndex++,vertexBuffer:o,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*a,strideInBytes:12*a,instanceDivisor:1}],c=n.shaderBuilder;return c.addDefine("HAS_INSTANCE_MATRICES"),c.addAttribute("vec4","a_instancingTransformRow0"),c.addAttribute("vec4","a_instancingTransformRow1"),c.addAttribute("vec4","a_instancingTransformRow2"),s}InstancingPipelineStage._getInstanceTransformsTypedArray=getInstanceTransformsTypedArray;const ModelMatrixUpdateStage={name:"ModelMatrixUpdateStage",update:function(e,t,n){e._transformDirty&&(updateRuntimeNode(e,t,e.transform),e._transformDirty=!1)}},transformScratch=new Matrix4;function updateRuntimeNode(e,t,n){let i,r;for(i=0;i<e.runtimePrimitives.length;i++){const o=e.runtimePrimitives[i];for(r=0;r<o.drawCommands.length;r++){const e=o.drawCommands[r];Matrix4.multiplyTransformation(t._computedModelMatrix,n,e.modelMatrix),BoundingSphere.transform(o.boundingSphere,e.modelMatrix,e.boundingVolume)}}if(defined(e.children))for(i=0;i<e.children.length;i++){const n=t._runtimeNodes[e.children[i]];Matrix4.multiplyTransformation(e.transform,n.transform,transformScratch),updateRuntimeNode(n,t,transformScratch)}}function ModelExperimentalNode(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).sceneGraph,n=e.transform;this._sceneGraph=t,this._children=e.children,this._node=e.node;const i=t.components;this._originalTransform=Matrix4.clone(n),this._axisCorrectedTransform=Matrix4.clone(n),ModelExperimentalUtility.correctModelMatrix(this._axisCorrectedTransform,i.upAxis,i.forwardAxis),this._transform=Matrix4.clone(n),this._computedTransform=Matrix4.multiplyTransformation(t.computedModelMatrix,n,new Matrix4),this._transformDirty=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.configurePipeline()}function ModelAlphaOptions(){this.pass=void 0,this.alphaMode=void 0,this.alphaCutoff=void 0}function ShaderStruct(e){this.name=e,this.fields=[]}function ShaderFunction(e){this.signature=e,this.body=[]}function ShaderBuilder(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}function generateStructLines(e){const t=[],n=[];let i,r,o,a,s=e._vertexShaderParts.structIds;for(i=0;i<s.length;i++)r=s[i],o=e._structs[r],a=o.generateGlslLines(),t.push.apply(t,a);for(s=e._fragmentShaderParts.structIds,i=0;i<s.length;i++)r=s[i],o=e._structs[r],a=o.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function generateFunctionLines(e){const t=[],n=[];let i,r,o,a,s=e._vertexShaderParts.functionIds;for(i=0;i<s.length;i++)r=s[i],o=e._functions[r],a=o.generateGlslLines(),t.push.apply(t,a);for(s=e._fragmentShaderParts.functionIds,i=0;i<s.length;i++)r=s[i],o=e._functions[r],a=o.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function ModelRenderResources(e){this.shaderBuilder=new ShaderBuilder,this.model=e,this.uniformMap={},this.alphaOptions=new ModelAlphaOptions}function NodeRenderResources(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.runtimeNode=t,this.modelMatrix=t.transform,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0,this.instancingTranslationMax=void 0,this.instancingTranslationMin=void 0}function ModelLightingOptions(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.lightingModel=defaultValue(e.lightingModel,LightingModel$1.UNLIT)}function PrimitiveRenderResources(e,t){this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.hasFeatureIds=!1,this.uniformMap=clone$1(e.uniformMap),this.alphaOptions=clone$1(e.alphaOptions),this.transform=e.runtimeNode.transform.clone(),this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=defined(n.indices)?n.indices.count:ModelExperimentalUtility.getAttributeBySemantic(n,"POSITION").count,this.indices=n.indices,this.primitiveType=n.primitiveType,this.boundingSphere=ModelExperimentalUtility.createBoundingSphere(n,Matrix4.IDENTITY,e.instancingTranslationMax,e.instancingTranslationMin),this.lightingOptions=new ModelLightingOptions,this.pickId=void 0,this.renderStateOptions={depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.DISABLED},this.styleCommandsNeeded=void 0}function ModelExperimentalSceneGraph(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._model=e.model,this._modelComponents=e.modelComponents,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._drawCommands=[],this._boundingSpheres=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._computedModelMatrix=Matrix4.clone(this._model.modelMatrix),initialize$2(this)}function initialize$2(e){const t=e._modelComponents,n=t.scene,i=e._model;e._computedModelMatrix=Matrix4.multiplyTransformation(i.modelMatrix,t.transform,new Matrix4),ModelExperimentalUtility.correctModelMatrix(e._computedModelMatrix,t.upAxis,t.forwardAxis);const r=n.nodes;for(let t=0;t<r.length;t++){const i=n.nodes[t],r=traverseSceneGraph(e,i,ModelExperimentalUtility.getNodeTransform(i));e._rootNodes.push(r)}}function traverseSceneGraph(e,t,n){const i=[];let r;if(defined(t.children))for(r=0;r<t.children.length;r++){const o=t.children[r],a=traverseSceneGraph(e,o,Matrix4.multiply(n,ModelExperimentalUtility.getNodeTransform(o),new Matrix4));i.push(a)}const o=new ModelExperimentalNode({node:t,transform:n,children:i,sceneGraph:e});if(defined(t.primitives))for(r=0;r<t.primitives.length;r++)o.runtimePrimitives.push(new ModelExperimentalPrimitive({primitive:t.primitives[r],node:t,model:e._model}));return e._runtimeNodes.push(o),e._runtimeNodes.length-1}function ModelFeature(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}function ModelFeatureTable(e){const t=e.model,n=e.propertyTable;this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=StyleCommandsNeeded$1.ALL_OPAQUE,initialize$1(this)}function initialize$1(e){const t=e._model,n=ModelExperimentalType$1.is3DTiles(t.type),i=e._propertyTable.count;if(0===i)return;let r;const o=new Array(i);if(n){const e=t.content;for(r=0;r<i;r++)o[r]=new Cesium3DTileFeature(e,r)}else for(r=0;r<i;r++)o[r]=new ModelFeature({model:t,featureId:r,featureTable:e});e._features=o,e._featuresLength=i,e._batchTexture=new BatchTexture({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:e._statistics})}Object.defineProperties(ModelExperimentalNode.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){Matrix4.equals(this._transform,e)||(this._transformDirty=!0,this._transform=Matrix4.clone(e,this._transform),this._axisCorrectedTransform=Matrix4.clone(e,this._axisCorrectedTransform),ModelExperimentalUtility.correctModelMatrix(this._axisCorrectedTransform,this._sceneGraph.components.upAxis,this._sceneGraph.components.forwardAxis),Matrix4.multiplyTransformation(this._sceneGraph.computedModelMatrix,e,this._computedTransform))}},axisCorrectedTransform:{get:function(){return this._axisCorrectedTransform}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}}}),ModelExperimentalNode.prototype.getChild=function(e){return this.sceneGraph.runtimeNodes[this.children[e]]},ModelExperimentalNode.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,defined(e.instances)&&t.push(InstancingPipelineStage),n.push(ModelMatrixUpdateStage)},ModelExperimentalNode.prototype.updateModelMatrix=function(){this._transformDirty=!0,Matrix4.multiplyTransformation(this._sceneGraph.computedModelMatrix,this._transform,this._computedTransform)},ShaderStruct.prototype.addField=function(e,t){const n=" "+e+" "+t+";";this.fields.push(n)},ShaderStruct.prototype.generateGlslLines=function(){let e=this.fields;return 0===e.length&&(e=[" float _empty;"]),[].concat("struct "+this.name,"{",e,"};")},ShaderFunction.prototype.addLines=function(e){const t=e.map((function(e){return" "+e}));Array.prototype.push.apply(this.body,t)},ShaderFunction.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")},Object.defineProperties(ShaderBuilder.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}}),ShaderBuilder.prototype.addDefine=function(e,t,n){n=defaultValue(n,ShaderDestination$1.BOTH);let i=e;defined(t)&&(i+=" "+t.toString()),ShaderDestination$1.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),ShaderDestination$1.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)},ShaderBuilder.prototype.addStruct=function(e,t,n){this._structs[e]=new ShaderStruct(t),ShaderDestination$1.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),ShaderDestination$1.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)},ShaderBuilder.prototype.addStructField=function(e,t,n){this._structs[e].addField(t,n)},ShaderBuilder.prototype.addFunction=function(e,t,n){this._functions[e]=new ShaderFunction(t),ShaderDestination$1.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),ShaderDestination$1.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)},ShaderBuilder.prototype.addFunctionLines=function(e,t){this._functions[e].addLines(t)},ShaderBuilder.prototype.addUniform=function(e,t,n){n=defaultValue(n,ShaderDestination$1.BOTH);const i="uniform "+e+" "+t+";";ShaderDestination$1.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),ShaderDestination$1.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)},ShaderBuilder.prototype.setPositionAttribute=function(e,t){return this._positionAttributeLine="attribute "+e+" "+t+";",this._attributeLocations[t]=0,0},ShaderBuilder.prototype.addAttribute=function(e,t){const n="attribute "+e+" "+t+";";this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation++,i},ShaderBuilder.prototype.addVarying=function(e,t){const n="varying "+e+" "+t+";";this._vertexShaderParts.varyingLines.push(n),this._fragmentShaderParts.varyingLines.push(n)},ShaderBuilder.prototype.addVertexLines=function(e){Array.prototype.push.apply(this._vertexShaderParts.shaderLines,e)},ShaderBuilder.prototype.addFragmentLines=function(e){Array.prototype.push.apply(this._fragmentShaderParts.shaderLines,e)},ShaderBuilder.prototype.buildShaderProgram=function(e){const t=defined(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=generateStructLines(this),i=generateFunctionLines(this),r=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join("\n"),o=new ShaderSource({defines:this._vertexShaderParts.defineLines,sources:[r]}),a=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join("\n"),s=new ShaderSource({defines:this._fragmentShaderParts.defineLines,sources:[a]});return ShaderProgram.fromCache({context:e,vertexShaderSource:o,fragmentShaderSource:s,attributeLocations:this._attributeLocations})},ShaderBuilder.prototype.clone=function(){return clone$1(this,!0)},Object.defineProperties(ModelExperimentalSceneGraph.prototype,{components:{get:function(){return this._modelComponents}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}}),ModelExperimentalSceneGraph.prototype.buildDrawCommands=function(e){const t=new ModelRenderResources(this._model);this.configurePipeline();const n=this.modelPipelineStages,i=this.model;let r,o,a;for(r=0;r<n.length;r++){n[r].process(t,i,e)}for(r=0;r<this._runtimeNodes.length;r++){const n=this._runtimeNodes[r];n.configurePipeline();const i=n.pipelineStages,s=new NodeRenderResources(t,n);for(o=0;o<i.length;o++){i[o].process(s,n.node,e)}for(o=0;o<n.runtimePrimitives.length;o++){const t=n.runtimePrimitives[o];t.configurePipeline();const i=t.pipelineStages,r=new PrimitiveRenderResources(s,t);for(a=0;a<i.length;a++){i[a].process(r,t.primitive,e)}t.boundingSphere=BoundingSphere.clone(r.boundingSphere),this._boundingSpheres.push(r.boundingSphere);const c=buildDrawCommands(r,e);t.drawCommands=c}}this._boundingSphere=BoundingSphere.fromBoundingSpheres(this._boundingSpheres)},ModelExperimentalSceneGraph.prototype.configurePipeline=function(){const e=this.modelPipelineStages;e.length=0;defined(this._model.color)&&e.push(ModelColorPipelineStage)},ModelExperimentalSceneGraph.prototype.update=function(e){let t,n,i;for(t=0;t<this._runtimeNodes.length;t++){const r=this._runtimeNodes[t];for(n=0;n<r.updateStages.length;n++){r.updateStages[n].update(r,this,e)}for(n=0;n<r.runtimePrimitives.length;n++){const e=r.runtimePrimitives[n];for(i=0;i<e.updateStages.length;i++){e.updateStages[i].update(e)}}}},ModelExperimentalSceneGraph.prototype.updateModelMatrix=function(){this._computedModelMatrix=Matrix4.clone(this._model.modelMatrix),Matrix4.multiply(this._computedModelMatrix,this._modelComponents.transform,this._computedModelMatrix),ModelExperimentalUtility.correctModelMatrix(this._computedModelMatrix,this._modelComponents.upAxis,this._modelComponents.forwardAxis);const e=this._rootNodes;for(let t=0;t<e.length;t++){this._runtimeNodes[e[t]].updateModelMatrix()}},ModelExperimentalSceneGraph.prototype.getDrawCommands=function(){const e=[];for(let t=0;t<this._runtimeNodes.length;t++){const n=this._runtimeNodes[t];for(let t=0;t<n.runtimePrimitives.length;t++){const i=n.runtimePrimitives[t];e.push.apply(e,i.drawCommands)}}return e},Object.defineProperties(ModelFeature.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return defined(this._color)||(this._color=new Color),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}}),ModelFeature.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)},ModelFeature.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyInherited=function(e){const t=this._featureTable.getPropertyBySemantic(this._featureId,e);return defined(t)?t:this._featureTable.getProperty(this._featureId,e)},ModelFeature.prototype.getPropertyNames=function(e){return this._featureTable.getPropertyNames(e)},ModelFeature.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)},Object.defineProperties(ModelFeatureTable.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}}),ModelFeatureTable.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=StyleCommandsNeeded$1.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)},ModelFeatureTable.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},ModelFeatureTable.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},ModelFeatureTable.prototype.getShow=function(e){return this._batchTexture.getShow(e)},ModelFeatureTable.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},ModelFeatureTable.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},ModelFeatureTable.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},ModelFeatureTable.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)},ModelFeatureTable.prototype.getFeature=function(e){return this._features[e]},ModelFeatureTable.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)},ModelFeatureTable.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)},ModelFeatureTable.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)},ModelFeatureTable.prototype.getPropertyNames=function(e){return this._propertyTable.getPropertyIds(e)},ModelFeatureTable.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};const scratchColor$e=new Color;function JsonMetadataTable(e){this._count=e.count,this._properties=clone$1(e.properties,!0)}function parseBatchTable(e){const t=e.count,n=e.batchTable,i=e.binaryBody,r=partitionProperties(n),o=new JsonMetadataTable({count:t,properties:r.jsonProperties}),a=initializeHierarchy(r.hierarchy,i),s=transcodeBinaryProperties(t,MetadataClass.BATCH_TABLE_CLASS_NAME,r.binaryProperties,i),c=s.featureTableJson,l=new MetadataTable({count:c.count,properties:c.properties,class:s.transcodedClass,bufferViews:s.bufferViewsU8}),u=new PropertyTable({id:0,name:"Batch Table",count:c.count,metadataTable:l,jsonMetadataTable:o,batchTableHierarchy:a});return new FeatureMetadata({schema:s.transcodedSchema,propertyTables:[u],extensions:r.extensions,extras:r.extras})}function partitionProperties(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let r;defined(t)?(parseBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),r=t):defined(i)&&(r=i["3DTILES_batch_table_hierarchy"]);const o={},a={};for(const t in e){if(!e.hasOwnProperty(t)||"HIERARCHY"===t||"extensions"===t||"extras"===t)continue;const n=e[t];Array.isArray(n)?o[t]=n:a[t]=n}return{binaryProperties:a,jsonProperties:o,hierarchy:r,extras:n,extensions:i}}function transcodeBinaryProperties(e,t,n,i){const r={},o={},a={};let s=0;for(const t in n){if(!n.hasOwnProperty(t))continue;if(!defined(i))throw new RuntimeError("Property "+t+" requires a batch table binary.");const c=n[t],l=getBinaryAccessor(c);o[t]={bufferView:s},r[t]=transcodePropertyType(c),a[s]=l.createArrayBufferView(i.buffer,i.byteOffset+c.byteOffset,e),s++}const c={classes:{}};c.classes[t]={properties:r};const l=new MetadataSchema(c);return{featureTableJson:{class:t,count:e,properties:o},bufferViewsU8:a,transcodedSchema:l,transcodedClass:l.classes[t]}}function transcodePropertyType(e){const t=transcodeComponentType(e.componentType),n=e.type;return"SCALAR"===n?{type:"SINGLE",componentType:t}:{type:n,componentType:t}}function transcodeComponentType(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}function initializeHierarchy(e,t){if(defined(e))return new BatchTableHierarchy({extension:e,binaryBody:t})}ModelFeatureTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(BatchTexture.DEFAULT_COLOR_VALUE),void this.setAllShow(BatchTexture.DEFAULT_SHOW_VALUE);for(let t=0;t<this._featuresLength;t++){const n=this.getFeature(t),i=defined(e.color)?defaultValue(e.color.evaluateColor(n,scratchColor$e),BatchTexture.DEFAULT_COLOR_VALUE):BatchTexture.DEFAULT_COLOR_VALUE,r=defined(e.show)?defaultValue(e.show.evaluate(n),BatchTexture.DEFAULT_SHOW_VALUE):BatchTexture.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,r)}},ModelFeatureTable.prototype.isDestroyed=function(){return!1},ModelFeatureTable.prototype.destroy=function(e){this._batchTexture.destroy(),destroyObject(this)},JsonMetadataTable.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties)},JsonMetadataTable.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,void 0,e)},JsonMetadataTable.prototype.getProperty=function(e,t){const n=this._properties[t];if(defined(n))return clone$1(n[e],!0)},JsonMetadataTable.prototype.setProperty=function(e,t,n){const i=this._properties[t];return!!defined(i)&&(i[e]=clone$1(n,!0),!0)},parseBatchTable._deprecationWarning=deprecationWarning;const B3dmLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},FeatureIdAttribute$2=ModelComponents.FeatureIdAttribute;function B3dmLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).b3dmResource;let n=e.baseResource;const i=e.arrayBuffer,r=defaultValue(e.byteOffset,0),o=defaultValue(e.releaseGltfJson,!1),a=defaultValue(e.asynchronous,!0),s=defaultValue(e.incrementallyLoadTextures,!0),c=defaultValue(e.upAxis,Axis$1.Y),l=defaultValue(e.forwardAxis,Axis$1.X),u=defaultValue(e.loadAsTypedArray,!1);n=defined(n)?n:t.clone(),this._b3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=r,this._releaseGltfJson=o,this._asynchronous=a,this._incrementallyLoadTextures=s,this._upAxis=c,this._forwardAxis=l,this._loadAsTypedArray=u,this._state=B3dmLoaderState.UNLOADED,this._promise=when.defer(),this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=Matrix4.IDENTITY}function handleError$1(e,t){e.unload(),e._state=B3dmLoaderState.FAILED;t=e.getError("Failed to load b3dm",t),e._promise.reject(t)}function createFeatureMetadata$1(e,t){const n=e._batchTable,i=e._batchLength;if(0===i)return;let r;if(defined(n.json))r=parseBatchTable({count:i,batchTable:n.json,binaryBody:n.binary});else{r=new FeatureMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:i})]})}const o=t.scene.nodes;for(let e=0;e<o.length;e++)processNode(o[e]);t.featureMetadata=r}function processNode(e){if(!defined(e.children)&&!defined(e.primitives))return;let t;if(defined(e.children))for(t=0;t<e.children.length;t++)processNode(e.children[t]);if(defined(e.primitives))for(t=0;t<e.primitives.length;t++){const n=e.primitives[t],i=ModelExperimentalUtility.getAttributeBySemantic(n,VertexAttributeSemantic$1.FEATURE_ID);if(defined(i)){i.setIndex=0;const e=new FeatureIdAttribute$2;e.propertyTableId=0,e.setIndex=0,n.featureIdAttributes.push(e)}}}defined(Object.create)&&(B3dmLoader.prototype=Object.create(ResourceLoader.prototype),B3dmLoader.prototype.constructor=B3dmLoader),Object.defineProperties(B3dmLoader.prototype,{promise:{get:function(){return this._promise.promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),B3dmLoader.prototype.load=function(){const e=B3dmParser.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,r=e.batchTableJson,o=e.batchTableBinary,a=new Cesium3DTileFeatureTable(n,i);t=a.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const s=a.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(s)&&(this._transform=Matrix4.fromTranslation(Cartesian3.fromArray(s))),this._batchTable={json:r,binary:o};const c=new GltfLoader({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAsTypedArray:this._loadAsTypedArray,renameBatchIdSemantic:!0});this._gltfLoader=c,this._state=B3dmLoaderState.LOADING;const l=this;c.load(),c.promise.then((function(){if(l.isDestroyed())return;const e=c.components;e.transform=l._transform,createFeatureMetadata$1(l,e),l._components=e,l._state=B3dmLoaderState.READY,l._promise.resolve(l)})).otherwise((function(e){l.isDestroyed()||handleError$1(l,e)}))},B3dmLoader.prototype.process=function(e){this._state===B3dmLoaderState.LOADING&&(this._state=B3dmLoaderState.PROCESSING),this._state===B3dmLoaderState.PROCESSING&&this._gltfLoader.process(e)},B3dmLoader.prototype.unload=function(){defined(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0};const Components=ModelComponents.Components,Scene$1=ModelComponents.Scene,Node$1=ModelComponents.Node,Primitive=ModelComponents.Primitive,Attribute$1=ModelComponents.Attribute,Quantization=ModelComponents.Quantization,FeatureIdAttribute$1=ModelComponents.FeatureIdAttribute,Material=ModelComponents.Material,MetallicRoughness=ModelComponents.MetallicRoughness;function PntsLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).arrayBuffer,n=defaultValue(e.byteOffset,0);this._arrayBuffer=t,this._byteOffset=n,this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=when.defer(),this._state=ResourceLoaderState$1.UNLOADED,this._buffers=[],this._components=void 0,this._transform=Matrix4.IDENTITY}function decodeDraco(e,t){const n=e._parsedContent.draco;let i;i=defined(n)?DracoLoader.decodePointCloud(n,t):when.resolve(),defined(i)&&(e._decodePromise=i,i.then((function(i){e.isDestroyed()||(defined(i)&&processDracoAttributes(e,n,i),makeComponents(e,t),e._state=ResourceLoaderState$1.READY,e._promise.resolve(e))})).otherwise((function(t){e.unload(),e._state=ResourceLoaderState$1.FAILED;e._promise.reject(e.getError("Failed to load Draco",t))})))}function processDracoAttributes(e,t,n){e._state=ResourceLoaderState$1.READY;const i=e._parsedContent;let r;if(defined(n.POSITION)){if(r={name:"POSITION",semantic:VertexAttributeSemantic$1.POSITION,typedArray:n.POSITION.array,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,isQuantized:!1},defined(n.POSITION.data.quantization)){const e=n.POSITION.data.quantization,t=e.range,i=Cartesian3.fromElements(t,t,t),o=Cartesian3.unpack(e.minValues),a=(1<<e.quantizationBits)-1;r.isQuantized=!0,r.quantizedRange=a,r.quantizedVolumeOffset=o,r.quantizedVolumeScale=i,r.quantizedComponentDatatype=ComponentDatatype$1.UNSIGNED_SHORT,r.quantizedType=AttributeType$1.VEC3}i.positions=r}if(defined(n.NORMAL)){if(r={name:"NORMAL",semantic:VertexAttributeSemantic$1.NORMAL,typedArray:n.NORMAL.array,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},defined(n.NORMAL.data.quantization)){const e=(1<<n.NORMAL.data.quantization.quantizationBits)-1;r.quantizedRange=e,r.octEncoded=!0,r.octEncodedZXY=!0,r.quantizedComponentDatatype=ComponentDatatype$1.UNSIGNED_BYTE,r.quantizedType=AttributeType$1.VEC2}i.normals=r}if(defined(n.RGBA)?i.colors={name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC4,normalized:!0,isTranslucent:!0}:defined(n.RGB)&&(i.colors={name:"COLOR",semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,type:AttributeType$1.VEC3,normalized:!0,isTranslucent:!1}),defined(n.BATCH_ID)){const e=n.BATCH_ID.array;i.batchIds={name:"FEATURE_ID",semantic:VertexAttributeSemantic$1.FEATURE_ID,setIndex:0,typedArray:e,componentDatatype:ComponentDatatype$1.fromTypedArray(e),type:AttributeType$1.SCALAR}}let o=i.styleableProperties;const a=t.batchTableProperties;for(const e in a)if(a.hasOwnProperty(e)){const t=n[e];defined(o)||(o={}),o[e]={typedArray:t.array,componentCount:t.data.componentsPerAttribute}}i.styleableProperties=o}function makeAttribute(e,t,n){let i,r=t.typedArray;if(t.octEncoded&&(i=new Quantization,i.octEncoded=t.octEncoded,i.octEncodedZXY=t.octEncodedZXY,i.normalizationRange=t.quantizedRange,i.type=t.quantizedType,i.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){i=new Quantization;const e=t.quantizedRange;i.normalizationRange=e,i.quantizedVolumeOffset=Cartesian3.ZERO;const n=t.quantizedVolumeScale;i.quantizedVolumeDimensions=n,i.quantizedVolumeStepSize=Cartesian3.divideByScalar(n,e,new Cartesian3),i.componentDatatype=t.quantizedComponentDatatype,i.type=t.quantizedType}const o=new Attribute$1;if(o.name=t.name,o.semantic=t.semantic,o.setIndex=t.setIndex,o.componentDatatype=t.componentDatatype,o.type=t.type,o.normalized=defaultValue(t.normalized,!1),o.min=t.min,o.max=t.max,o.quantization=i,t.isRGB565&&(r=AttributeCompression.decodeRGB565(r)),defined(t.constantColor)){const e=new Array(4);o.constant=Color.pack(t.constantColor,e)}else{const t=Buffer$1.createVertexBuffer({typedArray:r,context:n,usage:BufferUsage$1.STATIC_DRAW});t.vertexArrayDestroyable=!1,e._buffers.push(t),o.buffer=t}return o}let randomNumberGenerator,randomValues;function getRandomValues(e){if(!defined(randomValues)){randomNumberGenerator=new mersenneTwister(0),randomValues=new Array(e);for(let t=0;t<e;++t)randomValues[t]=randomNumberGenerator.random()}return randomValues}defined(Object.create)&&(PntsLoader.prototype=Object.create(ResourceLoader.prototype),PntsLoader.prototype.constructor=PntsLoader),Object.defineProperties(PntsLoader.prototype,{promise:{get:function(){return this._promise.promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}}),PntsLoader.prototype.load=function(){this._parsedContent=PntsParser.parse(this._arrayBuffer,this._byteOffset),this._state=ResourceLoaderState$1.PROCESSING},PntsLoader.prototype.process=function(e){this._state===ResourceLoaderState$1.PROCESSING&&(defined(this._decodePromise)||decodeDraco(this,e.context))};const scratchMin$1=new Cartesian3,scratchMax$1=new Cartesian3,scratchPosition$3=new Cartesian3;function computeApproximateExtrema(e){const t=e.typedArray,n=t.length/3,i=Math.min(n,20),r=getRandomValues(20),o=Number.MAX_VALUE,a=-Number.MAX_VALUE;let s,c,l,u=Cartesian3.fromElements(o,o,o,scratchMin$1),d=Cartesian3.fromElements(a,a,a,scratchMax$1);if(e.isQuantized)u=Cartesian3.ZERO,d=e.quantizedVolumeScale;else for(s=0;s<i;++s)c=Math.floor(r[s]*n),l=Cartesian3.unpack(t,3*c,scratchPosition$3),Cartesian3.minimumByComponent(u,l,u),Cartesian3.maximumByComponent(d,l,d);e.min=Cartesian3.clone(u),e.max=Cartesian3.clone(d)}const defaultColorAttribute={name:VertexAttributeSemantic$1.COLOR,semantic:VertexAttributeSemantic$1.COLOR,setIndex:0,constantColor:Color.DARKGRAY,componentDatatype:ComponentDatatype$1.FLOAT,type:AttributeType$1.VEC4,isQuantized:!1,isTranslucent:!1};function makeAttributes(e,t,n){const i=[];let r;const o=t.positions;return defined(o)&&(computeApproximateExtrema(o),r=makeAttribute(e,o,n),r.count=t.pointsLength,i.push(r)),defined(t.normals)&&(r=makeAttribute(e,t.normals,n),i.push(r)),defined(t.colors)?(r=makeAttribute(e,t.colors,n),i.push(r)):(r=makeAttribute(e,defaultColorAttribute,n),i.push(r)),defined(t.batchIds)&&(r=makeAttribute(e,t.batchIds,n),i.push(r)),i}function makeFeatureMetadata(e){const t=e.batchLength,n=e.pointsLength,i=e.batchTableBinary;if(defined(i)){return parseBatchTable({count:defaultValue(t,n),batchTable:e.batchTableJson,binaryBody:i})}return new FeatureMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:n})]})}function makeComponents(e,t){const n=e._parsedContent,i=new MetallicRoughness;i.metallicFactor=0,i.roughnessFactor=.9;const r=new Material;r.metallicRoughness=i;const o=n.colors;defined(o)&&o.isTranslucent&&(r.alphaMode=AlphaMode$1.BLEND);const a=!defined(n.normals);r.unlit=a;const s=new Primitive;if(s.attributes=makeAttributes(e,n,t),s.primitiveType=PrimitiveType$1.POINTS,s.material=r,defined(n.batchIds)){const e=new FeatureIdAttribute$1;e.propertyTableId=0,e.setIndex=0,s.featureIdAttributes=[e]}const c=new Node$1;c.primitives=[s];const l=new Scene$1;l.nodes=[c],l.upAxis=Axis$1.Z,l.forwardAxis=Axis$1.X;const u=new Components;u.scene=l,u.nodes=[c],u.featureMetadata=makeFeatureMetadata(n),defined(n.rtcCenter)&&(u.transform=Matrix4.multiplyByTranslation(u.transform,n.rtcCenter,u.transform));const d=n.positions;defined(d)&&d.isQuantized&&(u.transform=Matrix4.multiplyByTranslation(u.transform,d.quantizedVolumeOffset,u.transform)),e._components=u,e._parsedContent=void 0}PntsLoader.prototype.unload=function(){const e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0};const I3dmLoaderState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Attribute=ModelComponents.Attribute,FeatureIdAttribute=ModelComponents.FeatureIdAttribute,Instances=ModelComponents.Instances;function I3dmLoader(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const r=defaultValue(e.byteOffset,0),o=defaultValue(e.releaseGltfJson,!1),a=defaultValue(e.asynchronous,!0),s=defaultValue(e.incrementallyLoadTextures,!0),c=defaultValue(e.upAxis,Axis$1.Y),l=defaultValue(e.forwardAxis,Axis$1.X),u=defaultValue(e.loadAsTypedArray,!1);i=defined(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=r,this._releaseGltfJson=o,this._asynchronous=a,this._incrementallyLoadTextures=s,this._upAxis=c,this._forwardAxis=l,this._loadAsTypedArray=u,this._state=I3dmLoaderState.UNLOADED,this._promise=when.defer(),this._gltfLoader=void 0,this._transform=Matrix4.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}function handleError(e,t){e.unload(),e._state=I3dmLoaderState.FAILED;t=e.getError("Failed to load I3DM",t),e._promise.reject(t)}function createFeatureMetadata(e,t){const n=e._batchTable,i=e._instancesLength;if(0===i)return;let r;if(defined(n.json))r=parseBatchTable({count:i,batchTable:n.json,binaryBody:n.binary});else{r=new FeatureMetadata({schema:{},propertyTables:[new PropertyTable({name:MetadataClass.BATCH_TABLE_CLASS_NAME,count:i})]})}t.featureMetadata=r}defined(Object.create)&&(I3dmLoader.prototype=Object.create(ResourceLoader.prototype),I3dmLoader.prototype.constructor=I3dmLoader),Object.defineProperties(I3dmLoader.prototype,{promise:{get:function(){return this._promise.promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),I3dmLoader.prototype.load=function(){const e=I3dmParser.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,r=e.batchTableBinary,o=e.gltfFormat,a=new Cesium3DTileFeatureTable(t,n);this._featureTable=a;const s=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=s,!defined(s))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=s;const c=a.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(c)&&(this._transform=Matrix4.fromTranslation(Cartesian3.fromArray(c))),this._batchTable={json:i,binary:r};const l={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAsTypedArray:this._loadAsTypedArray};if(0===o){let t=getStringFromTypedArray(e.gltf);t=t.replace(/[\s\0]+$/,"");const n=this._baseResource.getDerivedResource({url:t});l.gltfResource=n,l.baseResource=n}else l.gltfResource=this._i3dmResource,l.typedArray=e.gltf;const u=new GltfLoader(l);this._gltfLoader=u,this._state=I3dmLoaderState.LOADING;const d=this;u.load(),u.promise.then((function(){if(d.isDestroyed())return;const e=u.components;e.transform=d._transform,createInstances(d,e),createFeatureMetadata(d,e),d._components=e,d._state=I3dmLoaderState.READY,d._promise.resolve(d)})).otherwise((function(e){d.isDestroyed()||handleError(d,e)}))},I3dmLoader.prototype.process=function(e){this._state===I3dmLoaderState.LOADING&&(this._state=I3dmLoaderState.PROCESSING),this._state===I3dmLoaderState.PROCESSING&&this._gltfLoader.process(e)};const positionScratch$5=new Cartesian3,propertyScratch1=new Array(4);function createInstances(e,t){let n;const i=e._featureTable,r=e._instancesLength;if(0===r)return;const o=i.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3),a=i.getGlobalProperty("EAST_NORTH_UP"),s=i.hasProperty("NORMAL_UP")||i.hasProperty("NORMAL_UP_OCT32P")||a,c=i.hasProperty("SCALE")||i.hasProperty("SCALE_NON_UNIFORM"),l=getPositions(i);let u,d;s&&(u=new Float32Array(4*r)),c&&(d=new Float32Array(3*r));const h=new Float32Array(r),p=Cartesian3.unpackArray(l);let f=new Cartesian3;const m=new Cartesian3,g=new Cartesian3,_=new Cartesian3,y=new Matrix3,C=new Quaternion,T=new Array(4),S=new Cartesian3,A=new Array(3),v=new Matrix4;if(!defined(o)){const e=BoundingSphere.fromPoints(p);for(n=0;n<p.length;n++)Cartesian3.subtract(p[n],e.center,positionScratch$5),l[3*n+0]=positionScratch$5.x,l[3*n+1]=positionScratch$5.y,l[3*n+2]=positionScratch$5.z;t.transform=Matrix4.fromTranslation(e.center)}for(n=0;n<r;n++){f=Cartesian3.clone(p[n]),defined(o)&&Cartesian3.add(f,Cartesian3.unpack(o),f),s&&(processRotation(i,a,n,C,f,g,m,_,y,v),Quaternion.pack(C,T,0),u[4*n+0]=T[0],u[4*n+1]=T[1],u[4*n+2]=T[2],u[4*n+3]=T[3]),c&&(processScale(i,n,S),Cartesian3.pack(S,A,0),d[3*n+0]=A[0],d[3*n+1]=A[1],d[3*n+2]=A[2]);let e=i.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,n);defined(e)||(e=n),h[n]=e}const E=new Instances;E.transformInWorldSpace=!0;const b=new Attribute;if(b.name="Instance Translation",b.semantic=InstanceAttributeSemantic$1.TRANSLATION,b.componentDatatype=ComponentDatatype$1.FLOAT,b.type=AttributeType$1.VEC3,b.count=r,b.packedTypedArray=l,E.attributes.push(b),s){const e=new Attribute;e.name="Instance Rotation",e.semantic=InstanceAttributeSemantic$1.ROTATION,e.componentDatatype=ComponentDatatype$1.FLOAT,e.type=AttributeType$1.VEC4,e.count=r,e.packedTypedArray=u,E.attributes.push(e)}if(c){const e=new Attribute;e.name="Instance Scale",e.semantic=InstanceAttributeSemantic$1.SCALE,e.componentDatatype=ComponentDatatype$1.FLOAT,e.type=AttributeType$1.VEC3,e.count=r,e.packedTypedArray=d,E.attributes.push(e)}const x=new Attribute;x.name="Instance Feature ID",x.setIndex=0,x.semantic=InstanceAttributeSemantic$1.FEATURE_ID,x.componentDatatype=ComponentDatatype$1.FLOAT,x.type=AttributeType$1.SCALAR,x.count=r,x.packedTypedArray=h,E.attributes.push(x);const P=new FeatureIdAttribute;for(P.propertyTableId=0,P.setIndex=0,E.featureIdAttributes.push(P),n=0;n<t.nodes.length;n++){const e=t.nodes[n];e.primitives.length>0&&(e.instances=E)}}function getPositions(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const t=e.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3),n=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(n))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(i))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(let e=0;e<t.length/3;e++){const r=t[e];for(let o=0;o<3;o++)t[3*e+o]=r[o]/65535*i[o]+n[o]}return t}throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const propertyScratch2=new Array(4);function processRotation(e,t,n,i,r,o,a,s,c,l){const u=e.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,n,propertyScratch1),d=e.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,n,propertyScratch2);let h=!1;if(defined(u)){if(!defined(d))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(u,0,o),Cartesian3.unpack(d,0,a),h=!0}else{const i=e.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,n,propertyScratch1),s=e.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,n,propertyScratch2);if(defined(i)){if(!defined(s))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(i[0],i[1],65535,o),AttributeCompression.octDecodeInRange(s[0],s[1],65535,a),h=!0}else t?(Transforms.eastNorthUpToFixedFrame(r,Ellipsoid.WGS84,l),Matrix4.getMatrix3(l,c)):Matrix3.clone(Matrix3.IDENTITY,c)}h&&(Cartesian3.cross(a,o,s),Cartesian3.normalize(s,s),Matrix3.setColumn(c,0,a,c),Matrix3.setColumn(c,1,o,c),Matrix3.setColumn(c,2,s,c)),Quaternion.fromRotationMatrix(c,i)}function processScale(e,t,n){n=Cartesian3.fromElements(1,1,1,n);const i=e.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,t);defined(i)&&Cartesian3.multiplyByScalar(n,i,n);const r=e.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,t,propertyScratch1);defined(r)&&(n.x*=r[0],n.y*=r[1],n.z*=r[2])}function ModelExperimental(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._loader=e.loader,this._resource=e.resource,this.type=defaultValue(e.type,ModelExperimentalType$1.GLTF),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._readyPromise=when.defer(),this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1;const t=e.color;this._color=defaultValue(t)?Color.clone(t):void 0,this._colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this._colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._allowPicking=defaultValue(e.allowPicking,!0),this._show=defaultValue(e.show,!0),this._featureIdAttributeIndex=defaultValue(e.featureIdAttributeIndex,0),this._featureIdTextureIndex=defaultValue(e.featureIdTextureIndex,0),this._featureTables=void 0,this._featureTableId=void 0,this._resources=[],this._boundingSphere=void 0;const n=new PointCloudShading(e.pointCloudShading);this._attenuation=n.attenuation,this._pointCloudShading=n,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),initialize(this)}function createModelFeatureTables(e,t){const n=[],i=t.propertyTables;for(let t=0;t<i.length;t++){const r=new ModelFeatureTable({model:e,propertyTable:i[t]});r.featuresLength>0&&n.push(r)}return n}function selectFeatureTableId(e,t){const n=t._featureIdAttributeIndex,i=t._featureIdTextureIndex;let r,o,a,s,c;for(r=0;r<e.nodes.length;r++)if(c=e.nodes[r],defined(c.instances)&&(a=c.instances.featureIdAttributes[n],defined(a)))return a.propertyTableId;for(r=0;r<e.nodes.length;r++)for(c=e.nodes[r],o=0;o<c.primitives.length;o++){const e=c.primitives[o];if(s=e.featureIdTextures[i],a=e.featureIdAttributes[n],defined(s))return s.propertyTableId;if(defined(a))return a.propertyTableId}}function initialize(e){const t=e._loader,n=e._resource;t.load(),t.promise.then((function(t){const n=t.components,i=n.featureMetadata;if(defined(i)&&i.propertyTableCount>0){const t=selectFeatureTableId(n,e),r=createModelFeatureTables(e,i);e.featureTables=r,e.featureTableId=t}e._sceneGraph=new ModelExperimentalSceneGraph({model:e,modelComponents:n}),e._resourcesLoaded=!0})).otherwise(ModelExperimentalUtility.getFailedLoadFunction(e,"model",n));defaultValue(t.texturesLoadedPromise,when.resolve()).then((function(){e._texturesLoaded=!0})).otherwise(ModelExperimentalUtility.getFailedLoadFunction(e,"model",n))}function updateShowBoundingVolume(e,t){const n=e._drawCommands;for(let e=0;e<n.length;e++)n[e].debugShowBoundingVolume=t}function ModelExperimental3DTileContent(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._groupMetadata=void 0}I3dmLoader.prototype.unload=function(){defined(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0},Object.defineProperties(ModelExperimental.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},loader:{get:function(){return this._loader}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){e!==this._style&&this.applyStyle(e),this._style=e}},color:{get:function(){return this._color},set:function(e){Color.equals(this._color,e)||this.resetDrawCommands(),this._color=Color.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},boundingSphere:{get:function(){return this._sceneGraph.boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdAttributeIndex:{get:function(){return this._featureIdAttributeIndex}},featureIdTextureIndex:{get:function(){return this._featureIdTextureIndex}}}),ModelExperimental.prototype.resetDrawCommands=function(){this._drawCommandsBuilt&&(this.destroyResources(),this._drawCommandsBuilt=!1)},ModelExperimental.prototype.update=function(e){if(this._resourcesLoaded&&this._texturesLoaded||this._loader.process(e),defined(this._customShader)&&this._customShader.update(e),this.pointCloudShading.attenuation!==this._attenuation&&(this.resetDrawCommands(),this._attenuation=this.pointCloudShading.attenuation),!this._resourcesLoaded)return;const t=this._featureTables;if(defined(t))for(let n=0;n<t.length;n++)t[n].update(e),t[n].styleCommandsNeededDirty&&this.resetDrawCommands();if(!this._drawCommandsBuilt){this._sceneGraph.buildDrawCommands(e),this._drawCommandsBuilt=!0;const t=this;if(!t._ready)return void e.afterRender.push((function(){t._ready=!0,t._readyPromise.resolve(t)}))}if(this._debugShowBoundingVolumeDirty&&(updateShowBoundingVolume(this._sceneGraph,this._debugShowBoundingVolume),this._debugShowBoundingVolumeDirty=!1),Matrix4.equals(this.modelMatrix,this._modelMatrix)||this._sceneGraph.updateModelMatrix(this),this._sceneGraph.update(e),this._show){const t=this._sceneGraph.getDrawCommands();e.commandList.push.apply(e.commandList,t)}},ModelExperimental.prototype.isDestroyed=function(){return!1},ModelExperimental.prototype.destroy=function(){const e=this._loader;defined(e)&&e.destroy();const t=this._featureTables;if(defined(t))for(let e=0;e<t.length;e++)t[e].destroy();this.destroyResources(),destroyObject(this)},ModelExperimental.prototype.destroyResources=function(){const e=this._resources;for(let t=0;t<e.length;t++)e[t].destroy();this._resources=[]},ModelExperimental.fromGltf=function(e){const t={releaseGltfJson:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis},n=e.gltf,i=defaultValue(e.basePath,""),r=Resource.createIfNeeded(i);defined(n.asset)?(t.gltfJson=n,t.baseResource=r,t.gltfResource=r):n instanceof Uint8Array?(t.typedArray=n,t.baseResource=r,t.gltfResource=r):t.gltfResource=Resource.createIfNeeded(e.gltf);const o=new GltfLoader(t),a=defined(e.content)?ModelExperimentalType$1.TILE_GLTF:ModelExperimentalType$1.GLTF;return new ModelExperimental({loader:o,resource:t.gltfResource,type:a,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,color:e.color,colorBlendAmount:e.colorBlendAmount,colorBlendMode:e.colorBlendMode,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex,pointCloudShading:e.pointCloudShading})},ModelExperimental.fromB3dm=function(e){const t={b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis};return new ModelExperimental({loader:new B3dmLoader(t),resource:t.b3dmResource,type:ModelExperimentalType$1.TILE_B3DM,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,color:e.color,colorBlendAmount:e.colorBlendAmount,colorBlendMode:e.colorBlendMode,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex})},ModelExperimental.fromPnts=function(e){return new ModelExperimental({loader:new PntsLoader({arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset}),resource:e.resource,type:ModelExperimentalType$1.TILE_PNTS,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,color:e.color,colorBlendAmount:e.colorBlendAmount,colorBlendMode:e.colorBlendMode,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex})},ModelExperimental.fromI3dm=function(e){const t={i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis};return new ModelExperimental({loader:new I3dmLoader(t),resource:t.i3dmResource,type:ModelExperimentalType$1.TILE_I3DM,modelMatrix:e.modelMatrix,debugShowBoundingVolume:e.debugShowBoundingVolume,cull:e.cull,opaquePass:e.opaquePass,allowPicking:e.allowPicking,customShader:e.customShader,content:e.content,show:e.show,featureIdAttributeIndex:e.featureIdAttributeIndex,featureIdTextureIndex:e.featureIdTextureIndex})},ModelExperimental.prototype.applyColorAndShow=function(e){const t=defined(e)&&defined(e.color),n=defined(e)&&defined(e.show);this._color=t?e.color.evaluateColor(void 0,this._color):Color.clone(Color.WHITE,this._color),this._show=!n||e.show.evaluate(void 0)},ModelExperimental.prototype.applyStyle=function(e){if(defined(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0){this.featureTables[this.featureTableId].applyStyle(e)}else this.applyColorAndShow(e);this.resetDrawCommands()},Object.defineProperties(ModelExperimental3DTileContent.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return defined(t)&&defined(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;if(defined(t)&&defined(t[n]))return t[n]}},groupMetadata:{get:function(){return this._groupMetadata},set:function(e){this._groupMetadata=e}}}),ModelExperimental3DTileContent.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!defined(n))return;return t.featureTables[n].getFeature(e)},ModelExperimental3DTileContent.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;if(!defined(i))return!1;return n.featureTables[i].hasProperty(e,t)},ModelExperimental3DTileContent.prototype.applyDebugSettings=function(e,t){},ModelExperimental3DTileContent.prototype.applyStyle=function(e){this._model.applyStyle(e)},ModelExperimental3DTileContent.prototype.update=function(e,t){const n=this._model,i=this._tile;n.colorBlendAmount=e.colorBlendAmount,n.colorBlendMode=e.colorBlendMode,n.modelMatrix=i.computedTransform,n.customShader=e.customShader,n.pointCloudShading=e.pointCloudShading,n.update(t)},ModelExperimental3DTileContent.prototype.isDestroyed=function(){return!1},ModelExperimental3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),destroyObject(this)},ModelExperimental3DTileContent.fromGltf=function(e,t,n,i){const r=new ModelExperimental3DTileContent(e,t,n),o={gltf:i,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:n,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:r,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return r._model=ModelExperimental.fromGltf(o),r},ModelExperimental3DTileContent.fromB3dm=function(e,t,n,i,r){const o=new ModelExperimental3DTileContent(e,t,n),a={arrayBuffer:i,byteOffset:r,resource:n,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:o,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return o._model=ModelExperimental.fromB3dm(a),o},ModelExperimental3DTileContent.fromI3dm=function(e,t,n,i,r){const o=new ModelExperimental3DTileContent(e,t,n),a={arrayBuffer:i,byteOffset:r,resource:n,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:o,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return o._model=ModelExperimental.fromI3dm(a),o},ModelExperimental3DTileContent.fromPnts=function(e,t,n,i,r){const o=new ModelExperimental3DTileContent(e,t,n),a={arrayBuffer:i,byteOffset:r,resource:n,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._gltfUpAxis,forwardAxis:Axis$1.X,incrementallyLoadTextures:!1,customShader:e.customShader,content:o,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount};return o._model=ModelExperimental.fromPnts(a),o};const Cesium3DTileContentFactory={b3dm:function(e,t,n,i,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromB3dm(e,t,n,i,r):new Batched3DModel3DTileContent(e,t,n,i,r)},pnts:function(e,t,n,i,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromPnts(e,t,n,i,r):new PointCloud3DTileContent(e,t,n,i,r)},i3dm:function(e,t,n,i,r){return e.enableModelExperimental?ModelExperimental3DTileContent.fromI3dm(e,t,n,i,r):new Instanced3DModel3DTileContent(e,t,n,i,r)},cmpt:function(e,t,n,i,r){return new Composite3DTileContent(e,t,n,i,r,Cesium3DTileContentFactory)},externalTileset:function(e,t,n,i){return new Tileset3DTileContent(e,t,n,i)},geom:function(e,t,n,i,r){return new Geometry3DTileContent(e,t,n,i,r)},vctr:function(e,t,n,i,r){return new Vector3DTileContent(e,t,n,i,r)},subt:function(e,t,n,i,r){return new Implicit3DTileContent(e,t,n,i,r)},glb:function(e,t,n,i,r){if(i.byteLength<12)throw new RuntimeError("Invalid glb content");const o=new DataView(i,r).getUint32(8,!0),a=new Uint8Array(i,r,o);return e.enableModelExperimental?ModelExperimental3DTileContent.fromGltf(e,t,n,a):new Gltf3DTileContent(e,t,n,a)},gltf:function(e,t,n,i){return e.enableModelExperimental?ModelExperimental3DTileContent.fromGltf(e,t,n,i):new Gltf3DTileContent(e,t,n,i)}},Cesium3DTileContentState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5};var Cesium3DTileContentState$1=Object.freeze(Cesium3DTileContentState);const Cesium3DTileContentType={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",isBinaryFormat:function(e){switch(e){case Cesium3DTileContentType.BATCHED_3D_MODEL:case Cesium3DTileContentType.INSTANCED_3D_MODEL:case Cesium3DTileContentType.COMPOSITE:case Cesium3DTileContentType.POINT_CLOUD:case Cesium3DTileContentType.VECTOR:case Cesium3DTileContentType.GEOMETRY:case Cesium3DTileContentType.IMPLICIT_SUBTREE:case Cesium3DTileContentType.GLTF_BINARY:return!0;default:return!1}}};var Cesium3DTileContentType$1=Object.freeze(Cesium3DTileContentType);const Cesium3DTileOptimizationHint={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var Cesium3DTileOptimizationHint$1=Object.freeze(Cesium3DTileOptimizationHint);function Cesium3DTilesetMostDetailedTraversal(){}const traversal$1={stack:new ManagedArray,stackMaximumLength:0};function isVisible$1(e){return e._visible&&e._inRequestVolume}function hasEmptyContent$1(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent$1(e){return!hasEmptyContent$1(e)&&e.contentUnloaded}function canTraverse$1(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0))}function updateAndPushChildren$1(e,t,n,i){const r=t.children,o=r.length;for(let e=0;e<o;++e){const t=r[e];t.updateVisibility(i),isVisible$1(t)&&n.push(t)}}function loadTile$1(e,t){(hasUnloadedContent$1(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function touchTile$1(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function visitTile$3(e){++e.statistics.visited}function selectDesiredTile$1(e,t,n){t.contentAvailable&&t.contentVisibility(n)!==Intersect$1.OUTSIDE&&e._selectedTiles.push(t)}function Cesium3DTilesetTraversal(){}function isVisible(e){return e._visible&&e._inRequestVolume}Cesium3DTilesetMostDetailedTraversal.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e._hasMixedContent=!1;let n=!0;const i=e.root;if(i.updateVisibility(t),!isVisible$1(i))return n;const r=traversal$1.stack;for(r.push(e.root);r.length>0;){traversal$1.stackMaximumLength=Math.max(traversal$1.stackMaximumLength,r.length);const i=r.pop(),o=i.refine===Cesium3DTileRefine$1.ADD,a=i.refine===Cesium3DTileRefine$1.REPLACE,s=canTraverse$1(e,i);s&&updateAndPushChildren$1(e,i,r,t),(o||a&&!s)&&(loadTile$1(e,i),touchTile$1(e,i,t),selectDesiredTile$1(e,i,t),hasEmptyContent$1(i)||i.contentAvailable||(n=!1)),visitTile$3(e)}return traversal$1.stack.trim(traversal$1.stackMaximumLength),n};const traversal={stack:new ManagedArray,stackMaximumLength:0},emptyTraversal={stack:new ManagedArray,stackMaximumLength:0},descendantTraversal={stack:new ManagedArray,stackMaximumLength:0},selectionTraversal={stack:new ManagedArray,stackMaximumLength:0,ancestorStack:new ManagedArray,ancestorStackMaximumLength:0},descendantSelectionDepth=2;function executeBaseTraversal(e,t,n){executeTraversal(e,t,e._maximumScreenSpaceError,e._maximumScreenSpaceError,n)}function executeSkipTraversal(e,t,n){executeTraversal(e,t,Number.MAX_VALUE,e._maximumScreenSpaceError,n),traverseAndSelect(e,t,n)}function executeBaseAndSkipTraversal(e,t,n){executeTraversal(e,t,Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),e.maximumScreenSpaceError,n),traverseAndSelect(e,t,n)}function skipLevelOfDetail(e){return e._skipLevelOfDetail}function addEmptyTile(e,t){e._emptyTiles.push(t)}function selectTile(e,t,n){if(t.contentVisibility(n)!==Intersect$1.OUTSIDE){const i=t.content;i.featurePropertiesDirty?(i.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<n.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=n.frameNumber,e._selectedTiles.push(t)}}function selectDescendants(e,t,n){const i=descendantTraversal.stack;for(i.push(t);i.length>0;){descendantTraversal.stackMaximumLength=Math.max(descendantTraversal.stackMaximumLength,i.length);const r=i.pop().children,o=r.length;for(let a=0;a<o;++a){const o=r[a];isVisible(o)&&(o.contentAvailable?(updateTile(e,o,n),touchTile(e,o,n),selectTile(e,o,n)):o._depth-t._depth<descendantSelectionDepth&&i.push(o))}}}function selectDesiredTile(e,t,n){if(!skipLevelOfDetail(e))return void(t.contentAvailable&&selectTile(e,t,n));const i=t.contentAvailable?t:t._ancestorWithContentAvailable;defined(i)?i._shouldSelect=!0:selectDescendants(e,t,n)}function visitTile$2(e,t,n){++e._statistics.visited,t._visitedFrame=n.frameNumber}function touchTile(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function updateMinimumMaximumPriority(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function isOnScreenLongEnough(e,t,n){if(!e._cullRequestsWhileMoving)return!0;const i=t.boundingSphere,r=Math.max(2*i.radius,1),o=n.camera,a=0!==o.positionWCDeltaMagnitude?o.positionWCDeltaMagnitude:o.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*a/r<1}function loadTile(e,t,n){if(t._requestedFrame===n.frameNumber||!hasUnloadedContent(t)&&!t.contentExpired)return;if(!isOnScreenLongEnough(e,t,n))return;const i=n.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&i||(t._requestedFrame=n.frameNumber,e._requestedTiles.push(t))}function updateVisibility(e,t,n){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(n),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function anyChildrenVisible(e,t,n){let i=!1;const r=t.children,o=r.length;for(let t=0;t<o;++t){const o=r[t];updateVisibility(e,o,n),i=i||isVisible(o)}return i}function meetsScreenSpaceErrorEarly(e,t,n){const i=t.parent;return!(!defined(i)||i.hasTilesetContent||i.hasImplicitContent||i.refine!==Cesium3DTileRefine$1.ADD)&&t.getScreenSpaceError(n,!0)<=e._maximumScreenSpaceError}function updateTileVisibility(e,t,n){if(updateVisibility(e,t,n),!isVisible(t))return;const i=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&i){const i=t.children[0];return updateTileVisibility(e,i,n),void(t._visible=i._visible)}if(meetsScreenSpaceErrorEarly(e,t,n))return void(t._visible=!1);const r=t.refine===Cesium3DTileRefine$1.REPLACE,o=t._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;return r&&o&&i&&!anyChildrenVisible(e,t,n)?(++e._statistics.numberOfTilesCulledWithChildrenUnion,void(t._visible=!1)):void 0}function updateTile(e,t,n){updateTileVisibility(e,t,n),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,updateMinimumMaximumPriority(e,t),t._shouldSelect=!1,t._finalResolution=!0}function updateTileAncestorContentLinks(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const n=e.parent;if(defined(n)){const i=!hasUnloadedContent(n)||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}}function hasEmptyContent(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function hasUnloadedContent(e){return!hasEmptyContent(e)&&e.contentUnloaded}function reachedSkippingThreshold(e,t){const n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||defined(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function sortChildrenByDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function updateAndPushChildren(e,t,n,i){let r;const o=t.refine===Cesium3DTileRefine$1.REPLACE,a=t.children,s=a.length;for(r=0;r<s;++r)updateTile(e,a[r],i);a.sort(sortChildrenByDistanceToCamera);const c=!skipLevelOfDetail(e)&&o&&!hasEmptyContent(t);let l,u=!0,d=!1,h=-1,p=Number.MAX_VALUE;for(r=0;r<s;++r)if(l=a[r],isVisible(l)?(n.push(l),l._foveatedFactor<p&&(h=r,p=l._foveatedFactor),d=!0):(c||e.loadSiblings)&&(l._foveatedFactor<p&&(h=r,p=l._foveatedFactor),loadTile(e,l,i),touchTile(e,l,i)),c){let t;t=!!l._inRequestVolume&&(hasEmptyContent(l)?executeEmptyTraversal(e,l,i):l.contentAvailable),u=u&&t}if(d||(u=!1),-1!==h&&!skipLevelOfDetail(e)&&o){const n=a[h];n._wasMinPriorityChild=!0;const i=(t._wasMinPriorityChild||t===e.root)&&p<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(i._foveatedFactor=Math.min(n._foveatedFactor,i._foveatedFactor),i._distanceToCamera=Math.min(n._distanceToCamera,i._distanceToCamera),r=0;r<s;++r)l=a[r],l._priorityHolder=i}return u}function inBaseTraversal(e,t,n){return!skipLevelOfDetail(e)||!e.immediatelyLoadDesiredLevelOfDetail&&(!defined(t._ancestorWithContent)||(0===t._screenSpaceError?t.parent._screenSpaceError>n:t._screenSpaceError>n))}function canTraverse(e,t){return 0!==t.children.length&&(t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError)}function executeTraversal(e,t,n,i,r){const o=traversal.stack;for(o.push(t);o.length>0;){traversal.stackMaximumLength=Math.max(traversal.stackMaximumLength,o.length);const t=o.pop();updateTileAncestorContentLinks(t,r);const i=inBaseTraversal(e,t,n),a=t.refine===Cesium3DTileRefine$1.ADD,s=t.refine===Cesium3DTileRefine$1.REPLACE,c=t.parent,l=!defined(c)||c._refines;let u=!1;canTraverse(e,t)&&(u=updateAndPushChildren(e,t,o,r)&&l);const d=!u&&l;hasEmptyContent(t)?(addEmptyTile(e,t),loadTile(e,t,r),d&&selectDesiredTile(e,t,r)):a?(selectDesiredTile(e,t,r),loadTile(e,t,r)):s&&(i?(loadTile(e,t,r),d&&selectDesiredTile(e,t,r)):d?(selectDesiredTile(e,t,r),loadTile(e,t,r)):reachedSkippingThreshold(e,t)&&loadTile(e,t,r)),visitTile$2(e,t,r),touchTile(e,t,r),t._refines=u}}function executeEmptyTraversal(e,t,n){let i=!0;const r=emptyTraversal.stack;for(r.push(t);r.length>0;){emptyTraversal.stackMaximumLength=Math.max(emptyTraversal.stackMaximumLength,r.length);const t=r.pop(),o=t.children,a=o.length,s=hasEmptyContent(t),c=s&&canTraverse(e,t),l=s&&0===t.children.length;if(c||t.contentAvailable||l||(i=!1),updateTile(e,t,n),isVisible(t)||(loadTile(e,t,n),touchTile(e,t,n)),c)for(let e=0;e<a;++e){const t=o[e];r.push(t)}}return i}function traverseAndSelect(e,t,n){const i=selectionTraversal.stack,r=selectionTraversal.ancestorStack;let o;for(i.push(t);i.length>0||r.length>0;){if(selectionTraversal.stackMaximumLength=Math.max(selectionTraversal.stackMaximumLength,i.length),selectionTraversal.ancestorStackMaximumLength=Math.max(selectionTraversal.ancestorStackMaximumLength,r.length),r.length>0){const t=r.peek();if(t._stackLength===i.length){r.pop(),t!==o&&(t._finalResolution=!1),selectTile(e,t,n);continue}}const t=i.pop();if(!defined(t))continue;const a=t.refine===Cesium3DTileRefine$1.ADD,s=t._shouldSelect,c=t.children,l=c.length,u=canTraverse(e,t);if(s)if(a)selectTile(e,t,n);else{if(t._selectionDepth=r.length,t._selectionDepth>0&&(e._hasMixedContent=!0),o=t,!u){selectTile(e,t,n);continue}r.push(t),t._stackLength=i.length}if(u)for(let e=0;e<l;++e){const t=c[e];isVisible(t)&&i.push(t)}}}Cesium3DTilesetTraversal.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e._hasMixedContent=!1;const n=e.root;if(updateTile(e,n,t),!isVisible(n))return;if(n.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;skipLevelOfDetail(e)?e.immediatelyLoadDesiredLevelOfDetail?executeSkipTraversal(e,n,t):executeBaseAndSkipTraversal(e,n,t):executeBaseTraversal(e,n,t),traversal.stack.trim(traversal.stackMaximumLength),emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength),descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength),selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength),selectionTraversal.ancestorStack.trim(selectionTraversal.ancestorStackMaximumLength);const i=e._requestedTiles,r=i.length;for(let e=0;e<r;++e)i[e].updatePriority()};const Cesium3DTilePass={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},passOptions=new Array(Cesium3DTilePass.NUMBER_OF_PASSES);passOptions[Cesium3DTilePass.RENDER]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!0,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PICK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),passOptions[Cesium3DTilePass.SHADOW]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PRELOAD]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.PRELOAD_FLIGHT]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PICK]=Object.freeze({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),Cesium3DTilePass.getPassOptions=function(e){return passOptions[e]};var Cesium3DTilePass$1=Object.freeze(Cesium3DTilePass);function Empty3DTileContent(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}function findGroupMetadata(e,t){if(hasExtension(t,"3DTILES_metadata")){const n=t.extensions["3DTILES_metadata"].group;return e.metadata.groups[n]}}function preprocess3DTileContent(e){const t=new Uint8Array(e);let n=getMagic(t);if("glTF"===n&&(n="glb"),Cesium3DTileContentType$1.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=getJsonContent(t);if(defined(i.root))return{contentType:Cesium3DTileContentType$1.EXTERNAL_TILESET,jsonPayload:i};if(defined(i.asset))return{contentType:Cesium3DTileContentType$1.GLTF,jsonPayload:i};throw new RuntimeError("Invalid tile content.")}function getJsonContent(e){let t;try{t=getJsonFromTypedArray(e)}catch(e){throw new RuntimeError("Invalid tile content.")}return t}function Multiple3DTileContent(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[];const r=i.content;this._innerContentHeaders=r,this._requestsInFlight=0,this._cancelCount=0;const o=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(o),this._requests=new Array(o),this._innerContentResources=new Array(o),this._serverKeys=new Array(o);for(let e=0;e<o;e++){const t=n.getDerivedResource({url:r[e].uri}),i=RequestScheduler.getServerKey(t.getUrlComponent());this._innerContentResources[e]=t,this._serverKeys[e]=i}this._contentsFetchedPromise=void 0,this._readyPromise=when.defer()}function updatePendingRequests(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function cancelPendingRequests(e,t){e._cancelCount++,e._tile._contentState=t,e.tileset.statistics.numberOfPendingRequests-=e._requestsInFlight,e._requestsInFlight=0;const n=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(n)}function canScheduleAllRequests(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];defined(t[i])?t[i]++:t[i]=1}for(const e in t)if(t.hasOwnProperty(e)&&!RequestScheduler.serverHasOpenSlots(e,t[e]))return!1;return RequestScheduler.heapHasOpenSlots(e.length)}function requestInnerContent(e,t,n,i){const r=e._innerContentResources[t].clone(),o=e.tile,a=e._serverKeys[t],s=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:function(){return o._priority},serverKey:a});return r.request=s,e._requests[t]=s,r.fetchArrayBuffer().then((function(t){if(!(n<e._cancelCount))return updatePendingRequests(e,-1),t})).otherwise((function(o){n<e._cancelCount||(r.request.state!==RequestState$1.CANCELLED?(updatePendingRequests(e,-1),handleInnerContentFailed(e,t,o)):cancelPendingRequests(e,i))}))}function createInnerContents(e){const t=e._cancelCount;when.all(e._arrayFetchPromises).then((function(n){if(!(t<e._cancelCount))return n.map((function(t,n){if(defined(t))try{return createInnerContent(e,t,n)}catch(t){return void handleInnerContentFailed(e,n,t)}}))})).then((function(t){defined(t)?(e._contents=t.filter(defined),awaitReadyPromises(e),defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.resolve()):defined(e._contentsFetchedPromise)&&(e._contentsFetchedPromise.resolve(),e._contentsFetchedPromise=void 0)})).otherwise((function(t){defined(e._contentsFetchedPromise)&&e._contentsFetchedPromise.reject(t)}))}function createInnerContent(e,t,n){const i=preprocess3DTileContent(t);if(i.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET)throw new RuntimeError("External tilesets are disallowed inside the 3DTILES_multiple_contents extension");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===Cesium3DTileContentType$1.GEOMETRY||i.contentType===Cesium3DTileContentType$1.VECTOR;const r=e._tileset,o=e._innerContentResources[n];let a;const s=Cesium3DTileContentFactory[i.contentType];a=defined(i.binaryPayload)?s(r,e._tile,o,i.binaryPayload.buffer,0):s(r,e._tile,o,i.jsonPayload);const c=e._innerContentHeaders[n];return a.groupMetadata=findGroupMetadata(r,c),a}function awaitReadyPromises(e){const t=e._contents.map((function(e){return e.readyPromise}));when.all(t).then((function(){e._readyPromise.resolve(e)})).otherwise((function(t){e._readyPromise.reject(t)}))}function handleInnerContentFailed(e,t,n){const i=e._tileset,r=e._innerContentResources[t].url,o=defined(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0?i.tileFailed.raiseEvent({url:r,message:o}):(console.log("A content failed to load: "+r),console.log("Error: "+o))}function TileBoundingRegion(e){this.rectangle=Rectangle.clone(e.rectangle),this.minimumHeight=defaultValue(e.minimumHeight,0),this.maximumHeight=defaultValue(e.maximumHeight,0),this.southwestCornerCartesian=new Cartesian3,this.northeastCornerCartesian=new Cartesian3,this.westNormal=new Cartesian3,this.southNormal=new Cartesian3,this.eastNormal=new Cartesian3,this.northNormal=new Cartesian3;const t=defaultValue(e.ellipsoid,Ellipsoid.WGS84);computeBox(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,defaultValue(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(Empty3DTileContent.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},batchTable:{get:function(){}},groupMetadata:{get:function(){},set:function(e){throw new DeveloperError("Empty3DTileContent cannot have group metadata")}}}),Empty3DTileContent.prototype.hasProperty=function(e,t){return!1},Empty3DTileContent.prototype.getFeature=function(e){},Empty3DTileContent.prototype.applyDebugSettings=function(e,t){},Empty3DTileContent.prototype.applyStyle=function(e){},Empty3DTileContent.prototype.update=function(e,t){},Empty3DTileContent.prototype.isDestroyed=function(){return!1},Empty3DTileContent.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(Multiple3DTileContent.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},batchTable:{get:function(){}},groupMetadata:{get:function(){},set:function(){throw new DeveloperError("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map((function(e){return e.uri}))}},contentsFetchedPromise:{get:function(){if(defined(this._contentsFetchedPromise))return this._contentsFetchedPromise.promise}}}),Multiple3DTileContent.prototype.requestInnerContents=function(){if(!canScheduleAllRequests(this._serverKeys))return this._serverKeys.length;const e=this._innerContentHeaders;updatePendingRequests(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=requestInnerContent(this,t,this._cancelCount,this._tile._contentState);return defined(this._contentsFetchedPromise)||(this._contentsFetchedPromise=when.defer()),createInnerContents(this),0},Multiple3DTileContent.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];defined(t)&&t.cancel()}},Multiple3DTileContent.prototype.hasProperty=function(e,t){return!1},Multiple3DTileContent.prototype.getFeature=function(e){},Multiple3DTileContent.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let r=0;r<i;++r)n[r].applyDebugSettings(e,t)},Multiple3DTileContent.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)},Multiple3DTileContent.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let r=0;r<i;++r)n[r].update(e,t)},Multiple3DTileContent.prototype.isDestroyed=function(){return!1},Multiple3DTileContent.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return destroyObject(this)},Object.defineProperties(TileBoundingRegion.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingRegion.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=OrientedBoundingBox.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)};const cartesian3Scratch$1=new Cartesian3,cartesian3Scratch2=new Cartesian3,cartesian3Scratch3=new Cartesian3,eastWestNormalScratch=new Cartesian3,westernMidpointScratch=new Cartesian3,easternMidpointScratch=new Cartesian3,cartographicScratch$2=new Cartographic,planeScratch=new Plane(Cartesian3.UNIT_X,0),rayScratch=new Ray;function computeBox(e,t,n){n.cartographicToCartesian(Rectangle.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(Rectangle.northeast(t),e.northeastCornerCartesian),cartographicScratch$2.longitude=t.west,cartographicScratch$2.latitude=.5*(t.south+t.north),cartographicScratch$2.height=0;const i=n.cartographicToCartesian(cartographicScratch$2,westernMidpointScratch),r=Cartesian3.cross(i,Cartesian3.UNIT_Z,cartesian3Scratch$1);Cartesian3.normalize(r,e.westNormal),cartographicScratch$2.longitude=t.east;const o=n.cartographicToCartesian(cartographicScratch$2,easternMidpointScratch),a=Cartesian3.cross(Cartesian3.UNIT_Z,o,cartesian3Scratch$1);Cartesian3.normalize(a,e.eastNormal);const s=Cartesian3.subtract(i,o,cartesian3Scratch$1),c=Cartesian3.normalize(s,eastWestNormalScratch),l=t.south;let u;if(l>0){cartographicScratch$2.longitude=.5*(t.west+t.east),cartographicScratch$2.latitude=l;const i=n.cartographicToCartesian(cartographicScratch$2,rayScratch.origin);Cartesian3.clone(c,rayScratch.direction);const r=Plane.fromPointNormal(e.southwestCornerCartesian,e.westNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,r,e.southwestCornerCartesian),u=n.geodeticSurfaceNormal(i,cartesian3Scratch2)}else u=n.geodeticSurfaceNormalCartographic(Rectangle.southeast(t),cartesian3Scratch2);const d=Cartesian3.cross(u,s,cartesian3Scratch3);Cartesian3.normalize(d,e.southNormal);const h=t.north;let p;if(h<0){cartographicScratch$2.longitude=.5*(t.west+t.east),cartographicScratch$2.latitude=h;const i=n.cartographicToCartesian(cartographicScratch$2,rayScratch.origin);Cartesian3.negate(c,rayScratch.direction);const r=Plane.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,r,e.northeastCornerCartesian),p=n.geodeticSurfaceNormal(i,cartesian3Scratch2)}else p=n.geodeticSurfaceNormalCartographic(Rectangle.northwest(t),cartesian3Scratch2);const f=Cartesian3.cross(s,p,cartesian3Scratch3);Cartesian3.normalize(f,e.northNormal)}const southwestCornerScratch=new Cartesian3,northeastCornerScratch=new Cartesian3,negativeUnitY=new Cartesian3(0,-1,0),negativeUnitZ=new Cartesian3(0,0,-1),vectorScratch=new Cartesian3;function distanceToCameraRegion(e,t){const n=t.camera,i=n.positionWC,r=n.positionCartographic;let o,a,s,c=0;if(!Rectangle.contains(e.rectangle,r)){let n=e.southwestCornerCartesian,r=e.northeastCornerCartesian,o=e.westNormal,a=e.southNormal,s=e.eastNormal,l=e.northNormal;t.mode!==SceneMode$1.SCENE3D&&(n=t.mapProjection.project(Rectangle.southwest(e.rectangle),southwestCornerScratch),n.z=n.y,n.y=n.x,n.x=0,r=t.mapProjection.project(Rectangle.northeast(e.rectangle),northeastCornerScratch),r.z=r.y,r.y=r.x,r.x=0,o=negativeUnitY,s=Cartesian3.UNIT_Y,a=negativeUnitZ,l=Cartesian3.UNIT_Z);const u=Cartesian3.subtract(i,n,vectorScratch),d=Cartesian3.dot(u,o),h=Cartesian3.dot(u,a),p=Cartesian3.subtract(i,r,vectorScratch),f=Cartesian3.dot(p,s),m=Cartesian3.dot(p,l);d>0?c+=d*d:f>0&&(c+=f*f),h>0?c+=h*h:m>0&&(c+=m*m)}if(t.mode===SceneMode$1.SCENE3D?(o=r.height,a=e.minimumHeight,s=e.maximumHeight):(o=i.x,a=0,s=0),o>s){const e=o-s;c+=e*e}else if(o<a){const e=a-o;c+=e*e}return Math.sqrt(c)}TileBoundingRegion.prototype.distanceToCamera=function(e){const t=distanceToCameraRegion(this,e);if(e.mode===SceneMode$1.SCENE3D&&defined(this._orientedBoundingBox)){const n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t},TileBoundingRegion.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileBoundingRegion.prototype.createDebugVolume=function(e){const t=new Matrix4.clone(Matrix4.IDENTITY);return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new RectangleOutlineGeometry({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})};let centerCartographicScratch$1=new Cartographic;function TileBoundingS2Cell(e){const t=S2Cell.fromToken(e.token),n=defaultValue(e.minimumHeight,0),i=defaultValue(e.maximumHeight,0),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=r;const o=computeBoundingPlanes(t,n,i,r);this._boundingPlanes=o;const a=computeVertices(o);let s;for(this._vertices=a,this._edgeNormals=new Array(6),this._edgeNormals[0]=computeEdgeNormals(o[0],a.slice(0,4)),s=0;s<4;s++)this._edgeNormals[0][s]=Cartesian3.negate(this._edgeNormals[0][s],this._edgeNormals[0][s]);for(this._edgeNormals[1]=computeEdgeNormals(o[1],a.slice(4,8)),s=0;s<4;s++)this._edgeNormals[2+s]=computeEdgeNormals(o[2+s],[a[s%4],a[(s+1)%4],a[4+(s+1)%4],a[4+s]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],s=0;s<4;s++)this._planeVertices.push([this._vertices[s%4],this._vertices[(s+1)%4],this._vertices[4+(s+1)%4],this._vertices[4+s]]);const c=t.getCenter();centerCartographicScratch$1=r.cartesianToCartographic(c,centerCartographicScratch$1),centerCartographicScratch$1.height=(i+n)/2,this.center=r.cartographicToCartesian(centerCartographicScratch$1,c),this._boundingSphere=BoundingSphere.fromPoints(a)}const centerGeodeticNormalScratch=new Cartesian3,topCartographicScratch=new Cartographic,topScratch=new Cartesian3,vertexCartographicScratch=new Cartographic,vertexScratch=new Cartesian3,vertexGeodeticNormalScratch=new Cartesian3,sideNormalScratch=new Cartesian3,sideScratch=new Cartesian3;function computeBoundingPlanes(e,t,n,i){const r=new Array(6),o=e.getCenter(),a=i.geodeticSurfaceNormal(o,centerGeodeticNormalScratch),s=i.cartesianToCartographic(o,topCartographicScratch);s.height=n;const c=i.cartographicToCartesian(s,topScratch),l=Plane.fromPointNormal(c,a);r[0]=l;let u,d=0;const h=[];let p,f;for(u=0;u<4;u++){p=e.getVertex(u),h[u]=p,f=i.cartesianToCartographic(p,vertexCartographicScratch),f.height=t;const n=Plane.getPointDistance(l,i.cartographicToCartesian(f,vertexScratch));n<d&&(d=n)}const m=Plane.clone(l);for(m.normal=Cartesian3.negate(m.normal,m.normal),m.distance=-1*m.distance+d,r[1]=m,u=0;u<4;u++){p=h[u];const e=h[(u+1)%4],t=i.geodeticSurfaceNormal(p,vertexGeodeticNormalScratch),n=Cartesian3.subtract(e,p,sideScratch);let o=Cartesian3.cross(n,t,sideNormalScratch);o=Cartesian3.normalize(o,o),r[2+u]=Plane.fromPointNormal(p,o)}return r}let n0Scratch=new Cartesian3,n1Scratch=new Cartesian3,n2Scratch=new Cartesian3,x0Scratch=new Cartesian3,x1Scratch=new Cartesian3,x2Scratch=new Cartesian3;const t0Scratch=new Cartesian3,t1Scratch=new Cartesian3,t2Scratch=new Cartesian3;let f0Scratch=new Cartesian3,f1Scratch=new Cartesian3,f2Scratch=new Cartesian3,sScratch=new Cartesian3;const matrixScratch=new Matrix3;function computeIntersection(e,t,n){n0Scratch=e.normal,n1Scratch=t.normal,n2Scratch=n.normal,x0Scratch=Cartesian3.multiplyByScalar(e.normal,-e.distance,x0Scratch),x1Scratch=Cartesian3.multiplyByScalar(t.normal,-t.distance,x1Scratch),x2Scratch=Cartesian3.multiplyByScalar(n.normal,-n.distance,x2Scratch),f0Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n1Scratch,n2Scratch,t0Scratch),Cartesian3.dot(x0Scratch,n0Scratch),f0Scratch),f1Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n2Scratch,n0Scratch,t1Scratch),Cartesian3.dot(x1Scratch,n1Scratch),f1Scratch),f2Scratch=Cartesian3.multiplyByScalar(Cartesian3.cross(n0Scratch,n1Scratch,t2Scratch),Cartesian3.dot(x2Scratch,n2Scratch),f2Scratch),matrixScratch[0]=n0Scratch.x,matrixScratch[1]=n1Scratch.x,matrixScratch[2]=n2Scratch.x,matrixScratch[3]=n0Scratch.y,matrixScratch[4]=n1Scratch.y,matrixScratch[5]=n2Scratch.y,matrixScratch[6]=n0Scratch.z,matrixScratch[7]=n1Scratch.z,matrixScratch[8]=n2Scratch.z;const i=Matrix3.determinant(matrixScratch);return sScratch=Cartesian3.add(f0Scratch,f1Scratch,sScratch),sScratch=Cartesian3.add(sScratch,f2Scratch,sScratch),new Cartesian3(sScratch.x/i,sScratch.y/i,sScratch.z/i)}function computeVertices(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=computeIntersection(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=computeIntersection(e[1],e[2+(n+3)%4],e[2+n%4]);return t}let edgeScratch=new Cartesian3,edgeNormalScratch=new Cartesian3;function computeEdgeNormals(e,t){const n=[];for(let i=0;i<4;i++)edgeScratch=Cartesian3.subtract(t[(i+1)%4],t[i],edgeScratch),edgeNormalScratch=Cartesian3.cross(e.normal,edgeScratch,edgeNormalScratch),edgeNormalScratch=Cartesian3.normalize(edgeNormalScratch,edgeNormalScratch),n[i]=Cartesian3.clone(edgeNormalScratch);return n}Object.defineProperties(TileBoundingS2Cell.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const facePointScratch=new Cartesian3;TileBoundingS2Cell.prototype.distanceToCamera=function(e){const t=e.camera.positionWC,n=[],i=[];let r,o,a,s,c;for(Plane.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),r=this._edgeNormals[0]):Plane.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),r=this._edgeNormals[1]),o=0;o<4;o++)a=2+o,Plane.getPointDistance(this._boundingPlanes[a],t)>0&&(n.push(a),i.push(this._planeVertices[a]),r=this._edgeNormals[a]);if(0===n.length)return 0;if(1===n.length)return c=this._boundingPlanes[n[0]],s=closestPointPolygon(Plane.projectPointOntoPlane(c,t,facePointScratch),i[0],c,r),Cartesian3.distance(s,t);if(2===n.length){if(0===n[0]){const e=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return s=closestPointLineSegment(t,e[0],e[1]),Cartesian3.distance(s,t)}let e,r=Number.MAX_VALUE;for(o=0;o<2;o++)c=this._boundingPlanes[n[o]],s=closestPointPolygon(Plane.projectPointOntoPlane(c,t,facePointScratch),i[o],c,this._edgeNormals[n[o]]),e=Cartesian3.distanceSquared(s,t),e<r&&(r=e);return Math.sqrt(r)}if(n.length>3)return s=closestPointPolygon(Plane.projectPointOntoPlane(this._boundingPlanes[1],t,facePointScratch),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),Cartesian3.distance(s,t);const l=2===n[1]&&5===n[2]?0:1;return 0===n[0]?Cartesian3.distance(t,this._vertices[(n[1]-2+l)%4]):Cartesian3.distance(t,this._vertices[4+(n[1]-2+l)%4])};const dScratch=new Cartesian3,pL0Scratch=new Cartesian3;function closestPointLineSegment(e,t,n){const i=Cartesian3.subtract(n,t,dScratch),r=Cartesian3.subtract(e,t,pL0Scratch);let o=Cartesian3.dot(i,r);if(o<=0)return t;const a=Cartesian3.dot(i,i);return o>=a?n:(o/=a,new Cartesian3((1-o)*t.x+o*n.x,(1-o)*t.y+o*n.y,(1-o)*t.z+o*n.z))}const edgePlaneScratch=new Plane(Cartesian3.UNIT_X,0);function closestPointPolygon(e,t,n,i){let r,o,a,s=Number.MAX_VALUE;for(let n=0;n<t.length;n++){const c=Plane.fromPointNormal(t[n],i[n],edgePlaneScratch);Plane.getPointDistance(c,e)<0||(a=closestPointLineSegment(e,t[n],t[(n+1)%4]),r=Cartesian3.distance(e,a),r<s&&(s=r,o=a))}return defined(o)?o:e}function TileBoundingSphere(e,t){0===t&&(t=CesiumMath.EPSILON7),this._boundingSphere=new BoundingSphere(e,t)}function TileMetadata(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._class=e.class;const t=e.tile;this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}TileBoundingS2Cell.prototype.intersectPlane=function(e){let t=0,n=0;for(let i=0;i<this._vertices.length;i++){Cartesian3.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++}return t===this._vertices.length?Intersect$1.INSIDE:n===this._vertices.length?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},TileBoundingS2Cell.prototype.createDebugVolume=function(e){const t=new Matrix4.clone(Matrix4.IDENTITY),n=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[0]}}),i=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(n),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),r=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[1]}}),o=new GeometryInstance({geometry:CoplanarPolygonOutlineGeometry.createGeometry(r),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),a=[];for(let n=0;n<4;n++){const i=new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:this._planeVertices[2+n]}}),r=CoplanarPolygonOutlineGeometry.createGeometry(i);a[n]=new GeometryInstance({geometry:r,id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}})}return new Primitive$3({geometryInstances:[a[0],a[1],a[2],a[3],o,i],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Object.defineProperties(TileBoundingSphere.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileBoundingSphere.prototype.distanceToCamera=function(e){const t=this._boundingSphere;return Math.max(0,Cartesian3.distance(t.center,e.camera.positionWC)-t.radius)},TileBoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this._boundingSphere,e)},TileBoundingSphere.prototype.update=function(e,t){Cartesian3.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t},TileBoundingSphere.prototype.createDebugVolume=function(e){return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new SphereOutlineGeometry({radius:this.radius}),id:"outline",modelMatrix:Matrix4.fromTranslation(this.center,new Matrix4.clone(Matrix4.IDENTITY)),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Object.defineProperties(TileMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TileMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TileMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TileMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TileMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TileMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TileMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)};const scratchU=new Cartesian3,scratchV=new Cartesian3,scratchW=new Cartesian3,scratchCartesian$6=new Cartesian3;function computeMissingVector(e,t,n){n=Cartesian3.cross(e,t,n);const i=Cartesian3.magnitude(n);return Cartesian3.multiplyByScalar(n,CesiumMath.EPSILON7/i,n)}function findOrthogonalVector(e,t){const n=Cartesian3.normalize(e,scratchCartesian$6);return computeMissingVector(e,Cartesian3.equalsEpsilon(n,Cartesian3.UNIT_X,CesiumMath.EPSILON6)?Cartesian3.UNIT_Y:Cartesian3.UNIT_X,t)}function checkHalfAxes(e){let t=Matrix3.getColumn(e,0,scratchU),n=Matrix3.getColumn(e,1,scratchV),i=Matrix3.getColumn(e,2,scratchW);const r=Cartesian3.equals(t,Cartesian3.ZERO),o=Cartesian3.equals(n,Cartesian3.ZERO),a=Cartesian3.equals(i,Cartesian3.ZERO);return r||o||a?r&&o&&a?(e[0]=CesiumMath.EPSILON7,e[4]=CesiumMath.EPSILON7,e[8]=CesiumMath.EPSILON7,e):(!r||o||a?r||!o||a?r||o||!a?r?o?a||(t=findOrthogonalVector(i,t),n=computeMissingVector(i,t,n)):(t=findOrthogonalVector(n,t),i=computeMissingVector(n,t,i)):(n=findOrthogonalVector(t,n),i=computeMissingVector(n,t,i)):i=computeMissingVector(n,t,i):n=computeMissingVector(t,i,n):t=computeMissingVector(n,i,t),Matrix3.setColumn(e,0,t,e),Matrix3.setColumn(e,1,n,e),Matrix3.setColumn(e,2,i,e),e):e}function TileOrientedBoundingBox(e,t){t=checkHalfAxes(t),this._orientedBoundingBox=new OrientedBoundingBox(e,t),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)}function Cesium3DTile(e,t,n,i){this._tileset=e,this._header=n;const r=n.content;this.transform=defined(n.transform)?Matrix4.unpack(n.transform):Matrix4.clone(Matrix4.IDENTITY);const o=defined(i)?i.computedTransform:e.modelMatrix,a=Matrix4.multiply(o,this.transform,new Matrix4),s=defined(i)?i._initialTransform:Matrix4.IDENTITY;let c,l,u,d;this._initialTransform=Matrix4.multiply(s,this.transform,new Matrix4),this.computedTransform=a,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,a),this._boundingVolume2D=void 0,defined(r)&&defined(r.boundingVolume)&&(c=this.createBoundingVolume(r.boundingVolume,a)),this._contentBoundingVolume=c,this._contentBoundingVolume2D=void 0,defined(n.viewerRequestVolume)&&(l=this.createBoundingVolume(n.viewerRequestVolume,a)),this._viewerRequestVolume=l,this.geometricError=n.geometricError,this._geometricError=n.geometricError,defined(this._geometricError)||(this._geometricError=defined(i)?i.geometricError:e._geometricError,Cesium3DTile._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale(),defined(n.refine)?("replace"!==n.refine&&"add"!==n.refine||Cesium3DTile._deprecationWarning("lowercase-refine",'This tile uses a lowercase refine "'+n.refine+'". Instead use "'+n.refine.toUpperCase()+'".'),u="REPLACE"===n.refine.toUpperCase()?Cesium3DTileRefine$1.REPLACE:Cesium3DTileRefine$1.ADD):u=defined(i)?i.refine:Cesium3DTileRefine$1.REPLACE,this.refine=u,this.children=[],this.parent=i;let h,p,f,m,g=!1,_=!1;if(t=Resource.createIfNeeded(t),hasExtension(n,"3DTILES_multiple_contents"))_=!0,h=Cesium3DTileContentState$1.UNLOADED,p=t.clone();else if(defined(r)){let e=r.uri;defined(r.url)&&(Cesium3DTile._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),e=r.url),h=Cesium3DTileContentState$1.UNLOADED,p=t.getDerivedResource({url:e}),f=RequestScheduler.getServerKey(p.getUrlComponent())}else d=new Empty3DTileContent(e,this),g=!0,h=Cesium3DTileContentState$1.READY;if(this._content=d,this._contentResource=p,this._contentState=h,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=f,this.hasEmptyContent=g,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasMultipleContents=_,hasExtension(n,"3DTILES_metadata")){const t=n.extensions["3DTILES_metadata"];m=new TileMetadata({tile:t,class:e.metadata.schema.classes[t.class]})}this.metadata=m,this.cacheNode=void 0;const y=n.expire;let C,T;defined(y)&&(C=y.duration,defined(y.date)&&(T=JulianDate.fromIso8601(y.date))),this.expireDuration=C,this.expireDate=T,this.lastStyleTime=0,this._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=Color.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new JulianDate,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Object.defineProperties(TileOrientedBoundingBox.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileOrientedBoundingBox.prototype.distanceToCamera=function(e){return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))},TileOrientedBoundingBox.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileOrientedBoundingBox.prototype.update=function(e,t){Cartesian3.clone(e,this._orientedBoundingBox.center),t=checkHalfAxes(t),Matrix3.clone(t,this._orientedBoundingBox.halfAxes),BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)},TileOrientedBoundingBox.prototype.createDebugVolume=function(e){return new Primitive$3({geometryInstances:new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-1,-1,-1),maximum:new Cartesian3(1,1,1)}),id:"outline",modelMatrix:Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Cesium3DTile._deprecationWarning=deprecationWarning,Object.defineProperties(Cesium3DTile.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return defaultValue(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return defined(this._color)||(this._color=new Color),Color.clone(this._color)},set:function(e){this._color=Color.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||defined(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Cesium3DTileContentState$1.READY}},contentUnloaded:{get:function(){return this._contentState===Cesium3DTileContentState$1.UNLOADED}},contentExpired:{get:function(){return this._contentState===Cesium3DTileContentState$1.EXPIRED}},contentFailed:{get:function(){return this._contentState===Cesium3DTileContentState$1.FAILED}},contentReadyToProcessPromise:{get:function(){if(defined(this._contentReadyToProcessPromise))return this._contentReadyToProcessPromise.promise}},contentReadyPromise:{get:function(){if(defined(this._contentReadyPromise))return this._contentReadyPromise.promise}},commandsLength:{get:function(){return this._commandsLength}}});const scratchCartesian$5=new Cartesian3;function isPriorityDeferred(e,t){const n=e._tileset,i=t.camera,r=e.boundingSphere,o=r.radius,a=Cartesian3.multiplyByScalar(i.directionWC,e._centerZDepth,scratchCartesian$5),s=Cartesian3.add(i.positionWC,a,scratchCartesian$5),c=Cartesian3.subtract(s,r.center,scratchCartesian$5);if(Cartesian3.magnitude(c)>o){const t=Cartesian3.normalize(c,scratchCartesian$5),n=Cartesian3.multiplyByScalar(t,o,scratchCartesian$5),a=Cartesian3.add(r.center,n,scratchCartesian$5),s=Cartesian3.subtract(a,i.positionWC,scratchCartesian$5),l=Cartesian3.normalize(s,scratchCartesian$5);e._foveatedFactor=1-Math.abs(Cartesian3.dot(i.directionWC,l))}else e._foveatedFactor=0;const l=e.refine===Cesium3DTileRefine$1.REPLACE,u=n._skipLevelOfDetail;if(l&&!u||!n.foveatedScreenSpaceError||1===n.foveatedConeSize||e._priorityProgressiveResolution&&l&&u||n._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT||n._pass===Cesium3DTilePass$1.PRELOAD)return!1;const d=1-Math.cos(.5*i.frustum.fov),h=n.foveatedConeSize*d;if(e._foveatedFactor<=h)return!1;const p=d-h,f=CesiumMath.clamp((e._foveatedFactor-h)/p,0,1),m=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.maximumScreenSpaceError,f),g=0===e._screenSpaceError&&defined(e.parent)?.5*e.parent._screenSpaceError:e._screenSpaceError;return n.maximumScreenSpaceError-m<=g}const scratchJulianDate$1=new JulianDate;function isPriorityProgressiveResolution(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let n=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const i=t.parent,r=e._maximumScreenSpaceError,o=t._screenSpaceErrorProgressiveResolution<=r,a=defined(i)&&i._screenSpaceErrorProgressiveResolution>r;return o&&a&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,n=!0),n}function getPriorityReverseScreenSpaceError(e,t){const n=t.parent,i=defined(n)&&(!e._skipLevelOfDetail||0===t._screenSpaceError||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-i}function updateExpireDate(e){if(defined(e.expireDuration)){const t=JulianDate.now(scratchJulianDate$1);JulianDate.addSeconds(t,e.expireDuration,t),defined(e.expireDate)?JulianDate.lessThan(e.expireDate,t)&&JulianDate.clone(t,e.expireDate):e.expireDate=JulianDate.clone(t)}}function createPriorityFunction(e){return function(){return e._priority}}function requestMultipleContents(e){let t=e._content;const n=e._tileset;if(!defined(t)){const i=e._header.extensions["3DTILES_multiple_contents"];t=new Multiple3DTileContent(n,e,e._contentResource.clone(),i),e._content=t}const i=t.requestInnerContents();return i>0?i:(e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=when.defer(),e._contentReadyPromise=when.defer(),t.contentsFetchedPromise.then((function(){if(e._contentState===Cesium3DTileContentState$1.LOADING){if(!e.isDestroyed())return e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(t),t.readyPromise.then((function(t){e.isDestroyed()?multipleContentFailed(e,n,"Tile was unloaded while content was processing"):(e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}));multipleContentFailed(e,n,"Tile was unloaded while content was loading")}})).otherwise((function(t){multipleContentFailed(e,n,t)})),0)}function multipleContentFailed(e,t,n){e._contentState===Cesium3DTileContentState$1.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(n),e._contentReadyToProcessPromise.reject(n)}function requestSingleContent(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:createPriorityFunction(e),serverKey:e._serverKey});e._request=i,t.request=i;const r=t.fetchArrayBuffer();if(!defined(r))return 1;const o=e._contentState,a=e._tileset;return e._contentState=Cesium3DTileContentState$1.LOADING,e._contentReadyToProcessPromise=when.defer(),e._contentReadyPromise=when.defer(),++a.statistics.numberOfPendingRequests,r.then((function(t){if(e.isDestroyed())return void singleContentFailed(e,a);const i=makeContent(e,t);return n&&(e.expireDate=void 0),e._content=i,e._contentState=Cesium3DTileContentState$1.PROCESSING,e._contentReadyToProcessPromise.resolve(i),--a.statistics.numberOfPendingRequests,i.readyPromise.then((function(t){e.isDestroyed()?singleContentFailed(e,a):(updateExpireDate(e),e._selectedFrame=0,e.lastStyleTime=0,JulianDate.now(e._loadTimestamp),e._contentState=Cesium3DTileContentState$1.READY,e._contentReadyPromise.resolve(t))}))})).otherwise((function(t){if(i.state===RequestState$1.CANCELLED)return e._contentState=o,--a.statistics.numberOfPendingRequests,void++a.statistics.numberOfAttemptedRequests;singleContentFailed(e,a,t)})),0}function singleContentFailed(e,t,n){e._contentState===Cesium3DTileContentState$1.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Cesium3DTileContentState$1.FAILED,e._contentReadyPromise.reject(n),e._contentReadyToProcessPromise.reject(n)}function makeContent(e,t){const n=preprocess3DTileContent(t),i=e._tileset;let r;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===Cesium3DTileContentType$1.GEOMETRY||n.contentType===Cesium3DTileContentType$1.VECTOR,n.contentType===Cesium3DTileContentType$1.IMPLICIT_SUBTREE&&(e.hasImplicitContent=!0),n.contentType===Cesium3DTileContentType$1.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);const o=Cesium3DTileContentFactory[n.contentType];r=defined(n.binaryPayload)?o(i,e,e._contentResource,n.binaryPayload.buffer,0):o(i,e,e._contentResource,n.jsonPayload);const a=e._header.content;return r.groupMetadata=findGroupMetadata(i,a),r}Cesium3DTile.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,r=defaultValue(n,1),o=defined(this.parent)?this.parent.geometricError:i._geometricError,a=t?o:this.geometricError;if(0===a)return 0;const s=e.camera;let c=s.frustum;const l=e.context,u=l.drawingBufferWidth,d=l.drawingBufferHeight*r;let h;if(e.mode===SceneMode$1.SCENE2D||c instanceof OrthographicFrustum){defined(c._offCenterFrustum)&&(c=c._offCenterFrustum);h=a/(Math.max(c.top-c.bottom,c.right-c.left)/Math.max(u,d))}else{const e=Math.max(this._distanceToCamera,CesiumMath.EPSILON7);if(h=a*d/(e*s.frustum.sseDenominator),i.dynamicScreenSpaceError){const t=i._dynamicScreenSpaceErrorComputedDensity,n=i.dynamicScreenSpaceErrorFactor;h-=CesiumMath.fog(e,t)*n}}return h/=e.pixelRatio,h},Cesium3DTile.prototype.updateVisibility=function(e){const t=this.parent,n=this._tileset,i=defined(t)?t.computedTransform:n.modelMatrix,r=defined(t)?t._visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.updateTransform(i),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,n.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,r),this._visible=this._visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=getPriorityReverseScreenSpaceError(n,this),this._priorityProgressiveResolution=isPriorityProgressiveResolution(n,this),this.priorityDeferred=isPriorityDeferred(this,e)},Cesium3DTile.prototype.updateExpiration=function(){if(defined(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=JulianDate.now(scratchJulianDate$1);JulianDate.lessThan(this.expireDate,e)&&(this._contentState=Cesium3DTileContentState$1.EXPIRED,this._expiredContent=this._content)}},Cesium3DTile.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?requestMultipleContents(this):requestSingleContent(this)},Cesium3DTile.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()},Cesium3DTile.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Cesium3DTileContentState$1.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=0===this._clippingPlanesState,this._clippingPlanesState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};const scratchProjectedBoundingSphere=new BoundingSphere;function getBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=BoundingSphere.projectTo2D(n,t.mapProjection,scratchProjectedBoundingSphere);e._boundingVolume2D=new TileBoundingSphere(i.center,i.radius)}return t.mode!==SceneMode$1.SCENE3D?e._boundingVolume2D:e._boundingVolume}function getContentBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=BoundingSphere.projectTo2D(n,t.mapProjection,scratchProjectedBoundingSphere);e._contentBoundingVolume2D=new TileBoundingSphere(i.center,i.radius)}return t.mode!==SceneMode$1.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Cesium3DTile.prototype.visibility=function(e,t){const n=e.cullingVolume,i=getBoundingVolume(this,e),r=this._tileset,o=r.clippingPlanes;if(defined(o)&&o.enabled){const e=o.computeIntersectionWithBoundingVolume(i,r.clippingPlanesOriginMatrix);if(this._isClipped=e!==Intersect$1.INSIDE,e===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)},Cesium3DTile.prototype.contentVisibility=function(e){if(!defined(this._contentBoundingVolume))return Intersect$1.INSIDE;if(this._visibilityPlaneMask===CullingVolume.MASK_INSIDE)return Intersect$1.INSIDE;const t=e.cullingVolume,n=getContentBoundingVolume(this,e),i=this._tileset,r=i.clippingPlanes;if(defined(r)&&r.enabled){const e=r.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=e!==Intersect$1.INSIDE,e===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE}return t.computeVisibility(n)},Cesium3DTile.prototype.distanceToTile=function(e){return getBoundingVolume(this,e).distanceToCamera(e)};const scratchToTileCenter=new Cartesian3;Cesium3DTile.prototype.distanceToTileCenter=function(e){const t=getBoundingVolume(this,e).boundingVolume,n=Cartesian3.subtract(t.center,e.camera.positionWC,scratchToTileCenter);return Cartesian3.dot(e.camera.directionWC,n)},Cesium3DTile.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!defined(t)||0===t.distanceToCamera(e)};const scratchMatrix$2=new Matrix3,scratchScale$2=new Cartesian3,scratchHalfAxes=new Matrix3,scratchCenter$4=new Cartesian3,scratchRectangle$5=new Rectangle,scratchOrientedBoundingBox=new OrientedBoundingBox,scratchTransform=new Matrix4;function createBox(e,t,n){let i=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),r=Matrix3.fromArray(e,3,scratchHalfAxes);i=Matrix4.multiplyByPoint(t,i,i);const o=Matrix4.getMatrix3(t,scratchMatrix$2);return r=Matrix3.multiply(o,r,r),defined(n)?(n.update(i,r),n):new TileOrientedBoundingBox(i,r)}function createBoxFromTransformedRegion(e,t,n,i){const r=Rectangle.unpack(e,0,scratchRectangle$5),o=e[4],a=e[5],s=OrientedBoundingBox.fromRectangle(r,o,a,Ellipsoid.WGS84,scratchOrientedBoundingBox);let c=s.center,l=s.halfAxes;t=Matrix4.multiplyTransformation(t,Matrix4.inverseTransformation(n,scratchTransform),scratchTransform),c=Matrix4.multiplyByPoint(t,c,c);const u=Matrix4.getMatrix3(t,scratchMatrix$2);return l=Matrix3.multiply(u,l,l),defined(i)&&i instanceof TileOrientedBoundingBox?(i.update(c,l),i):new TileOrientedBoundingBox(c,l)}function createRegion(e,t,n,i){if(!Matrix4.equalsEpsilon(t,n,CesiumMath.EPSILON8))return createBoxFromTransformedRegion(e,t,n,i);if(defined(i))return i;return new TileBoundingRegion({rectangle:Rectangle.unpack(e,0,scratchRectangle$5),minimumHeight:e[4],maximumHeight:e[5]})}function createSphere(e,t,n){let i=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$4),r=e[3];i=Matrix4.multiplyByPoint(t,i,i);const o=Matrix4.getScale(t,scratchScale$2);return r*=Cartesian3.maximumComponent(o),defined(n)?(n.update(i,r),n):new TileBoundingSphere(i,r)}function applyDebugSettings$1(e,t,n,i){if(!i.isRender)return;const r=defined(e._header.content)&&defined(e._header.content.boundingVolume),o=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,a=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!r;if(a){let t;t=e._finalResolution?o?Color.DARKGRAY:Color.WHITE:Color.YELLOW,defined(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(t)),e._debugBoundingVolume.update(n);const i=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");i.color=ColorGeometryInstanceAttribute.toValue(t,i.color)}else!a&&defined(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&r?(defined(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(Color.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&defined(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&defined(e._viewerRequestVolume)?(defined(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(Color.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&defined(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const s=t.debugColorizeTiles&&!e._debugColorizeTiles||defined(t._heatmap.tilePropertyName),c=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):c&&(e._debugColorizeTiles=!1,e.color=Color.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function updateContent(e,t,n){const i=e._content,r=e._expiredContent;if(!e.hasMultipleContents&&defined(r)){if(!e.contentReady)return void r.update(t,n);e._expiredContent.destroy(),e._expiredContent=void 0}i.update(t,n)}function updateClippingPlanes(e,t){const n=t.clippingPlanes;let i=0;defined(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}Cesium3DTile.prototype.createBoundingVolume=function(e,t,n){if(!defined(e))throw new RuntimeError("boundingVolume must be defined");if(hasExtension(e,"3DTILES_bounding_volume_S2"))return new TileBoundingS2Cell(e.extensions["3DTILES_bounding_volume_S2"]);if(defined(e.box))return createBox(e.box,t,n);if(defined(e.region))return createRegion(e.region,t,this._initialTransform,n);if(defined(e.sphere))return createSphere(e.sphere,t,n);throw new RuntimeError("boundingVolume must contain a sphere, region, or box")},Cesium3DTile.prototype.updateTransform=function(e){e=defaultValue(e,Matrix4.IDENTITY);const t=Matrix4.multiply(e,this.transform,scratchTransform);if(!!Matrix4.equals(t,this.computedTransform))return;Matrix4.clone(t,this.computedTransform);const n=this._header,i=this._header.content;this._boundingVolume=this.createBoundingVolume(n.boundingVolume,this.computedTransform,this._boundingVolume),defined(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._contentBoundingVolume)),defined(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(n.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()},Cesium3DTile.prototype.updateGeometricErrorScale=function(){const e=Matrix4.getScale(this.computedTransform,scratchScale$2),t=Cartesian3.maximumComponent(e);this.geometricError=this._geometricError*t},Cesium3DTile.prototype.update=function(e,t,n){const i=t.commandList.length;updateClippingPlanes(this,e),applyDebugSettings$1(this,e,t,n),updateContent(this,e,t);const r=t.commandList.length-i;this._commandsLength=r;for(let e=0;e<r;++e){const n=t.commandList[i+e],r=n.pass===Pass$1.TRANSLUCENT;n.depthForTranslucentClassification=r}this.clippingPlanesDirty=!1};const scratchCommandList$1=[];function isolateDigits(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function priorityNormalizeAndClamp(e,t,n){return Math.max(CesiumMath.normalize(e,t,n)-CesiumMath.EPSILON7,0)}function GroupMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id,n=e.group,i=defined(n.properties)?n.properties:{};this._class=e.class,this._properties=i,this._id=t,this._extras=n.extras,this._extensions=n.extensions}function TilesetMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).tileset,n=defined(t.properties)?t.properties:{};this._class=e.class,this._properties=n,this._extras=t.extras,this._extensions=t.extensions}function Cesium3DTilesetMetadata(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).extension,n=e.schema,i={};if(defined(t.groups))for(const e in t.groups)if(t.groups.hasOwnProperty(e)){const r=t.groups[e];i[e]=new GroupMetadata({id:e,group:t.groups[e],class:n.classes[r.class]})}let r;defined(t.tileset)&&(r=new TilesetMetadata({tileset:t.tileset,class:n.classes[t.tileset.class]})),this._schema=n,this._groups=i,this._tileset=r,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Cesium3DTile.prototype.process=function(e,t){const n=t.commandList;t.commandList=scratchCommandList$1,this._content.update(e,t),scratchCommandList$1.length=0,t.commandList=n},Cesium3DTile.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,r=Math.pow(10,8),o=Math.pow(10,9),a=Math.pow(10,10);let s=priorityNormalizeAndClamp(this._depth,n.depth,i.depth);s=t?1-s:s;const c=isolateDigits(!e._skipLevelOfDetail&&this.refine===Cesium3DTileRefine$1.REPLACE?priorityNormalizeAndClamp(this._priorityHolder._distanceToCamera,n.distance,i.distance):priorityNormalizeAndClamp(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),4,0),l=this._priorityProgressiveResolution?0:r,u=isolateDigits(priorityNormalizeAndClamp(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),4,4),d=this.priorityDeferred?o:0,h=e._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT?0:a;this._priority=s+c+l+u+d+h},Cesium3DTile.prototype.isDestroyed=function(){return!1},Cesium3DTile.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),destroyObject(this)},Object.defineProperties(GroupMetadata.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),GroupMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},GroupMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},GroupMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},GroupMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},GroupMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},GroupMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(TilesetMetadata.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),TilesetMetadata.prototype.hasProperty=function(e){return MetadataEntity.hasProperty(e,this._properties,this._class)},TilesetMetadata.prototype.hasPropertyBySemantic=function(e){return MetadataEntity.hasPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.getPropertyIds=function(e){return MetadataEntity.getPropertyIds(this._properties,this._class,e)},TilesetMetadata.prototype.getProperty=function(e){return MetadataEntity.getProperty(e,this._properties,this._class)},TilesetMetadata.prototype.setProperty=function(e,t){return MetadataEntity.setProperty(e,t,this._properties,this._class)},TilesetMetadata.prototype.getPropertyBySemantic=function(e){return MetadataEntity.getPropertyBySemantic(e,this._properties,this._class)},TilesetMetadata.prototype.setPropertyBySemantic=function(e,t){return MetadataEntity.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(Cesium3DTilesetMetadata.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});const Cesium3DTileOptimizations={},scratchAxis$1=new Cartesian3;function Cesium3DTilesetCache(){this._list=new DoublyLinkedList,this._sentinel=this._list.add(),this._trimTiles=!1}function Cesium3DTilesetHeatmap(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function getHeatmapValue(e,t){let n;return n="_loadTimestamp"===t?JulianDate.toDate(e).getTime():e,n}function getHeatmapValueAndUpdateMinimumMaximum(e,t){const n=e.tilePropertyName;if(defined(n)){const i=getHeatmapValue(t[n],n);return defined(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}Cesium3DTileOptimizations.checkChildrenWithinParent=function(e){const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof TileOrientedBoundingBox||i instanceof TileBoundingRegion){const r=i._orientedBoundingBox;e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;for(let i=0;i<n;++i){const n=t[i].boundingVolume;if(!(n instanceof TileOrientedBoundingBox||n instanceof TileBoundingRegion)){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}const o=n._orientedBoundingBox,a=Cartesian3.subtract(o.center,r.center,scratchAxis$1),s=Cartesian3.magnitude(a);Cartesian3.divideByScalar(a,s,a);if(Math.abs(r.halfAxes[0]*a.x)+Math.abs(r.halfAxes[1]*a.y)+Math.abs(r.halfAxes[2]*a.z)+Math.abs(r.halfAxes[3]*a.x)+Math.abs(r.halfAxes[4]*a.y)+Math.abs(r.halfAxes[5]*a.z)+Math.abs(r.halfAxes[6]*a.x)+Math.abs(r.halfAxes[7]*a.y)+Math.abs(r.halfAxes[8]*a.z)<=Math.abs(o.halfAxes[0]*a.x)+Math.abs(o.halfAxes[1]*a.y)+Math.abs(o.halfAxes[2]*a.z)+Math.abs(o.halfAxes[3]*a.x)+Math.abs(o.halfAxes[4]*a.y)+Math.abs(o.halfAxes[5]*a.z)+Math.abs(o.halfAxes[6]*a.x)+Math.abs(o.halfAxes[7]*a.y)+Math.abs(o.halfAxes[8]*a.z)+s){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION},Cesium3DTilesetCache.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)},Cesium3DTilesetCache.prototype.touch=function(e){const t=e.cacheNode;defined(t)&&this._list.splice(this._sentinel,t)},Cesium3DTilesetCache.prototype.add=function(e){defined(e.cacheNode)||(e.cacheNode=this._list.add(e))},Cesium3DTilesetCache.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;defined(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))},Cesium3DTilesetCache.prototype.unloadTiles=function(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,r=1024*e.maximumMemoryUsage*1024,o=this._sentinel;let a=i.head;for(;a!==o&&(e.totalMemoryUsageInBytes>r||n);){const n=a.item;a=a.next,this.unloadTile(e,n,t)}},Cesium3DTilesetCache.prototype.trim=function(){this._trimTiles=!0},Cesium3DTilesetHeatmap.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=getHeatmapValue(e,n),this._referenceMaximum[n]=getHeatmapValue(t,n)};const heatmapColors=[new Color(.1,.1,.1,1),new Color(.153,.278,.878,1),new Color(.827,.231,.49,1),new Color(.827,.188,.22,1),new Color(1,.592,.259,1),new Color(1,.843,0,1)];function Cesium3DTilesetStatistics(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.batchTableByteLength=0}function updatePointAndFeatureCounts(e,t,n,i){const r=t.innerContents,o=t.pointsLength,a=t.trianglesLength,s=t.featuresLength,c=t.geometryByteLength,l=t.texturesByteLength,u=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-s:s,e.numberOfPointsLoaded+=n?-o:o,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-l:l,e.batchTableByteLength+=n?-u:u):(e.numberOfFeaturesSelected+=n?-s:s,e.numberOfPointsSelected+=n?-o:o,e.numberOfTrianglesSelected+=n?-a:a),defined(r)){const t=r.length;for(let o=0;o<t;++o)updatePointAndFeatureCounts(e,r[o],n,i)}}function Cesium3DTileStyleEngine(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}function ImplicitTileset(e,t,n){const i=t.extensions["3DTILES_implicit_tiling"];if(this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n,!defined(t.boundingVolume.box)&&!defined(t.boundingVolume.region)&&!hasExtension(t.boundingVolume,"3DTILES_bounding_volume_S2"))throw new RuntimeError("Only box, region and 3DTILES_bounding_volume_S2 are supported for implicit tiling");this.boundingVolume=t.boundingVolume,this.refine=t.refine,this.subtreeUriTemplate=new Resource({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=gatherContentHeaders(t);for(let e=0;e<r.length;e++){const t=r[e];this.contentHeaders.push(clone$1(t,!0));const n=new Resource({url:t.uri});this.contentUriTemplates.push(n)}this.contentCount=this.contentHeaders.length,this.tileHeader=makeTileHeaderTemplate(t),this.subdivisionScheme=ImplicitSubdivisionScheme$1[i.subdivisionScheme],this.branchingFactor=ImplicitSubdivisionScheme$1.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,this.maximumLevel=i.maximumLevel}function gatherContentHeaders(e){return hasExtension(e,"3DTILES_multiple_contents")?e.extensions["3DTILES_multiple_contents"].content:defined(e.content)?[e.content]:[]}function makeTileHeaderTemplate(e){const t=clone$1(e,!0);return delete t.extensions["3DTILES_implicit_tiling"],delete t.content,delete t.extensions["3DTILES_multiple_contents"],0===Object.keys(t.extensions).length&&delete t.extensions,t}function ImplicitTileCoordinates(e){this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(this.z=e.z)}Cesium3DTilesetHeatmap.prototype.colorize=function(e,t){if(!defined(this.tilePropertyName)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const n=getHeatmapValueAndUpdateMinimumMaximum(this,e),i=this._previousMinimum,r=this._previousMaximum;if(i===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const o=r-i+CesiumMath.EPSILON7,a=CesiumMath.clamp(n-i,0,o)/o*(heatmapColors.length-1),s=Math.floor(a),c=Math.ceil(a),l=a-s,u=heatmapColors[s],d=heatmapColors[c],h=Color.clone(Color.WHITE);h.red=CesiumMath.lerp(u.red,d.red,l),h.green=CesiumMath.lerp(u.green,d.green,l),h.blue=CesiumMath.lerp(u.blue,d.blue,l),e._debugColor=h},Cesium3DTilesetHeatmap.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(defined(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=defined(t)&&defined(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}},Cesium3DTilesetStatistics.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0},Cesium3DTilesetStatistics.prototype.incrementSelectionCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!1)},Cesium3DTilesetStatistics.prototype.incrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!0)},Cesium3DTilesetStatistics.prototype.decrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!0,!0)},Cesium3DTilesetStatistics.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.batchTableByteLength=e.batchTableByteLength},Object.defineProperties(Cesium3DTileStyleEngine.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}}),Cesium3DTileStyleEngine.prototype.makeDirty=function(){this._styleDirty=!0},Cesium3DTileStyleEngine.prototype.resetDirty=function(){this._styleDirty=!1},Cesium3DTileStyleEngine.prototype.applyStyle=function(e){if(!e.ready)return;if(defined(this._style)&&!this._style.ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const n=this._lastStyleTime,i=e._statistics,r=t?e._selectedTiles:e._selectedTilesToStyle,o=r.length;for(let e=0;e<o;++e){const t=r[e];if(t.lastStyleTime!==n){const e=t.content;t.lastStyleTime=n,e.applyStyle(this._style),i.numberOfFeaturesStyled+=e.featuresLength,++i.numberOfTilesStyled}}},Object.defineProperties(ImplicitTileCoordinates.prototype,{childIndex:{get:function(){let e=0;return e|=1&this.x,e|=(1&this.y)<<1,this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e|=(1&this.z)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?MortonOrder.encode3D(this.x,this.y,this.z):MortonOrder.encode2D(this.x,this.y)}},tileIndex:{get:function(){return(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3)+this.mortonIndex}}}),ImplicitTileCoordinates.prototype.getDescendantCoordinates=function(e){const t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const r=(this.z<<e.level)+e.z;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:r})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})},ImplicitTileCoordinates.prototype.getAncestorCoordinates=function(e){const t=1<<e,n=this.level-e,i=Math.floor(this.x/t),r=Math.floor(this.y/t);if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const e=Math.floor(this.z/t);return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:r,z:e})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:r})},ImplicitTileCoordinates.prototype.getOffsetCoordinates=function(e){const t=e.level-this.level,n=1<<t,i=e.x%n,r=e.y%n;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const o=e.z%n;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r,z:o})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:r})},ImplicitTileCoordinates.prototype.getChildCoordinates=function(e){const t=this.level+1,n=2*this.x+e%2,i=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const r=2*this.z+Math.floor(e/4)%2;return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:r})}return new ImplicitTileCoordinates({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})},ImplicitTileCoordinates.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)},ImplicitTileCoordinates.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)},ImplicitTileCoordinates.prototype.isAncestor=function(e){const t=e.level-this.level;if(t<=0)return!1;const n=e.x>>t,i=e.y>>t,r=this.x===n,o=this.y===i;if(this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE){const n=e.z>>t,i=this.z===n;return r&&o&&i}return r&&o},ImplicitTileCoordinates.prototype.isEqual=function(e){return this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme!==ImplicitSubdivisionScheme$1.OCTREE||this.z===e.z)},ImplicitTileCoordinates.prototype.isImplicitTilesetRoot=function(){return 0===this.level},ImplicitTileCoordinates.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels==0},ImplicitTileCoordinates.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels==this.subtreeLevels-1},ImplicitTileCoordinates.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===ImplicitSubdivisionScheme$1.OCTREE&&(e.z=this.z),e};const scratchCoordinatesArray=[0,0,0];function Cesium3DTileset(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._gltfUpAxis=void 0,this._cache=new Cesium3DTilesetCache,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._cullWithChildrenBounds=defaultValue(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new ManagedArray,this._maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,512),this._styleEngine=new Cesium3DTileStyleEngine,this._modelMatrix=defined(e.modelMatrix)?Matrix4.clone(e.modelMatrix):Matrix4.clone(Matrix4.IDENTITY),this._statistics=new Cesium3DTilesetStatistics,this._statisticsLast=new Cesium3DTilesetStatistics,this._statisticsPerPass=new Array(Cesium3DTilePass$1.NUMBER_OF_PASSES);for(let e=0;e<Cesium3DTilePass$1.NUMBER_OF_PASSES;++e)this._statisticsPerPass[e]=new Cesium3DTilesetStatistics;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new Cesium3DTilesetHeatmap(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=defaultValue(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=defaultValue(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=CesiumMath.clamp(defaultValue(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=defaultValue(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._readyPromise=when.defer(),this._classificationType=e.classificationType,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._initialClippingPlanesOriginMatrix=Matrix4.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=defaultValue(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=defaultValue(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=defaultValue(e.preloadWhenHidden,!1),this.preloadFlightDestinations=defaultValue(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=defaultValue(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=defaultValue(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=defaultValue(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=defaultValue(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=defaultValue(e.foveatedInterpolationCallback,CesiumMath.lerp),this.foveatedTimeDelay=defaultValue(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.show=defaultValue(e.show,!0),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new PointCloudShading(e.pointCloudShading),this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,this.loadProgress=new Event,this.allTilesLoaded=new Event,this.initialTilesLoaded=new Event,this.tileLoad=new Event,this.tileUnload=new Event,this.tileFailed=new Event,this.tileVisible=new Event,this.skipLevelOfDetail=defaultValue(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=defaultValue(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=defaultValue(e.skipScreenSpaceErrorFactor,16),this.skipLevels=defaultValue(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=defaultValue(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=defaultValue(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps,this.backFaceCulling=defaultValue(e.backFaceCulling,!0),this.showOutline=defaultValue(e.showOutline,!0),this.debugFreezeFrame=defaultValue(e.debugFreezeFrame,!1),this.debugColorizeTiles=defaultValue(e.debugColorizeTiles,!1),this.debugWireframe=defaultValue(e.debugWireframe,!1),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=defaultValue(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=defaultValue(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=defaultValue(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=defaultValue(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=defaultValue(e.debugShowMemoryUsage,!1),this.debugShowUrl=defaultValue(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this.metadata=void 0,this._customShader=e.customShader,this.enableModelExperimental=defaultValue(e.enableModelExperimental,ExperimentalFeatures.enableModelExperimental),this._schemaLoader=void 0;const t=this;let n;when(e.url).then((function(e){let i;return n=Resource.createIfNeeded(e),t._resource=n,t._credits=n.credits,"json"===n.extension?i=n.getBaseUri(!0):n.isDataUri&&(i=""),t._url=n.url,t._basePath=i,Cesium3DTileset.loadJson(n)})).then((function(e){return processMetadataExtension(t,e)})).then((function(e){t._root=t.loadTileset(n,e);const i=defined(e.asset.gltfUpAxis)?Axis$1.fromName(e.asset.gltfUpAxis):Axis$1.Y,r=e.asset;t._asset=r,t._properties=e.properties,t._geometricError=e.geometricError,t._extensionsUsed=e.extensionsUsed,t._extensions=e.extensions,t._gltfUpAxis=i,t._extras=e.extras;const o=r.extras;if(defined(o)&&defined(o.cesium)&&defined(o.cesium.credits)){const e=o.cesium.credits;let n=t._credits;defined(n)||(n=[],t._credits=n);for(let t=0;t<e.length;++t){const i=e[t];n.push(new Credit(i.html,i.showOnScreen))}}const a=t._root.createBoundingVolume(e.root.boundingVolume,Matrix4.IDENTITY).boundingSphere.center,s=t._ellipsoid.cartesianToCartographic(a);defined(s)&&s.height>ApproximateTerrainHeights._defaultMinTerrainHeight&&(t._initialClippingPlanesOriginMatrix=Transforms.eastNorthUpToFixedFrame(a)),t._clippingPlanesOriginMatrix=Matrix4.clone(t._initialClippingPlanesOriginMatrix),t._readyPromise.resolve(t)})).otherwise((function(e){t._readyPromise.reject(e)}))}function makeTile(e,t,n,i){if(hasExtension(n,"3DTILES_implicit_tiling")){const r=new ImplicitTileset(t,n,defined(e.metadata)?e.metadata.schema:void 0),o=new ImplicitTileCoordinates({subdivisionScheme:r.subdivisionScheme,subtreeLevels:r.subtreeLevels,level:0,x:0,y:0,z:0}),a=combine$2({content:{uri:r.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url}},n,!0);delete a.extensions;const s=new Cesium3DTile(e,t,a,i);return s.implicitTileset=r,s.implicitCoordinates=o,s}return new Cesium3DTile(e,t,n,i)}function processMetadataExtension(e,t){if(!hasExtension(t,"3DTILES_metadata"))return when.resolve(t);const n=t.extensions["3DTILES_metadata"];let i;if(defined(n.schemaUri)){const t=e._resource.getDerivedResource({url:n.schemaUri});i=ResourceCache.loadSchema({resource:t})}else i=ResourceCache.loadSchema({schema:n.schema});return e._schemaLoader=i,i.promise.then((function(i){return e.metadata=new Cesium3DTilesetMetadata({schema:i.schema,extension:n}),t}))}ImplicitTileCoordinates.fromMortonIndex=function(e,t,n,i){let r;return e===ImplicitSubdivisionScheme$1.OCTREE?(r=MortonOrder.decode3D(i,scratchCoordinatesArray),new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:n,x:r[0],y:r[1],z:r[2]})):(r=MortonOrder.decode2D(i,scratchCoordinatesArray),new ImplicitTileCoordinates({subdivisionScheme:e,subtreeLevels:t,level:n,x:r[0],y:r[1]}))},ImplicitTileCoordinates.fromTileIndex=function(e,t,n){let i,r,o;return e===ImplicitSubdivisionScheme$1.OCTREE?(i=Math.floor(CesiumMath.log2(7*n+1)/3),r=((1<<3*i)-1)/7,o=n-r):(i=Math.floor(CesiumMath.log2(3*n+1)/2),r=((1<<2*i)-1)/3,o=n-r),ImplicitTileCoordinates.fromMortonIndex(e,t,i,o)},Object.defineProperties(Cesium3DTileset.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){return this._properties}},ready:{get:function(){return defined(this._root)}},readyPromise:{get:function(){return this._readyPromise.promise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return deprecationWarning("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){this._pointCloudShading=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=Matrix4.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return defined(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(Matrix4.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):Matrix4.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}}}),Cesium3DTileset.loadJson=function(e){return Resource.createIfNeeded(e).fetchJson()},Cesium3DTileset.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()},Cesium3DTileset.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!defined(i))throw new RuntimeError("Tileset must have an asset property.");if("0.0"!==i.version&&"1.0"!==i.version)throw new RuntimeError("The tileset must be 3D Tiles version 0.0 or 1.0.");defined(t.extensionsRequired)&&Cesium3DTileset.checkSupportedExtensions(t.extensionsRequired);const r=this._statistics,o=i.tilesetVersion;defined(o)&&(this._basePath+="?v="+o,(e=e.clone()).setQueryParameters({v:o}));const a=makeTile(this,e,t.root,n);defined(n)&&(n.children.push(a),a._depth=n._depth+1);const s=[];for(s.push(a);s.length>0;){const t=s.pop();++r.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&t.refine===Cesium3DTileRefine$1.ADD;const n=t._header.children;if(defined(n)){const i=n.length;for(let r=0;r<i;++r){const i=makeTile(this,e,n[r],t);t.children.push(i),i._depth=t._depth+1,s.push(i)}}this._cullWithChildrenBounds&&Cesium3DTileOptimizations.checkChildrenWithinParent(t)}return a};const scratchPositionNormal$2=new Cartesian3,scratchCartographic$9=new Cartographic,scratchMatrix$1=new Matrix4,scratchCenter$3=new Cartesian3,scratchPosition$2=new Cartesian3,scratchDirection$1=new Cartesian3;function updateDynamicScreenSpaceError(e,t){let n,i,r,o,a;const s=t.camera,c=e._root,l=c.contentBoundingVolume;if(l instanceof TileBoundingRegion)n=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),i=s.directionWC,r=s.positionCartographic.height,o=l.minimumHeight,a=l.maximumHeight;else{const e=Matrix4.inverseTransformation(c.computedTransform,scratchMatrix$1),u=t.mapProjection.ellipsoid,d=l.boundingVolume,h=Matrix4.multiplyByPoint(e,d.center,scratchCenter$3);if(Cartesian3.magnitude(h)>u.minimumRadius){const e=Cartographic.fromCartesian(h,u,scratchCartographic$9);n=Cartesian3.normalize(s.positionWC,scratchPositionNormal$2),i=s.directionWC,r=s.positionCartographic.height,o=0,a=2*e.height}else{const t=Matrix4.multiplyByPoint(e,s.positionWC,scratchPosition$2);if(n=Cartesian3.UNIT_Z,i=Matrix4.multiplyByPointAsVector(e,s.directionWC,scratchDirection$1),i=Cartesian3.normalize(i,i),r=t.z,l instanceof TileOrientedBoundingBox){const e=c._header.boundingVolume.box[11];o=h.z-e,a=h.z+e}else if(l instanceof TileBoundingSphere){const e=d.radius;o=h.z-e,a=h.z+e}}}const u=o+(a-o)*e.dynamicScreenSpaceErrorHeightFalloff,d=a,h=CesiumMath.clamp((r-u)/(d-u),0,1);let p=1-Math.abs(Cartesian3.dot(i,n));p*=1-h;let f=e.dynamicScreenSpaceErrorDensity;f*=p,e._dynamicScreenSpaceErrorComputedDensity=f}function requestContent(e,t){if(t.hasEmptyContent)return;const n=e._statistics,i=t.contentExpired,r=t.requestContent();r>0?n.numberOfAttemptedRequests+=r:(i&&(t.hasTilesetContent||t.hasImplicitContent?destroySubtree(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(addToProcessingQueue(e,t)),t.contentReadyPromise.then(handleTileSuccess(e,t)).otherwise(handleTileFailure(e,t)))}function sortRequestByPriority(e,t){return e._priority-t._priority}function cancelOutOfViewRequests(e,t){const n=e._requestedTilesInFlight;let i=0;const r=n.length;for(let e=0;e<r;++e){const r=n[e],o=t.frameNumber-r._touchedFrame>=1;r._contentState===Cesium3DTileContentState$1.LOADING?o?(r.cancelRequests(),++i):i>0&&(n[e-i]=r):++i}n.length-=i}function requestTiles(e,t){const n=e._requestedTiles,i=n.length;n.sort(sortRequestByPriority);for(let t=0;t<i;++t)requestContent(e,n[t])}function addToProcessingQueue(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function handleTileFailure(e,t){return function(n){const i=t._contentResource.url,r=defined(n.message)?n.message:n.toString();e.tileFailed.numberOfListeners>0?e.tileFailed.raiseEvent({url:i,message:r}):(console.log("A 3D tile failed to load: "+i),console.log("Error: "+r))}}function handleTileSuccess(e,t){return function(){--e._statistics.numberOfTilesProcessing,t.hasTilesetContent||t.hasImplicitContent||(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t)}}function filterProcessingQueue(e){const t=e._processingQueue,n=t.length;let i=0;for(let e=0;e<n;++e){const n=t[e];n._contentState===Cesium3DTileContentState$1.PROCESSING?i>0&&(t[e-i]=n):++i}t.length-=i}function processTiles(e,t){filterProcessingQueue(e);const n=e._processingQueue,i=n.length;for(let r=0;r<i;++r)n[r].process(e,t)}Cesium3DTileset.prototype.postPassesUpdate=function(e){this.ready&&(cancelOutOfViewRequests(this,e),raiseLoadProgressEvent(this,e),this._cache.unloadTiles(this,unloadTile),this._styleEngine.resetDirty())},Cesium3DTileset.prototype.prePassesUpdate=function(e){if(!this.ready)return;processTiles(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,defined(t)&&t.enabled&&t.update(e),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time)),this._timeSinceLoad=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!defined(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&updateDynamicScreenSpaceError(this,e),e.newFrame&&this._cache.reset()};const scratchCartesian$4=new Cartesian3,stringOptions$1={maximumFractionDigits:3};function formatMemoryString$1(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions$1):Math.round(t).toLocaleString()}function computeTileLabelPosition(e){const t=e.boundingVolume.boundingVolume,n=t.halfAxes,i=t.radius;let r=Cartesian3.clone(t.center,scratchCartesian$4);if(defined(n))r.x+=.75*(n[0]+n[3]+n[6]),r.y+=.75*(n[1]+n[4]+n[7]),r.z+=.75*(n[2]+n[5]+n[8]);else if(defined(i)){let e=Cartesian3.normalize(t.center,scratchCartesian$4);e=Cartesian3.multiplyByScalar(e,.75*i,scratchCartesian$4),r=Cartesian3.add(e,t.center,scratchCartesian$4)}return r}function addTileDebugLabel(e,t,n){let i="",r=0;if(t.debugShowGeometricError&&(i+="\nGeometric error: "+e.geometricError,r++),t.debugShowRenderingStatistics){i+="\nCommands: "+e.commandsLength,r++;e.content.pointsLength>0&&(i+="\nPoints: "+e.content.pointsLength,r++);e.content.trianglesLength>0&&(i+="\nTriangles: "+e.content.trianglesLength,r++),i+="\nFeatures: "+e.content.featuresLength,r++}if(t.debugShowMemoryUsage&&(i+="\nTexture Memory: "+formatMemoryString$1(e.content.texturesByteLength),i+="\nGeometry Memory: "+formatMemoryString$1(e.content.geometryByteLength),r+=2),t.debugShowUrl)if(e.hasMultipleContents){i+="\nUrls:";const t=e.content.innerContentUrls;for(let e=0;e<t.length;e++)i+="\n- "+t[e];r+=t.length}else i+="\nUrl: "+e._header.content.uri,r++;const o={text:i.substring(1),position:n,font:19-r+"px sans-serif",showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(o)}function updateTileDebugLabels(e,t){let n,i;const r=e._selectedTiles,o=r.length,a=e._emptyTiles,s=a.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(defined(e.debugPickedTile)){const t=defined(e.debugPickPosition)?e.debugPickPosition:computeTileLabelPosition(e.debugPickedTile);addTileDebugLabel(e.debugPickedTile,e,t).pixelOffset=new Cartesian2(15,-15)}}else{for(n=0;n<o;++n)i=r[n],addTileDebugLabel(i,e,computeTileLabelPosition(i));for(n=0;n<s;++n)i=a[n],(i.hasTilesetContent||i.hasImplicitContent)&&addTileDebugLabel(i,e,computeTileLabelPosition(i))}e._tileDebugLabels.update(t)}function updateTiles(e,t,n){e._styleEngine.applyStyle(e);const i=n.isRender,r=e._statistics,o=t.commandList,a=o.length,s=e._selectedTiles,c=s.length,l=e._emptyTiles,u=l.length,d=e.tileVisible;let h,p;const f=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,f&&(defined(e._stencilClearCommand)||(e._stencilClearCommand=new ClearCommand({stencil:0,pass:Pass$1.CESIUM_3D_TILE,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.SKIP_LOD_MASK})})),o.push(e._stencilClearCommand));const m=o.length;for(h=0;h<c;++h)p=s[h],i&&d.raiseEvent(p),p.update(e,t,n),r.incrementSelectionCounts(p.content),++r.selected;for(h=0;h<u;++h)p=l[h],p.update(e,t,n);let g=o.length-m;if(e._backfaceCommands.trim(),f){const t=e._backfaceCommands.values,n=t.length;for(o.length+=n,h=g-1;h>=0;--h)o[m+n+h]=o[m+h];for(h=0;h<n;++h)o[m+h]=t[h]}g=o.length-a,r.numberOfCommands=g,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&g>0&&e._pointCloudEyeDomeLighting.update(t,a,e.pointCloudShading,e.boundingSphere),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(defined(e._tileDebugLabels)||(e._tileDebugLabels=new LabelCollection),updateTileDebugLabels(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const scratchStack=[];function destroySubtree(e,t){const n=t,i=scratchStack;for(i.push(t);i.length>0;){const r=(t=i.pop()).children,o=r.length;for(let e=0;e<o;++e)i.push(r[e]);t!==n&&(destroyTile(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function unloadTile(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function destroyTile(e,t){e._cache.unloadTile(e,t,unloadTile),t.destroy()}function raiseLoadProgressEvent(e,t){const n=e._statistics,i=e._statisticsLast,r=n.numberOfPendingRequests,o=n.numberOfTilesProcessing,a=i.numberOfPendingRequests,s=i.numberOfTilesProcessing;Cesium3DTilesetStatistics.clone(n,i);const c=r!==a||o!==s;c&&t.afterRender.push((function(){e.loadProgress.raiseEvent(r,o)})),e._tilesLoaded=0===n.numberOfPendingRequests&&0===n.numberOfTilesProcessing&&0===n.numberOfAttemptedRequests,c&&e._tilesLoaded&&(t.afterRender.push((function(){e.allTilesLoaded.raiseEvent()})),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push((function(){e.initialTilesLoaded.raiseEvent()}))))}function resetMinimumMaximum(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function detectModelMatrixChanged(e,t){t.frameNumber===e._updatedModelMatrixFrame&&defined(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!Matrix4.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=Matrix4.clone(e.modelMatrix,e._previousModelMatrix)))}function update$1(e,t,n,i){if(t.mode===SceneMode$1.MORPHING)return!1;if(!e.ready)return!1;const r=e._statistics;r.clear();const o=i.isRender;++e._updatedVisibilityFrame,resetMinimumMaximum(e),detectModelMatrixChanged(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const a=i.traversal.selectTiles(e,t);if(i.requestTiles&&requestTiles(e),updateTiles(e,t,i),Cesium3DTilesetStatistics.clone(r,n),o){const n=e._credits;if(defined(n)&&0!==r.selected){const e=n.length;for(let i=0;i<e;++i)t.creditDisplay.addCredit(n[i])}}return a}Cesium3DTileset.prototype.trimLoadedTiles=function(){this._cache.trim()},Cesium3DTileset.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)},Cesium3DTileset.prototype.updateForPass=function(e,t){const n=t.pass;if(n===Cesium3DTilePass$1.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===Cesium3DTilePass$1.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,r=e.camera,o=e.cullingVolume;t.ready=!1;const a=Cesium3DTilePass$1.getPassOptions(n),s=a.ignoreCommands,c=defaultValue(t.commandList,i),l=c.length;e.commandList=c,e.camera=defaultValue(t.camera,r),e.cullingVolume=defaultValue(t.cullingVolume,o);const u=this._statisticsPerPass[n];(this.show||s)&&(this._pass=n,t.ready=update$1(this,e,u,a)),s&&(c.length=l),e.commandList=i,e.camera=r,e.cullingVolume=o},Cesium3DTileset.prototype.hasExtension=function(e){return!!defined(this._extensionsUsed)&&this._extensionsUsed.indexOf(e)>-1},Cesium3DTileset.prototype.isDestroyed=function(){return!1},Cesium3DTileset.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._schemaLoader)&&ResourceCache.unload(this._schemaLoader),defined(this._root)){const e=scratchStack;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const n=t.children,i=n.length;for(let t=0;t<i;++t)e.push(n[t])}}return this._root=void 0,destroyObject(this)},Cesium3DTileset.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0},Cesium3DTileset.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!Cesium3DTileset.supportedExtensions[e[t]])throw new RuntimeError("Unsupported 3D Tiles Extension: "+e[t])};const modelMatrixScratch$1=new Matrix4;function Cesium3DTilesetVisualizer(e,t){t.collectionChanged.addEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeTileset(e,t,n,i){const r=n[t.id];defined(r)&&(i.removeAndDestroy(r.tilesetPrimitive),delete n[t.id])}function checkLoad(e,t,n){e.readyPromise.otherwise((function(e){console.error(e),n[t.id].loadFail=!0}))}Cesium3DTilesetVisualizer.prototype.update=function(e){const t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let r=0,o=t.length;r<o;r++){const o=t[r],a=o._tileset;let s,c=n[o.id];const l=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);let u;if(l&&(u=o.computeModelMatrix(e,modelMatrixScratch$1),s=Resource.createIfNeeded(Property.getValueOrUndefined(a._uri,e))),!l){defined(c)&&(c.tilesetPrimitive.show=!1);continue}let d=defined(c)?c.tilesetPrimitive:void 0;defined(d)&&s.url===c.url||(defined(d)&&(i.removeAndDestroy(d),delete n[o.id]),d=new Cesium3DTileset({url:s}),d.id=o,i.add(d),c={tilesetPrimitive:d,url:s.url,loadFail:!1},n[o.id]=c,checkLoad(d,o,n)),d.show=!0,defined(u)&&(d.modelMatrix=u),d.maximumScreenSpaceError=Property.getValueOrDefault(a.maximumScreenSpaceError,e,d.maximumScreenSpaceError)}return!0},Cesium3DTilesetVisualizer.prototype.isDestroyed=function(){return!1},Cesium3DTilesetVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Cesium3DTilesetVisualizer.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)removeTileset(this,e[i],t,n);return destroyObject(this)},Cesium3DTilesetVisualizer.prototype.getBoundingSphere=function(e,t){const n=this._tilesetHash[e.id];if(!defined(n)||n.loadFail)return BoundingSphereState$1.FAILED;const i=n.tilesetPrimitive;return defined(i)&&i.show?i.ready?(BoundingSphere.clone(i.boundingSphere,t),BoundingSphereState$1.DONE):BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},Cesium3DTilesetVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o;const a=this._entitiesToVisualize,s=this._tilesetHash,c=this._primitives;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._tileset)&&a.set(o.id,o);for(r=i.length-1;r>-1;r--)o=i[r],defined(o._tileset)?a.set(o.id,o):(removeTileset(this,o,s,c),a.remove(o.id));for(r=n.length-1;r>-1;r--)o=n[r],removeTileset(this,o,s,c),a.remove(o.id)};const defaultEvenColor$1=Color.WHITE,defaultOddColor$1=Color.BLACK,defaultRepeat$1=new Cartesian2(2,2);function CheckerboardMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat}Object.defineProperties(CheckerboardMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),repeat:createPropertyDescriptor("repeat")}),CheckerboardMaterialProperty.prototype.getType=function(e){return"Checkerboard"},CheckerboardMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.lightColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor$1,t.lightColor),t.darkColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor$1,t.darkColor),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat$1),t},CheckerboardMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CheckerboardMaterialProperty&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._repeat,e._repeat)};const entityOptionsScratch$1={id:void 0};function fireChangedEvent(e){if(e._firing)e._refire=!0;else if(0===e._suspendCount){const t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(0!==i.length||0!==t.length||0!==n.length){e._firing=!0;do{e._refire=!1;const r=t.values.slice(0),o=n.values.slice(0),a=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,r,o,a)}while(e._refire);e._firing=!1}}}function EntityCollection(e){this._owner=e,this._entities=new AssociativeArray,this._addedEntities=new AssociativeArray,this._removedEntities=new AssociativeArray,this._changedEntities=new AssociativeArray,this._suspendCount=0,this._collectionChanged=new Event,this._id=createGuid(),this._show=!0,this._firing=!1,this._refire=!1}EntityCollection.prototype.suspendEvents=function(){this._suspendCount++},EntityCollection.prototype.resumeEvents=function(){this._suspendCount--,fireChangedEvent(this)},EntityCollection.collectionChangedEventCallback=void 0,Object.defineProperties(EntityCollection.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(e===this._show)return;let t;this.suspendEvents();const n=[],i=this._entities.values,r=i.length;for(t=0;t<r;t++)n.push(i[t].isShowing);for(this._show=e,t=0;t<r;t++){const e=n[t],r=i[t];e!==r.isShowing&&r.definitionChanged.raiseEvent(r,"isShowing",r.isShowing,e)}this.resumeEvents()}},owner:{get:function(){return this._owner}}}),EntityCollection.prototype.computeAvailability=function(){let e=Iso8601.MAXIMUM_VALUE,t=Iso8601.MINIMUM_VALUE;const n=this._entities.values;for(let i=0,r=n.length;i<r;i++){const r=n[i].availability;if(defined(r)){const n=r.start,i=r.stop;JulianDate.lessThan(n,e)&&!n.equals(Iso8601.MINIMUM_VALUE)&&(e=n),JulianDate.greaterThan(i,t)&&!i.equals(Iso8601.MAXIMUM_VALUE)&&(t=i)}}return Iso8601.MAXIMUM_VALUE.equals(e)&&(e=Iso8601.MINIMUM_VALUE),Iso8601.MINIMUM_VALUE.equals(t)&&(t=Iso8601.MAXIMUM_VALUE),new TimeInterval({start:e,stop:t})},EntityCollection.prototype.add=function(e){e instanceof Entity||(e=new Entity(e));const t=e.id,n=this._entities;if(n.contains(t))throw new RuntimeError("An entity with id "+t+" already exists in this collection.");return e.entityCollection=this,n.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),e},EntityCollection.prototype.remove=function(e){return!!defined(e)&&this.removeById(e.id)},EntityCollection.prototype.contains=function(e){return this._entities.get(e.id)===e},EntityCollection.prototype.removeById=function(e){if(!defined(e))return!1;const t=this._entities.get(e);return!!this._entities.remove(e)&&(this._addedEntities.remove(e)||(this._removedEntities.set(e,t),this._changedEntities.remove(e)),this._entities.remove(e),t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),!0)},EntityCollection.prototype.removeAll=function(){const e=this._entities,t=e.length,n=e.values,i=this._addedEntities,r=this._removedEntities;for(let e=0;e<t;e++){const t=n[e],o=t.id;defined(i.get(o))||(t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),r.set(o,t))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),fireChangedEvent(this)},EntityCollection.prototype.getById=function(e){return this._entities.get(e)},EntityCollection.prototype.getOrCreateEntity=function(e){let t=this._entities.get(e);return defined(t)||(entityOptionsScratch$1.id=e,t=new Entity(entityOptionsScratch$1),this.add(t)),t},EntityCollection.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),fireChangedEvent(this)};const entityOptionsScratch={id:void 0},entityIdScratch=new Array(2);function clean(e){const t=e.propertyNames,n=t.length;for(let i=0;i<n;i++)e[t[i]]=void 0;e._name=void 0,e._availability=void 0}function subscribeToEntity(e,t,n,i){entityIdScratch[0]=n,entityIdScratch[1]=i.id,t[JSON.stringify(entityIdScratch)]=i.definitionChanged.addEventListener(CompositeEntityCollection.prototype._onDefinitionChanged,e)}function unsubscribeFromEntity(e,t,n,i){entityIdScratch[0]=n,entityIdScratch[1]=i.id;const r=JSON.stringify(entityIdScratch);t[r](),t[r]=void 0}function recomposite(e){if(e._shouldRecomposite=!0,0!==e._suspendCount)return;const t=e._collections,n=t.length,i=e._collectionsCopy,r=i.length;let o,a,s,c,l;const u=e._composite,d=new EntityCollection(e),h=e._eventHash;let p;for(o=0;o<r;o++)for(l=i[o],l.collectionChanged.removeEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),s=l.values,p=l.id,c=s.length-1;c>-1;c--)a=s[c],unsubscribeFromEntity(e,h,p,a);for(o=n-1;o>=0;o--)for(l=t[o],l.collectionChanged.addEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),s=l.values,p=l.id,c=s.length-1;c>-1;c--){a=s[c],subscribeToEntity(e,h,p,a);let t=d.getById(a.id);defined(t)||(t=u.getById(a.id),defined(t)?clean(t):(entityOptionsScratch.id=a.id,t=new Entity(entityOptionsScratch)),d.add(t)),t.merge(a)}e._collectionsCopy=t.slice(0),u.suspendEvents(),u.removeAll();const f=d.values;for(o=0;o<f.length;o++)u.add(f[o]);u.resumeEvents()}function CompositeEntityCollection(e,t){this._owner=t,this._composite=new EntityCollection(this),this._suspendCount=0,this._collections=defined(e)?e.slice():[],this._collectionsCopy=[],this._id=createGuid(),this._eventHash={},recomposite(this),this._shouldRecomposite=!1}function getCollectionIndex(e,t){return e.indexOf(t)}function swapCollections(e,t,n){const i=e._collections;if((t=CesiumMath.clamp(t,0,i.length-1))===(n=CesiumMath.clamp(n,0,i.length-1)))return;const r=i[t];i[t]=i[n],i[n]=r,recomposite(e)}function subscribeAll(e,t,n,i){function r(){n.raiseEvent(e)}const o=[];t.removeAll();const a=i.length;for(let e=0;e<a;e++){const n=i.get(e);defined(n.data)&&-1===o.indexOf(n.data)&&t.add(n.data.definitionChanged,r)}}function CompositeProperty(){this._eventHelper=new EventHelper,this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(CompositeProperty.prototype._intervalsChanged,this)}function CompositeMaterialProperty(){this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositeMaterialProperty.prototype._raiseDefinitionChanged,this)}function CompositePositionProperty(e){this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositePositionProperty.prototype._raiseDefinitionChanged,this)}Object.defineProperties(CompositeEntityCollection.prototype,{collectionChanged:{get:function(){return this._composite._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._composite.values}},owner:{get:function(){return this._owner}}}),CompositeEntityCollection.prototype.addCollection=function(e,t){defined(t)?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),recomposite(this)},CompositeEntityCollection.prototype.removeCollection=function(e){const t=this._collections.indexOf(e);return-1!==t&&(this._collections.splice(t,1),recomposite(this),!0)},CompositeEntityCollection.prototype.removeAllCollections=function(){this._collections.length=0,recomposite(this)},CompositeEntityCollection.prototype.containsCollection=function(e){return-1!==this._collections.indexOf(e)},CompositeEntityCollection.prototype.contains=function(e){return this._composite.contains(e)},CompositeEntityCollection.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)},CompositeEntityCollection.prototype.getCollection=function(e){return this._collections[e]},CompositeEntityCollection.prototype.getCollectionsLength=function(){return this._collections.length},CompositeEntityCollection.prototype.raiseCollection=function(e){const t=getCollectionIndex(this._collections,e);swapCollections(this,t,t+1)},CompositeEntityCollection.prototype.lowerCollection=function(e){const t=getCollectionIndex(this._collections,e);swapCollections(this,t,t-1)},CompositeEntityCollection.prototype.raiseCollectionToTop=function(e){const t=getCollectionIndex(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),recomposite(this))},CompositeEntityCollection.prototype.lowerCollectionToBottom=function(e){const t=getCollectionIndex(this._collections,e);0!==t&&(this._collections.splice(t,1),this._collections.splice(0,0,e),recomposite(this))},CompositeEntityCollection.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()},CompositeEntityCollection.prototype.resumeEvents=function(){this._suspendCount--,this._shouldRecomposite&&0===this._suspendCount&&(recomposite(this),this._shouldRecomposite=!1),this._composite.resumeEvents()},CompositeEntityCollection.prototype.computeAvailability=function(){return this._composite.computeAvailability()},CompositeEntityCollection.prototype.getById=function(e){return this._composite.getById(e)},CompositeEntityCollection.prototype._onCollectionChanged=function(e,t,n){const i=this._collectionsCopy,r=i.length,o=this._composite;let a,s,c,l;o.suspendEvents();const u=n.length,d=this._eventHash,h=e.id;for(a=0;a<u;a++){const e=n[a];unsubscribeFromEntity(this,d,h,e);const t=e.id;for(s=r-1;s>=0;s--)c=i[s].getById(t),defined(c)&&(defined(l)||(l=o.getById(t),clean(l)),l.merge(c));defined(l)||o.removeById(t),l=void 0}const p=t.length;for(a=0;a<p;a++){const e=t[a];subscribeToEntity(this,d,h,e);const n=e.id;for(s=r-1;s>=0;s--)c=i[s].getById(n),defined(c)&&(defined(l)||(l=o.getById(n),defined(l)?clean(l):(entityOptionsScratch.id=n,l=new Entity(entityOptionsScratch),o.add(l))),l.merge(c));l=void 0}o.resumeEvents()},CompositeEntityCollection.prototype._onDefinitionChanged=function(e,t,n,i){const r=this._collections,o=this._composite,a=r.length,s=e.id,c=o.getById(s);let l=c[t];const u=!defined(l);let d=!0;for(let n=a-1;n>=0;n--){const i=r[n].getById(e.id);if(defined(i)){const e=i[t];if(defined(e)){if(d){if(d=!1,!defined(e.merge)||!defined(e.clone)){l=e;break}l=e.clone(l)}l.merge(e)}}}u&&-1===c.propertyNames.indexOf(t)&&c.addProperty(t),c[t]=l},Object.defineProperties(CompositeProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),CompositeProperty.prototype.getValue=function(e,t){const n=this._intervals.findDataForIntervalContainingDate(e);if(defined(n))return n.getValue(e,t)},CompositeProperty.prototype.equals=function(e){return this===e||e instanceof CompositeProperty&&this._intervals.equals(e._intervals,Property.equals)},CompositeProperty.prototype._intervalsChanged=function(){subscribeAll(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositeMaterialProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}}),CompositeMaterialProperty.prototype.getType=function(e){const t=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(t))return t.getType(e)},CompositeMaterialProperty.prototype.getValue=function(e,t){const n=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(n))return n.getValue(e,t)},CompositeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CompositeMaterialProperty&&this._composite.equals(e._composite,Property.equals)},CompositeMaterialProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(CompositePositionProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}}),CompositePositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},CompositePositionProperty.prototype.getValueInReferenceFrame=function(e,t,n){const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValueInReferenceFrame(e,t,n)},CompositePositionProperty.prototype.equals=function(e){return this===e||e instanceof CompositePositionProperty&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Property.equals)},CompositePositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const defaultZIndex$1=new ConstantProperty(0);function GroundGeometryUpdater(e){GeometryUpdater.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}defined(Object.create)&&(GroundGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),GroundGeometryUpdater.prototype.constructor=GroundGeometryUpdater),Object.defineProperties(GroundGeometryUpdater.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),GroundGeometryUpdater.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!defined(t.height)&&!defined(t.extrudedHeight)&&GroundPrimitive.isSupported(this._scene)},GroundGeometryUpdater.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return 0===t||defined(n)&&n!==t},GroundGeometryUpdater.prototype._computeCenter=DeveloperError.throwInstantiationError,GroundGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,n,i){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,n,i),-1===this._observedPropertyNames.indexOf(t))return;const r=this._entity[this._geometryPropertyName];if(!defined(r))return;defined(r.zIndex)&&(defined(r.height)||defined(r.extrudedHeight))&&oneTimeWarning(oneTimeWarning.geometryZIndex),this._zIndex=defaultValue(r.zIndex,defaultZIndex$1),defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const o=r.heightReference,a=r.extrudedHeightReference;if(defined(o)||defined(a)){const e=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,e,o,a)}},GroundGeometryUpdater.prototype.destroy=function(){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),GeometryUpdater.prototype.destroy.call(this)},GroundGeometryUpdater.getGeometryHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:0;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryHeightReference)},GroundGeometryUpdater.getGeometryExtrudedHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:GroundGeometryUpdater.CLAMP_TO_GROUND;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryExtrudedHeightReference)},GroundGeometryUpdater.CLAMP_TO_GROUND="clamp",GroundGeometryUpdater.computeGeometryOffsetAttribute=function(e,t,n,i){defined(e)&&defined(t)||(t=HeightReference$1.NONE),defined(n)&&defined(i)||(i=HeightReference$1.NONE);let r=0;return t!==HeightReference$1.NONE&&r++,i===HeightReference$1.RELATIVE_TO_GROUND&&r++,2===r?GeometryOffsetAttribute$1.ALL:1===r?GeometryOffsetAttribute$1.TOP:void 0};const scratchColor$d=new Color,defaultOffset$9=Cartesian3.ZERO,offsetScratch$8=new Cartesian3,scratchRectangle$4=new Rectangle;function CorridorGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function CorridorGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CorridorGeometryOptions(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}function DynamicCorridorGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}function DataSource(){DeveloperError.throwInstantiationError()}function PointPrimitive(e,t){let n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,i=e.scaleByDistance,r=e.distanceDisplayCondition;defined(n)&&(n=NearFarScalar.clone(n)),defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=DistanceDisplayCondition.clone(r)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.TRANSPARENT)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._pixelSize=defaultValue(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=r,this._disableDepthTestDistance=defaultValue(e.disableDepthTestDistance,0),this._id=e.id,this._collection=defaultValue(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}defined(Object.create)&&(CorridorGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),CorridorGeometryUpdater.prototype.constructor=CorridorGeometryUpdater),CorridorGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$d)),defined(t)||(t=Color.WHITE),i.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(i.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:t,geometry:new CorridorGeometry(this._options),attributes:i})},CorridorGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$d),r={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return defined(this._options.offsetAttribute)&&(r.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$9,offsetScratch$8))),new GeometryInstance({id:t,geometry:new CorridorOutlineGeometry(this._options),attributes:r})},CorridorGeometryUpdater.prototype._computeCenter=function(e,t){const n=Property.getValueOrUndefined(this._entity.corridor.positions,e);if(defined(n)&&0!==n.length)return Cartesian3.clone(n[Math.floor(n.length/2)],t)},CorridorGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.width)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CorridorGeometryUpdater.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.width)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.cornerType)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},CorridorGeometryUpdater.prototype._setStaticOptions=function(e,t){let n=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let r=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(r)&&!defined(n)&&(n=0);const a=this._options;a.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,a.positions),a.width=t.width.getValue(Iso8601.MINIMUM_VALUE),a.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),a.cornerType=Property.getValueOrUndefined(t.cornerType,Iso8601.MINIMUM_VALUE),a.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,i,r,o),a.height=GroundGeometryUpdater.getGeometryHeight(n,i),r=GroundGeometryUpdater.getGeometryExtrudedHeight(r,o),r===GroundGeometryUpdater.CLAMP_TO_GROUND&&(r=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(a,scratchRectangle$4)).minimumTerrainHeight),a.extrudedHeight=r},CorridorGeometryUpdater.DynamicGeometryUpdater=DynamicCorridorGeometryUpdater,defined(Object.create)&&(DynamicCorridorGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCorridorGeometryUpdater.prototype.constructor=DynamicCorridorGeometryUpdater),DynamicCorridorGeometryUpdater.prototype._isHidden=function(e,t,n){const i=this._options;return!defined(i.positions)||!defined(i.width)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicCorridorGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;let r=Property.getValueOrUndefined(t.height,n);const o=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,n);const s=Property.getValueOrDefault(t.extrudedHeightReference,n,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),i.positions=Property.getValueOrUndefined(t.positions,n),i.width=Property.getValueOrUndefined(t.width,n),i.granularity=Property.getValueOrUndefined(t.granularity,n),i.cornerType=Property.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),i.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(i,scratchRectangle$4)).minimumTerrainHeight),i.extrudedHeight=a},Object.defineProperties(DataSource.prototype,{name:{get:DeveloperError.throwInstantiationError},clock:{get:DeveloperError.throwInstantiationError},entities:{get:DeveloperError.throwInstantiationError},isLoading:{get:DeveloperError.throwInstantiationError},changedEvent:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},loadingEvent:{get:DeveloperError.throwInstantiationError},show:{get:DeveloperError.throwInstantiationError},clustering:{get:DeveloperError.throwInstantiationError}}),DataSource.prototype.update=function(e){DeveloperError.throwInstantiationError()},DataSource.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};const SHOW_INDEX$3=PointPrimitive.SHOW_INDEX=0,POSITION_INDEX$3=PointPrimitive.POSITION_INDEX=1,COLOR_INDEX$3=PointPrimitive.COLOR_INDEX=2,OUTLINE_COLOR_INDEX$1=PointPrimitive.OUTLINE_COLOR_INDEX=3,OUTLINE_WIDTH_INDEX$1=PointPrimitive.OUTLINE_WIDTH_INDEX=4,PIXEL_SIZE_INDEX$1=PointPrimitive.PIXEL_SIZE_INDEX=5,SCALE_BY_DISTANCE_INDEX$1=PointPrimitive.SCALE_BY_DISTANCE_INDEX=6,TRANSLUCENCY_BY_DISTANCE_INDEX$1=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX=7,DISTANCE_DISPLAY_CONDITION_INDEX$1=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX=8,DISABLE_DEPTH_DISTANCE_INDEX$1=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX=9;function makeDirty$1(e,t){const n=e._pointPrimitiveCollection;defined(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}PointPrimitive.NUMBER_OF_PROPERTIES=10,Object.defineProperties(PointPrimitive.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$1(this,SHOW_INDEX$3))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){const t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,SCALE_BY_DISTANCE_INDEX$1))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){const t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,TRANSLUCENCY_BY_DISTANCE_INDEX$1))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,makeDirty$1(this,PIXEL_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,COLOR_INDEX$3))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){const t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,OUTLINE_COLOR_INDEX$1))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$1(this,OUTLINE_WIDTH_INDEX$1))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$1(this,DISTANCE_DISPLAY_CONDITION_INDEX$1))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$1(this,DISABLE_DEPTH_DISTANCE_INDEX$1))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty$1(this,SHOW_INDEX$3))}}}),PointPrimitive.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},PointPrimitive.prototype._getActualPosition=function(){return this._actualPosition},PointPrimitive.prototype._setActualPosition=function(e){Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$3)};const tempCartesian3=new Cartesian4;PointPrimitive._computeActualPosition=function(e,t,n){return t.mode===SceneMode$1.SCENE3D?e:(Matrix4.multiplyByPoint(n,e,tempCartesian3),SceneTransforms.computeActualWgs84Position(t,tempCartesian3))};const scratchCartesian4$2=new Cartesian4;PointPrimitive._computeScreenSpacePosition=function(e,t,n,i){const r=Matrix4.multiplyByVector(e,Cartesian4.fromElements(t.x,t.y,t.z,1,scratchCartesian4$2),scratchCartesian4$2);return SceneTransforms.wgs84ToWindowCoordinates(n,r,i)},PointPrimitive.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;defined(t)||(t=new Cartesian2);const i=n.modelMatrix,r=PointPrimitive._computeScreenSpacePosition(i,this._actualPosition,e,t);if(defined(r))return r.y=e.canvas.clientHeight-r.y,r},PointPrimitive.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,r=.5*i,o=t.x-r,a=t.y-r,s=i,c=i;return defined(n)||(n=new BoundingRectangle),n.x=o,n.y=a,n.width=s,n.height=c,n},PointPrimitive.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&Color.equals(this._outlineColor,e._outlineColor)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},PointPrimitive.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var PointPrimitiveCollectionFS="varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\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;\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\ngl_FragColor = czm_gammaCorrect(color);\nczm_writeLogDepth();\n}\n",PointPrimitiveCollectionVS="uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nattribute vec3 distanceDisplayConditionAndDisableDepth;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\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_pixelRatio;\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;\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);\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);\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\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;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\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\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = distanceDisplayConditionAndDisableDepth.x;\nfloat farSq = distanceDisplayConditionAndDisableDepth.y;\nif (lengthSq < nearSq || lengthSq > farSq) {\npositionEC.xyz = vec3(0.0, 0.0, 1.0);\n}\n#endif\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n}\n}\n#endif\nv_color = color;\nv_color.a *= translucency * show;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency * show;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize * show;\ngl_Position *= show;\nv_pickColor = pickColor;\n}\n";const SHOW_INDEX$2=PointPrimitive.SHOW_INDEX,POSITION_INDEX$2=PointPrimitive.POSITION_INDEX,COLOR_INDEX$2=PointPrimitive.COLOR_INDEX,OUTLINE_COLOR_INDEX=PointPrimitive.OUTLINE_COLOR_INDEX,OUTLINE_WIDTH_INDEX=PointPrimitive.OUTLINE_WIDTH_INDEX,PIXEL_SIZE_INDEX=PointPrimitive.PIXEL_SIZE_INDEX,SCALE_BY_DISTANCE_INDEX=PointPrimitive.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX,DISABLE_DEPTH_DISTANCE_INDEX=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX,NUMBER_OF_PROPERTIES$1=PointPrimitive.NUMBER_OF_PROPERTIES,attributeLocations$2={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function PointPrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$1),this._maxPixelSize=1,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}function destroyPointPrimitives(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}function removePointPrimitives(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],n=e._pointPrimitives,i=n.length;for(let e=0,r=0;e<i;++e){const i=n[e];i&&(i._index=r++,t.push(i))}e._pointPrimitives=t}}function createVAF$1(e,t,n){return new VertexArrayFacade(e,[{index:attributeLocations$2.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[POSITION_INDEX$2]},{index:attributeLocations$2.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[POSITION_INDEX$2]},{index:attributeLocations$2.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[COLOR_INDEX$2]},{index:attributeLocations$2.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[TRANSLUCENCY_BY_DISTANCE_INDEX]},{index:attributeLocations$2.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[SCALE_BY_DISTANCE_INDEX]},{index:attributeLocations$2.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,usage:n[DISTANCE_DISPLAY_CONDITION_INDEX]}],t)}Object.defineProperties(PointPrimitiveCollection.prototype,{length:{get:function(){return removePointPrimitives(this),this._pointPrimitives.length}}}),PointPrimitiveCollection.prototype.add=function(e){const t=new PointPrimitive(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},PointPrimitiveCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},PointPrimitiveCollection.prototype.removeAll=function(){destroyPointPrimitives(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},PointPrimitiveCollection.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},PointPrimitiveCollection.prototype.contains=function(e){return defined(e)&&e._pointPrimitiveCollection===this},PointPrimitiveCollection.prototype.get=function(e){return removePointPrimitives(this),this._pointPrimitives[e]},PointPrimitiveCollection.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<NUMBER_OF_PROPERTIES$1;++i){const r=0===n[i]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[i]!==r,e[i]=r}return t};const writePositionScratch$1=new EncodedCartesian3;function writePositionSizeAndOutline(e,t,n,i){const r=i._index,o=i._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,o,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(o,writePositionScratch$1);const a=i.pixelSize,s=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,a+s);const c=n[attributeLocations$2.positionHighAndSize],l=writePositionScratch$1.high;c(r,l.x,l.y,l.z,a);const u=n[attributeLocations$2.positionLowAndOutline],d=writePositionScratch$1.low;u(r,d.x,d.y,d.z,s)}const LEFT_SHIFT16=65536,LEFT_SHIFT8=256;function writeCompressedAttrib0(e,t,n,i){const r=i._index,o=i.color,a=i.getPickId(t).color,s=i.outlineColor;let c=Color.floatToByte(o.red),l=Color.floatToByte(o.green),u=Color.floatToByte(o.blue);const d=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u;c=Color.floatToByte(s.red),l=Color.floatToByte(s.green),u=Color.floatToByte(s.blue);const h=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u;c=Color.floatToByte(a.red),l=Color.floatToByte(a.green),u=Color.floatToByte(a.blue);const p=c*LEFT_SHIFT16+l*LEFT_SHIFT8+u,f=Color.floatToByte(o.alpha)*LEFT_SHIFT16+Color.floatToByte(s.alpha)*LEFT_SHIFT8+Color.floatToByte(a.alpha);(0,n[attributeLocations$2.compressedAttribute0])(r,d,h,p,f)}function writeCompressedAttrib1(e,t,n,i){const r=i._index;let o=0,a=1,s=1,c=1;const l=i.translucencyByDistance;defined(l)&&(o=l.near,a=l.nearValue,s=l.far,c=l.farValue,1===a&&1===c||(e._shaderTranslucencyByDistance=!0));let u=i.show&&i.clusterShow;0===i.color.alpha&&0===i.outlineColor.alpha&&(u=!1),a=CesiumMath.clamp(a,0,1),a=1===a?255:255*a|0;const d=(u?1:0)*LEFT_SHIFT8+a;c=CesiumMath.clamp(c,0,1),c=1===c?255:255*c|0;const h=c;(0,n[attributeLocations$2.compressedAttribute1])(r,d,h,o,s)}function writeScaleByDistance(e,t,n,i){const r=i._index,o=n[attributeLocations$2.scaleByDistance];let a=0,s=1,c=1,l=1;const u=i.scaleByDistance;defined(u)&&(a=u.near,s=u.nearValue,c=u.far,l=u.farValue,1===s&&1===l||(e._shaderScaleByDistance=!0)),o(r,a,s,c,l)}function writeDistanceDisplayConditionAndDepthDisable(e,t,n,i){const r=i._index,o=n[attributeLocations$2.distanceDisplayConditionAndDisableDepth];let a=0,s=Number.MAX_VALUE;const c=i.distanceDisplayCondition;defined(c)&&(a=c.near,s=c.far,a*=a,s*=s,e._shaderDistanceDisplayCondition=!0);let l=i.disableDepthTestDistance;l*=l,l>0&&(e._shaderDisableDepthDistance=!0,l===Number.POSITIVE_INFINITY&&(l=-1)),o(r,a,s,l)}function writePointPrimitive(e,t,n,i){writePositionSizeAndOutline(e,t,n,i),writeCompressedAttrib0(e,t,n,i),writeCompressedAttrib1(e,t,n,i),writeScaleByDistance(e,t,n,i),writeDistanceDisplayConditionAndDepthDisable(e,t,n,i)}function recomputeActualPositions(e,t,n,i,r,o){let a;i.mode===SceneMode$1.SCENE3D?(a=e._baseVolume,e._boundingVolumeDirty=!0):a=e._baseVolume2D;const s=[];for(let e=0;e<n;++e){const n=t[e],c=n.position,l=PointPrimitive._computeActualPosition(c,i,r);defined(l)&&(n._setActualPosition(l),o?s.push(l):BoundingSphere.expand(a,l,a))}o&&BoundingSphere.fromPoints(s,a)}function updateMode(e,t){const n=t.mode,i=e._pointPrimitives,r=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==SceneMode$1.SCENE3D&&!Matrix4.equals(o,e.modelMatrix)?(e._mode=n,Matrix4.clone(e.modelMatrix,o),e._createVertexArray=!0,n!==SceneMode$1.SCENE3D&&n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,i,i.length,t,o,!0)):n===SceneMode$1.MORPHING?recomputeActualPositions(e,i,i.length,t,o,!0):n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,r,e._pointPrimitivesToUpdateIndex,t,o,!1)}function updateBoundingVolume(e,t,n){const i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=i}const scratchWriterArray$1=[];function sortKD(e,t,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;select(e,t,a,i,r,o%2),sortKD(e,t,n,i,a-1,o+1),sortKD(e,t,n,a+1,r,o+1)}function select(e,t,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,c=Math.log(a),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(a-l)/a)*(s-a/2<0?-1:1);select(e,t,n,Math.max(i,Math.floor(n-s*l/a+u)),Math.min(r,Math.floor(n+(a-s)*l/a+u)),o)}const a=t[2*n+o];let s=i,c=r;for(swapItem(e,t,i,n),t[2*r+o]>a&&swapItem(e,t,i,r);s<c;){for(swapItem(e,t,s,c),s++,c--;t[2*s+o]<a;)s++;for(;t[2*c+o]>a;)c--}t[2*i+o]===a?swapItem(e,t,i,c):(c++,swapItem(e,t,c,r)),c<=n&&(i=c+1),n<=c&&(r=c-1)}}function swapItem(e,t,n,i){swap(e,n,i),swap(t,2*n,2*i),swap(t,2*n+1,2*i+1)}function swap(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function range(e,t,n,i,r,o,a){const s=[0,e.length-1,0],c=[];let l,u;for(;s.length;){const d=s.pop(),h=s.pop(),p=s.pop();if(h-p<=a){for(let a=p;a<=h;a++)l=t[2*a],u=t[2*a+1],l>=n&&l<=r&&u>=i&&u<=o&&c.push(e[a]);continue}const f=Math.floor((p+h)/2);l=t[2*f],u=t[2*f+1],l>=n&&l<=r&&u>=i&&u<=o&&c.push(e[f]);const m=(d+1)%2;(0===d?n<=l:i<=u)&&(s.push(p),s.push(f-1),s.push(m)),(0===d?r>=l:o>=u)&&(s.push(f+1),s.push(h),s.push(m))}return c}function within(e,t,n,i,r,o){const a=[0,e.length-1,0],s=[],c=r*r;for(;a.length;){const l=a.pop(),u=a.pop(),d=a.pop();if(u-d<=o){for(let r=d;r<=u;r++)sqDist(t[2*r],t[2*r+1],n,i)<=c&&s.push(e[r]);continue}const h=Math.floor((d+u)/2),p=t[2*h],f=t[2*h+1];sqDist(p,f,n,i)<=c&&s.push(e[h]);const m=(l+1)%2;(0===l?n-r<=p:i-r<=f)&&(a.push(d),a.push(h-1),a.push(m)),(0===l?n+r>=p:i+r>=f)&&(a.push(h+1),a.push(u),a.push(m))}return s}function sqDist(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}PointPrimitiveCollection.prototype.update=function(e){if(removePointPrimitives(this),!this.show)return;this._maxTotalPointSize=ContextLimits.maximumAliasedPointSize,updateMode(this,e);const t=this._pointPrimitives.length,n=this._pointPrimitivesToUpdate,i=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,o=this._createVertexArray;let a;const s=e.context,c=e.passes,l=c.pick;if(o||!l&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<NUMBER_OF_PROPERTIES$1;++e)r[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),t>0){this._vaf=createVAF$1(s,t,this._buffersUsage),a=this._vaf.writers;for(let e=0;e<t;++e){const t=this._pointPrimitives[e];t._dirty=!1,writePointPrimitive(this,s,a,t)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(i>0){const e=scratchWriterArray$1;e.length=0,(r[POSITION_INDEX$2]||r[OUTLINE_WIDTH_INDEX]||r[PIXEL_SIZE_INDEX])&&e.push(writePositionSizeAndOutline),(r[COLOR_INDEX$2]||r[OUTLINE_COLOR_INDEX])&&e.push(writeCompressedAttrib0),(r[SHOW_INDEX$2]||r[TRANSLUCENCY_BY_DISTANCE_INDEX])&&e.push(writeCompressedAttrib1),r[SCALE_BY_DISTANCE_INDEX]&&e.push(writeScaleByDistance),(r[DISTANCE_DISPLAY_CONDITION_INDEX]||r[DISABLE_DEPTH_DISTANCE_INDEX])&&e.push(writeDistanceDisplayConditionAndDepthDisable);const o=e.length;if(a=this._vaf.writers,i/t>.1){for(let t=0;t<i;++t){const i=n[t];i._dirty=!1;for(let t=0;t<o;++t)e[t](this,s,a,i)}this._vaf.commit()}else{for(let t=0;t<i;++t){const i=n[t];i._dirty=!1;for(let t=0;t<o;++t)e[t](this,s,a,i);this._vaf.subCommit(i._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(i>1.5*t&&(n.length=t),!defined(this._vaf)||!defined(this._vaf.va))return;let u;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let d=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D?(d=this.modelMatrix,u=BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):u=BoundingSphere.clone(this._baseVolume2D,this._boundingVolume),updateBoundingVolume(this,e,u);const h=this._blendOption!==this.blendOption;let p,f,m,g,_,y;this._blendOption=this.blendOption,h&&(this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance,(h||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(p=new ShaderSource({sources:[PointPrimitiveCollectionVS]}),this._shaderScaleByDistance&&p.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&p.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&p.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&p.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(f=new ShaderSource({defines:["OPAQUE"],sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2}),f=new ShaderSource({defines:["TRANSLUCENT"],sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.OPAQUE&&(f=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._blendOption===BlendOption$1.TRANSLUCENT&&(f=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:attributeLocations$2})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);const C=e.commandList;if(c.render||l){const e=this._colorCommands,t=this._blendOption===BlendOption$1.OPAQUE,n=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT;m=this._vaf.va,g=m.length,e.length=g;const i=n?2*g:g;for(y=0;y<i;++y){const i=t||n&&y%2==0;_=e[y],defined(_)||(_=e[y]=new DrawCommand),_.primitiveType=PrimitiveType$1.POINTS,_.pass=i||!n?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,_.owner=this;const r=n?Math.floor(y/2):y;_.boundingVolume=u,_.modelMatrix=d,_.shaderProgram=i?this._sp:this._spTranslucent,_.uniformMap=this._uniforms,_.vertexArray=m[r].va,_.renderState=i?this._rsOpaque:this._rsTranslucent,_.debugShowBoundingVolume=this.debugShowBoundingVolume,_.pickId="v_pickColor",C.push(_)}}},PointPrimitiveCollection.prototype.isDestroyed=function(){return!1},PointPrimitiveCollection.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyPointPrimitives(this._pointPrimitives),destroyObject(this)};const defaultGetX=e=>e[0],defaultGetY=e=>e[1];class KDBush{constructor(e,t=defaultGetX,n=defaultGetY,i=64,r=Float64Array){this.nodeSize=i,this.points=e;const o=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(e.length),s=this.coords=new r(2*e.length);for(let i=0;i<e.length;i++)a[i]=i,s[2*i]=t(e[i]),s[2*i+1]=n(e[i]);sortKD(a,s,i,0,a.length-1,0)}range(e,t,n,i){return range(this.ids,this.coords,e,t,n,i,this.nodeSize)}within(e,t,n){return within(this.ids,this.coords,e,t,n,this.nodeSize)}}function EntityCluster(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._enabled=defaultValue(e.enabled,!1),this._pixelRange=defaultValue(e.pixelRange,80),this._minimumClusterSize=defaultValue(e.minimumClusterSize,2),this._clusterBillboards=defaultValue(e.clusterBillboards,!0),this._clusterLabels=defaultValue(e.clusterLabels,!0),this._clusterPoints=defaultValue(e.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=defaultValue(e.show,!0)}function getX(e){return e.coord.x}function getY(e){return e.coord.y}function expandBoundingBox(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const labelBoundingBoxScratch=new BoundingRectangle;function getBoundingBox(e,t,n,i,r){if(defined(e._labelCollection)&&i._clusterLabels?r=Label.getScreenSpaceBoundingBox(e,t,r):defined(e._billboardCollection)&&i._clusterBillboards?r=Billboard.getScreenSpaceBoundingBox(e,t,r):defined(e._pointPrimitiveCollection)&&i._clusterPoints&&(r=PointPrimitive.getScreenSpaceBoundingBox(e,t,r)),expandBoundingBox(r,n),i._clusterLabels&&!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(i,e.id.id)&&defined(e.id._label)){const o=i._collectionIndicesByEntity[e.id.id].labelIndex,a=i._labelCollection.get(o),s=Label.getScreenSpaceBoundingBox(a,t,labelBoundingBoxScratch);expandBoundingBox(s,n),r=BoundingRectangle.union(r,s,r)}return r}function addNonClusteredItem(e,t){if(e.clusterShow=!0,!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(t,e.id.id)&&defined(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex;t._labelCollection.get(n).clusterShow=!0}}function addCluster(e,t,n,i){const r={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};r.billboard.show=!1,r.point.show=!1,r.label.show=!0,r.label.text=t.toLocaleString(),r.label.id=n,r.billboard.position=r.label.position=r.point.position=e,i._clusterEvent.raiseEvent(n,r)}function hasLabelIndex(e,t){return defined(e)&&defined(e._collectionIndicesByEntity[t])&&defined(e._collectionIndicesByEntity[t].labelIndex)}function getScreenSpacePositions(e,t,n,i,r){if(!defined(e))return;const o=e.length;for(let a=0;a<o;++a){const o=e.get(a);if(o.clusterShow=!1,!o.show||r._scene.mode===SceneMode$1.SCENE3D&&!i.isPointVisible(o.position))continue;const s=r._clusterLabels&&defined(o._labelCollection),c=r._clusterBillboards&&defined(o.id._billboard),l=r._clusterPoints&&defined(o.id._point);if(s&&(l||c))continue;const u=o.computeScreenSpacePosition(n);defined(u)&&t.push({index:a,collection:e,clustered:!1,coord:u})}}const pointBoundinRectangleScratch=new BoundingRectangle,totalBoundingRectangleScratch=new BoundingRectangle,neighborBoundingRectangleScratch=new BoundingRectangle;function createDeclutterCallback(e){return function(t){if(defined(t)&&t<.05||!e.enabled)return;const n=e._scene,i=e._labelCollection,r=e._billboardCollection,o=e._pointCollection;if(!defined(i)&&!defined(r)&&!defined(o)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let a=e._clusterLabelCollection,s=e._clusterBillboardCollection,c=e._clusterPointCollection;defined(a)?a.removeAll():a=e._clusterLabelCollection=new LabelCollection({scene:n}),defined(s)?s.removeAll():s=e._clusterBillboardCollection=new BillboardCollection({scene:n}),defined(c)?c.removeAll():c=e._clusterPointCollection=new PointPrimitiveCollection;const l=e._pixelRange,u=e._minimumClusterSize,d=e._previousClusters,h=[],p=e._previousHeight,f=n.camera.positionCartographic.height,m=new EllipsoidalOccluder(n.mapProjection.ellipsoid,n.camera.positionWC),g=[];let _,y,C,T,S,A,v,E,b,x,P,D;e._clusterLabels&&getScreenSpacePositions(i,g,n,m,e),e._clusterBillboards&&getScreenSpacePositions(r,g,n,m,e),e._clusterPoints&&getScreenSpacePositions(o,g,n,m,e);const w=new KDBush(g,getX,getY,64,Int32Array);if(f<p)for(C=d.length,_=0;_<C;++_){const t=d[_];if(!m.isPointVisible(t.position))continue;const i=Billboard._computeScreenSpacePosition(Matrix4.IDENTITY,t.position,Cartesian3.ZERO,Cartesian2.ZERO,n);if(!defined(i))continue;const r=1-f/p;let o=t.width=t.width*r,a=t.height=t.height*r;o=Math.max(o,t.minimumWidth),a=Math.max(a,t.minimumHeight);const s=i.x-.5*o,c=i.y-.5*a,l=i.x+o,C=i.y+a;for(S=w.range(s,c,l,C),A=S.length,x=0,b=[],y=0;y<A;++y)v=S[y],E=g[v],E.clustered||(++x,P=E.collection,D=E.index,b.push(P.get(D).id));if(x>=u)for(addCluster(t.position,x,b,e),h.push(t),y=0;y<A;++y)g[S[y]].clustered=!0}for(C=g.length,_=0;_<C;++_){const t=g[_];if(t.clustered)continue;t.clustered=!0,P=t.collection,D=t.index;const n=P.get(D);T=getBoundingBox(n,t.coord,l,e,pointBoundinRectangleScratch);const i=BoundingRectangle.clone(T,totalBoundingRectangleScratch);S=w.range(T.x,T.y,T.x+T.width,T.y+T.height),A=S.length;const r=Cartesian3.clone(n.position);for(x=1,b=[n.id],y=0;y<A;++y)if(v=S[y],E=g[v],!E.clustered){const t=E.collection.get(E.index),n=getBoundingBox(t,E.coord,l,e,neighborBoundingRectangleScratch);Cartesian3.add(t.position,r,r),BoundingRectangle.union(i,n,i),++x,b.push(t.id)}if(x>=u){const t=Cartesian3.multiplyByScalar(r,1/x,r);for(addCluster(t,x,b,e),h.push({position:t,width:i.width,height:i.height,minimumWidth:T.width,minimumHeight:T.height}),y=0;y<A;++y)g[S[y]].clustered=!0}else addNonClusteredItem(n,e)}0===a.length&&(a.destroy(),e._clusterLabelCollection=void 0),0===s.length&&(s.destroy(),e._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),e._clusterPointCollection=void 0),e._previousClusters=h,e._previousHeight=f}}function createGetEntity(e,t,n,i){return function(r){let o=this[e];defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let a,s,c=this._collectionIndicesByEntity[r.id];if(defined(c)||(c=this._collectionIndicesByEntity[r.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),defined(o)&&defined(c[i]))return o.get(c[i]);defined(o)||(o=this[e]=new t({scene:this._scene}));const l=this[n];return l.length>0?(a=l.pop(),s=o.get(a)):(s=o.add(),a=o.length-1),c[i]=a,this._clusterDirty=!0,s}}function removeEntityIndicesIfUnused(e,t){const n=e._collectionIndicesByEntity[t];defined(n.billboardIndex)||defined(n.labelIndex)||defined(n.pointIndex)||delete e._collectionIndicesByEntity[t]}function disableCollectionClustering(e){if(!defined(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function updateEnable(e){e.enabled||(defined(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),defined(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),defined(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,disableCollectionClustering(e._labelCollection),disableCollectionClustering(e._billboardCollection),disableCollectionClustering(e._pointCollection))}function CustomDataSource(e){this._name=e,this._clock=void 0,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster}EntityCluster.prototype._initialize=function(e){this._scene=e;const t=createDeclutterCallback(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)},Object.defineProperties(EntityCluster.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),EntityCluster.prototype.getLabel=createGetEntity("_labelCollection",LabelCollection,"_unusedLabelIndices","labelIndex"),EntityCluster.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._labelCollection)||!defined(t)||!defined(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0},EntityCluster.prototype.getBillboard=createGetEntity("_billboardCollection",BillboardCollection,"_unusedBillboardIndices","billboardIndex"),EntityCluster.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._billboardCollection)||!defined(t)||!defined(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0},EntityCluster.prototype.getPoint=createGetEntity("_pointCollection",PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),EntityCluster.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!defined(this._pointCollection)||!defined(t)||!defined(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,removeEntityIndicesIfUnused(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0},EntityCluster.prototype.update=function(e){if(!this.show)return;let t;defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),defined(this._billboardCollection)&&this._billboardCollection.length>0&&!defined(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,updateEnable(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),defined(this._clusterPointCollection)&&this._clusterPointCollection.update(e),defined(this._labelCollection)&&this._labelCollection.update(e),defined(this._billboardCollection)&&this._billboardCollection.update(e),defined(this._pointCollection)&&this._pointCollection.update(e)},EntityCluster.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1},Object.defineProperties(CustomDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){DataSource.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}}}),CustomDataSource.prototype.update=function(e){return!0};const defaultOffset$8=Cartesian3.ZERO,offsetScratch$7=new Cartesian3,positionScratch$4=new Cartesian3,scratchColor$c=new Color;function CylinderGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function CylinderGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CylinderGeometryOptions(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}function DynamicCylinderGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}function DataSourceClock(){this._definitionChanged=new Event,this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0}defined(Object.create)&&(CylinderGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),CylinderGeometryUpdater.prototype.constructor=CylinderGeometryUpdater),Object.defineProperties(CylinderGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),CylinderGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:i,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$c)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:t,geometry:new CylinderGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$c),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$8,offsetScratch$7))),new GeometryInstance({id:t,geometry:new CylinderOutlineGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},CylinderGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.length)||!defined(t.topRadius)||!defined(t.bottomRadius)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CylinderGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.length.isConstant&&t.topRadius.isConstant&&t.bottomRadius.isConstant&&Property.isConstant(t.slices)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.numberOfVerticalLines))},CylinderGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(Iso8601.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(Iso8601.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(Iso8601.MINIMUM_VALUE),i.slices=Property.getValueOrUndefined(t.slices,Iso8601.MINIMUM_VALUE),i.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),i.offsetAttribute=n!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},CylinderGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,CylinderGeometryUpdater.DynamicGeometryUpdater=DynamicCylinderGeometryUpdater,defined(Object.create)&&(DynamicCylinderGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicCylinderGeometryUpdater.prototype.constructor=DynamicCylinderGeometryUpdater),DynamicCylinderGeometryUpdater.prototype._isHidden=function(e,t,n){const i=this._options;return!defined(Property.getValueOrUndefined(e.position,n,positionScratch$4))||!defined(i.length)||!defined(i.topRadius)||!defined(i.bottomRadius)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicCylinderGeometryUpdater.prototype._setOptions=function(e,t,n){const i=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE),r=this._options;r.length=Property.getValueOrUndefined(t.length,n),r.topRadius=Property.getValueOrUndefined(t.topRadius,n),r.bottomRadius=Property.getValueOrUndefined(t.bottomRadius,n),r.slices=Property.getValueOrUndefined(t.slices,n),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,n),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},Object.defineProperties(DataSourceClock.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:createRawPropertyDescriptor("startTime"),stopTime:createRawPropertyDescriptor("stopTime"),currentTime:createRawPropertyDescriptor("currentTime"),clockRange:createRawPropertyDescriptor("clockRange"),clockStep:createRawPropertyDescriptor("clockStep"),multiplier:createRawPropertyDescriptor("multiplier")}),DataSourceClock.prototype.clone=function(e){return defined(e)||(e=new DataSourceClock),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e},DataSourceClock.prototype.equals=function(e){return this===e||defined(e)&&JulianDate.equals(this.startTime,e.startTime)&&JulianDate.equals(this.stopTime,e.stopTime)&&JulianDate.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier},DataSourceClock.prototype.merge=function(e){this.startTime=defaultValue(this.startTime,e.startTime),this.stopTime=defaultValue(this.stopTime,e.stopTime),this.currentTime=defaultValue(this.currentTime,e.currentTime),this.clockRange=defaultValue(this.clockRange,e.clockRange),this.clockStep=defaultValue(this.clockStep,e.clockStep),this.multiplier=defaultValue(this.multiplier,e.multiplier)},DataSourceClock.prototype.getValue=function(e){return defined(e)||(e=new Clock),e.startTime=defaultValue(this.startTime,e.startTime),e.stopTime=defaultValue(this.stopTime,e.stopTime),e.currentTime=defaultValue(this.currentTime,e.currentTime),e.clockRange=defaultValue(this.clockRange,e.clockRange),e.multiplier=defaultValue(this.multiplier,e.multiplier),e.clockStep=defaultValue(this.clockStep,e.clockStep),e};const defaultColor$6=Color.WHITE,defaultCellAlpha=.1,defaultLineCount=new Cartesian2(8,8),defaultLineOffset=new Cartesian2(0,0),defaultLineThickness=new Cartesian2(1,1);function GridMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset}function PolylineArrowMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(GridMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._cellAlpha)&&Property.isConstant(this._lineCount)&&Property.isConstant(this._lineThickness)&&Property.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),cellAlpha:createPropertyDescriptor("cellAlpha"),lineCount:createPropertyDescriptor("lineCount"),lineThickness:createPropertyDescriptor("lineThickness"),lineOffset:createPropertyDescriptor("lineOffset")}),GridMaterialProperty.prototype.getType=function(e){return"Grid"},GridMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$6,t.color),t.cellAlpha=Property.getValueOrDefault(this._cellAlpha,e,defaultCellAlpha),t.lineCount=Property.getValueOrClonedDefault(this._lineCount,e,defaultLineCount,t.lineCount),t.lineThickness=Property.getValueOrClonedDefault(this._lineThickness,e,defaultLineThickness,t.lineThickness),t.lineOffset=Property.getValueOrClonedDefault(this._lineOffset,e,defaultLineOffset,t.lineOffset),t},GridMaterialProperty.prototype.equals=function(e){return this===e||e instanceof GridMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._cellAlpha,e._cellAlpha)&&Property.equals(this._lineCount,e._lineCount)&&Property.equals(this._lineThickness,e._lineThickness)&&Property.equals(this._lineOffset,e._lineOffset)},Object.defineProperties(PolylineArrowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),PolylineArrowMaterialProperty.prototype.getType=function(e){return"PolylineArrow"},PolylineArrowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},PolylineArrowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineArrowMaterialProperty&&Property.equals(this._color,e._color)};const defaultColor$5=Color.WHITE,defaultGapColor=Color.TRANSPARENT,defaultDashLength=16,defaultDashPattern=255;function PolylineDashMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._gapColor=void 0,this._gapColorSubscription=void 0,this._dashLength=void 0,this._dashLengthSubscription=void 0,this._dashPattern=void 0,this._dashPatternSubscription=void 0,this.color=e.color,this.gapColor=e.gapColor,this.dashLength=e.dashLength,this.dashPattern=e.dashPattern}Object.defineProperties(PolylineDashMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._gapColor)&&Property.isConstant(this._dashLength)&&Property.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),gapColor:createPropertyDescriptor("gapColor"),dashLength:createPropertyDescriptor("dashLength"),dashPattern:createPropertyDescriptor("dashPattern")}),PolylineDashMaterialProperty.prototype.getType=function(e){return"PolylineDash"},PolylineDashMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$5,t.color),t.gapColor=Property.getValueOrClonedDefault(this._gapColor,e,defaultGapColor,t.gapColor),t.dashLength=Property.getValueOrDefault(this._dashLength,e,defaultDashLength,t.dashLength),t.dashPattern=Property.getValueOrDefault(this._dashPattern,e,defaultDashPattern,t.dashPattern),t},PolylineDashMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineDashMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._gapColor,e._gapColor)&&Property.equals(this._dashLength,e._dashLength)&&Property.equals(this._dashPattern,e._dashPattern)};const defaultColor$4=Color.WHITE,defaultGlowPower=.25,defaultTaperPower=1;function PolylineGlowMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this._taperPower=void 0,this._taperPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower,this.taperPower=e.taperPower}Object.defineProperties(PolylineGlowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),glowPower:createPropertyDescriptor("glowPower"),taperPower:createPropertyDescriptor("taperPower")}),PolylineGlowMaterialProperty.prototype.getType=function(e){return"PolylineGlow"},PolylineGlowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$4,t.color),t.glowPower=Property.getValueOrDefault(this._glowPower,e,defaultGlowPower,t.glowPower),t.taperPower=Property.getValueOrDefault(this._taperPower,e,defaultTaperPower,t.taperPower),t},PolylineGlowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineGlowMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._glowPower,e._glowPower)&&Property.equals(this._taperPower,e._taperPower)};const defaultColor$3=Color.WHITE,defaultOutlineColor$2=Color.BLACK,defaultOutlineWidth$2=1;function PolylineOutlineMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth}function PositionPropertyArray(e,t){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED),this.setValue(e)}function PropertyArray(e){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this.setValue(e)}function resolve(e){let t=e._targetProperty;if(!defined(t)){let n=e._targetEntity;if(!defined(n)){if(n=e._targetCollection.getById(e._targetId),!defined(n))return void(e._targetEntity=e._targetProperty=void 0);n.definitionChanged.addEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}const i=e._targetPropertyNames;t=e._targetEntity;for(let e=0,n=i.length;e<n&&defined(t);++e)t=t[i[e]];e._targetProperty=t}return t}function ReferenceProperty(e,t,n){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Event,e.collectionChanged.addEventListener(ReferenceProperty.prototype._onCollectionChanged,this)}Object.defineProperties(PolylineOutlineMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._outlineColor)&&Property.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth")}),PolylineOutlineMaterialProperty.prototype.getType=function(e){return"PolylineOutline"},PolylineOutlineMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$3,t.color),t.outlineColor=Property.getValueOrClonedDefault(this._outlineColor,e,defaultOutlineColor$2,t.outlineColor),t.outlineWidth=Property.getValueOrDefault(this._outlineWidth,e,defaultOutlineWidth$2),t},PolylineOutlineMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineOutlineMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._outlineColor,e._outlineColor)&&Property.equals(this._outlineWidth,e._outlineWidth)},Object.defineProperties(PositionPropertyArray.prototype,{isConstant:{get:function(){const e=this._value;if(!defined(e))return!0;const t=e.length;for(let n=0;n<t;n++)if(!Property.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),PositionPropertyArray.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},PositionPropertyArray.prototype.getValueInReferenceFrame=function(e,t,n){const i=this._value;if(!defined(i))return;const r=i.length;defined(n)||(n=new Array(r));let o=0,a=0;for(;o<r;){const r=i[o].getValueInReferenceFrame(e,t,n[o]);defined(r)&&(n[a]=r,a++),o++}return n.length=a,n},PositionPropertyArray.prototype.setValue=function(e){const t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();const n=e.length;for(let i=0;i<n;i++){const n=e[i];defined(n)&&t.add(n.definitionChanged,PositionPropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PositionPropertyArray.prototype.equals=function(e){return this===e||e instanceof PositionPropertyArray&&this._referenceFrame===e._referenceFrame&&Property.arrayEquals(this._value,e._value)},PositionPropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(PropertyArray.prototype,{isConstant:{get:function(){const e=this._value;if(!defined(e))return!0;const t=e.length;for(let n=0;n<t;n++)if(!Property.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyArray.prototype.getValue=function(e,t){const n=this._value;if(!defined(n))return;const i=n.length;defined(t)||(t=new Array(i));let r=0,o=0;for(;r<i;){const n=this._value[r].getValue(e,t[r]);defined(n)&&(t[o]=n,o++),r++}return t.length=o,t},PropertyArray.prototype.setValue=function(e){const t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();const n=e.length;for(let i=0;i<n;i++){const n=e[i];defined(n)&&t.add(n.definitionChanged,PropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PropertyArray.prototype.equals=function(e){return this===e||e instanceof PropertyArray&&Property.arrayEquals(this._value,e._value)},PropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(ReferenceProperty.prototype,{isConstant:{get:function(){return Property.isConstant(resolve(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=resolve(this);return defined(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return resolve(this)}}}),ReferenceProperty.fromString=function(e,t){let n;const i=[];let r=!0,o=!1,a="";for(let e=0;e<t.length;++e){const s=t.charAt(e);o?(a+=s,o=!1):"\\"===s?o=!0:r&&"#"===s?(n=a,r=!1,a=""):r||"."!==s?a+=s:(i.push(a),a="")}return i.push(a),new ReferenceProperty(e,n,i)},ReferenceProperty.prototype.getValue=function(e,t){const n=resolve(this);return defined(n)?n.getValue(e,t):void 0},ReferenceProperty.prototype.getValueInReferenceFrame=function(e,t,n){const i=resolve(this);return defined(i)?i.getValueInReferenceFrame(e,t,n):void 0},ReferenceProperty.prototype.getType=function(e){const t=resolve(this);return defined(t)?t.getType(e):void 0},ReferenceProperty.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;const i=this._targetPropertyNames.length;for(let e=0;e<i;e++)if(t[e]!==n[e])return!1;return!0},ReferenceProperty.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){defined(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))},ReferenceProperty.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;defined(i)&&-1!==n.indexOf(i)?(i.definitionChanged.removeEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):defined(i)||(i=resolve(this),defined(i)&&this._definitionChanged.raiseEvent(this))};const Rotation={packedLength:1,pack:function(e,t,n){return t[n=defaultValue(n,0)]=e,t},unpack:function(e,t,n){return e[t=defaultValue(t,0)]},convertPackedArrayForInterpolation:function(e,t,n,i){let r;defined(i)||(i=[]),t=defaultValue(t,0);for(let o=0,a=(n=defaultValue(n,e.length))-t+1;o<a;o++){const n=e[t+o];0===o||Math.abs(r-n)<Math.PI?i[o]=n:i[o]=n-CesiumMath.TWO_PI,r=n}},unpackInterpolationResult:function(e,t,n,i,r){return(r=e[0])<0?r+CesiumMath.TWO_PI:r}},PackableNumber={packedLength:1,pack:function(e,t,n){t[n=defaultValue(n,0)]=e},unpack:function(e,t,n){return e[t=defaultValue(t,0)]}};function arrayInsert(e,t,n){let i;const r=e.length,o=n.length,a=r+o;if(e.length=a,r!==t){let n=r-1;for(i=a-1;i>=t;i--)e[i]=e[n--]}for(i=0;i<o;i++)e[t++]=n[i]}function convertDate(e,t){return e instanceof JulianDate?e:"string"==typeof e?JulianDate.fromIso8601(e):JulianDate.addSeconds(t,e,new JulianDate)}const timesSpliceArgs=[],valuesSpliceArgs=[];function mergeNewSamples(e,t,n,i,r){let o,a,s,c,l,u,d=0;for(;d<i.length;){l=convertDate(i[d],e),s=binarySearch(t,l,JulianDate.compare);let h=0,p=0;if(s<0){for(s=~s,c=s*r,a=void 0,u=t[s];d<i.length&&(l=convertDate(i[d],e),!(defined(a)&&JulianDate.compare(a,l)>=0||defined(u)&&JulianDate.compare(l,u)>=0));){for(timesSpliceArgs[h++]=l,d+=1,o=0;o<r;o++)valuesSpliceArgs[p++]=i[d],d+=1;a=l}h>0&&(valuesSpliceArgs.length=p,arrayInsert(n,c,valuesSpliceArgs),timesSpliceArgs.length=h,arrayInsert(t,s,timesSpliceArgs))}else{for(o=0;o<r;o++)d++,n[s*r+o]=i[d];d++}}}function SampledProperty(e,t){let n=e;n===Number&&(n=PackableNumber);let i,r=n.packedLength,o=defaultValue(n.packedInterpolationLength,r),a=0;if(defined(t)){const e=t.length;i=new Array(e);for(let n=0;n<e;n++){let e=t[n];e===Number&&(e=PackableNumber);const a=e.packedLength;r+=a,o+=defaultValue(e.packedInterpolationLength,a),i[n]=e}a=e}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=LinearApproximation,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=r,this._packedInterpolationLength=o,this._updateTableLength=!0,this._interpolationResult=new Array(o),this._definitionChanged=new Event,this._derivativeTypes=t,this._innerDerivativeTypes=i,this._inputOrder=a,this._forwardExtrapolationType=ExtrapolationType$1.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=ExtrapolationType$1.NONE,this._backwardExtrapolationDuration=0}function removeSamples(e,t,n){const i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}function SampledPositionProperty(e,t){let n;if((t=defaultValue(t,0))>0){n=new Array(t);for(let e=0;e<t;e++)n[e]=Cartesian3}this._numberOfDerivatives=t,this._property=new SampledProperty(Cartesian3,n),this._definitionChanged=new Event,this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._property._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)}Object.defineProperties(SampledProperty.prototype,{isConstant:{get:function(){return 0===this._values.length}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}}),SampledProperty.prototype.getValue=function(e,t){const n=this._times,i=n.length;if(0===i)return;let r;const o=this._innerType,a=this._values;let s=binarySearch(n,e,JulianDate.compare);if(s<0){if(s=~s,0===s){const i=n[s];if(r=this._backwardExtrapolationDuration,this._backwardExtrapolationType===ExtrapolationType$1.NONE||0!==r&&JulianDate.secondsDifference(i,e)>r)return;if(this._backwardExtrapolationType===ExtrapolationType$1.HOLD)return o.unpack(a,0,t)}if(s>=i){s=i-1;const c=n[s];if(r=this._forwardExtrapolationDuration,this._forwardExtrapolationType===ExtrapolationType$1.NONE||0!==r&&JulianDate.secondsDifference(e,c)>r)return;if(this._forwardExtrapolationType===ExtrapolationType$1.HOLD)return s=i-1,o.unpack(a,s*o.packedLength,t)}const c=this._xTable,l=this._yTable,u=this._interpolationAlgorithm,d=this._packedInterpolationLength,h=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const e=Math.min(u.getRequiredDataPoints(this._interpolationDegree,h),i);e!==this._numberOfPoints&&(this._numberOfPoints=e,c.length=e,l.length=e*d)}const p=this._numberOfPoints-1;if(p<1)return;let f=0,m=i-1;if(m-f+1>=p+1){let e=s-(p/2|0)-1;e<f&&(e=f);let t=e+p;t>m&&(t=m,e=t-p,e<f&&(e=f)),f=e,m=t}const g=m-f+1;for(let e=0;e<g;++e)c[e]=JulianDate.secondsDifference(n[f+e],n[m]);if(defined(o.convertPackedArrayForInterpolation))o.convertPackedArrayForInterpolation(a,f,m,l);else{let e=0;const t=this._packedLength;let n=f*t;const i=(m+1)*t;for(;n<i;)l[e]=a[n],n++,e++}const _=JulianDate.secondsDifference(e,n[m]);let y;if(0!==h&&defined(u.interpolate)){const e=Math.floor(d/(h+1));y=u.interpolate(_,c,l,e,h,h,this._interpolationResult)}else y=u.interpolateOrderZero(_,c,l,d,this._interpolationResult);return defined(o.unpackInterpolationResult)?o.unpackInterpolationResult(y,a,f,m,t):o.unpack(y,0,t)}return o.unpack(a,s*this._packedLength,t)},SampledProperty.prototype.setInterpolationOptions=function(e){if(!defined(e))return;let t=!1;const n=e.interpolationAlgorithm,i=e.interpolationDegree;defined(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),defined(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))},SampledProperty.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,r=defined(i),o=this._innerType,a=[];if(a.push(e),o.pack(t,a,a.length),r){const e=i.length;for(let t=0;t<e;t++)i[t].pack(n[t],a,a.length)}mergeNewSamples(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,r=defined(i),o=this._innerType,a=e.length,s=[];for(let c=0;c<a;c++)if(s.push(e[c]),o.pack(t[c],s,s.length),r){const e=n[c],t=i.length;for(let n=0;n<t;n++)i[n].pack(e[n],s,s.length)}mergeNewSamples(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamplesPackedArray=function(e,t){mergeNewSamples(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.removeSample=function(e){const t=binarySearch(this._times,e,JulianDate.compare);return!(t<0)&&(removeSamples(this,t,1),!0)},SampledProperty.prototype.removeSamples=function(e){const t=this._times;let n=binarySearch(t,e.start,JulianDate.compare);n<0?n=~n:e.isStartIncluded||++n;let i=binarySearch(t,e.stop,JulianDate.compare);i<0?i=~i:e.isStopIncluded&&++i,removeSamples(this,n,i-n)},SampledProperty.prototype.equals=function(e){if(this===e)return!0;if(!defined(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,n=defined(t),i=e._derivativeTypes;if(n!==defined(i))return!1;let r,o;if(n){if(o=t.length,o!==i.length)return!1;for(r=0;r<o;r++)if(t[r]!==i[r])return!1}const a=this._times,s=e._times;if(o=a.length,o!==s.length)return!1;for(r=0;r<o;r++)if(!JulianDate.equals(a[r],s[r]))return!1;const c=this._values,l=e._values;for(o=c.length,r=0;r<o;r++)if(c[r]!==l[r])return!1;return!0},SampledProperty._mergeNewSamples=mergeNewSamples,Object.defineProperties(SampledPositionProperty.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}}}),SampledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},SampledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,n){if(defined(n=this._property.getValue(e,n)))return PositionProperty.convertToReferenceFrame(e,n,this._referenceFrame,t,n)},SampledPositionProperty.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},SampledPositionProperty.prototype.addSample=function(e,t,n){this._numberOfDerivatives,this._property.addSample(e,t,n)},SampledPositionProperty.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)},SampledPositionProperty.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},SampledPositionProperty.prototype.removeSample=function(e){return this._property.removeSample(e)},SampledPositionProperty.prototype.removeSamples=function(e){this._property.removeSamples(e)},SampledPositionProperty.prototype.equals=function(e){return this===e||e instanceof SampledPositionProperty&&Property.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};const StripeOrientation={HORIZONTAL:0,VERTICAL:1};var StripeOrientation$1=Object.freeze(StripeOrientation);const defaultOrientation=StripeOrientation$1.HORIZONTAL,defaultEvenColor=Color.WHITE,defaultOddColor=Color.BLACK,defaultOffset$7=0,defaultRepeat=1;function StripeMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,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}function TimeIntervalCollectionPositionProperty(e){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionPositionProperty.prototype._intervalsChanged,this),this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED)}function TimeIntervalCollectionProperty(){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionProperty.prototype._intervalsChanged,this)}function VelocityVectorProperty(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new Event,this._normalize=defaultValue(t,!0),this.position=e}Object.defineProperties(StripeMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._orientation)&&Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._offset)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:createPropertyDescriptor("orientation"),evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),offset:createPropertyDescriptor("offset"),repeat:createPropertyDescriptor("repeat")}),StripeMaterialProperty.prototype.getType=function(e){return"Stripe"},StripeMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.horizontal=Property.getValueOrDefault(this._orientation,e,defaultOrientation)===StripeOrientation$1.HORIZONTAL,t.evenColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor,t.evenColor),t.oddColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor,t.oddColor),t.offset=Property.getValueOrDefault(this._offset,e,defaultOffset$7),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat),t},StripeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof StripeMaterialProperty&&Property.equals(this._orientation,e._orientation)&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._offset,e._offset)&&Property.equals(this._repeat,e._repeat)},Object.defineProperties(TimeIntervalCollectionPositionProperty.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}}}),TimeIntervalCollectionPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame=function(e,t,n){const i=this._intervals.findDataForIntervalContainingDate(e);if(defined(i))return PositionProperty.convertToReferenceFrame(e,i,this._referenceFrame,t,n)},TimeIntervalCollectionPositionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionPositionProperty&&this._intervals.equals(e._intervals,Property.equals)&&this._referenceFrame===e._referenceFrame},TimeIntervalCollectionPositionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(TimeIntervalCollectionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),TimeIntervalCollectionProperty.prototype.getValue=function(e,t){const n=this._intervals.findDataForIntervalContainingDate(e);return defined(n)&&"function"==typeof n.clone?n.clone(t):n},TimeIntervalCollectionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionProperty&&this._intervals.equals(e._intervals,Property.equals)},TimeIntervalCollectionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(VelocityVectorProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){const t=this._position;t!==e&&(defined(t)&&this._subscription(),this._position=e,defined(e)&&(this._subscription=e._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)),this._definitionChanged.raiseEvent(this))}},normalize:{get:function(){return this._normalize},set:function(e){this._normalize!==e&&(this._normalize=e,this._definitionChanged.raiseEvent(this))}}});const position1Scratch=new Cartesian3,position2Scratch=new Cartesian3,timeScratch=new JulianDate,step=1/60;function VelocityOrientationProperty(e,t){this._velocityVectorProperty=new VelocityVectorProperty(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new Event,this.ellipsoid=defaultValue(t,Ellipsoid.WGS84);const n=this;this._velocityVectorProperty.definitionChanged.addEventListener((function(){n._definitionChanged.raiseEvent(n)}))}VelocityVectorProperty.prototype.getValue=function(e,t){return this._getValue(e,t)},VelocityVectorProperty.prototype._getValue=function(e,t,n){defined(t)||(t=new Cartesian3);const i=this._position;if(Property.isConstant(i))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);let r=i.getValue(e,position1Scratch),o=i.getValue(JulianDate.addSeconds(e,step,timeScratch),position2Scratch);if(!defined(r))return;if(!defined(o)&&(o=r,r=i.getValue(JulianDate.addSeconds(e,-step,timeScratch),position2Scratch),!defined(r)))return;if(Cartesian3.equals(r,o))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);defined(n)&&r.clone(n);const a=Cartesian3.subtract(o,r,t);return this._normalize?Cartesian3.normalize(a,t):Cartesian3.divideByScalar(a,step,t)},VelocityVectorProperty.prototype.equals=function(e){return this===e||e instanceof VelocityVectorProperty&&Property.equals(this._position,e._position)},Object.defineProperties(VelocityOrientationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._velocityVectorProperty)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._velocityVectorProperty.position},set:function(e){this._velocityVectorProperty.position=e}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){this._ellipsoid!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});const positionScratch$3=new Cartesian3,velocityScratch=new Cartesian3,rotationScratch$1=new Matrix3;function UnitCartesian3(){}let currentId;function createReferenceProperty(e,t){return"#"===t[0]&&(t=currentId+t),ReferenceProperty.fromString(e,t)}function createSpecializedProperty(e,t,n){if(defined(n.reference))return createReferenceProperty(t,n.reference);if(defined(n.velocityReference)){const i=createReferenceProperty(t,n.velocityReference);switch(e){case Cartesian3:case UnitCartesian3:return new VelocityVectorProperty(i,e===UnitCartesian3);case Quaternion:return new VelocityOrientationProperty(i)}}throw new RuntimeError(JSON.stringify(n)+" is not valid CZML.")}function createAdapterProperty(e,t){return new CallbackProperty((function(n,i){return t(e.getValue(n,i))}),e.isConstant)}VelocityOrientationProperty.prototype.getValue=function(e,t){const n=this._velocityVectorProperty._getValue(e,velocityScratch,positionScratch$3);if(defined(n))return Transforms.rotationMatrixFromPositionVelocity(positionScratch$3,n,this._ellipsoid,rotationScratch$1),Quaternion.fromRotationMatrix(rotationScratch$1,t)},VelocityOrientationProperty.prototype.equals=function(e){return this===e||e instanceof VelocityOrientationProperty&&Property.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},UnitCartesian3.packedLength=Cartesian3.packedLength,UnitCartesian3.unpack=Cartesian3.unpack,UnitCartesian3.pack=Cartesian3.pack;const scratchCartesian$3=new Cartesian3,scratchSpherical=new Spherical,scratchCartographic$8=new Cartographic,scratchTimeInterval$1=new TimeInterval,scratchQuaternion=new Quaternion;function unwrapColorInterval(e){let t=e.rgbaf;if(defined(t))return t;const n=e.rgba;if(!defined(n))return;const i=n.length;if(i===Color.packedLength)return[Color.byteToFloat(n[0]),Color.byteToFloat(n[1]),Color.byteToFloat(n[2]),Color.byteToFloat(n[3])];t=new Array(i);for(let e=0;e<i;e+=5)t[e]=n[e],t[e+1]=Color.byteToFloat(n[e+1]),t[e+2]=Color.byteToFloat(n[e+2]),t[e+3]=Color.byteToFloat(n[e+3]),t[e+4]=Color.byteToFloat(n[e+4]);return t}function unwrapUriInterval(e,t){const n=defaultValue(e.uri,e);return defined(t)?t.getDerivedResource({url:n}):Resource.createIfNeeded(n)}function unwrapRectangleInterval(e){let t=e.wsen;if(defined(t))return t;const n=e.wsenDegrees;if(!defined(n))return;const i=n.length;if(i===Rectangle.packedLength)return[CesiumMath.toRadians(n[0]),CesiumMath.toRadians(n[1]),CesiumMath.toRadians(n[2]),CesiumMath.toRadians(n[3])];t=new Array(i);for(let e=0;e<i;e+=5)t[e]=n[e],t[e+1]=CesiumMath.toRadians(n[e+1]),t[e+2]=CesiumMath.toRadians(n[e+2]),t[e+3]=CesiumMath.toRadians(n[e+3]),t[e+4]=CesiumMath.toRadians(n[e+4]);return t}function convertUnitSphericalToCartesian(e){const t=e.length;if(scratchSpherical.magnitude=1,2===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const n=new Array(t/3*4);for(let i=0,r=0;i<t;i+=3,r+=4)n[r]=e[i],scratchSpherical.clock=e[i+1],scratchSpherical.cone=e[i+2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),n[r+1]=scratchCartesian$3.x,n[r+2]=scratchCartesian$3.y,n[r+3]=scratchCartesian$3.z;return n}function convertSphericalToCartesian(e){const t=e.length;if(3===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],scratchSpherical.magnitude=e[2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],scratchSpherical.clock=e[i+1],scratchSpherical.cone=e[i+2],scratchSpherical.magnitude=e[i+3],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$3),n[i+1]=scratchCartesian$3.x,n[i+2]=scratchCartesian$3.y,n[i+3]=scratchCartesian$3.z;return n}function convertCartographicRadiansToCartesian(e){const t=e.length;if(3===t)return scratchCartographic$8.longitude=e[0],scratchCartographic$8.latitude=e[1],scratchCartographic$8.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$8,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],scratchCartographic$8.longitude=e[i+1],scratchCartographic$8.latitude=e[i+2],scratchCartographic$8.height=e[i+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$8,scratchCartesian$3),n[i+1]=scratchCartesian$3.x,n[i+2]=scratchCartesian$3.y,n[i+3]=scratchCartesian$3.z;return n}function convertCartographicDegreesToCartesian(e){const t=e.length;if(3===t)return scratchCartographic$8.longitude=CesiumMath.toRadians(e[0]),scratchCartographic$8.latitude=CesiumMath.toRadians(e[1]),scratchCartographic$8.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$8,scratchCartesian$3),[scratchCartesian$3.x,scratchCartesian$3.y,scratchCartesian$3.z];const n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],scratchCartographic$8.longitude=CesiumMath.toRadians(e[i+1]),scratchCartographic$8.latitude=CesiumMath.toRadians(e[i+2]),scratchCartographic$8.height=e[i+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$8,scratchCartesian$3),n[i+1]=scratchCartesian$3.x,n[i+2]=scratchCartesian$3.y,n[i+3]=scratchCartesian$3.z;return n}function unwrapCartesianInterval(e){const t=e.cartesian;if(defined(t))return t;const n=e.cartesianVelocity;if(defined(n))return n;const i=e.unitCartesian;if(defined(i))return i;const r=e.unitSpherical;if(defined(r))return convertUnitSphericalToCartesian(r);const o=e.spherical;if(defined(o))return convertSphericalToCartesian(o);const a=e.cartographicRadians;if(defined(a))return convertCartographicRadiansToCartesian(a);const s=e.cartographicDegrees;if(defined(s))return convertCartographicDegreesToCartesian(s);throw new RuntimeError(JSON.stringify(e)+" is not a valid CZML interval.")}function normalizePackedCartesianArray(e,t){Cartesian3.unpack(e,t,scratchCartesian$3),Cartesian3.normalize(scratchCartesian$3,scratchCartesian$3),Cartesian3.pack(scratchCartesian$3,e,t)}function unwrapUnitCartesianInterval(e){const t=unwrapCartesianInterval(e);if(3===t.length)return normalizePackedCartesianArray(t,0),t;for(let e=1;e<t.length;e+=4)normalizePackedCartesianArray(t,e);return t}function normalizePackedQuaternionArray(e,t){Quaternion.unpack(e,t,scratchQuaternion),Quaternion.normalize(scratchQuaternion,scratchQuaternion),Quaternion.pack(scratchQuaternion,e,t)}function unwrapQuaternionInterval(e){const t=e.unitQuaternion;if(defined(t)){if(4===t.length)return normalizePackedQuaternionArray(t,0),t;for(let e=1;e<t.length;e+=5)normalizePackedQuaternionArray(t,e)}return t}function getPropertyType(e){return"boolean"==typeof e?Boolean:"number"==typeof e?Number:"string"==typeof e?String:e.hasOwnProperty("array")?Array:e.hasOwnProperty("boolean")?Boolean:e.hasOwnProperty("boundingRectangle")?BoundingRectangle:e.hasOwnProperty("cartesian2")?Cartesian2:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?Cartesian3:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?UnitCartesian3:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?Color:e.hasOwnProperty("arcType")?ArcType$1:e.hasOwnProperty("classificationType")?ClassificationType$1:e.hasOwnProperty("colorBlendMode")?ColorBlendMode$1:e.hasOwnProperty("cornerType")?CornerType$1:e.hasOwnProperty("heightReference")?HeightReference$1:e.hasOwnProperty("horizontalOrigin")?HorizontalOrigin$1:e.hasOwnProperty("date")?JulianDate:e.hasOwnProperty("labelStyle")?LabelStyle$1:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?NearFarScalar:e.hasOwnProperty("distanceDisplayCondition")?DistanceDisplayCondition:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Quaternion:e.hasOwnProperty("shadowMode")?ShadowMode$1:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?StripeOrientation$1:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?Rectangle:e.hasOwnProperty("uri")?URI:e.hasOwnProperty("verticalOrigin")?VerticalOrigin$1:Object}function unwrapInterval(e,t,n){switch(e){case ArcType$1:return ArcType$1[defaultValue(t.arcType,t)];case Array:return t.array;case Boolean:return defaultValue(t.boolean,t);case BoundingRectangle:return t.boundingRectangle;case Cartesian2:return t.cartesian2;case Cartesian3:return unwrapCartesianInterval(t);case UnitCartesian3:return unwrapUnitCartesianInterval(t);case Color:return unwrapColorInterval(t);case ClassificationType$1:return ClassificationType$1[defaultValue(t.classificationType,t)];case ColorBlendMode$1:return ColorBlendMode$1[defaultValue(t.colorBlendMode,t)];case CornerType$1:return CornerType$1[defaultValue(t.cornerType,t)];case HeightReference$1:return HeightReference$1[defaultValue(t.heightReference,t)];case HorizontalOrigin$1:return HorizontalOrigin$1[defaultValue(t.horizontalOrigin,t)];case Image:return unwrapUriInterval(t,n);case JulianDate:return JulianDate.fromIso8601(defaultValue(t.date,t));case LabelStyle$1:return LabelStyle$1[defaultValue(t.labelStyle,t)];case Number:return defaultValue(t.number,t);case NearFarScalar:return t.nearFarScalar;case DistanceDisplayCondition:return t.distanceDisplayCondition;case Object:return defaultValue(defaultValue(t.object,t.value),t);case Quaternion:return unwrapQuaternionInterval(t);case Rotation:return defaultValue(t.number,t);case ShadowMode$1:return ShadowMode$1[defaultValue(defaultValue(t.shadowMode,t.shadows),t)];case String:return defaultValue(t.string,t);case StripeOrientation$1:return StripeOrientation$1[defaultValue(t.stripeOrientation,t)];case Rectangle:return unwrapRectangleInterval(t);case URI:return unwrapUriInterval(t,n);case VerticalOrigin$1:return VerticalOrigin$1[defaultValue(t.verticalOrigin,t)];default:throw new RuntimeError(e)}}const interpolators={HERMITE:HermitePolynomialApproximation,LAGRANGE:LagrangePolynomialApproximation,LINEAR:LinearApproximation};function updateInterpolationSettings(e,t){const n=e.interpolationAlgorithm,i=e.interpolationDegree;(defined(n)||defined(i))&&t.setInterpolationOptions({interpolationAlgorithm:interpolators[n],interpolationDegree:i});const r=e.forwardExtrapolationType;defined(r)&&(t.forwardExtrapolationType=ExtrapolationType$1[r]);const o=e.forwardExtrapolationDuration;defined(o)&&(t.forwardExtrapolationDuration=o);const a=e.backwardExtrapolationType;defined(a)&&(t.backwardExtrapolationType=ExtrapolationType$1[a]);const s=e.backwardExtrapolationDuration;defined(s)&&(t.backwardExtrapolationDuration=s)}const iso8601Scratch={iso8601:void 0};function intervalFromString(e){if(defined(e))return iso8601Scratch.iso8601=e,TimeInterval.fromIso8601(iso8601Scratch)}function wrapPropertyInInfiniteInterval(e){const t=Iso8601.MAXIMUM_INTERVAL.clone();return t.data=e,t}function convertPropertyToComposite(e){const t=new CompositeProperty;return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function convertPositionPropertyToComposite(e){const t=new CompositePositionProperty(e.referenceFrame);return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function processProperty(e,t,n,i,r,o,a){let s,c,l,u=intervalFromString(i.interval);defined(r)&&(u=defined(u)?TimeInterval.intersect(u,r,scratchTimeInterval$1):r);const d=!defined(i.reference)&&!defined(i.velocityReference),h=defined(u)&&!u.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===i.delete)return h?removePropertyData(t[n],u):void(t[n]=void 0);let p=!1;if(d){if(c=unwrapInterval(e,i,o),!defined(c))return;s=defaultValue(e.packedLength,1),l=defaultValue(c.length,1),p=!defined(i.array)&&"string"!=typeof c&&l>s&&e!==Object}const f="function"==typeof e.unpack&&e!==Rotation;if(!p&&!h)return void(t[n]=d?new ConstantProperty(f?e.unpack(c,0):c):createSpecializedProperty(e,a,i));let m,g=t[n];const _=i.epoch;if(defined(_)&&(m=JulianDate.fromIso8601(_)),p&&!h)return g instanceof SampledProperty||(t[n]=g=new SampledProperty(e)),g.addSamplesPackedArray(c,m),void updateInterpolationSettings(i,g);let y;if(!p&&h)return u=u.clone(),u.data=d?f?e.unpack(c,0):c:createSpecializedProperty(e,a,i),defined(g)||(t[n]=g=d?new TimeIntervalCollectionProperty:new CompositeProperty),void(d&&g instanceof TimeIntervalCollectionProperty?g.intervals.addInterval(u):g instanceof CompositeProperty?(d&&(u.data=new ConstantProperty(u.data)),g.intervals.addInterval(u)):(t[n]=g=convertPropertyToComposite(g),d&&(u.data=new ConstantProperty(u.data)),g.intervals.addInterval(u)));defined(g)||(t[n]=g=new CompositeProperty),g instanceof CompositeProperty||(t[n]=g=convertPropertyToComposite(g));const C=g.intervals;y=C.findInterval(u),defined(y)&&y.data instanceof SampledProperty||(y=u.clone(),y.data=new SampledProperty(e),C.addInterval(y)),y.data.addSamplesPackedArray(c,m),updateInterpolationSettings(i,y.data)}function removePropertyData(e,t){if(e instanceof SampledProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositeProperty){const n=e.intervals;for(let e=0;e<n.length;++e){const i=TimeInterval.intersect(n.get(e),t,scratchTimeInterval$1);i.isEmpty||removePropertyData(i.data,t)}n.removeInterval(t)}else;}function processPacketData(e,t,n,i,r,o,a){if(defined(i))if(Array.isArray(i))for(let s=0,c=i.length;s<c;++s)processProperty(e,t,n,i[s],r,o,a);else processProperty(e,t,n,i,r,o,a)}function processPositionProperty(e,t,n,i,r,o){let a=intervalFromString(n.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval$1):i);const s=defined(n.cartesianVelocity)?1:0,c=Cartesian3.packedLength*(s+1);let l,u;const d=!defined(n.reference),h=defined(a)&&!a.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===n.delete)return h?removePositionPropertyData(e[t],a):void(e[t]=void 0);let p,f=!1;if(d&&(defined(n.referenceFrame)&&(p=ReferenceFrame$1[n.referenceFrame]),p=defaultValue(p,ReferenceFrame$1.FIXED),l=unwrapCartesianInterval(n),u=defaultValue(l.length,1),f=u>c),!f&&!h)return void(e[t]=d?new ConstantPositionProperty(Cartesian3.unpack(l),p):createReferenceProperty(o,n.reference));let m,g=e[t];const _=n.epoch;if(defined(_)&&(m=JulianDate.fromIso8601(_)),f&&!h)return g instanceof SampledPositionProperty&&(!defined(p)||g.referenceFrame===p)||(e[t]=g=new SampledPositionProperty(p,s)),g.addSamplesPackedArray(l,m),void updateInterpolationSettings(n,g);let y;if(!f&&h)return a=a.clone(),a.data=d?Cartesian3.unpack(l):createReferenceProperty(o,n.reference),defined(g)||(g=d?new TimeIntervalCollectionPositionProperty(p):new CompositePositionProperty(p),e[t]=g),void(d&&g instanceof TimeIntervalCollectionPositionProperty&&defined(p)&&g.referenceFrame===p?g.intervals.addInterval(a):g instanceof CompositePositionProperty?(d&&(a.data=new ConstantPositionProperty(a.data,p)),g.intervals.addInterval(a)):(e[t]=g=convertPositionPropertyToComposite(g),d&&(a.data=new ConstantPositionProperty(a.data,p)),g.intervals.addInterval(a)));defined(g)?g instanceof CompositePositionProperty||(e[t]=g=convertPositionPropertyToComposite(g)):e[t]=g=new CompositePositionProperty(p);const C=g.intervals;y=C.findInterval(a),defined(y)&&y.data instanceof SampledPositionProperty&&(!defined(p)||y.data.referenceFrame===p)||(y=a.clone(),y.data=new SampledPositionProperty(p,s),C.addInterval(y)),y.data.addSamplesPackedArray(l,m),updateInterpolationSettings(n,y.data)}function removePositionPropertyData(e,t){if(e instanceof SampledPositionProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionPositionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositePositionProperty){const n=e.intervals;for(let e=0;e<n.length;++e){const i=TimeInterval.intersect(n.get(e),t,scratchTimeInterval$1);i.isEmpty||removePositionPropertyData(i.data,t)}n.removeInterval(t)}else;}function processPositionPacketData(e,t,n,i,r,o){if(defined(n))if(Array.isArray(n))for(let a=0,s=n.length;a<s;++a)processPositionProperty(e,t,n[a],i,r,o);else processPositionProperty(e,t,n,i,r,o)}function processShapePacketData(e,t,n,i){defined(n.references)?processReferencesArrayPacketData(e,t,n.references,n.interval,i,PropertyArray,CompositeProperty):(defined(n.cartesian2)?n.array=Cartesian2.unpackArray(n.cartesian2):defined(n.cartesian)&&(n.array=Cartesian2.unpackArray(n.cartesian)),defined(n.array)&&processPacketData(Array,e,t,n,void 0,void 0,i))}function processMaterialProperty(e,t,n,i,r,o){let a=intervalFromString(n.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval$1):i);let s,c,l,u=e[t];if(defined(a)){u instanceof CompositeMaterialProperty||(u=new CompositeMaterialProperty,e[t]=u);const n=u.intervals;c=n.findInterval({start:a.start,stop:a.stop}),defined(c)?s=c.data:(c=a.clone(),n.addInterval(c))}else s=u;defined(n.solidColor)?(s instanceof ColorMaterialProperty||(s=new ColorMaterialProperty),l=n.solidColor,processPacketData(Color,s,"color",l.color,void 0,void 0,o)):defined(n.grid)?(s instanceof GridMaterialProperty||(s=new GridMaterialProperty),l=n.grid,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Number,s,"cellAlpha",l.cellAlpha,void 0,r,o),processPacketData(Cartesian2,s,"lineCount",l.lineCount,void 0,r,o),processPacketData(Cartesian2,s,"lineThickness",l.lineThickness,void 0,r,o),processPacketData(Cartesian2,s,"lineOffset",l.lineOffset,void 0,r,o)):defined(n.image)?(s instanceof ImageMaterialProperty||(s=new ImageMaterialProperty),l=n.image,processPacketData(Image,s,"image",l.image,void 0,r,o),processPacketData(Cartesian2,s,"repeat",l.repeat,void 0,r,o),processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Boolean,s,"transparent",l.transparent,void 0,r,o)):defined(n.stripe)?(s instanceof StripeMaterialProperty||(s=new StripeMaterialProperty),l=n.stripe,processPacketData(StripeOrientation$1,s,"orientation",l.orientation,void 0,r,o),processPacketData(Color,s,"evenColor",l.evenColor,void 0,r,o),processPacketData(Color,s,"oddColor",l.oddColor,void 0,r,o),processPacketData(Number,s,"offset",l.offset,void 0,r,o),processPacketData(Number,s,"repeat",l.repeat,void 0,r,o)):defined(n.polylineOutline)?(s instanceof PolylineOutlineMaterialProperty||(s=new PolylineOutlineMaterialProperty),l=n.polylineOutline,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Color,s,"outlineColor",l.outlineColor,void 0,r,o),processPacketData(Number,s,"outlineWidth",l.outlineWidth,void 0,r,o)):defined(n.polylineGlow)?(s instanceof PolylineGlowMaterialProperty||(s=new PolylineGlowMaterialProperty),l=n.polylineGlow,processPacketData(Color,s,"color",l.color,void 0,r,o),processPacketData(Number,s,"glowPower",l.glowPower,void 0,r,o),processPacketData(Number,s,"taperPower",l.taperPower,void 0,r,o)):defined(n.polylineArrow)?(s instanceof PolylineArrowMaterialProperty||(s=new PolylineArrowMaterialProperty),l=n.polylineArrow,processPacketData(Color,s,"color",l.color,void 0,void 0,o)):defined(n.polylineDash)?(s instanceof PolylineDashMaterialProperty||(s=new PolylineDashMaterialProperty),l=n.polylineDash,processPacketData(Color,s,"color",l.color,void 0,void 0,o),processPacketData(Color,s,"gapColor",l.gapColor,void 0,void 0,o),processPacketData(Number,s,"dashLength",l.dashLength,void 0,r,o),processPacketData(Number,s,"dashPattern",l.dashPattern,void 0,r,o)):defined(n.checkerboard)&&(s instanceof CheckerboardMaterialProperty||(s=new CheckerboardMaterialProperty),l=n.checkerboard,processPacketData(Color,s,"evenColor",l.evenColor,void 0,r,o),processPacketData(Color,s,"oddColor",l.oddColor,void 0,r,o),processPacketData(Cartesian2,s,"repeat",l.repeat,void 0,r,o)),defined(c)?c.data=s:e[t]=s}function processMaterialPacketData(e,t,n,i,r,o){if(defined(n))if(Array.isArray(n))for(let a=0,s=n.length;a<s;++a)processMaterialProperty(e,t,n[a],i,r,o);else processMaterialProperty(e,t,n,i,r,o)}function processName(e,t,n,i){defined(t.name)&&(e.name=t.name)}function processDescription$1(e,t,n,i){const r=t.description;defined(r)&&processPacketData(String,e,"description",r,void 0,i,n)}function processPosition(e,t,n,i){const r=t.position;defined(r)&&processPositionPacketData(e,"position",r,void 0,i,n)}function processViewFrom(e,t,n,i){const r=t.viewFrom;defined(r)&&processPacketData(Cartesian3,e,"viewFrom",r,void 0,i,n)}function processOrientation(e,t,n,i){const r=t.orientation;defined(r)&&processPacketData(Quaternion,e,"orientation",r,void 0,i,n)}function processProperties(e,t,n,i){const r=t.properties;if(defined(r)){defined(e.properties)||(e.properties=new PropertyBag);for(const t in r)if(r.hasOwnProperty(t)){e.properties.hasProperty(t)||e.properties.addProperty(t);const o=r[t];if(Array.isArray(o))for(let r=0,a=o.length;r<a;++r)processProperty(getPropertyType(o[r]),e.properties,t,o[r],void 0,i,n);else processProperty(getPropertyType(o),e.properties,t,o,void 0,i,n)}}}function processReferencesArrayPacketData(e,t,n,i,r,o,a){const s=n.map((function(e){return createReferenceProperty(r,e)}));if(defined(i)){i=intervalFromString(i);let n=e[t];if(!(n instanceof a)){const i=new a;i.intervals.addInterval(wrapPropertyInInfiniteInterval(n)),e[t]=n=i}i.data=new o(s),n.intervals.addInterval(i)}else e[t]=new o(s)}function processArrayPacketData(e,t,n,i){const r=n.references;defined(r)?processReferencesArrayPacketData(e,t,r,n.interval,i,PropertyArray,CompositeProperty):processPacketData(Array,e,t,n,void 0,void 0,i)}function processArray(e,t,n,i){if(defined(n))if(Array.isArray(n))for(let r=0,o=n.length;r<o;++r)processArrayPacketData(e,t,n[r],i);else processArrayPacketData(e,t,n,i)}function processPositionArrayPacketData(e,t,n,i){const r=n.references;defined(r)?processReferencesArrayPacketData(e,t,r,n.interval,i,PositionPropertyArray,CompositePositionProperty):(defined(n.cartesian)?n.array=Cartesian3.unpackArray(n.cartesian):defined(n.cartographicRadians)?n.array=Cartesian3.fromRadiansArrayHeights(n.cartographicRadians):defined(n.cartographicDegrees)&&(n.array=Cartesian3.fromDegreesArrayHeights(n.cartographicDegrees)),defined(n.array)&&processPacketData(Array,e,t,n,void 0,void 0,i))}function processPositionArray(e,t,n,i){if(defined(n))if(Array.isArray(n))for(let r=0,o=n.length;r<o;++r)processPositionArrayPacketData(e,t,n[r],i);else processPositionArrayPacketData(e,t,n,i)}function unpackCartesianArray(e){return Cartesian3.unpackArray(e)}function unpackCartographicRadiansArray(e){return Cartesian3.fromRadiansArrayHeights(e)}function unpackCartographicDegreesArray(e){return Cartesian3.fromDegreesArrayHeights(e)}function processPositionArrayOfArraysPacketData(e,t,n,i){const r=n.references;if(defined(r)){const o=r.map((function(e){const t={};return processReferencesArrayPacketData(t,"positions",e,n.interval,i,PositionPropertyArray,CompositePositionProperty),t.positions}));e[t]=new PositionPropertyArray(o)}else defined(n.cartesian)?n.array=n.cartesian.map(unpackCartesianArray):defined(n.cartographicRadians)?n.array=n.cartographicRadians.map(unpackCartographicRadiansArray):defined(n.cartographicDegrees)&&(n.array=n.cartographicDegrees.map(unpackCartographicDegreesArray)),defined(n.array)&&processPacketData(Array,e,t,n,void 0,void 0,i)}function processPositionArrayOfArrays(e,t,n,i){if(defined(n))if(Array.isArray(n))for(let r=0,o=n.length;r<o;++r)processPositionArrayOfArraysPacketData(e,t,n[r],i);else processPositionArrayOfArraysPacketData(e,t,n,i)}function processShape(e,t,n,i){if(defined(n))if(Array.isArray(n))for(let r=0,o=n.length;r<o;r++)processShapePacketData(e,t,n[r],i);else processShapePacketData(e,t,n,i)}function processAvailability(e,t,n,i){const r=t.availability;if(!defined(r))return;let o;if(Array.isArray(r))for(let e=0,t=r.length;e<t;++e)defined(o)||(o=new TimeIntervalCollection),o.addInterval(intervalFromString(r[e]));else o=new TimeIntervalCollection,o.addInterval(intervalFromString(r));e.availability=o}function processAlignedAxis(e,t,n,i,r){defined(t)&&processPacketData(UnitCartesian3,e,"alignedAxis",t,n,i,r)}function processBillboard(e,t,n,i){const r=t.billboard;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.billboard;defined(a)||(e.billboard=a=new BillboardGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Image,a,"image",r.image,o,i,n),processPacketData(Number,a,"scale",r.scale,o,i,n),processPacketData(Cartesian2,a,"pixelOffset",r.pixelOffset,o,i,n),processPacketData(Cartesian3,a,"eyeOffset",r.eyeOffset,o,i,n),processPacketData(HorizontalOrigin$1,a,"horizontalOrigin",r.horizontalOrigin,o,i,n),processPacketData(VerticalOrigin$1,a,"verticalOrigin",r.verticalOrigin,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Color,a,"color",r.color,o,i,n),processPacketData(Rotation,a,"rotation",r.rotation,o,i,n),processAlignedAxis(a,r.alignedAxis,o,i,n),processPacketData(Boolean,a,"sizeInMeters",r.sizeInMeters,o,i,n),processPacketData(Number,a,"width",r.width,o,i,n),processPacketData(Number,a,"height",r.height,o,i,n),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,i,n),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,i,n),processPacketData(NearFarScalar,a,"pixelOffsetScaleByDistance",r.pixelOffsetScaleByDistance,o,i,n),processPacketData(BoundingRectangle,a,"imageSubRegion",r.imageSubRegion,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,i,n)}function processBox(e,t,n,i){const r=t.box;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.box;defined(a)||(e.box=a=new BoxGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Cartesian3,a,"dimensions",r.dimensions,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processCorridor(e,t,n,i){const r=t.corridor;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.corridor;defined(a)||(e.corridor=a=new CorridorGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPositionArray(a,"positions",r.positions,n),processPacketData(Number,a,"width",r.width,o,i,n),processPacketData(Number,a,"height",r.height,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,i,n),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,i,n),processPacketData(CornerType$1,a,"cornerType",r.cornerType,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,i,n),processPacketData(Number,a,"zIndex",r.zIndex,o,i,n)}function processCylinder(e,t,n,i){const r=t.cylinder;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.cylinder;defined(a)||(e.cylinder=a=new CylinderGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Number,a,"length",r.length,o,i,n),processPacketData(Number,a,"topRadius",r.topRadius,o,i,n),processPacketData(Number,a,"bottomRadius",r.bottomRadius,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(Number,a,"numberOfVerticalLines",r.numberOfVerticalLines,o,i,n),processPacketData(Number,a,"slices",r.slices,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processDocument$1(e,t){const n=e.version;if(defined(n)&&"string"==typeof n){const e=n.split(".");if(2===e.length){if("1"!==e[0])throw new RuntimeError("Cesium only supports CZML version 1.");t._version=n}}if(!defined(t._version))throw new RuntimeError("CZML version information invalid. It is expected to be a property on the document object in the <Major>.<Minor> version format.");const i=t._documentPacket;defined(e.name)&&(i.name=e.name);const r=e.clock;if(defined(r)){const e=i.clock;defined(e)?(e.interval=defaultValue(r.interval,e.interval),e.currentTime=defaultValue(r.currentTime,e.currentTime),e.range=defaultValue(r.range,e.range),e.step=defaultValue(r.step,e.step),e.multiplier=defaultValue(r.multiplier,e.multiplier)):i.clock={interval:r.interval,currentTime:r.currentTime,range:r.range,step:r.step,multiplier:r.multiplier}}}function processEllipse(e,t,n,i){const r=t.ellipse;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.ellipse;defined(a)||(e.ellipse=a=new EllipseGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Number,a,"semiMajorAxis",r.semiMajorAxis,o,i,n),processPacketData(Number,a,"semiMinorAxis",r.semiMinorAxis,o,i,n),processPacketData(Number,a,"height",r.height,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,i,n),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,i,n),processPacketData(Rotation,a,"rotation",r.rotation,o,i,n),processPacketData(Rotation,a,"stRotation",r.stRotation,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(Number,a,"numberOfVerticalLines",r.numberOfVerticalLines,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,i,n),processPacketData(Number,a,"zIndex",r.zIndex,o,i,n)}function processEllipsoid(e,t,n,i){const r=t.ellipsoid;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.ellipsoid;defined(a)||(e.ellipsoid=a=new EllipsoidGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Cartesian3,a,"radii",r.radii,o,i,n),processPacketData(Cartesian3,a,"innerRadii",r.innerRadii,o,i,n),processPacketData(Number,a,"minimumClock",r.minimumClock,o,i,n),processPacketData(Number,a,"maximumClock",r.maximumClock,o,i,n),processPacketData(Number,a,"minimumCone",r.minimumCone,o,i,n),processPacketData(Number,a,"maximumCone",r.maximumCone,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(Number,a,"stackPartitions",r.stackPartitions,o,i,n),processPacketData(Number,a,"slicePartitions",r.slicePartitions,o,i,n),processPacketData(Number,a,"subdivisions",r.subdivisions,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processLabel(e,t,n,i){const r=t.label;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.label;defined(a)||(e.label=a=new LabelGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(String,a,"text",r.text,o,i,n),processPacketData(String,a,"font",r.font,o,i,n),processPacketData(LabelStyle$1,a,"style",r.style,o,i,n),processPacketData(Number,a,"scale",r.scale,o,i,n),processPacketData(Boolean,a,"showBackground",r.showBackground,o,i,n),processPacketData(Color,a,"backgroundColor",r.backgroundColor,o,i,n),processPacketData(Cartesian2,a,"backgroundPadding",r.backgroundPadding,o,i,n),processPacketData(Cartesian2,a,"pixelOffset",r.pixelOffset,o,i,n),processPacketData(Cartesian3,a,"eyeOffset",r.eyeOffset,o,i,n),processPacketData(HorizontalOrigin$1,a,"horizontalOrigin",r.horizontalOrigin,o,i,n),processPacketData(VerticalOrigin$1,a,"verticalOrigin",r.verticalOrigin,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Color,a,"fillColor",r.fillColor,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,i,n),processPacketData(NearFarScalar,a,"pixelOffsetScaleByDistance",r.pixelOffsetScaleByDistance,o,i,n),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,i,n)}function processModel(e,t,n,i){const r=t.model;if(!defined(r))return;const o=intervalFromString(r.interval);let a,s,c=e.model;defined(c)||(e.model=c=new ModelGraphics),processPacketData(Boolean,c,"show",r.show,o,i,n),processPacketData(URI,c,"uri",r.gltf,o,i,n),processPacketData(Number,c,"scale",r.scale,o,i,n),processPacketData(Number,c,"minimumPixelSize",r.minimumPixelSize,o,i,n),processPacketData(Number,c,"maximumScale",r.maximumScale,o,i,n),processPacketData(Boolean,c,"incrementallyLoadTextures",r.incrementallyLoadTextures,o,i,n),processPacketData(Boolean,c,"runAnimations",r.runAnimations,o,i,n),processPacketData(Boolean,c,"clampAnimations",r.clampAnimations,o,i,n),processPacketData(ShadowMode$1,c,"shadows",r.shadows,o,i,n),processPacketData(HeightReference$1,c,"heightReference",r.heightReference,o,i,n),processPacketData(Color,c,"silhouetteColor",r.silhouetteColor,o,i,n),processPacketData(Number,c,"silhouetteSize",r.silhouetteSize,o,i,n),processPacketData(Color,c,"color",r.color,o,i,n),processPacketData(ColorBlendMode$1,c,"colorBlendMode",r.colorBlendMode,o,i,n),processPacketData(Number,c,"colorBlendAmount",r.colorBlendAmount,o,i,n),processPacketData(DistanceDisplayCondition,c,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n);const l=r.nodeTransformations;if(defined(l))if(Array.isArray(l))for(a=0,s=l.length;a<s;++a)processNodeTransformations(c,l[a],o,i,n);else processNodeTransformations(c,l,o,i,n);const u=r.articulations;if(defined(u))if(Array.isArray(u))for(a=0,s=u.length;a<s;++a)processArticulations(c,u[a],o,i,n);else processArticulations(c,u,o,i,n)}function processNodeTransformations(e,t,n,i,r){let o=intervalFromString(t.interval);defined(n)&&(o=defined(o)?TimeInterval.intersect(o,n,scratchTimeInterval$1):n);let a=e.nodeTransformations;const s=Object.keys(t);for(let n=0,c=s.length;n<c;++n){const c=s[n];if("interval"===c)continue;const l=t[c];if(!defined(l))continue;defined(a)||(e.nodeTransformations=a=new PropertyBag),a.hasProperty(c)||a.addProperty(c);let u=a[c];defined(u)||(a[c]=u=new NodeTransformationProperty),processPacketData(Cartesian3,u,"translation",l.translation,o,i,r),processPacketData(Quaternion,u,"rotation",l.rotation,o,i,r),processPacketData(Cartesian3,u,"scale",l.scale,o,i,r)}}function processArticulations(e,t,n,i,r){let o=intervalFromString(t.interval);defined(n)&&(o=defined(o)?TimeInterval.intersect(o,n,scratchTimeInterval$1):n);let a=e.articulations;const s=Object.keys(t);for(let n=0,c=s.length;n<c;++n){const c=s[n];if("interval"===c)continue;const l=t[c];defined(l)&&(defined(a)||(e.articulations=a=new PropertyBag),a.hasProperty(c)||a.addProperty(c),processPacketData(Number,a,c,l,o,i,r))}}function processPath(e,t,n,i){const r=t.path;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.path;defined(a)||(e.path=a=new PathGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Number,a,"leadTime",r.leadTime,o,i,n),processPacketData(Number,a,"trailTime",r.trailTime,o,i,n),processPacketData(Number,a,"width",r.width,o,i,n),processPacketData(Number,a,"resolution",r.resolution,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processPoint$2(e,t,n,i){const r=t.point;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.point;defined(a)||(e.point=a=new PointGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Number,a,"pixelSize",r.pixelSize,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Color,a,"color",r.color,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(NearFarScalar,a,"scaleByDistance",r.scaleByDistance,o,i,n),processPacketData(NearFarScalar,a,"translucencyByDistance",r.translucencyByDistance,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(Number,a,"disableDepthTestDistance",r.disableDepthTestDistance,o,i,n)}function PolygonHierarchyProperty(e){this.polygon=e,this._definitionChanged=new Event}function processPolygon$2(e,t,n,i){const r=t.polygon;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polygon;defined(a)||(e.polygon=a=new PolygonGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPositionArray(a,"_positions",r.positions,n),processPositionArrayOfArrays(a,"_holes",r.holes,n),(defined(a._positions)||defined(a._holes))&&(a.hierarchy=new PolygonHierarchyProperty(a)),processPacketData(Number,a,"height",r.height,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,i,n),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,i,n),processPacketData(Rotation,a,"stRotation",r.stRotation,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(Boolean,a,"perPositionHeight",r.perPositionHeight,o,i,n),processPacketData(Boolean,a,"closeTop",r.closeTop,o,i,n),processPacketData(Boolean,a,"closeBottom",r.closeBottom,o,i,n),processPacketData(ArcType$1,a,"arcType",r.arcType,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,i,n),processPacketData(Number,a,"zIndex",r.zIndex,o,i,n)}function adaptFollowSurfaceToArcType(e){return e?ArcType$1.GEODESIC:ArcType$1.NONE}function processPolyline(e,t,n,i){const r=t.polyline;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polyline;if(defined(a)||(e.polyline=a=new PolylineGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPositionArray(a,"positions",r.positions,n),processPacketData(Number,a,"width",r.width,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processMaterialPacketData(a,"depthFailMaterial",r.depthFailMaterial,o,i,n),processPacketData(ArcType$1,a,"arcType",r.arcType,o,i,n),processPacketData(Boolean,a,"clampToGround",r.clampToGround,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,i,n),processPacketData(Number,a,"zIndex",r.zIndex,o,i,n),defined(r.followSurface)&&!defined(r.arcType)){const e={};processPacketData(Boolean,e,"followSurface",r.followSurface,o,i,n),a.arcType=createAdapterProperty(e.followSurface,adaptFollowSurfaceToArcType)}}function processPolylineVolume(e,t,n,i){const r=t.polylineVolume;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.polylineVolume;defined(a)||(e.polylineVolume=a=new PolylineVolumeGraphics),processPositionArray(a,"positions",r.positions,n),processShape(a,"shape",r.shape,n),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(CornerType$1,a,"cornerType",r.cornerType,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processRectangle(e,t,n,i){const r=t.rectangle;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.rectangle;defined(a)||(e.rectangle=a=new RectangleGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(Rectangle,a,"coordinates",r.coordinates,o,i,n),processPacketData(Number,a,"height",r.height,o,i,n),processPacketData(HeightReference$1,a,"heightReference",r.heightReference,o,i,n),processPacketData(Number,a,"extrudedHeight",r.extrudedHeight,o,i,n),processPacketData(HeightReference$1,a,"extrudedHeightReference",r.extrudedHeightReference,o,i,n),processPacketData(Rotation,a,"rotation",r.rotation,o,i,n),processPacketData(Rotation,a,"stRotation",r.stRotation,o,i,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n),processPacketData(ClassificationType$1,a,"classificationType",r.classificationType,o,i,n),processPacketData(Number,a,"zIndex",r.zIndex,o,i,n)}function processTileset(e,t,n,i){const r=t.tileset;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.tileset;defined(a)||(e.tileset=a=new Cesium3DTilesetGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPacketData(URI,a,"uri",r.uri,o,i,n),processPacketData(Number,a,"maximumScreenSpaceError",r.maximumScreenSpaceError,o,i,n)}function processWall(e,t,n,i){const r=t.wall;if(!defined(r))return;const o=intervalFromString(r.interval);let a=e.wall;defined(a)||(e.wall=a=new WallGraphics),processPacketData(Boolean,a,"show",r.show,o,i,n),processPositionArray(a,"positions",r.positions,n),processArray(a,"minimumHeights",r.minimumHeights,n),processArray(a,"maximumHeights",r.maximumHeights,n),processPacketData(Number,a,"granularity",r.granularity,o,i,n),processPacketData(Boolean,a,"fill",r.fill,o,i,n),processMaterialPacketData(a,"material",r.material,o,i,n),processPacketData(Boolean,a,"outline",r.outline,o,i,n),processPacketData(Color,a,"outlineColor",r.outlineColor,o,i,n),processPacketData(Number,a,"outlineWidth",r.outlineWidth,o,i,n),processPacketData(ShadowMode$1,a,"shadows",r.shadows,o,i,n),processPacketData(DistanceDisplayCondition,a,"distanceDisplayCondition",r.distanceDisplayCondition,o,i,n)}function processCzmlPacket(e,t,n,i,r){let o=e.id;if(defined(o)||(o=createGuid()),currentId=o,!defined(r._version)&&"document"!==o)throw new RuntimeError("The first CZML packet is required to be the document object.");if(!0===e.delete)t.removeById(o);else if("document"===o)processDocument$1(e,r);else{const r=t.getOrCreateEntity(o),a=e.parent;defined(a)&&(r.parent=t.getOrCreateEntity(a));for(let o=n.length-1;o>-1;o--)n[o](r,e,t,i)}currentId=void 0}function updateClock(e){let t;const n=e._documentPacket.clock;if(!defined(n)){if(!defined(e._clock)){const n=e._entityCollection.computeAvailability();if(!n.start.equals(Iso8601.MINIMUM_VALUE)){const i=n.start,r=n.stop,o=JulianDate.secondsDifference(r,i),a=Math.round(o/120);return t=new DataSourceClock,t.startTime=JulianDate.clone(i),t.stopTime=JulianDate.clone(r),t.clockRange=ClockRange$1.LOOP_STOP,t.multiplier=a,t.currentTime=JulianDate.clone(i),t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}defined(e._clock)?t=e._clock.clone():(t=new DataSourceClock,t.startTime=Iso8601.MINIMUM_VALUE.clone(),t.stopTime=Iso8601.MAXIMUM_VALUE.clone(),t.currentTime=Iso8601.MINIMUM_VALUE.clone(),t.clockRange=ClockRange$1.LOOP_STOP,t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);const i=intervalFromString(n.interval);return defined(i)&&(t.startTime=i.start,t.stopTime=i.stop),defined(n.currentTime)&&(t.currentTime=JulianDate.fromIso8601(n.currentTime)),defined(n.range)&&(t.clockRange=defaultValue(ClockRange$1[n.range],ClockRange$1.LOOP_STOP)),defined(n.step)&&(t.clockStep=defaultValue(ClockStep$1[n.step],ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)),defined(n.multiplier)&&(t.multiplier=n.multiplier),!t.equals(e._clock)&&(e._clock=t.clone(e._clock),!0)}function load$2(e,t,n,i){let r=t,o=(n=defaultValue(n,defaultValue.EMPTY_OBJECT)).sourceUri,a=n.credit;if("string"==typeof a&&(a=new Credit(a)),e._credit=a,"string"==typeof t||t instanceof Resource){r=(t=Resource.createIfNeeded(t)).fetchJson(),o=defaultValue(o,t.clone());const n=e._resourceCredits,i=t.credits;if(defined(i)){const e=i.length;for(let t=0;t<e;t++)n.push(i[t])}}return o=Resource.createIfNeeded(o),DataSource.setLoading(e,!0),when(r,(function(t){return loadCzml(e,t,o,i)})).otherwise((function(t){return DataSource.setLoading(e,!1),e._error.raiseEvent(e,t),console.log(t),when.reject(t)}))}function loadCzml(e,t,n,i){DataSource.setLoading(e,!0);const r=e._entityCollection;i&&(e._version=void 0,e._documentPacket=new DocumentPacket,r.removeAll()),CzmlDataSource._processCzml(t,r,n,void 0,e);let o=updateClock(e);const a=e._documentPacket;return defined(a.name)&&e._name!==a.name?(e._name=a.name,o=!0):!defined(e._name)&&defined(n)&&(e._name=getFilenameFromUri(n.getUrlComponent()),o=!0),DataSource.setLoading(e,!1),o&&e._changed.raiseEvent(e),e}function DocumentPacket(){this.name=void 0,this.clock=void 0}function CzmlDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._clock=void 0,this._documentPacket=new DocumentPacket,this._version=void 0,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function DataSourceCollection(){this._dataSources=[],this._dataSourceAdded=new Event,this._dataSourceRemoved=new Event,this._dataSourceMoved=new Event}function getIndex(e,t){return e.indexOf(t)}function swapDataSources(e,t,n){const i=e._dataSources,r=i.length-1;if((t=CesiumMath.clamp(t,0,r))===(n=CesiumMath.clamp(n,0,r)))return;const o=i[t];i[t]=i[n],i[n]=o,e.dataSourceMoved.raiseEvent(o,n,t)}function PrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._primitives=[],this._guid=createGuid(),this._zIndex=void 0,this.show=defaultValue(e.show,!0),this.destroyPrimitives=defaultValue(e.destroyPrimitives,!0)}function getPrimitiveIndex(e,t){return e._primitives.indexOf(t)}function OrderedGroundPrimitiveCollection(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}function DynamicGeometryBatch(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new AssociativeArray}Object.defineProperties(PolygonHierarchyProperty.prototype,{isConstant:{get:function(){const e=this.polygon._positions,t=this.polygon._holes;return(!defined(e)||e.isConstant)&&(!defined(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}}),PolygonHierarchyProperty.prototype.getValue=function(e,t){let n,i;return defined(this.polygon._positions)&&(n=this.polygon._positions.getValue(e)),defined(this.polygon._holes)&&(i=this.polygon._holes.getValue(e),defined(i)&&(i=i.map((function(e){return new PolygonHierarchy(e)})))),defined(t)?(t.positions=n,t.holes=i,t):new PolygonHierarchy(n,i)},PolygonHierarchyProperty.prototype.equals=function(e){return this===e||e instanceof PolygonHierarchyProperty&&Property.equals(this.polygon._positions,e.polygon._positions)&&Property.equals(this.polygon._holes,e.polygon._holes)},CzmlDataSource.load=function(e,t){return(new CzmlDataSource).load(e,t)},Object.defineProperties(CzmlDataSource.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}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),CzmlDataSource.updaters=[processBillboard,processBox,processCorridor,processCylinder,processEllipse,processEllipsoid,processLabel,processModel,processName,processDescription$1,processPath,processPoint$2,processPolygon$2,processPolyline,processPolylineVolume,processProperties,processRectangle,processPosition,processTileset,processViewFrom,processWall,processOrientation,processAvailability],CzmlDataSource.prototype.process=function(e,t){return load$2(this,e,t,!1)},CzmlDataSource.prototype.load=function(e,t){return load$2(this,e,t,!0)},CzmlDataSource.prototype.update=function(e){return!0},CzmlDataSource.processPacketData=processPacketData,CzmlDataSource.processPositionPacketData=processPositionPacketData,CzmlDataSource.processMaterialPacketData=processMaterialPacketData,CzmlDataSource._processCzml=function(e,t,n,i,r){if(i=defaultValue(i,CzmlDataSource.updaters),Array.isArray(e))for(let o=0,a=e.length;o<a;++o)processCzmlPacket(e[o],t,i,n,r);else processCzmlPacket(e,t,i,n,r)},Object.defineProperties(DataSourceCollection.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}}),DataSourceCollection.prototype.add=function(e){const t=this,n=this._dataSources;return when(e,(function(e){return n===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e}))},DataSourceCollection.prototype.remove=function(e,t){t=defaultValue(t,!1);const n=this._dataSources.indexOf(e);return-1!==n&&(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&"function"==typeof e.destroy&&e.destroy(),!0)},DataSourceCollection.prototype.removeAll=function(e){e=defaultValue(e,!1);const t=this._dataSources;for(let n=0,i=t.length;n<i;++n){const i=t[n];this._dataSourceRemoved.raiseEvent(this,i),e&&"function"==typeof i.destroy&&i.destroy()}this._dataSources=[]},DataSourceCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},DataSourceCollection.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},DataSourceCollection.prototype.get=function(e){return this._dataSources[e]},DataSourceCollection.prototype.getByName=function(e){return this._dataSources.filter((function(t){return t.name===e}))},DataSourceCollection.prototype.raise=function(e){const t=getIndex(this._dataSources,e);swapDataSources(this,t,t+1)},DataSourceCollection.prototype.lower=function(e){const t=getIndex(this._dataSources,e);swapDataSources(this,t,t-1)},DataSourceCollection.prototype.raiseToTop=function(e){const t=getIndex(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))},DataSourceCollection.prototype.lowerToBottom=function(e){const t=getIndex(this._dataSources,e);0!==t&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))},DataSourceCollection.prototype.isDestroyed=function(){return!1},DataSourceCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},Object.defineProperties(PrimitiveCollection.prototype,{length:{get:function(){return this._primitives.length}}}),PrimitiveCollection.prototype.add=function(e,t){const n=defined(t),i=e._external=e._external||{};return(i._composites=i._composites||{})[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),e},PrimitiveCollection.prototype.remove=function(e){if(this.contains(e)){const 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},PrimitiveCollection.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},PrimitiveCollection.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let n=0;n<t;++n)delete e[n]._external._composites[this._guid],this.destroyPrimitives&&e[n].destroy();this._primitives=[]},PrimitiveCollection.prototype.contains=function(e){return!!(defined(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},PrimitiveCollection.prototype.raise=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),n=this._primitives;if(t!==n.length-1){const e=n[t];n[t]=n[t+1],n[t+1]=e}}},PrimitiveCollection.prototype.raiseToTop=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}},PrimitiveCollection.prototype.lower=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),n=this._primitives;if(0!==t){const e=n[t];n[t]=n[t-1],n[t-1]=e}}},PrimitiveCollection.prototype.lowerToBottom=function(e){if(defined(e)){const t=getPrimitiveIndex(this,e),n=this._primitives;0!==t&&(n.splice(t,1),n.unshift(e))}},PrimitiveCollection.prototype.get=function(e){return this._primitives[e]},PrimitiveCollection.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)},PrimitiveCollection.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];defined(i.prePassesUpdate)&&i.prePassesUpdate(e)}},PrimitiveCollection.prototype.updateForPass=function(e,t){const n=this._primitives;for(let i=0;i<n.length;++i){const r=n[i];defined(r.updateForPass)&&r.updateForPass(e,t)}},PrimitiveCollection.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];defined(i.postPassesUpdate)&&i.postPassesUpdate(e)}},PrimitiveCollection.prototype.isDestroyed=function(){return!1},PrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},Object.defineProperties(OrderedGroundPrimitiveCollection.prototype,{length:{get:function(){return this._length}}}),OrderedGroundPrimitiveCollection.prototype.add=function(e,t){t=defaultValue(t,0);let n=this._collections[t];if(!defined(n)){n=new PrimitiveCollection({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;const e=this._collectionsArray;let i=0;for(;i<e.length&&e[i]._zIndex<t;)i++;e.splice(i,0,n)}return n.add(e),this._length++,e._zIndex=t,e},OrderedGroundPrimitiveCollection.prototype.set=function(e,t){return t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e},OrderedGroundPrimitiveCollection.prototype.remove=function(e,t){if(this.contains(e)){const n=e._zIndex,i=this._collections[n];let r;return r=t?i.remove(e):i.removeAndDestroy(e),r&&this._length--,0===i.length&&(this._collectionsArray.splice(this._collectionsArray.indexOf(i),1),this._collections[n]=void 0,i.destroy()),r}return!1},OrderedGroundPrimitiveCollection.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0},OrderedGroundPrimitiveCollection.prototype.contains=function(e){if(!defined(e))return!1;const t=this._collections[e._zIndex];return defined(t)&&t.contains(e)},OrderedGroundPrimitiveCollection.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)},OrderedGroundPrimitiveCollection.prototype.isDestroyed=function(){return!1},OrderedGroundPrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},DynamicGeometryBatch.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))},DynamicGeometryBatch.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);defined(n)&&(this._dynamicUpdaters.remove(t),n.destroy())},DynamicGeometryBatch.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0},DynamicGeometryBatch.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},DynamicGeometryBatch.prototype.getBoundingSphere=function(e,t){return defined(e=this._dynamicUpdaters.get(e.id))&&defined(e.getBoundingSphere)?e.getBoundingSphere(t):BoundingSphereState$1.FAILED};const scratchColor$b=new Color,defaultOffset$6=Cartesian3.ZERO,offsetScratch$6=new Cartesian3,scratchRectangle$3=new Rectangle;function EllipseGeometryOptions(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,this.offsetAttribute=void 0}function EllipseGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipseGeometryOptions(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function DynamicEllipseGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(EllipseGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),EllipseGeometryUpdater.prototype.constructor=EllipseGeometryUpdater),EllipseGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$b)),defined(t)||(t=Color.WHITE),i.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(i.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseGeometry(this._options),attributes:i})},EllipseGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$b),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseOutlineGeometry(this._options),attributes:o})},EllipseGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipseGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.semiMajorAxis)||!defined(t.semiMinorAxis)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipseGeometryUpdater.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Property.isConstant(t.rotation)||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.numberOfVerticalLines)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},EllipseGeometryUpdater.prototype._setStaticOptions=function(e,t){let n=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let r=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(r)&&!defined(n)&&(n=0);const a=this._options;a.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.center=e.position.getValue(Iso8601.MINIMUM_VALUE,a.center),a.semiMajorAxis=t.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE,a.semiMajorAxis),a.semiMinorAxis=t.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE,a.semiMinorAxis),a.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),a.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),a.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),a.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),a.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,i,r,o),a.height=GroundGeometryUpdater.getGeometryHeight(n,i),r=GroundGeometryUpdater.getGeometryExtrudedHeight(r,o),r===GroundGeometryUpdater.CLAMP_TO_GROUND&&(r=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(a,scratchRectangle$3)).minimumTerrainHeight),a.extrudedHeight=r},EllipseGeometryUpdater.DynamicGeometryUpdater=DynamicEllipseGeometryUpdater,defined(Object.create)&&(DynamicEllipseGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipseGeometryUpdater.prototype.constructor=DynamicEllipseGeometryUpdater),DynamicEllipseGeometryUpdater.prototype._isHidden=function(e,t,n){const i=this._options;return!defined(i.center)||!defined(i.semiMajorAxis)||!defined(i.semiMinorAxis)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicEllipseGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;let r=Property.getValueOrUndefined(t.height,n);const o=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,n);const s=Property.getValueOrDefault(t.extrudedHeightReference,n,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),i.center=Property.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=Property.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=Property.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=Property.getValueOrUndefined(t.rotation,n),i.granularity=Property.getValueOrUndefined(t.granularity,n),i.stRotation=Property.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),i.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(i,scratchRectangle$3)).minimumTerrainHeight),i.extrudedHeight=a};const defaultMaterial$1=new ColorMaterialProperty(Color.WHITE),defaultOffset$5=Cartesian3.ZERO,offsetScratch$5=new Cartesian3,radiiScratch=new Cartesian3,innerRadiiScratch=new Cartesian3,scratchColor$a=new Color,unitSphere=new Cartesian3(1,1,1);function EllipsoidGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function EllipsoidGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipsoidGeometryOptions(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function DynamicEllipsoidGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new Matrix4,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,this._lastOffset=new Cartesian3,this._material={}}defined(Object.create)&&(EllipsoidGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),EllipsoidGeometryUpdater.prototype.constructor=EllipsoidGeometryUpdater),Object.defineProperties(EllipsoidGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),EllipsoidGeometryUpdater.prototype.createFillGeometryInstance=function(e,t,n){const i=this._entity,r=i.isAvailable(e);let o;const a=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),c={show:a,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(s),color:void 0,offset:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$a)),defined(t)||(t=Color.WHITE),o=ColorGeometryInstanceAttribute.fromColor(t),c.color=o}return defined(this._options.offsetAttribute)&&(c.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:i,geometry:new EllipsoidGeometry(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,n),attributes:c})},EllipsoidGeometryUpdater.prototype.createOutlineGeometryInstance=function(e,t,n){const i=this._entity,r=i.isAvailable(e),o=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$a),a=this._distanceDisplayConditionProperty.getValue(e),s={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(o),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),offset:void 0};return defined(this._options.offsetAttribute)&&(s.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5))),new GeometryInstance({id:i,geometry:new EllipsoidOutlineGeometry(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,n),attributes:s})},EllipsoidGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipsoidGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.radii)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipsoidGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.radii.isConstant&&Property.isConstant(t.innerRadii)&&Property.isConstant(t.stackPartitions)&&Property.isConstant(t.slicePartitions)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.minimumClock)&&Property.isConstant(t.maximumClock)&&Property.isConstant(t.minimumCone)&&Property.isConstant(t.maximumCone)&&Property.isConstant(t.subdivisions))},EllipsoidGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(Iso8601.MINIMUM_VALUE,i.radii),i.innerRadii=Property.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=Property.getValueOrUndefined(t.minimumClock,Iso8601.MINIMUM_VALUE),i.maximumClock=Property.getValueOrUndefined(t.maximumClock,Iso8601.MINIMUM_VALUE),i.minimumCone=Property.getValueOrUndefined(t.minimumCone,Iso8601.MINIMUM_VALUE),i.maximumCone=Property.getValueOrUndefined(t.maximumCone,Iso8601.MINIMUM_VALUE),i.stackPartitions=Property.getValueOrUndefined(t.stackPartitions,Iso8601.MINIMUM_VALUE),i.slicePartitions=Property.getValueOrUndefined(t.slicePartitions,Iso8601.MINIMUM_VALUE),i.subdivisions=Property.getValueOrUndefined(t.subdivisions,Iso8601.MINIMUM_VALUE),i.offsetAttribute=n!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},EllipsoidGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,EllipsoidGeometryUpdater.DynamicGeometryUpdater=DynamicEllipsoidGeometryUpdater,defined(Object.create)&&(DynamicEllipsoidGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicEllipsoidGeometryUpdater.prototype.constructor=DynamicEllipsoidGeometryUpdater),DynamicEllipsoidGeometryUpdater.prototype.update=function(e){const t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Property.getValueOrDefault(n.show,e,!0))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const i=Property.getValueOrUndefined(n.radii,e,radiiScratch);let r=defined(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,.5*i.z,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!defined(r)||!defined(i))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const o=Property.getValueOrDefault(n.fill,e,!0),a=Property.getValueOrDefault(n.outline,e,!1),s=Property.getValueOrClonedDefault(n.outlineColor,e,Color.BLACK,scratchColor$a),c=MaterialProperty.getValue(e,defaultValue(n.material,defaultMaterial$1),this._material),l=Property.getValueOrUndefined(n.innerRadii,e,innerRadiiScratch),u=Property.getValueOrUndefined(n.minimumClock,e),d=Property.getValueOrUndefined(n.maximumClock,e),h=Property.getValueOrUndefined(n.minimumCone,e),p=Property.getValueOrUndefined(n.maximumCone,e),f=Property.getValueOrUndefined(n.stackPartitions,e),m=Property.getValueOrUndefined(n.slicePartitions,e),g=Property.getValueOrUndefined(n.subdivisions,e),_=Property.getValueOrDefault(n.outlineWidth,e,1),y=Property.getValueOrDefault(n.heightReference,e,HeightReference$1.NONE),C=y!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0,T=this._scene.mode,S=T===SceneMode$1.SCENE3D&&y===HeightReference$1.NONE,A=this._options,v=this._geometryUpdater.shadowsProperty.getValue(e),E=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),b=Property.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,defaultOffset$5,offsetScratch$5);if(!S||this._lastSceneMode!==T||!defined(this._primitive)||A.stackPartitions!==f||A.slicePartitions!==m||defined(l)&&!Cartesian3.equals(A.innerRadii!==l)||A.minimumClock!==u||A.maximumClock!==d||A.minimumCone!==h||A.maximumCone!==p||A.subdivisions!==g||this._lastOutlineWidth!==_||A.offsetAttribute!==C){const t=this._primitives;if(t.removeAndDestroy(this._primitive),t.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=T,this._lastOutlineWidth=_,A.stackPartitions=f,A.slicePartitions=m,A.subdivisions=g,A.offsetAttribute=C,A.radii=Cartesian3.clone(S?unitSphere:i,A.radii),defined(l))if(S){const e=Cartesian3.magnitude(i);A.innerRadii=Cartesian3.fromElements(l.x/e,l.y/e,l.z/e,A.innerRadii)}else A.innerRadii=Cartesian3.clone(l,A.innerRadii);else A.innerRadii=void 0;A.minimumClock=u,A.maximumClock=d,A.minimumCone=h,A.maximumCone=p;const n=new MaterialAppearance({material:c,translucent:c.isTranslucent(),closed:!0});A.vertexFormat=n.vertexFormat;const r=this._geometryUpdater.createFillGeometryInstance(e,S,this._modelMatrix);this._primitive=t.add(new Primitive$3({geometryInstances:r,appearance:n,asynchronous:!1,shadows:v}));const y=this._geometryUpdater.createOutlineGeometryInstance(e,S,this._modelMatrix);this._outlinePrimitive=t.add(new Primitive$3({geometryInstances:y,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==y.attributes.color.value[3],renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(_)}}),asynchronous:!1,shadows:v})),this._lastShow=o,this._lastOutlineShow=a,this._lastOutlineColor=Color.clone(s,this._lastOutlineColor),this._lastDistanceDisplayCondition=E,this._lastOffset=Cartesian3.clone(b,this._lastOffset)}else if(this._primitive.ready){const e=this._primitive,n=this._outlinePrimitive;e.show=!0,n.show=!0,e.appearance.material=c;let i=this._attributes;defined(i)||(i=e.getGeometryInstanceAttributes(t),this._attributes=i),o!==this._lastShow&&(i.show=ShowGeometryInstanceAttribute.toValue(o,i.show),this._lastShow=o);let r=this._outlineAttributes;defined(r)||(r=n.getGeometryInstanceAttributes(t),this._outlineAttributes=r),a!==this._lastOutlineShow&&(r.show=ShowGeometryInstanceAttribute.toValue(a,r.show),this._lastOutlineShow=a),Color.equals(s,this._lastOutlineColor)||(r.color=ColorGeometryInstanceAttribute.toValue(s,r.color),Color.clone(s,this._lastOutlineColor)),DistanceDisplayCondition.equals(E,this._lastDistanceDisplayCondition)||(i.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(E,i.distanceDisplayCondition),r.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(E,r.distanceDisplayCondition),DistanceDisplayCondition.clone(E,this._lastDistanceDisplayCondition)),Cartesian3.equals(b,this._lastOffset)||(i.offset=OffsetGeometryInstanceAttribute.toValue(b,i.offset),r.offset=OffsetGeometryInstanceAttribute.toValue(b,i.offset),Cartesian3.clone(b,this._lastOffset))}S&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),r=Matrix4.multiplyByScale(r,i,r),this._primitive.modelMatrix=r,this._outlinePrimitive.modelMatrix=r)};const positionScratch$2=new Cartesian3,scratchColor$9=new Color;function PlaneGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function PlaneGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PlaneGeometryOptions(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}function DynamicPlaneGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(PlaneGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PlaneGeometryUpdater.prototype.constructor=PlaneGeometryUpdater),PlaneGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e);let i,r;const o=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$9)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),i={show:o,distanceDisplayCondition:s,color:r}}else i={show:o,distanceDisplayCondition:s};const c=t.plane,l=this._options;let u=t.computeModelMatrix(e);const d=Property.getValueOrDefault(c.plane,e,l.plane),h=Property.getValueOrUndefined(c.dimensions,e,l.dimensions);return l.plane=d,l.dimensions=h,u=createPrimitiveMatrix(d,h,u,u),new GeometryInstance({id:t,geometry:new PlaneGeometry(this._options),modelMatrix:u,attributes:i})},PlaneGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$9),r=this._distanceDisplayConditionProperty.getValue(e),o=t.plane,a=this._options;let s=t.computeModelMatrix(e);const c=Property.getValueOrDefault(o.plane,e,a.plane),l=Property.getValueOrUndefined(o.dimensions,e,a.dimensions);return a.plane=c,a.dimensions=l,s=createPrimitiveMatrix(c,l,s,s),new GeometryInstance({id:t,geometry:new PlaneOutlineGeometry,modelMatrix:s,attributes:{show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},PlaneGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.plane)||!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PlaneGeometryUpdater.prototype._getIsClosed=function(e){return!1},PlaneGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.plane.isConstant&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},PlaneGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof ColorMaterialProperty,i=this._options;i.vertexFormat=n?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(Iso8601.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,i.dimensions)},PlaneGeometryUpdater.DynamicGeometryUpdater=DynamicPlaneGeometryUpdater,defined(Object.create)&&(DynamicPlaneGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPlaneGeometryUpdater.prototype.constructor=DynamicPlaneGeometryUpdater),DynamicPlaneGeometryUpdater.prototype._isHidden=function(e,t,n){const i=this._options;return!defined(Property.getValueOrUndefined(e.position,n,positionScratch$2))||!defined(i.plane)||!defined(i.dimensions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicPlaneGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;i.plane=Property.getValueOrDefault(t.plane,n,i.plane),i.dimensions=Property.getValueOrUndefined(t.dimensions,n,i.dimensions)};const scratchAxis=new Cartesian3,scratchUp$2=new Cartesian3,scratchTranslation$1=new Cartesian3,scratchScale$1=new Cartesian3,scratchRotation$1=new Matrix3,scratchRotationScale=new Matrix3,scratchLocalTransform=new Matrix4;function createPrimitiveMatrix(e,t,n,i){const r=e.normal,o=e.distance,a=Cartesian3.multiplyByScalar(r,-o,scratchTranslation$1);let s=Cartesian3.clone(Cartesian3.UNIT_Z,scratchUp$2);CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(s,r)),1,CesiumMath.EPSILON8)&&(s=Cartesian3.clone(Cartesian3.UNIT_Y,s));const c=Cartesian3.cross(s,r,scratchAxis);s=Cartesian3.cross(r,c,s),Cartesian3.normalize(c,c),Cartesian3.normalize(s,s);const l=scratchRotation$1;Matrix3.setColumn(l,0,c,l),Matrix3.setColumn(l,1,s,l),Matrix3.setColumn(l,2,r,l);const u=Cartesian3.fromElements(t.x,t.y,1,scratchScale$1),d=Matrix3.multiplyByScale(l,u,scratchRotationScale),h=Matrix4.fromRotationTranslation(d,a,scratchLocalTransform);return Matrix4.multiplyTransformation(n,h,i)}PlaneGeometryUpdater.createPrimitiveMatrix=createPrimitiveMatrix;const heightAndPerPositionHeightWarning="Entity polygons cannot have both height and perPositionHeight. height will be ignored",heightReferenceAndPerPositionHeightWarning="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",scratchColor$8=new Color,defaultOffset$4=Cartesian3.ZERO,offsetScratch$4=new Cartesian3,scratchRectangle$2=new Rectangle,scratch2DPositions=[],cart2Scratch=new Cartesian2;function PolygonGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0}function PolygonGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolygonGeometryOptions(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function DyanmicPolygonGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(PolygonGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),PolygonGeometryUpdater.prototype.constructor=PolygonGeometryUpdater),PolygonGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=this._options,r={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$8)),defined(t)||(t=Color.WHITE),r.color=ColorGeometryInstanceAttribute.fromColor(t)}let o;return defined(i.offsetAttribute)&&(r.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),o=i.perPositionHeight&&!defined(i.extrudedHeight)?new CoplanarPolygonGeometry(i):new PolygonGeometry(i),new GeometryInstance({id:t,geometry:o,attributes:r})},PolygonGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=this._options,r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$8),o=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o),offset:void 0};let s;return defined(i.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$4))),s=i.perPositionHeight&&!defined(i.extrudedHeight)?new CoplanarPolygonOutlineGeometry(i):new PolygonOutlineGeometry(i),new GeometryInstance({id:t,geometry:s,attributes:a})},PolygonGeometryUpdater.prototype._computeCenter=function(e,t){const n=Property.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!defined(n))return;const i=n.positions;if(0===i.length)return;const r=this._scene.mapProjection.ellipsoid,o=EllipsoidTangentPlane.fromPoints(i,r),a=o.projectPointsOntoPlane(i,scratch2DPositions),s=a.length;let c=0,l=s-1,u=new Cartesian2;for(let e=0;e<s;l=e++){const t=a[e],n=a[l],i=t.x*n.y-n.x*t.y;let r=Cartesian2.add(t,n,cart2Scratch);r=Cartesian2.multiplyByScalar(r,i,r),u=Cartesian2.add(u,r,u),c+=i}const d=1/(3*c);return u=Cartesian2.multiplyByScalar(u,d,u),o.projectPointOntoEllipsoid(u,t)},PolygonGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.hierarchy)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolygonGeometryUpdater.prototype._isOnTerrain=function(e,t){const n=GroundGeometryUpdater.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,r=defined(i)&&(!i.isConstant||i.getValue(Iso8601.MINIMUM_VALUE));return n&&!r},PolygonGeometryUpdater.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.perPositionHeight)||!Property.isConstant(t.closeTop)||!Property.isConstant(t.closeBottom)||!Property.isConstant(t.zIndex)||!Property.isConstant(t.arcType)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},PolygonGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof ColorMaterialProperty,i=this._options;i.vertexFormat=n?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat;const r=t.hierarchy.getValue(Iso8601.MINIMUM_VALUE);let o=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const a=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let s=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const c=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),l=Property.getValueOrDefault(t.perPositionHeight,Iso8601.MINIMUM_VALUE,!1);let u;o=GroundGeometryUpdater.getGeometryHeight(o,a),l?(defined(o)&&(o=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),a!==HeightReference$1.NONE&&l&&(o=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(s)&&!defined(o)&&(o=0),u=GroundGeometryUpdater.computeGeometryOffsetAttribute(o,a,s,c)),i.polygonHierarchy=r,i.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),i.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),i.perPositionHeight=l,i.closeTop=Property.getValueOrDefault(t.closeTop,Iso8601.MINIMUM_VALUE,!0),i.closeBottom=Property.getValueOrDefault(t.closeBottom,Iso8601.MINIMUM_VALUE,!0),i.offsetAttribute=u,i.height=o,i.arcType=Property.getValueOrDefault(t.arcType,Iso8601.MINIMUM_VALUE,ArcType$1.GEODESIC),s=GroundGeometryUpdater.getGeometryExtrudedHeight(s,c),s===GroundGeometryUpdater.CLAMP_TO_GROUND&&(s=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(i,scratchRectangle$2)).minimumTerrainHeight),i.extrudedHeight=s},PolygonGeometryUpdater.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight,i=defined(n)&&n!==t;return!e.perPositionHeight&&(!i&&0===t||i&&e.closeTop&&e.closeBottom)},PolygonGeometryUpdater.DynamicGeometryUpdater=DyanmicPolygonGeometryUpdater,defined(Object.create)&&(DyanmicPolygonGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DyanmicPolygonGeometryUpdater.prototype.constructor=DyanmicPolygonGeometryUpdater),DyanmicPolygonGeometryUpdater.prototype._isHidden=function(e,t,n){return!defined(this._options.polygonHierarchy)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DyanmicPolygonGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;i.polygonHierarchy=Property.getValueOrUndefined(t.hierarchy,n);let r=Property.getValueOrUndefined(t.height,n);const o=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE),a=Property.getValueOrDefault(t.extrudedHeightReference,n,HeightReference$1.NONE);let s=Property.getValueOrUndefined(t.extrudedHeight,n);const c=Property.getValueOrUndefined(t.perPositionHeight,n);let l;r=GroundGeometryUpdater.getGeometryHeight(r,a),c?(defined(r)&&(r=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),o!==HeightReference$1.NONE&&c&&(r=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(s)&&!defined(r)&&(r=0),l=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,s,a)),i.granularity=Property.getValueOrUndefined(t.granularity,n),i.stRotation=Property.getValueOrUndefined(t.stRotation,n),i.perPositionHeight=Property.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=Property.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=Property.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=l,i.height=r,i.arcType=Property.getValueOrDefault(t.arcType,n,ArcType$1.GEODESIC),s=GroundGeometryUpdater.getGeometryExtrudedHeight(s,a),s===GroundGeometryUpdater.CLAMP_TO_GROUND&&(s=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(i,scratchRectangle$2)).minimumTerrainHeight),i.extrudedHeight=s};const scratchColor$7=new Color;function PolylineVolumeGeometryOptions(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 PolylineVolumeGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolylineVolumeGeometryOptions(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function DynamicPolylineVolumeGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(PolylineVolumeGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PolylineVolumeGeometryUpdater.prototype.constructor=PolylineVolumeGeometryUpdater),PolylineVolumeGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e);let i,r;const o=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$7)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),i={show:o,distanceDisplayCondition:s,color:r}}else i={show:o,distanceDisplayCondition:s};return new GeometryInstance({id:t,geometry:new PolylineVolumeGeometry(this._options),attributes:i})},PolylineVolumeGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$7),r=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new PolylineVolumeOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},PolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.shape)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolylineVolumeGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&t.shape.isConstant&&Property.isConstant(t.granularity)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.cornerType))},PolylineVolumeGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,r=this._options,o=this._materialProperty instanceof ColorMaterialProperty;r.vertexFormat=o?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.polylinePositions=t.positions.getValue(Iso8601.MINIMUM_VALUE,r.polylinePositions),r.shapePositions=t.shape.getValue(Iso8601.MINIMUM_VALUE,r.shape),r.granularity=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE):void 0,r.cornerType=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE):void 0},PolylineVolumeGeometryUpdater.DynamicGeometryUpdater=DynamicPolylineVolumeGeometryUpdater,defined(Object.create)&&(DynamicPolylineVolumeGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicPolylineVolumeGeometryUpdater.prototype.constructor=DynamicPolylineVolumeGeometryUpdater),DynamicPolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t,n){const i=this._options;return!defined(i.polylinePositions)||!defined(i.shapePositions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicPolylineVolumeGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;i.polylinePositions=Property.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=Property.getValueOrUndefined(t.shape,n),i.granularity=Property.getValueOrUndefined(t.granularity,n),i.cornerType=Property.getValueOrUndefined(t.cornerType,n)};const scratchColor$6=new Color,defaultOffset$3=Cartesian3.ZERO,offsetScratch$3=new Cartesian3,scratchRectangle$1=new Rectangle,scratchCenterRect=new Rectangle,scratchCarto=new Cartographic;function RectangleGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function RectangleGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new RectangleGeometryOptions(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function DynamicRectangleGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(RectangleGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),RectangleGeometryUpdater.prototype.constructor=RectangleGeometryUpdater),RectangleGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$6)),defined(t)||(t=Color.WHITE),i.color=ColorGeometryInstanceAttribute.fromColor(t)}return defined(this._options.offsetAttribute)&&(i.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:t,geometry:new RectangleGeometry(this._options),attributes:i})},RectangleGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$6),r=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r),offset:void 0};return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$3,offsetScratch$3))),new GeometryInstance({id:t,geometry:new RectangleOutlineGeometry(this._options),attributes:o})},RectangleGeometryUpdater.prototype._computeCenter=function(e,t){const n=Property.getValueOrUndefined(this._entity.rectangle.coordinates,e,scratchCenterRect);if(!defined(n))return;const i=Rectangle.center(n,scratchCarto);return Cartographic.toCartesian(i,Ellipsoid.WGS84,t)},RectangleGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.coordinates)||GeometryUpdater.prototype._isHidden.call(this,e,t)},RectangleGeometryUpdater.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.rotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)&&!(this._materialProperty instanceof ColorMaterialProperty)},RectangleGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof ColorMaterialProperty;let i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE);const r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);let o=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE);const a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(o)&&!defined(i)&&(i=0);const s=this._options;s.vertexFormat=n?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,s.rectangle=t.coordinates.getValue(Iso8601.MINIMUM_VALUE,s.rectangle),s.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),s.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),s.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),s.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,r,o,a),s.height=GroundGeometryUpdater.getGeometryHeight(i,r),o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,a),o===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(s,scratchRectangle$1)).minimumTerrainHeight),s.extrudedHeight=o},RectangleGeometryUpdater.DynamicGeometryUpdater=DynamicRectangleGeometryUpdater,defined(Object.create)&&(DynamicRectangleGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicRectangleGeometryUpdater.prototype.constructor=DynamicRectangleGeometryUpdater),DynamicRectangleGeometryUpdater.prototype._isHidden=function(e,t,n){return!defined(this._options.rectangle)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicRectangleGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;let r=Property.getValueOrUndefined(t.height,n);const o=Property.getValueOrDefault(t.heightReference,n,HeightReference$1.NONE);let a=Property.getValueOrUndefined(t.extrudedHeight,n);const s=Property.getValueOrDefault(t.extrudedHeightReference,n,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0),i.rectangle=Property.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=Property.getValueOrUndefined(t.granularity,n),i.stRotation=Property.getValueOrUndefined(t.stRotation,n),i.rotation=Property.getValueOrUndefined(t.rotation,n),i.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,o,a,s),i.height=GroundGeometryUpdater.getGeometryHeight(r,o),a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,s),a===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(i,scratchRectangle$1)).minimumTerrainHeight),i.extrudedHeight=a};const colorScratch$5=new Color,distanceDisplayConditionScratch$7=new DistanceDisplayCondition,defaultDistanceDisplayCondition$6=new DistanceDisplayCondition,defaultOffset$2=Cartesian3.ZERO,offsetScratch$2=new Cartesian3;function Batch$5(e,t,n,i,r,o,a){let s;this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=r,this.depthFailMaterial=void 0,this.closed=o,this.shadows=a,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.invalidated=!1,defined(r)&&(s=r.definitionChanged.addEventListener(Batch$5.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=s}function StaticGeometryColorBatch(e,t,n,i,r){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=r}function removeItem(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.remove(t))return 0===i.updaters.length&&(e.splice(n,1),i.destroy()),!0}return!1}function moveItems(e,t,n){let i=!1;const r=t.length;for(let o=0;o<r;++o){const r=t[o],a=r.itemsToRemove,s=a.length;if(s>0)for(o=0;o<s;o++){const t=a[o];r.remove(t),e.add(n,t),i=!0}}return i}function updateItems(e,t,n,i){let r,o=t.length;for(r=o-1;r>=0;r--){const i=t[r];if(i.invalidated){t.splice(r,1);const o=i.updaters.values,a=o.length;for(let t=0;t<a;t++)e.add(n,o[t]);i.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}function getBoundingSphere(e,t,n){const i=e.length;for(let r=0;r<i;r++){const i=e[r];if(i.contains(t))return i.getBoundingSphere(t,n)}return BoundingSphereState$1.FAILED}function removeAllPrimitives(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}Batch$5.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$5.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t||!!defined(t)&&t.equals(n)},Batch$5.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},Batch$5.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$5.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const r=this.primitives;let o;if(this.createPrimitive){const n=this.geometry.values;if(n.length>0){let o;defined(i)&&(defined(this.oldPrimitive)?r.remove(i):this.oldPrimitive=i),defined(this.depthFailAppearanceType)&&(defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:n.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),r.add(i),t=!1}else{defined(i)&&(r.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(r.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(r.remove(this.oldPrimitive),this.oldPrimitive=void 0),!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,a=t.length,s=this.waitingOnCreate;for(o=0;o<a;o++){const r=t[o],a=this.geometry.get(r.id);let c=this.attributes.get(a.id.id);if(defined(c)||(c=i.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,c)),!r.fillMaterialProperty.isConstant||s){const t=r.fillMaterialProperty.color,i=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$5);Color.equals(c._lastColor,i)||(c._lastColor=Color.clone(i,c._lastColor),c.color=ColorGeometryInstanceAttribute.toValue(i,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[n++]=r))}if(defined(this.depthFailAppearanceType)&&r.depthFailMaterialProperty instanceof ColorMaterialProperty&&(!r.depthFailMaterialProperty.isConstant||s)){const t=r.depthFailMaterialProperty.color,n=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$5);Color.equals(c._lastDepthFailColor,n)||(c._lastDepthFailColor=Color.clone(n,c._lastDepthFailColor),c.depthFailColor=ColorGeometryInstanceAttribute.toValue(n,c.depthFailColor))}const l=r.entity.isShowing&&(r.hasConstantFill||r.isFilled(e));l!==(1===c.show[0])&&(c.show=ShowGeometryInstanceAttribute.toValue(l,c.show));const u=r.distanceDisplayConditionProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultDistanceDisplayCondition$6,distanceDisplayConditionScratch$7);DistanceDisplayCondition.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,c.distanceDisplayCondition))}const d=r.terrainOffsetProperty;if(!Property.isConstant(d)){const t=Property.getValueOrDefault(d,e,defaultOffset$2,offsetScratch$2);Cartesian3.equals(t,c._lastOffset)||(c._lastOffset=Cartesian3.clone(t,c._lastOffset),c.offset=OffsetGeometryInstanceAttribute.toValue(t,c.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else defined(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t},Batch$5.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=this.geometry.get(n.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=n.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$5.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$5.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!defined(i)||!defined(i.boundingSphere)||defined(i.show)&&0===i.show[0]?BoundingSphereState$1.FAILED:(i.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$5.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const n=this.oldPrimitive;defined(n)&&t.remove(n),defined(this.removeMaterialSubscription)&&this.removeMaterialSubscription()},StaticGeometryColorBatch.prototype.add=function(e,t){let n,i;const r=t.createFillGeometryInstance(e);255===r.attributes.color.value[3]?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);const o=n.length;for(let e=0;e<o;e++){const i=n[e];if(i.isMaterial(t))return void i.add(t,r)}const a=new Batch$5(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);a.add(t,r),n.push(a)},StaticGeometryColorBatch.prototype.remove=function(e){removeItem(this._solidItems,e)||removeItem(this._translucentItems,e)},StaticGeometryColorBatch.prototype.update=function(e){let t=updateItems(this,this._solidItems,e,!0);t=updateItems(this,this._translucentItems,e,t)&&t;const n=moveItems(this,this._solidItems,e),i=moveItems(this,this._translucentItems,e);return(n||i)&&(t=updateItems(this,this._solidItems,e,t)&&t,t=updateItems(this,this._translucentItems,e,t)&&t),t},StaticGeometryColorBatch.prototype.getBoundingSphere=function(e,t){const n=getBoundingSphere(this._solidItems,e,t);return n===BoundingSphereState$1.FAILED?getBoundingSphere(this._translucentItems,e,t):n},StaticGeometryColorBatch.prototype.removeAllPrimitives=function(){removeAllPrimitives(this._solidItems),removeAllPrimitives(this._translucentItems)};const distanceDisplayConditionScratch$6=new DistanceDisplayCondition,defaultDistanceDisplayCondition$5=new DistanceDisplayCondition,defaultOffset$1=Cartesian3.ZERO,offsetScratch$1=new Cartesian3;function Batch$4(e,t,n,i,r,o,a){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=r,this.closed=o,this.shadows=a,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Batch$4.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}Batch$4.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$4.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,r=e.depthFailMaterialProperty;if(n===t&&r===i)return!0;let o=defined(t)&&t.equals(n);return o=(!defined(i)&&!defined(r)||defined(i)&&i.equals(r))&&o,o},Batch$4.prototype.add=function(e,t){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)&&Property.isConstant(t.terrainOffsetProperty)){const e=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(n,t);this.createPrimitive=!0},Batch$4.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const colorScratch$4=new Color;function StaticGeometryPerMaterialBatch(e,t,n,i,r){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=r}Batch$4.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0){let o;defined(n)&&(defined(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:r.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),i.add(n),t=!1}else{defined(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const i=t[o],r=i.entity,a=this.geometry.get(i.id);let s=this.attributes.get(a.id.id);if(defined(s)||(s=n.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s)),defined(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof ColorMaterialProperty&&!i.depthFailMaterialProperty.isConstant){const t=i.depthFailMaterialProperty.color,n=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$4);Color.equals(s._lastDepthFailColor,n)||(s._lastDepthFailColor=Color.clone(n,s._lastDepthFailColor),s.depthFailColor=ColorGeometryInstanceAttribute.toValue(n,s.depthFailColor))}const c=r.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=i.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$5,distanceDisplayConditionScratch$6);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}const u=i.terrainOffsetProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultOffset$1,offsetScratch$1);Cartesian3.equals(t,s._lastOffset)||(s._lastOffset=Cartesian3.clone(t,s._lastOffset),s.offset=OffsetGeometryInstanceAttribute.toValue(t,s.offset))}}this.updateShows(n)}else defined(n)&&!n.ready&&(t=!1);return t},Batch$4.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=n.entity,o=this.geometry.get(n.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch$4.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$4.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!defined(i)||!defined(i.boundingSphere)||defined(i.show)&&0===i.show[0]?BoundingSphereState$1.FAILED:(i.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$4.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const n=this.oldPrimitive;defined(n)&&t.remove(n),this.removeMaterialSubscription()},StaticGeometryPerMaterialBatch.prototype.add=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const i=n[r];if(i.isMaterial(t))return void i.add(e,t)}const r=new Batch$4(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);r.add(e,t),n.push(r)},StaticGeometryPerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},StaticGeometryPerMaterialBatch.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const r=i.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},StaticGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const i=n[r];if(i.contains(e))return i.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const colorScratch$3=new Color,distanceDisplayConditionScratch$5=new DistanceDisplayCondition,defaultDistanceDisplayCondition$4=new DistanceDisplayCondition;function Batch$3(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryColorBatch(e,t){this._batches=[],this._primitives=e,this._classificationType=t}Batch$3.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$3.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),this.rectangleCollisionCheck.insert(n,t.geometry.rectangle),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},Batch$3.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$3.prototype.update=function(e){let t=!0;let n=this.primitive;const i=this.primitives;let r;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)defined(n)&&(defined(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:e.slice(),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{defined(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,o=t.length,a=this.waitingOnCreate;for(r=0;r<o;r++){const i=t[r],o=this.geometry.get(i.id);let s=this.attributes.get(o.id.id);if(defined(s)||(s=n.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s)),!i.fillMaterialProperty.isConstant||a){const t=i.fillMaterialProperty.color,n=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$3);Color.equals(s._lastColor,n)||(s._lastColor=Color.clone(n,s._lastColor),s.color=ColorGeometryInstanceAttribute.toValue(n,s.color))}const c=i.entity.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=i.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$4,distanceDisplayConditionScratch$5);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(t=!1);return this.itemsToRemove.length=0,t},Batch$3.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=this.geometry.get(n.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=n.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$3.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$3.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getBoundingSphere(e.entity);return defined(i)?(i.clone(t),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},Batch$3.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;defined(n)&&(e.remove(n),this.oldPrimitive=void 0)},StaticGroundGeometryColorBatch.prototype.add=function(e,t){const n=t.createFillGeometryInstance(e),i=this._batches,r=Property.getValueOrDefault(t.zIndex,0);let o;const a=i.length;for(let e=0;e<a;++e){const t=i[e];if(t.zIndex===r&&!t.overlapping(n.geometry.rectangle)){o=t;break}}return defined(o)||(o=new Batch$3(this._primitives,this._classificationType,n.attributes.color.value,r),i.push(o)),o.add(t,n),o},StaticGroundGeometryColorBatch.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return},StaticGroundGeometryColorBatch.prototype.update=function(e){let t,n,i=!0;const r=this._batches,o=r.length;for(t=0;t<o;++t)i=r[t].update(e)&&i;for(t=0;t<o;++t){const i=r[t],o=i.itemsToRemove,a=o.length;for(let t=0;t<a;t++){n=o[t],i.remove(n);const r=this.add(e,n);i.isDirty=!0,r.isDirty=!0}}for(t=o-1;t>=0;--t){const n=r[t];n.isDirty&&(i=r[t].update(e)&&i,n.isDirty=!1),0===n.geometry.length&&r.splice(t,1)}return i},StaticGroundGeometryColorBatch.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let r=0;r<i;++r){const i=n[r];if(i.contains(e))return i.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryColorBatch.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const distanceDisplayConditionScratch$4=new DistanceDisplayCondition,defaultDistanceDisplayCondition$3=new DistanceDisplayCondition;function Batch$2(e,t,n,i,r,o){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch$2.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.usingSphericalTextureCoordinates=r,this.zIndex=o,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryPerMaterialBatch(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}Batch$2.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$2.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$2.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(n)},Batch$2.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),this.rectangleCollisionCheck.insert(i,n.geometry.rectangle),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},Batch$2.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},Batch$2.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0)defined(n)&&(defined(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),n=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:r.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{defined(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const i=t[o],r=i.entity,a=this.geometry.get(i.id);let s=this.attributes.get(a.id.id);defined(s)||(s=n.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s));const c=r.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=i.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition$3,distanceDisplayConditionScratch$4);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(n)}else defined(n)&&!n.ready&&(t=!1);return t},Batch$2.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=n.entity,o=this.geometry.get(n.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch$2.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$2.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!defined(i)||!defined(i.boundingSphere)||defined(i.show)&&0===i.show[0]?BoundingSphereState$1.FAILED:(i.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$2.prototype.destroy=function(){const e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);const n=this.oldPrimitive;defined(n)&&t.remove(n),this.removeMaterialSubscription()},StaticGroundGeometryPerMaterialBatch.prototype.add=function(e,t){const n=this._items,i=n.length,r=t.createFillGeometryInstance(e),o=ShadowVolumeAppearance.shouldUseSphericalCoordinates(r.geometry.rectangle),a=Property.getValueOrDefault(t.zIndex,0);for(let s=0;s<i;++s){const i=n[s];if(i.isMaterial(t)&&i.usingSphericalTextureCoordinates===o&&i.zIndex===a&&!i.overlapping(r.geometry.rectangle))return void i.add(e,t,r)}const s=new Batch$2(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,o,a);s.add(e,t,r),n.push(s)},StaticGroundGeometryPerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},StaticGroundGeometryPerMaterialBatch.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const r=i.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},StaticGroundGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const i=n[r];if(i.contains(e))return i.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const colorScratch$2=new Color,distanceDisplayConditionScratch$3=new DistanceDisplayCondition,defaultDistanceDisplayCondition$2=new DistanceDisplayCondition,defaultOffset=Cartesian3.ZERO,offsetScratch=new Cartesian3;function Batch$1(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.itemsToRemove=[],this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}function StaticOutlineGeometryBatch(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new AssociativeArray,this._translucentBatches=new AssociativeArray}Batch$1.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant&&Property.isConstant(e.distanceDisplayConditionProperty)&&Property.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},Batch$1.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$1.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const r=this.primitives;let o;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)defined(i)&&(defined(this.oldPrimitive)?r.remove(i):this.oldPrimitive=i),i=new Primitive$3({show:!1,asynchronous:!0,geometryInstances:e.slice(),appearance:new PerInstanceColorAppearance({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),r.add(i),t=!1;else{defined(i)&&(r.remove(i),i=void 0);const e=this.oldPrimitive;defined(e)&&(r.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(i)&&i.ready){i.show=!0,defined(this.oldPrimitive)&&(r.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,a=t.length,s=this.waitingOnCreate;for(o=0;o<a;o++){const r=t[o],a=this.geometry.get(r.id);let c=this.attributes.get(a.id.id);if(defined(c)||(c=i.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,c)),!r.outlineColorProperty.isConstant||s){const t=r.outlineColorProperty,i=Property.getValueOrDefault(t,e,Color.WHITE,colorScratch$2);Color.equals(c._lastColor,i)||(c._lastColor=Color.clone(i,c._lastColor),c.color=ColorGeometryInstanceAttribute.toValue(i,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[n++]=r))}const l=r.entity.isShowing&&(r.hasConstantOutline||r.isOutlineVisible(e));l!==(1===c.show[0])&&(c.show=ShowGeometryInstanceAttribute.toValue(l,c.show));const u=r.distanceDisplayConditionProperty;if(!Property.isConstant(u)){const t=Property.getValueOrDefault(u,e,defaultDistanceDisplayCondition$2,distanceDisplayConditionScratch$3);DistanceDisplayCondition.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,c.distanceDisplayCondition))}const d=r.terrainOffsetProperty;if(!Property.isConstant(d)){const t=Property.getValueOrDefault(d,e,defaultOffset,offsetScratch);Cartesian3.equals(t,c._lastOffset)||(c._lastOffset=Cartesian3.clone(t,c._lastOffset),c.offset=OffsetGeometryInstanceAttribute.toValue(t,c.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else defined(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t},Batch$1.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=this.geometry.get(n.id);let o=this.attributes.get(r.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,o));const a=n.entity.isShowing;a!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(a,o.show),r.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$1.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$1.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!defined(i)||!defined(i.boundingSphere)||defined(i.show)&&0===i.show[0]?BoundingSphereState$1.FAILED:(i.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$1.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;defined(n)&&(e.remove(n),this.oldPrimitive=void 0)},StaticOutlineGeometryBatch.prototype.add=function(e,t){const n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth);let r,o;255===n.attributes.color.value[3]?(r=this._solidBatches,o=r.get(i),defined(o)||(o=new Batch$1(this._primitives,!1,i,this._shadows),r.set(i,o)),o.add(t,n)):(r=this._translucentBatches,o=r.get(i),defined(o)||(o=new Batch$1(this._primitives,!0,i,this._shadows),r.set(i,o)),o.add(t,n))},StaticOutlineGeometryBatch.prototype.remove=function(e){let t;const n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;const r=this._translucentBatches.values,o=r.length;for(t=0;t<o;t++)if(r[t].remove(e))return},StaticOutlineGeometryBatch.prototype.update=function(e){let t,n,i,r;const o=this._solidBatches.values,a=o.length,s=this._translucentBatches.values,c=s.length;let l,u=!0,d=!1;do{for(d=!1,n=0;n<a;n++){r=o[n],u=r.update(e),l=r.itemsToRemove;const a=l.length;if(a>0)for(d=!0,t=0;t<a;t++)i=l[t],r.remove(i),this.add(e,i)}for(n=0;n<c;n++){r=s[n],u=r.update(e),l=r.itemsToRemove;const o=l.length;if(o>0)for(d=!0,t=0;t<o;t++)i=l[t],r.remove(i),this.add(e,i)}}while(d);return u},StaticOutlineGeometryBatch.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,r=i.length;for(n=0;n<r;n++){const r=i[n];if(r.contains(e))return r.getBoundingSphere(e,t)}const o=this._translucentBatches.values,a=o.length;for(n=0;n<a;n++){const i=o[n];if(i.contains(e))return i.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticOutlineGeometryBatch.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._translucentBatches.values,r=i.length;for(e=0;e<r;e++)i[e].removeAllPrimitives()};const scratchColor$5=new Color;function WallGeometryOptions(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 WallGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new WallGeometryOptions(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function DynamicWallGeometryUpdater(e,t,n){DynamicGeometryUpdater$1.call(this,e,t,n)}defined(Object.create)&&(WallGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),WallGeometryUpdater.prototype.constructor=WallGeometryUpdater),WallGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e);let i,r;const o=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a);if(this._materialProperty instanceof ColorMaterialProperty){let t;defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,scratchColor$5)),defined(t)||(t=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(t),i={show:o,distanceDisplayCondition:s,color:r}}else i={show:o,distanceDisplayCondition:s};return new GeometryInstance({id:t,geometry:new WallGeometry(this._options),attributes:i})},WallGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$5),r=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new WallOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(i),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)}})},WallGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||GeometryUpdater.prototype._isHidden.call(this,e,t)},WallGeometryUpdater.prototype._getIsClosed=function(e){return!1},WallGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&Property.isConstant(t.minimumHeights)&&Property.isConstant(t.maximumHeights)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.granularity))},WallGeometryUpdater.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,r=t.granularity,o=this._materialProperty instanceof ColorMaterialProperty,a=this._options;a.vertexFormat=o?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,a.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,a.positions),a.minimumHeights=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE,a.minimumHeights):void 0,a.maximumHeights=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE,a.maximumHeights):void 0,a.granularity=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE):void 0},WallGeometryUpdater.DynamicGeometryUpdater=DynamicWallGeometryUpdater,defined(Object.create)&&(DynamicWallGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater$1.prototype),DynamicWallGeometryUpdater.prototype.constructor=DynamicWallGeometryUpdater),DynamicWallGeometryUpdater.prototype._isHidden=function(e,t,n){return!defined(this._options.positions)||DynamicGeometryUpdater$1.prototype._isHidden.call(this,e,t,n)},DynamicWallGeometryUpdater.prototype._setOptions=function(e,t,n){const i=this._options;i.positions=Property.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=Property.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=Property.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=Property.getValueOrUndefined(t.granularity,n)};const emptyArray$1=[],geometryUpdaters=[BoxGeometryUpdater,CylinderGeometryUpdater,CorridorGeometryUpdater,EllipseGeometryUpdater,EllipsoidGeometryUpdater,PlaneGeometryUpdater,PolygonGeometryUpdater,PolylineVolumeGeometryUpdater,RectangleGeometryUpdater,WallGeometryUpdater];function GeometryUpdaterSet(e,t){this.entity=e,this.scene=t;const n=new Array(geometryUpdaters.length),i=new Event;function r(e){i.raiseEvent(e)}const o=new EventHelper;for(let i=0;i<n.length;i++){const a=new geometryUpdaters[i](e,t);o.add(a.geometryChanged,r),n[i]=a}this.updaters=n,this.geometryChanged=i,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(GeometryUpdaterSet.prototype._onEntityPropertyChanged,this)}function GeometryVisualizer(e,t,n,i){n=defaultValue(n,e.primitives),i=defaultValue(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;const r=ShadowMode$1.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(2*r),this._closedColorBatches=new Array(2*r),this._closedMaterialBatches=new Array(2*r),this._openColorBatches=new Array(2*r),this._openMaterialBatches=new Array(2*r);const o=Entity.supportsMaterialsforEntitiesOnTerrain(e);let a;for(this._supportsMaterialsforEntitiesOnTerrain=o,a=0;a<r;++a)this._outlineBatches[a]=new StaticOutlineGeometryBatch(n,e,a,!1),this._outlineBatches[r+a]=new StaticOutlineGeometryBatch(n,e,a,!0),this._closedColorBatches[a]=new StaticGeometryColorBatch(n,PerInstanceColorAppearance,void 0,!0,a,!0),this._closedColorBatches[r+a]=new StaticGeometryColorBatch(n,PerInstanceColorAppearance,void 0,!0,a,!1),this._closedMaterialBatches[a]=new StaticGeometryPerMaterialBatch(n,MaterialAppearance,void 0,!0,a,!0),this._closedMaterialBatches[r+a]=new StaticGeometryPerMaterialBatch(n,MaterialAppearance,void 0,!0,a,!1),this._openColorBatches[a]=new StaticGeometryColorBatch(n,PerInstanceColorAppearance,void 0,!1,a,!0),this._openColorBatches[r+a]=new StaticGeometryColorBatch(n,PerInstanceColorAppearance,void 0,!1,a,!1),this._openMaterialBatches[a]=new StaticGeometryPerMaterialBatch(n,MaterialAppearance,void 0,!1,a,!0),this._openMaterialBatches[r+a]=new StaticGeometryPerMaterialBatch(n,MaterialAppearance,void 0,!1,a,!1);const s=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(s),l=[];if(o)for(a=0;a<s;++a)l.push(new StaticGroundGeometryPerMaterialBatch(i,a,MaterialAppearance)),c[a]=new StaticGroundGeometryColorBatch(i,a);else for(a=0;a<s;++a)c[a]=new StaticGroundGeometryColorBatch(i,a);this._groundColorBatches=c,this._groundMaterialBatches=l,this._dynamicBatch=new DynamicGeometryBatch(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new AssociativeArray,this._updaterSets=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray$1)}GeometryUpdaterSet.prototype._onEntityPropertyChanged=function(e,t,n,i){const r=this.updaters;for(let o=0;o<r.length;o++)r[o]._onEntityPropertyChanged(e,t,n,i)},GeometryUpdaterSet.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])},GeometryUpdaterSet.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),destroyObject(this)},GeometryVisualizer.prototype.update=function(e){const t=this._addedObjects,n=t.values,i=this._removedObjects,r=i.values,o=this._changedObjects,a=o.values;let s,c,l,u;const d=this;for(s=a.length-1;s>-1;s--)c=a[s],l=c.id,u=this._updaterSets.get(l),u.entity===c?u.forEach((function(t){d._removeUpdater(t),d._insertUpdaterIntoBatch(e,t)})):(r.push(c),n.push(c));for(s=r.length-1;s>-1;s--)c=r[s],l=c.id,u=this._updaterSets.get(l),u.forEach(this._removeUpdater.bind(this)),u.destroy(),this._updaterSets.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(s=n.length-1;s>-1;s--)c=n[s],l=c.id,u=new GeometryUpdaterSet(c,this._scene),this._updaterSets.set(l,u),u.forEach((function(t){d._insertUpdaterIntoBatch(e,t)})),this._subscriptions.set(l,u.geometryChanged.addEventListener(GeometryVisualizer._onGeometryChanged,this));t.removeAll(),i.removeAll(),o.removeAll();let h=!0;const p=this._batches,f=p.length;for(s=0;s<f;s++)h=p[s].update(e)&&h;return h};const getBoundingSphereArrayScratch$2=[],getBoundingSphereBoundingSphereScratch$2=new BoundingSphere;GeometryVisualizer.prototype.getBoundingSphere=function(e,t){const n=getBoundingSphereArrayScratch$2,i=getBoundingSphereBoundingSphereScratch$2;let r=0,o=BoundingSphereState$1.DONE;const a=this._batches,s=a.length,c=e.id,l=this._updaterSets.get(c).updaters;for(let e=0;e<l.length;e++){const t=l[e];for(let e=0;e<s;e++){if(o=a[e].getBoundingSphere(t,i),o===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;o===BoundingSphereState$1.DONE&&(n[r]=BoundingSphere.clone(i,n[r]),r++)}}return 0===r?BoundingSphereState$1.FAILED:(n.length=r,BoundingSphere.fromBoundingSpheres(n,t),BoundingSphereState$1.DONE)},GeometryVisualizer.prototype.isDestroyed=function(){return!1},GeometryVisualizer.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();const r=this._updaterSets.values;for(n=r.length,e=0;e<n;e++)r[e].destroy();return this._updaterSets.removeAll(),destroyObject(this)},GeometryVisualizer.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)},GeometryVisualizer.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic)return void this._dynamicBatch.add(e,t);let n;(t.outlineEnabled||t.fillEnabled)&&(n=t.shadowsProperty.getValue(e));const i=ShadowMode$1.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(defined(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){const n=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof ColorMaterialProperty?this._groundColorBatches[n].add(e,t):this._groundMaterialBatches[n].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):defined(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):defined(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)},GeometryVisualizer._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,r=i.id;defined(t.get(r))||defined(n.get(r))||n.set(r,i)},GeometryVisualizer.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,r=this._removedObjects,o=this._changedObjects;let a,s,c;for(a=n.length-1;a>-1;a--)c=n[a],s=c.id,i.remove(s)||(r.set(s,c),o.remove(s));for(a=t.length-1;a>-1;a--)c=t[a],s=c.id,r.remove(s)?o.set(s,c):i.set(s,c)};const defaultScale$1=1,defaultFont="30px sans-serif",defaultStyle=LabelStyle$1.FILL,defaultFillColor=Color.WHITE,defaultOutlineColor$1=Color.BLACK,defaultOutlineWidth$1=1,defaultShowBackground=!1,defaultBackgroundColor$1=new Color(.165,.165,.165,.8),defaultBackgroundPadding=new Cartesian2(7,5),defaultPixelOffset=Cartesian2.ZERO,defaultEyeOffset=Cartesian3.ZERO,defaultHeightReference$1=HeightReference$1.NONE,defaultHorizontalOrigin=HorizontalOrigin$1.CENTER,defaultVerticalOrigin=VerticalOrigin$1.CENTER,positionScratch$1=new Cartesian3,fillColorScratch=new Color,outlineColorScratch$1=new Color,backgroundColorScratch=new Color,backgroundPaddingScratch=new Cartesian2,eyeOffsetScratch=new Cartesian3,pixelOffsetScratch=new Cartesian2,translucencyByDistanceScratch$1=new NearFarScalar,pixelOffsetScaleByDistanceScratch=new NearFarScalar,scaleByDistanceScratch$1=new NearFarScalar,distanceDisplayConditionScratch$2=new DistanceDisplayCondition;function EntityData$2(e){this.entity=e,this.label=void 0,this.index=void 0}function LabelVisualizer(e,t){t.collectionChanged.addEventListener(LabelVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$1(e,t,n){defined(e)&&(e.label=void 0,n.removeLabel(t))}LabelVisualizer.prototype.update=function(e){const t=this._items.values,n=this._cluster;for(let i=0,r=t.length;i<r;i++){const r=t[i],o=r.entity,a=o._label;let s,c,l=r.label,u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=Property.getValueOrUndefined(o._position,e,positionScratch$1),s=Property.getValueOrUndefined(a._text,e),u=defined(c)&&defined(s)),!u){returnPrimitive$1(r,o,n);continue}Property.isConstant(o._position)||(n._clusterDirty=!0);let d=!1;const h=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference$1);defined(l)||(l=n.getLabel(o),l.id=o,r.label=l,d=Cartesian3.equals(l.position,c)&&l.heightReference===h),l.show=!0,l.position=c,l.text=s,l.scale=Property.getValueOrDefault(a._scale,e,defaultScale$1),l.font=Property.getValueOrDefault(a._font,e,defaultFont),l.style=Property.getValueOrDefault(a._style,e,defaultStyle),l.fillColor=Property.getValueOrDefault(a._fillColor,e,defaultFillColor,fillColorScratch),l.outlineColor=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor$1,outlineColorScratch$1),l.outlineWidth=Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth$1),l.showBackground=Property.getValueOrDefault(a._showBackground,e,defaultShowBackground),l.backgroundColor=Property.getValueOrDefault(a._backgroundColor,e,defaultBackgroundColor$1,backgroundColorScratch),l.backgroundPadding=Property.getValueOrDefault(a._backgroundPadding,e,defaultBackgroundPadding,backgroundPaddingScratch),l.pixelOffset=Property.getValueOrDefault(a._pixelOffset,e,defaultPixelOffset,pixelOffsetScratch),l.eyeOffset=Property.getValueOrDefault(a._eyeOffset,e,defaultEyeOffset,eyeOffsetScratch),l.heightReference=h,l.horizontalOrigin=Property.getValueOrDefault(a._horizontalOrigin,e,defaultHorizontalOrigin),l.verticalOrigin=Property.getValueOrDefault(a._verticalOrigin,e,defaultVerticalOrigin),l.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch$1),l.pixelOffsetScaleByDistance=Property.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch),l.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch$1),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$2),l.disableDepthTestDistance=Property.getValueOrUndefined(a._disableDepthTestDistance,e),d&&l._updateClamping()}return!0},LabelVisualizer.prototype.getBoundingSphere=function(e,t){const n=this._items.get(e.id);if(!defined(n)||!defined(n.label))return BoundingSphereState$1.FAILED;const i=n.label;return t.center=Cartesian3.clone(defaultValue(i._clampedPosition,i.position),t.center),t.radius=0,BoundingSphereState$1.DONE},LabelVisualizer.prototype.isDestroyed=function(){return!1},LabelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(LabelVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return destroyObject(this)},LabelVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._label)&&defined(o._position)&&a.set(o.id,new EntityData$2(o));for(r=i.length-1;r>-1;r--)o=i[r],defined(o._label)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData$2(o)):(returnPrimitive$1(a.get(o.id),o,s),a.remove(o.id));for(r=n.length-1;r>-1;r--)o=n[r],returnPrimitive$1(a.get(o.id),o,s),a.remove(o.id)};const defaultScale=1,defaultMinimumPixelSize=0,defaultIncrementallyLoadTextures=!0,defaultClampAnimations=!0,defaultShadows$1=ShadowMode$1.ENABLED,defaultHeightReference=HeightReference$1.NONE,defaultSilhouetteColor=Color.RED,defaultSilhouetteSize=0,defaultColor$2=Color.WHITE,defaultColorBlendMode=ColorBlendMode$1.HIGHLIGHT,defaultColorBlendAmount=.5,defaultImageBasedLightingFactor=new Cartesian2(1,1),modelMatrixScratch=new Matrix4,nodeMatrixScratch=new Matrix4;function ModelVisualizer(e,t){t.collectionChanged.addEventListener(ModelVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeModel(e,t,n,i){const r=n[t.id];defined(r)&&(i.removeAndDestroy(r.modelPrimitive),delete n[t.id])}function clearNodeTransformationsArticulationsScratch(e,t){const n=t[e.id];defined(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function checkModelLoad(e,t,n){e.readyPromise.otherwise((function(e){console.error(e),n[t.id].loadFail=!0}))}function ScaledPositionProperty(e){this._definitionChanged=new Event,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}ModelVisualizer.prototype.update=function(e){const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let r=0,o=t.length;r<o;r++){const o=t[r],a=o._model;let s,c,l=n[o.id],u=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(u&&(c=o.computeModelMatrix(e,modelMatrixScratch),s=Resource.createIfNeeded(Property.getValueOrUndefined(a._uri,e)),u=defined(c)&&defined(s)),!u){defined(l)&&(l.modelPrimitive.show=!1);continue}let d=defined(l)?l.modelPrimitive:void 0;if(defined(d)&&s.url===l.url||(defined(d)&&(i.removeAndDestroy(d),delete n[o.id]),d=Model.fromGltf({url:s,incrementallyLoadTextures:Property.getValueOrDefault(a._incrementallyLoadTextures,e,defaultIncrementallyLoadTextures),scene:this._scene}),d.id=o,i.add(d),l={modelPrimitive:d,url:s.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1},n[o.id]=l,checkModelLoad(d,o,n)),d.show=!0,d.scale=Property.getValueOrDefault(a._scale,e,defaultScale),d.minimumPixelSize=Property.getValueOrDefault(a._minimumPixelSize,e,defaultMinimumPixelSize),d.maximumScale=Property.getValueOrUndefined(a._maximumScale,e),d.modelMatrix=Matrix4.clone(c,d.modelMatrix),d.shadows=Property.getValueOrDefault(a._shadows,e,defaultShadows$1),d.heightReference=Property.getValueOrDefault(a._heightReference,e,defaultHeightReference),d.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e),d.silhouetteColor=Property.getValueOrDefault(a._silhouetteColor,e,defaultSilhouetteColor,d._silhouetteColor),d.silhouetteSize=Property.getValueOrDefault(a._silhouetteSize,e,defaultSilhouetteSize),d.color=Property.getValueOrDefault(a._color,e,defaultColor$2,d._color),d.colorBlendMode=Property.getValueOrDefault(a._colorBlendMode,e,defaultColorBlendMode),d.colorBlendAmount=Property.getValueOrDefault(a._colorBlendAmount,e,defaultColorBlendAmount),d.clippingPlanes=Property.getValueOrUndefined(a._clippingPlanes,e),d.clampAnimations=Property.getValueOrDefault(a._clampAnimations,e,defaultClampAnimations),d.imageBasedLightingFactor=Property.getValueOrDefault(a._imageBasedLightingFactor,e,defaultImageBasedLightingFactor),d.lightColor=Property.getValueOrUndefined(a._lightColor,e),d.ready){const t=Property.getValueOrDefault(a._runAnimations,e,!0);l.animationsRunning!==t&&(t?d.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT}):d.activeAnimations.removeAll(),l.animationsRunning=t);const n=Property.getValueOrUndefined(a._nodeTransformations,e,l.nodeTransformationsScratch);if(defined(n)){const e=Object.keys(n);for(let t=0,i=e.length;t<i;++t){const i=e[t],r=n[i];if(!defined(r))continue;const o=d.getNode(i);if(!defined(o))continue;const a=Matrix4.fromTranslationRotationScale(r,nodeMatrixScratch);o.matrix=Matrix4.multiply(o.originalMatrix,a,a)}}let i=!1;const r=Property.getValueOrUndefined(a._articulations,e,l.articulationsScratch);if(defined(r)){const e=Object.keys(r);for(let t=0,n=e.length;t<n;++t){const n=e[t],o=r[n];defined(o)&&(i=!0,d.setArticulationStage(n,o))}}i&&d.applyArticulations()}}return!0},ModelVisualizer.prototype.isDestroyed=function(){return!1},ModelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(ModelVisualizer.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)removeModel(this,e[i],t,n);return destroyObject(this)},ModelVisualizer.prototype.getBoundingSphere=function(e,t){const n=this._modelHash[e.id];if(!defined(n)||n.loadFail)return BoundingSphereState$1.FAILED;const i=n.modelPrimitive;if(!defined(i)||!i.show)return BoundingSphereState$1.FAILED;if(!i.ready)return BoundingSphereState$1.PENDING;if(i.heightReference===HeightReference$1.NONE)BoundingSphere.transform(i.boundingSphere,i.modelMatrix,t);else{if(!defined(i._clampedModelMatrix))return BoundingSphereState$1.PENDING;BoundingSphere.transform(i.boundingSphere,i._clampedModelMatrix,t)}return BoundingSphereState$1.DONE},ModelVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o;const a=this._entitiesToVisualize,s=this._modelHash,c=this._primitives;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._model)&&defined(o._position)&&a.set(o.id,o);for(r=i.length-1;r>-1;r--)o=i[r],defined(o._model)&&defined(o._position)?(clearNodeTransformationsArticulationsScratch(o,s),a.set(o.id,o)):(removeModel(this,o,s,c),a.remove(o.id));for(r=n.length-1;r>-1;r--)o=n[r],removeModel(this,o,s,c),a.remove(o.id)},Object.defineProperties(ScaledPositionProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return defined(this._value)?this._value.referenceFrame:ReferenceFrame$1.FIXED}}}),ScaledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ScaledPositionProperty.prototype.setValue=function(e){this._value!==e&&(this._value=e,defined(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),defined(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},ScaledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,n){if(defined(this._value))return defined(n=this._value.getValueInReferenceFrame(e,t,n))?Ellipsoid.WGS84.scaleToGeodeticSurface(n,n):void 0},ScaledPositionProperty.prototype.equals=function(e){return this===e||e instanceof ScaledPositionProperty&&this._value===e._value},ScaledPositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const defaultResolution=60,defaultWidth=1,scratchTimeInterval=new TimeInterval,subSampleCompositePropertyScratch=new TimeInterval,subSampleIntervalPropertyScratch=new TimeInterval;function EntityData$1(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function subSampleSampledProperty(e,t,n,i,r,o,a,s,c){let l,u=s;l=e.getValueInReferenceFrame(t,o,c[u]),defined(l)&&(c[u++]=l);let d=!defined(r)||JulianDate.lessThanOrEquals(r,t)||JulianDate.greaterThanOrEquals(r,n),h=0;const p=i.length;let f=i[h];const m=n;let g,_,y,C=!1;for(;h<p;){if(!d&&JulianDate.greaterThanOrEquals(f,r)&&(l=e.getValueInReferenceFrame(r,o,c[u]),defined(l)&&(c[u++]=l),d=!0),JulianDate.greaterThan(f,t)&&JulianDate.lessThan(f,m)&&!f.equals(r)&&(l=e.getValueInReferenceFrame(f,o,c[u]),defined(l)&&(c[u++]=l)),h<p-1){if(a>0&&!C){const e=i[h+1],t=JulianDate.secondsDifference(e,f);C=t>a,C&&(g=Math.ceil(t/a),_=0,y=t/Math.max(g,2),g=Math.max(g-1,1))}if(C&&_<g){f=JulianDate.addSeconds(f,y,new JulianDate),_++;continue}}C=!1,h++,f=i[h]}return l=e.getValueInReferenceFrame(n,o,c[u]),defined(l)&&(c[u++]=l),u}function subSampleGenericProperty(e,t,n,i,r,o,a,s){let c,l=0,u=a,d=t;const h=Math.max(o,60);let p=!defined(i)||JulianDate.lessThanOrEquals(i,t)||JulianDate.greaterThanOrEquals(i,n);for(;JulianDate.lessThan(d,n);)!p&&JulianDate.greaterThanOrEquals(d,i)&&(p=!0,c=e.getValueInReferenceFrame(i,r,s[u]),defined(c)&&(s[u]=c,u++)),c=e.getValueInReferenceFrame(d,r,s[u]),defined(c)&&(s[u]=c,u++),l++,d=JulianDate.addSeconds(t,h*l,new JulianDate);return c=e.getValueInReferenceFrame(n,r,s[u]),defined(c)&&(s[u]=c,u++),u}function subSampleIntervalProperty(e,t,n,i,r,o,a,s){subSampleIntervalPropertyScratch.start=t,subSampleIntervalPropertyScratch.stop=n;let c=a;const l=e.intervals;for(let t=0;t<l.length;t++){const n=l.get(t);if(!TimeInterval.intersect(n,subSampleIntervalPropertyScratch,scratchTimeInterval).isEmpty){let t=n.start;n.isStartIncluded||(t=n.isStopIncluded?n.stop:JulianDate.addSeconds(n.start,JulianDate.secondsDifference(n.stop,n.start)/2,new JulianDate));const i=e.getValueInReferenceFrame(t,r,s[c]);defined(i)&&(s[c]=i,c++)}}return c}function subSampleConstantProperty(e,t,n,i,r,o,a,s){const c=e.getValueInReferenceFrame(t,r,s[a]);return defined(c)&&(s[a++]=c),a}function subSampleCompositeProperty(e,t,n,i,r,o,a,s){subSampleCompositePropertyScratch.start=t,subSampleCompositePropertyScratch.stop=n;let c=a;const l=e.intervals;for(let e=0;e<l.length;e++){const a=l.get(e);if(!TimeInterval.intersect(a,subSampleCompositePropertyScratch,scratchTimeInterval).isEmpty){const e=a.start,l=a.stop;let u=t;JulianDate.greaterThan(e,u)&&(u=e);let d=n;JulianDate.lessThan(l,d)&&(d=l),c=reallySubSample(a.data,u,d,i,r,o,c,s)}}return c}function reallySubSample(e,t,n,i,r,o,a,s){for(;e instanceof ReferenceProperty;)e=e.resolvedProperty;if(e instanceof SampledPositionProperty){a=subSampleSampledProperty(e,t,n,e._property._times,i,r,o,a,s)}else a=e instanceof CompositePositionProperty?subSampleCompositeProperty(e,t,n,i,r,o,a,s):e instanceof TimeIntervalCollectionPositionProperty?subSampleIntervalProperty(e,t,n,i,r,o,a,s):e instanceof ConstantPositionProperty||e instanceof ScaledPositionProperty&&Property.isConstant(e)?subSampleConstantProperty(e,t,n,i,r,o,a,s):subSampleGenericProperty(e,t,n,i,r,o,a,s);return a}function subSample(e,t,n,i,r,o,a){defined(a)||(a=[]);const s=reallySubSample(e,t,n,i,r,o,0,a);return a.length=s,a}const toFixedScratch=new Matrix3;function PolylineUpdater(e,t){this._unusedIndexes=[],this._polylineCollection=new PolylineCollection,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function PathVisualizer(e,t){t.collectionChanged.addEventListener(PathVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}PolylineUpdater.prototype.update=function(e){if(this._referenceFrame===ReferenceFrame$1.INERTIAL){let t=Transforms.computeIcrfToFixedMatrix(e,toFixedScratch);defined(t)||(t=Transforms.computeTemeToPseudoFixedMatrix(e,toFixedScratch)),Matrix4.fromRotationTranslation(t,Cartesian3.ZERO,this._polylineCollection.modelMatrix)}},PolylineUpdater.prototype.updateObject=function(e,t){const n=t.entity,i=n._path,r=n._position;let o,a;const s=i._show;let c=t.polyline,l=n.isShowing&&n.isAvailable(e)&&(!defined(s)||s.getValue(e));if(l){const t=Property.getValueOrUndefined(i._leadTime,e),r=Property.getValueOrUndefined(i._trailTime,e),s=n._availability,c=defined(s),u=defined(t),d=defined(r);if(l=c||u&&d,l){if(d&&(o=JulianDate.addSeconds(e,-r,new JulianDate)),u&&(a=JulianDate.addSeconds(e,t,new JulianDate)),c){const e=s.start,t=s.stop;d&&!JulianDate.greaterThan(e,o)||(o=e),u&&!JulianDate.lessThan(t,a)||(a=t)}l=JulianDate.lessThan(o,a)}}if(!l)return void(defined(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0));if(!defined(c)){const e=this._unusedIndexes;if(e.length>0){const n=e.pop();c=this._polylineCollection.get(n),t.index=n}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=n,t.polyline=c}const u=Property.getValueOrDefault(i._resolution,e,defaultResolution);c.show=!0,c.positions=subSample(r,o,a,e,this._referenceFrame,u,c.positions.slice()),c.material=MaterialProperty.getValue(e,i._material,c.material),c.width=Property.getValueOrDefault(i._width,e,defaultWidth),c.distanceDisplayCondition=Property.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)},PolylineUpdater.prototype.removeObject=function(e){const t=e.polyline;defined(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)},PolylineUpdater.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),destroyObject(this)},PathVisualizer.prototype.update=function(e){const t=this._updaters;for(const n in t)t.hasOwnProperty(n)&&t[n].update(e);const n=this._items.values;if(0===n.length&&defined(this._updaters)&&Object.keys(this._updaters).length>0){for(const e in t)t.hasOwnProperty(e)&&t[e].destroy();this._updaters={}}for(let t=0,i=n.length;t<i;t++){const i=n[t],r=i.entity._position,o=i.updater;let a=ReferenceFrame$1.FIXED;this._scene.mode===SceneMode$1.SCENE3D&&(a=r.referenceFrame);let s=this._updaters[a];o===s&&defined(s)?s.updateObject(e,i):(defined(o)&&o.removeObject(i),defined(s)||(s=new PolylineUpdater(this._scene,a),s.update(e),this._updaters[a]=s),i.updater=s,defined(s)&&s.updateObject(e,i))}return!0},PathVisualizer.prototype.isDestroyed=function(){return!1},PathVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PathVisualizer.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return destroyObject(this)},PathVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o,a;const s=this._items;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._path)&&defined(o._position)&&s.set(o.id,new EntityData$1(o));for(r=i.length-1;r>-1;r--)o=i[r],defined(o._path)&&defined(o._position)?s.contains(o.id)||s.set(o.id,new EntityData$1(o)):(a=s.get(o.id),defined(a)&&(defined(a.updater)&&a.updater.removeObject(a),s.remove(o.id)));for(r=n.length-1;r>-1;r--)o=n[r],a=s.get(o.id),defined(a)&&(defined(a.updater)&&a.updater.removeObject(a),s.remove(o.id))},PathVisualizer._subSample=subSample;const defaultColor$1=Color.WHITE,defaultOutlineColor=Color.BLACK,defaultOutlineWidth=0,defaultPixelSize=1,defaultDisableDepthTestDistance=0,colorScratch$1=new Color,positionScratch=new Cartesian3,outlineColorScratch=new Color,scaleByDistanceScratch=new NearFarScalar,translucencyByDistanceScratch=new NearFarScalar,distanceDisplayConditionScratch$1=new DistanceDisplayCondition;function EntityData(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function PointVisualizer(e,t){t.collectionChanged.addEventListener(PointVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive(e,t,n){if(defined(e)){if(defined(e.pointPrimitive))return e.pointPrimitive=void 0,void n.removePoint(t);defined(e.billboard)&&(e.billboard=void 0,n.removeBillboard(t))}}PointVisualizer.prototype.update=function(e){const t=this._items.values,n=this._cluster;for(let i=0,r=t.length;i<r;i++){const r=t[i],o=r.entity,a=o._point;let s=r.pointPrimitive,c=r.billboard;const l=Property.getValueOrDefault(a._heightReference,e,HeightReference$1.NONE);let u,d=o.isShowing&&o.isAvailable(e)&&Property.getValueOrDefault(a._show,e,!0);if(d&&(u=Property.getValueOrUndefined(o._position,e,positionScratch),d=defined(u)),!d){returnPrimitive(r,o,n);continue}Property.isConstant(o._position)||(n._clusterDirty=!0);let h=!1,p=!1;if(l===HeightReference$1.NONE||defined(c)?l!==HeightReference$1.NONE||defined(s)||(defined(c)&&(returnPrimitive(r,o,n),c=void 0),s=n.getPoint(o),s.id=o,r.pointPrimitive=s):(defined(s)&&(returnPrimitive(r,o,n),s=void 0),c=n.getBillboard(o),c.id=o,c.image=void 0,r.billboard=c,h=!0,p=Cartesian3.equals(c.position,u)&&c.heightReference===l),defined(s))s.show=!0,s.position=u,s.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch),s.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch),s.color=Property.getValueOrDefault(a._color,e,defaultColor$1,colorScratch$1),s.outlineColor=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor,outlineColorScratch),s.outlineWidth=Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth),s.pixelSize=Property.getValueOrDefault(a._pixelSize,e,defaultPixelSize),s.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),s.disableDepthTestDistance=Property.getValueOrDefault(a._disableDepthTestDistance,e,defaultDisableDepthTestDistance);else if(defined(c)){c.show=!0,c.position=u,c.scaleByDistance=Property.getValueOrUndefined(a._scaleByDistance,e,scaleByDistanceScratch),c.translucencyByDistance=Property.getValueOrUndefined(a._translucencyByDistance,e,translucencyByDistanceScratch),c.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,distanceDisplayConditionScratch$1),c.disableDepthTestDistance=Property.getValueOrDefault(a._disableDepthTestDistance,e,defaultDisableDepthTestDistance),c.heightReference=l;const t=Property.getValueOrDefault(a._color,e,defaultColor$1,colorScratch$1),n=Property.getValueOrDefault(a._outlineColor,e,defaultOutlineColor,outlineColorScratch),i=Math.round(Property.getValueOrDefault(a._outlineWidth,e,defaultOutlineWidth));let o=Math.max(1,Math.round(Property.getValueOrDefault(a._pixelSize,e,defaultPixelSize)));if(i>0?(c.scale=1,h=h||i!==r.outlineWidth||o!==r.pixelSize||!Color.equals(t,r.color)||!Color.equals(n,r.outlineColor)):(c.scale=o/50,o=50,h=h||i!==r.outlineWidth||!Color.equals(t,r.color)||!Color.equals(n,r.outlineColor)),h){r.color=Color.clone(t,r.color),r.outlineColor=Color.clone(n,r.outlineColor),r.pixelSize=o,r.outlineWidth=i;const e=t.alpha,a=t.toCssColorString(),s=n.toCssColorString(),l=JSON.stringify([a,o,s,i]);c.setImage(l,createBillboardPointCallback(e,a,s,i,o))}p&&c._updateClamping()}}return!0},PointVisualizer.prototype.getBoundingSphere=function(e,t){const n=this._items.get(e.id);if(!defined(n)||!defined(n.pointPrimitive)&&!defined(n.billboard))return BoundingSphereState$1.FAILED;if(defined(n.pointPrimitive))t.center=Cartesian3.clone(n.pointPrimitive.position,t.center);else{const e=n.billboard;if(!defined(e._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(e._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},PointVisualizer.prototype.isDestroyed=function(){return!1},PointVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PointVisualizer.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return destroyObject(this)},PointVisualizer.prototype._onCollectionChanged=function(e,t,n,i){let r,o;const a=this._items,s=this._cluster;for(r=t.length-1;r>-1;r--)o=t[r],defined(o._point)&&defined(o._position)&&a.set(o.id,new EntityData(o));for(r=i.length-1;r>-1;r--)o=i[r],defined(o._point)&&defined(o._position)?a.contains(o.id)||a.set(o.id,new EntityData(o)):(returnPrimitive(a.get(o.id),o,s),a.remove(o.id));for(r=n.length-1;r>-1;r--)o=n[r],returnPrimitive(a.get(o.id),o,s),a.remove(o.id)};const defaultZIndex=new ConstantProperty(0),polylineCollections={},scratchColor$4=new Color,defaultMaterial=new ColorMaterialProperty(Color.WHITE),defaultShow=new ConstantProperty(!0),defaultShadows=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$1=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType=new ConstantProperty(ClassificationType$1.BOTH);function GeometryOptions(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function GroundGeometryOptions(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function PolylineGeometryUpdater(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(PolylineGeometryUpdater.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Event,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new GeometryOptions,this._groundGeometryOptions=new GroundGeometryOptions,this._id="polyline-"+e.id,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Entity.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(PolylineGeometryUpdater.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}}),PolylineGeometryUpdater.prototype.isOutlineVisible=function(e){return!1},PolylineGeometryUpdater.prototype.isFilled=function(e){const t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e),!1)},PolylineGeometryUpdater.prototype.createFillGeometryInstance=function(e){const t=this._entity,n=t.isAvailable(e),i=new ShowGeometryInstanceAttribute(n&&t.isShowing&&this._showProperty.getValue(e)),r=this._distanceDisplayConditionProperty.getValue(e),o={show:i,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(r)};let a;return this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,scratchColor$4)),defined(a)||(a=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(a)),this.clampToGround?new GeometryInstance({id:t,geometry:new GroundPolylineGeometry(this._groundGeometryOptions),attributes:o}):(defined(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof ColorMaterialProperty&&(defined(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,scratchColor$4)),defined(a)||(a=Color.WHITE),o.depthFailColor=ColorGeometryInstanceAttribute.fromColor(a)),new GeometryInstance({id:t,geometry:new PolylineGeometry(this._geometryOptions),attributes:o}))},PolylineGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){},PolylineGeometryUpdater.prototype.isDestroyed=function(){return!1},PolylineGeometryUpdater.prototype.destroy=function(){this._entitySubscription(),destroyObject(this)},PolylineGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,n,i){if("availability"!==t&&"polyline"!==t)return;const r=this._entity.polyline;if(!defined(r))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const o=r.positions,a=r.show;if(defined(a)&&a.isConstant&&!a.getValue(Iso8601.MINIMUM_VALUE)||!defined(o))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const s=r.zIndex,c=defaultValue(r.material,defaultMaterial),l=c instanceof ColorMaterialProperty;this._materialProperty=c,this._depthFailMaterialProperty=r.depthFailMaterial,this._showProperty=defaultValue(a,defaultShow),this._shadowsProperty=defaultValue(r.shadows,defaultShadows),this._distanceDisplayConditionProperty=defaultValue(r.distanceDisplayCondition,defaultDistanceDisplayCondition$1),this._classificationTypeProperty=defaultValue(r.classificationType,defaultClassificationType),this._fillEnabled=!0,this._zIndex=defaultValue(s,defaultZIndex);const u=r.width,d=r.arcType,h=r.clampToGround,p=r.granularity;if(o.isConstant&&Property.isConstant(u)&&Property.isConstant(d)&&Property.isConstant(p)&&Property.isConstant(h)&&Property.isConstant(s)){const e=this._geometryOptions,t=o.getValue(Iso8601.MINIMUM_VALUE,e.positions);if(!defined(t)||t.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));let n;n=l&&(!defined(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof ColorMaterialProperty)?PolylineColorAppearance.VERTEX_FORMAT:PolylineMaterialAppearance.VERTEX_FORMAT,e.vertexFormat=n,e.positions=t,e.width=defined(u)?u.getValue(Iso8601.MINIMUM_VALUE):void 0,e.arcType=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):void 0,e.granularity=defined(p)?p.getValue(Iso8601.MINIMUM_VALUE):void 0;const i=this._groundGeometryOptions;i.positions=t,i.width=e.width,i.arcType=e.arcType,i.granularity=e.granularity,this._clampToGround=!!defined(h)&&h.getValue(Iso8601.MINIMUM_VALUE),!this._clampToGround&&defined(s)&&oneTimeWarning("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))},PolylineGeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new DynamicGeometryUpdater(e,t,this)};const generateCartesianArcOptions={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function DynamicGeometryUpdater(e,t,n){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=n,this._positions=[]}function getLine(e){if(defined(e._line))return e._line;const t=e._geometryUpdater._scene.id;let n=polylineCollections[t];const i=e._primitives;!defined(n)||n.isDestroyed()?(n=new PolylineCollection,polylineCollections[t]=n,i.add(n)):i.contains(n)||i.add(n);const r=n.add();return r.id=e._geometryUpdater._entity,e._line=r,r}DynamicGeometryUpdater.prototype.update=function(e){const t=this._geometryUpdater,n=t._entity,i=n.polyline,r=i.positions;let o=Property.getValueOrUndefined(r,e,this._positions);t._clampToGround=Property.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=o,t._groundGeometryOptions.width=Property.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=Property.getValueOrDefault(i._arcType,e,ArcType$1.GEODESIC),t._groundGeometryOptions.granularity=Property.getValueOrDefault(i._granularity,e,9999);const a=this._groundPrimitives;if(defined(this._groundPolylinePrimitive)&&(a.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!Property.getValueOrDefault(i._show,e,!0))return;if(!defined(o)||o.length<2)return;const r=t.fillMaterialProperty;let s;if(r instanceof ColorMaterialProperty)s=new PolylineColorAppearance;else{const t=MaterialProperty.getValue(e,r,this._material);s=new PolylineMaterialAppearance({material:t,translucent:t.isTranslucent()}),this._material=t}return this._groundPolylinePrimitive=a.add(new GroundPolylinePrimitive({geometryInstances:t.createFillGeometryInstance(e),appearance:s,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Property.getValueOrUndefined(t.zIndex,e)),void(defined(this._line)&&(this._line.show=!1))}const s=getLine(this);if(!n.isShowing||!n.isAvailable(e)||!Property.getValueOrDefault(i._show,e,!0))return void(s.show=!1);if(!defined(o)||o.length<2)return void(s.show=!1);let c=ArcType$1.GEODESIC;c=Property.getValueOrDefault(i._arcType,e,c);const l=t._scene.globe;c!==ArcType$1.NONE&&defined(l)&&(generateCartesianArcOptions.ellipsoid=l.ellipsoid,generateCartesianArcOptions.positions=o,generateCartesianArcOptions.granularity=Property.getValueOrUndefined(i._granularity,e),generateCartesianArcOptions.height=PolylinePipeline.extractHeights(o,l.ellipsoid),o=c===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc(generateCartesianArcOptions):PolylinePipeline.generateCartesianRhumbArc(generateCartesianArcOptions)),s.show=!0,s.positions=o.slice(),s.material=MaterialProperty.getValue(e,t.fillMaterialProperty,s.material),s.width=Property.getValueOrDefault(i._width,e,1),s.distanceDisplayCondition=Property.getValueOrUndefined(i._distanceDisplayCondition,e,s.distanceDisplayCondition)},DynamicGeometryUpdater.prototype.getBoundingSphere=function(e){if(this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(defined(t)&&t.show&&t.ready){const n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(defined(n)&&defined(n.boundingSphere))return BoundingSphere.clone(n.boundingSphere,e),BoundingSphereState$1.DONE}return defined(t)&&!t.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.DONE}{const t=getLine(this);if(t.show&&t.positions.length>0)return BoundingSphere.fromPoints(t.positions,e),BoundingSphereState$1.DONE}return BoundingSphereState$1.FAILED},DynamicGeometryUpdater.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater.prototype.destroy=function(){const e=this._geometryUpdater._scene.id,t=polylineCollections[e];defined(t)&&(t.remove(this._line),0===t.length&&(this._primitives.removeAndDestroy(t),delete polylineCollections[e])),defined(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),destroyObject(this)};const scratchColor$3=new Color,distanceDisplayConditionScratch=new DistanceDisplayCondition,defaultDistanceDisplayCondition=new DistanceDisplayCondition;function Batch(e,t,n,i,r){let o;o=n instanceof ColorMaterialProperty?PolylineColorAppearance:PolylineMaterialAppearance,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=o,this.materialProperty=n,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Batch.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.zIndex=i,this._asynchronous=r}function StaticGroundPolylinePerMaterialBatch(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=defaultValue(n,!0)}Batch.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(n)},Batch.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Property.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(n,i,r,o){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},Batch.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return defined(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},Batch.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,r=this.geometry.values;let o;if(this.createPrimitive){if(r.length>0)defined(n)&&(defined(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new GroundPolylinePrimitive({show:!1,asynchronous:this._asynchronous,geometryInstances:r.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{defined(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;defined(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const t=this.updatersWithAttributes.values,r=t.length;for(o=0;o<r;o++){const i=t[o],r=i.entity,a=this.geometry.get(i.id);let s=this.attributes.get(a.id.id);if(defined(s)||(s=n.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,s)),!i.fillMaterialProperty.isConstant){const t=i.fillMaterialProperty.color,n=Property.getValueOrDefault(t,e,Color.WHITE,scratchColor$3);Color.equals(s._lastColor,n)||(s._lastColor=Color.clone(n,s._lastColor),s.color=ColorGeometryInstanceAttribute.toValue(n,s.color))}const c=r.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(c,s.show));const l=i.distanceDisplayConditionProperty;if(!Property.isConstant(l)){const t=Property.getValueOrDefault(l,e,defaultDistanceDisplayCondition,distanceDisplayConditionScratch);DistanceDisplayCondition.equals(t,s._lastDistanceDisplayCondition)||(s._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(t,s._lastDistanceDisplayCondition),s.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(t,s.distanceDisplayCondition))}}this.updateShows(n)}else defined(n)&&!n.ready&&(t=!1);return t},Batch.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],r=n.entity,o=this.geometry.get(n.id);let a=this.attributes.get(o.id.id);defined(a)||(a=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,a));const s=r.isShowing;s!==(1===a.show[0])&&(a.show=ShowGeometryInstanceAttribute.toValue(s,a.show),o.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()},Batch.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return BoundingSphereState$1.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!defined(i)||!defined(i.boundingSphere)||defined(i.show)&&0===i.show[0]?BoundingSphereState$1.FAILED:(i.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;defined(e)&&t.remove(e);const n=this.oldPrimitive;defined(n)&&t.remove(n),this.removeMaterialSubscription()},StaticGroundPolylinePerMaterialBatch.prototype.add=function(e,t){const n=this._items,i=n.length,r=t.createFillGeometryInstance(e),o=Property.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){const i=n[a];if(i.isMaterial(t)&&i.zIndex===o)return void i.add(e,t,r)}const a=new Batch(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,o,this._asynchronous);a.add(e,t,r),n.push(a)},StaticGroundPolylinePerMaterialBatch.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},StaticGroundPolylinePerMaterialBatch.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const r=i.updaters.values,o=r.length;for(let t=0;t<o;t++)this.add(e,r[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const i=n[r];if(i.contains(e))return i.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundPolylinePerMaterialBatch.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const emptyArray=[];function removeUpdater(e,t){const n=e._batches,i=n.length;for(let e=0;e<i;e++)n[e].remove(t)}function insertUpdaterIntoBatch(e,t,n){if(n.isDynamic)return void e._dynamicBatch.add(t,n);if(n.clampToGround&&n.fillEnabled){const i=n.classificationTypeProperty.getValue(t);return void e._groundBatches[i].add(t,n)}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let r,o=0;defined(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof ColorMaterialProperty?1:2),defined(i)&&(r=i+o*ShadowMode$1.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof ColorMaterialProperty?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function PolylineVisualizer(e,t,n,i){let r;i=defaultValue(i,e.groundPrimitives),n=defaultValue(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;const o=ShadowMode$1.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(3*o),this._materialBatches=new Array(3*o),r=0;r<o;++r)this._colorBatches[r]=new StaticGeometryColorBatch(n,PolylineColorAppearance,void 0,!1,r),this._materialBatches[r]=new StaticGeometryPerMaterialBatch(n,PolylineMaterialAppearance,void 0,!1,r),this._colorBatches[r+o]=new StaticGeometryColorBatch(n,PolylineColorAppearance,PolylineColorAppearance,!1,r),this._materialBatches[r+o]=new StaticGeometryPerMaterialBatch(n,PolylineMaterialAppearance,PolylineColorAppearance,!1,r),this._colorBatches[r+2*o]=new StaticGeometryColorBatch(n,PolylineColorAppearance,PolylineMaterialAppearance,!1,r),this._materialBatches[r+2*o]=new StaticGeometryPerMaterialBatch(n,PolylineMaterialAppearance,PolylineMaterialAppearance,!1,r);this._dynamicBatch=new DynamicGeometryBatch(n,i);const a=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(a),r=0;r<a;++r)this._groundBatches[r]=new StaticGroundPolylinePerMaterialBatch(i,r);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new AssociativeArray,this._updaters=new AssociativeArray,this._entityCollection=t,t.collectionChanged.addEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray)}PolylineVisualizer.prototype.update=function(e){const t=this._addedObjects,n=t.values,i=this._removedObjects,r=i.values,o=this._changedObjects,a=o.values;let s,c,l,u;for(s=a.length-1;s>-1;s--)c=a[s],l=c.id,u=this._updaters.get(l),u.entity===c?(removeUpdater(this,u),insertUpdaterIntoBatch(this,e,u)):(r.push(c),n.push(c));for(s=r.length-1;s>-1;s--)c=r[s],l=c.id,u=this._updaters.get(l),removeUpdater(this,u),u.destroy(),this._updaters.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(s=n.length-1;s>-1;s--)c=n[s],l=c.id,u=new PolylineGeometryUpdater(c,this._scene),this._updaters.set(l,u),insertUpdaterIntoBatch(this,e,u),this._subscriptions.set(l,u.geometryChanged.addEventListener(PolylineVisualizer._onGeometryChanged,this));t.removeAll(),i.removeAll(),o.removeAll();let d=!0;const h=this._batches,p=h.length;for(s=0;s<p;s++)d=h[s].update(e)&&d;return d};const getBoundingSphereArrayScratch$1=[],getBoundingSphereBoundingSphereScratch$1=new BoundingSphere;function DataSourceDisplay(e){GroundPrimitive.initializeTerrainHeights(),GroundPolylinePrimitive.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new EventHelper,this._eventHelper.add(n.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(n.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(n.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=n,this._scene=t,this._visualizersCallback=defaultValue(e.visualizersCallback,DataSourceDisplay.defaultVisualizersCallback);let i=!1;const r=new PrimitiveCollection,o=new PrimitiveCollection;n.length>0&&(t.primitives.add(r),t.groundPrimitives.add(o),i=!0),this._primitives=r,this._groundPrimitives=o;for(let e=0,t=n.length;e<t;e++)this._onDataSourceAdded(n,n.get(e));const a=new CustomDataSource;let s,c;if(this._onDataSourceAdded(void 0,a),this._defaultDataSource=a,!i){const e=this,i=function(){t.primitives.add(r),t.groundPrimitives.add(o),s(),c(),e._removeDefaultDataSourceListener=void 0,e._removeDataSourceCollectionListener=void 0};s=a.entities.collectionChanged.addEventListener(i),c=n.dataSourceAdded.addEventListener(i)}this._removeDefaultDataSourceListener=s,this._removeDataSourceCollectionListener=c,this._ready=!1}PolylineVisualizer.prototype.getBoundingSphere=function(e,t){const n=getBoundingSphereArrayScratch$1,i=getBoundingSphereBoundingSphereScratch$1;let r=0,o=BoundingSphereState$1.DONE;const a=this._batches,s=a.length,c=this._updaters.get(e.id);for(let e=0;e<s;e++){if(o=a[e].getBoundingSphere(c,i),o===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;o===BoundingSphereState$1.DONE&&(n[r]=BoundingSphere.clone(i,n[r]),r++)}return 0===r?BoundingSphereState$1.FAILED:(n.length=r,BoundingSphere.fromBoundingSpheres(n,t),BoundingSphereState$1.DONE)},PolylineVisualizer.prototype.isDestroyed=function(){return!1},PolylineVisualizer.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),destroyObject(this)},PolylineVisualizer._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,r=i.id;defined(t.get(r))||defined(n.get(r))||n.set(r,i)},PolylineVisualizer.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,r=this._removedObjects,o=this._changedObjects;let a,s,c;for(a=n.length-1;a>-1;a--)c=n[a],s=c.id,i.remove(s)||(r.set(s,c),o.remove(s));for(a=t.length-1;a>-1;a--)c=t[a],s=c.id,r.remove(s)?o.set(s,c):i.set(s,c)},DataSourceDisplay.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new BillboardVisualizer(t,i),new GeometryVisualizer(e,i,n._primitives,n._groundPrimitives),new LabelVisualizer(t,i),new ModelVisualizer(e,i),new Cesium3DTilesetVisualizer(e,i),new PointVisualizer(t,i),new PathVisualizer(e,i),new PolylineVisualizer(e,i,n._primitives,n._groundPrimitives)]},Object.defineProperties(DataSourceDisplay.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}}),DataSourceDisplay.prototype.isDestroyed=function(){return!1},DataSourceDisplay.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,n=e.length;t<n;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),defined(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),destroyObject(this)},DataSourceDisplay.prototype.update=function(e){if(!ApproximateTerrainHeights.initialized)return this._ready=!1,!1;let t,n,i,r,o=!0;const a=this._dataSourceCollection,s=a.length;for(t=0;t<s;t++){const s=a.get(t);for(defined(s.update)&&(o=s.update(e)&&o),i=s._visualizers,r=i.length,n=0;n<r;n++)o=i[n].update(e)&&o}for(i=this._defaultDataSource._visualizers,r=i.length,n=0;n<r;n++)o=i[n].update(e)&&o;return this._ready=o,o},DataSourceDisplay.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){const n=t.get(i),r=n.credit;defined(r)&&e.creditDisplay.addCredit(r);const o=n._resourceCredits;if(defined(o)){const t=o.length;for(let n=0;n<t;n++)e.creditDisplay.addCredit(o[n])}}};const getBoundingSphereArrayScratch=[],getBoundingSphereBoundingSphereScratch=new BoundingSphere;DataSourceDisplay.prototype.getBoundingSphere=function(e,t,n){if(!this._ready)return BoundingSphereState$1.PENDING;let i,r,o=this._defaultDataSource;if(!o.entities.contains(e)){o=void 0;const t=this._dataSourceCollection;for(r=t.length,i=0;i<r;i++){const n=t.get(i);if(n.entities.contains(e)){o=n;break}}}if(!defined(o))return BoundingSphereState$1.FAILED;const a=getBoundingSphereArrayScratch,s=getBoundingSphereBoundingSphereScratch;let c=0,l=BoundingSphereState$1.DONE;const u=o._visualizers,d=u.length;for(i=0;i<d;i++){if(defined(u[i].getBoundingSphere)){if(l=u[i].getBoundingSphere(e,s),!t&&l===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;l===BoundingSphereState$1.DONE&&(a[c]=BoundingSphere.clone(s,a[c]),c++)}}return 0===c?BoundingSphereState$1.FAILED:(a.length=c,BoundingSphere.fromBoundingSpheres(a,n),BoundingSphereState$1.DONE)},DataSourceDisplay.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,r=this._groundPrimitives,o=i.add(new PrimitiveCollection),a=r.add(new OrderedGroundPrimitiveCollection);t._primitives=o,t._groundPrimitives=a;const s=t.clustering;s._initialize(n),o.add(s),t._visualizers=this._visualizersCallback(n,s,t)},DataSourceDisplay.prototype._onDataSourceRemoved=function(e,t){const n=this._primitives,i=this._groundPrimitives,r=t._primitives,o=t._groundPrimitives,a=t.clustering;r.remove(a);const s=t._visualizers,c=s.length;for(let e=0;e<c;e++)s[e].destroy();n.remove(r),i.remove(o),t._visualizers=void 0},DataSourceDisplay.prototype._onDataSourceMoved=function(e,t,n){const i=this._primitives,r=this._groundPrimitives,o=e._primitives,a=e._groundPrimitives;t===n+1?(i.raise(o),r.raise(a)):t===n-1?(i.lower(o),r.lower(a)):0===t?(i.lowerToBottom(o),r.lowerToBottom(a),i.raise(o),r.raise(a)):(i.raiseToTop(o),r.raiseToTop(a))};const updateTransformMatrix3Scratch1=new Matrix3,updateTransformMatrix3Scratch2=new Matrix3,updateTransformMatrix3Scratch3=new Matrix3,updateTransformMatrix4Scratch=new Matrix4,updateTransformCartesian3Scratch1=new Cartesian3,updateTransformCartesian3Scratch2=new Cartesian3,updateTransformCartesian3Scratch3=new Cartesian3,updateTransformCartesian3Scratch4=new Cartesian3,updateTransformCartesian3Scratch5=new Cartesian3,updateTransformCartesian3Scratch6=new Cartesian3,deltaTime=new JulianDate,northUpAxisFactor=1.25;function updateTransform(e,t,n,i,r,o,a){const s=e.scene.mode;let c=r.getValue(o,e._lastCartesian);if(defined(c)){let n,l,u,d,h,p,f=!1,m=!1;if(s===SceneMode$1.SCENE3D){JulianDate.addSeconds(o,.001,deltaTime);let e=r.getValue(deltaTime,updateTransformCartesian3Scratch1);if(defined(e)||(JulianDate.addSeconds(o,-.001,deltaTime),e=r.getValue(deltaTime,updateTransformCartesian3Scratch1),m=!0),defined(e)){let t,i=Transforms.computeFixedToIcrfMatrix(o,updateTransformMatrix3Scratch1),r=Transforms.computeFixedToIcrfMatrix(deltaTime,updateTransformMatrix3Scratch2);defined(i)&&defined(r)?t=Matrix3.transpose(i,updateTransformMatrix3Scratch3):(t=Transforms.computeTemeToPseudoFixedMatrix(o,updateTransformMatrix3Scratch3),i=Matrix3.transpose(t,updateTransformMatrix3Scratch1),r=Transforms.computeTemeToPseudoFixedMatrix(deltaTime,updateTransformMatrix3Scratch2),Matrix3.transpose(r,r));const s=Matrix3.multiplyByVector(i,c,updateTransformCartesian3Scratch5),d=Matrix3.multiplyByVector(r,e,updateTransformCartesian3Scratch6);Cartesian3.subtract(s,d,updateTransformCartesian3Scratch4);const h=1e3*Cartesian3.magnitude(updateTransformCartesian3Scratch4),p=CesiumMath.GRAVITATIONALPARAMETER,g=-p/(h*h-2*p/Cartesian3.magnitude(s));g<0||g>northUpAxisFactor*a.maximumRadius?(n=updateTransformCartesian3Scratch2,Cartesian3.normalize(c,n),Cartesian3.negate(n,n),u=Cartesian3.clone(Cartesian3.UNIT_Z,updateTransformCartesian3Scratch3),l=Cartesian3.cross(u,n,updateTransformCartesian3Scratch1),Cartesian3.magnitude(l)>CesiumMath.EPSILON7&&(Cartesian3.normalize(n,n),Cartesian3.normalize(l,l),u=Cartesian3.cross(n,l,updateTransformCartesian3Scratch3),Cartesian3.normalize(u,u),f=!0)):Cartesian3.equalsEpsilon(c,e,CesiumMath.EPSILON7)||(u=updateTransformCartesian3Scratch2,Cartesian3.normalize(s,u),Cartesian3.normalize(d,d),l=Cartesian3.cross(u,d,updateTransformCartesian3Scratch3),m&&(l=Cartesian3.multiplyByScalar(l,-1,l)),Cartesian3.equalsEpsilon(l,Cartesian3.ZERO,CesiumMath.EPSILON7)||(n=Cartesian3.cross(l,u,updateTransformCartesian3Scratch1),Matrix3.multiplyByVector(t,n,n),Matrix3.multiplyByVector(t,l,l),Matrix3.multiplyByVector(t,u,u),Cartesian3.normalize(n,n),Cartesian3.normalize(l,l),Cartesian3.normalize(u,u),f=!0))}}defined(e.boundingSphere)&&(c=e.boundingSphere.center),i&&(d=Cartesian3.clone(t.position,updateTransformCartesian3Scratch4),h=Cartesian3.clone(t.direction,updateTransformCartesian3Scratch5),p=Cartesian3.clone(t.up,updateTransformCartesian3Scratch6));const g=updateTransformMatrix4Scratch;f?(g[0]=n.x,g[1]=n.y,g[2]=n.z,g[3]=0,g[4]=l.x,g[5]=l.y,g[6]=l.z,g[7]=0,g[8]=u.x,g[9]=u.y,g[10]=u.z,g[11]=0,g[12]=c.x,g[13]=c.y,g[14]=c.z,g[15]=0):Transforms.eastNorthUpToFixedFrame(c,a,g),t._setTransform(g),i&&(Cartesian3.clone(d,t.position),Cartesian3.clone(h,t.direction),Cartesian3.clone(p,t.up),Cartesian3.cross(h,p,t.right))}if(n){const n=s===SceneMode$1.SCENE2D||Cartesian3.equals(e._offset3D,Cartesian3.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,n)}}function EntityView(e,t,n){this.entity=e,this.scene=t,this.ellipsoid=defaultValue(n,Ellipsoid.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new Cartesian3,this._defaultOffset3D=void 0,this._offset3D=new Cartesian3}Object.defineProperties(EntityView,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=Cartesian3.clone(e,new Cartesian3)}}}),EntityView.defaultOffset3D=new Cartesian3(-14e3,3500,3500);const scratchHeadingPitchRange=new HeadingPitchRange,scratchCartesian$2=new Cartesian3;EntityView.prototype.update=function(e,t){const n=this.scene,i=this.ellipsoid,r=n.mode;if(r===SceneMode$1.MORPHING)return;const o=this.entity,a=o.position;if(!defined(a))return;const s=o!==this._lastEntity,c=r!==this._mode,l=n.camera;let u=s||c,d=!0;if(s){const n=o.viewFrom,r=defined(n);if(!r&&defined(t)){scratchHeadingPitchRange.pitch=-CesiumMath.PI_OVER_FOUR,scratchHeadingPitchRange.range=0;const n=a.getValue(e,scratchCartesian$2);if(defined(n)){const e=2-1/Math.max(1,Cartesian3.magnitude(n)/i.maximumRadius);scratchHeadingPitchRange.pitch*=e}l.viewBoundingSphere(t,scratchHeadingPitchRange),this.boundingSphere=t,u=!1,d=!1}else r&&defined(n.getValue(e,this._offset3D))||Cartesian3.clone(EntityView._defaultOffset3D,this._offset3D)}else c||this._mode===SceneMode$1.SCENE2D||Cartesian3.clone(l.position,this._offset3D);this._lastEntity=o,this._mode=r,updateTransform(this,l,u,d,a,e,i)};const MAX_BITS$1=15,D_CODES=30,BL_CODES=19,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,HEAP_SIZE=2*L_CODES+1,END_BLOCK=256,MAX_BL_BITS=7,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,Buf_size=16,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_DEFAULT_STRATEGY=0,Z_NO_FLUSH$1=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH$1=4,Z_OK$1=0,Z_STREAM_END$1=1,Z_NEED_DICT$1=2,Z_STREAM_ERROR$1=-2,Z_DATA_ERROR$1=-3,Z_BUF_ERROR$1=-5;function extractArray(e){return flatArray(e.map((([e,t])=>new Array(e).fill(t,0,e))))}function flatArray(e){return e.reduce(((e,t)=>e.concat(Array.isArray(t)?flatArray(t):t)),[])}const _dist_code=[0,1,2,3].concat(...extractArray([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function Tree(){const e=this;function t(e,t){let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}e.build_tree=function(n){const i=e.dyn_tree,r=e.stat_desc.static_tree,o=e.stat_desc.elems;let a,s,c,l=-1;for(n.heap_len=0,n.heap_max=HEAP_SIZE,a=0;a<o;a++)0!==i[2*a]?(n.heap[++n.heap_len]=l=a,n.depth[a]=0):i[2*a+1]=0;for(;n.heap_len<2;)c=n.heap[++n.heap_len]=l<2?++l:0,i[2*c]=1,n.depth[c]=0,n.opt_len--,r&&(n.static_len-=r[2*c+1]);for(e.max_code=l,a=Math.floor(n.heap_len/2);a>=1;a--)n.pqdownheap(i,a);c=o;do{a=n.heap[1],n.heap[1]=n.heap[n.heap_len--],n.pqdownheap(i,1),s=n.heap[1],n.heap[--n.heap_max]=a,n.heap[--n.heap_max]=s,i[2*c]=i[2*a]+i[2*s],n.depth[c]=Math.max(n.depth[a],n.depth[s])+1,i[2*a+1]=i[2*s+1]=c,n.heap[1]=c++,n.pqdownheap(i,1)}while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],function(t){const n=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,a=e.stat_desc.max_length;let s,c,l,u,d,h,p=0;for(u=0;u<=MAX_BITS$1;u++)t.bl_count[u]=0;for(n[2*t.heap[t.heap_max]+1]=0,s=t.heap_max+1;s<HEAP_SIZE;s++)c=t.heap[s],u=n[2*n[2*c+1]+1]+1,u>a&&(u=a,p++),n[2*c+1]=u,c>e.max_code||(t.bl_count[u]++,d=0,c>=o&&(d=r[c-o]),h=n[2*c],t.opt_len+=h*(u+d),i&&(t.static_len+=h*(i[2*c+1]+d)));if(0!==p){do{for(u=a-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[a]--,p-=2}while(p>0);for(u=a;0!==u;u--)for(c=t.bl_count[u];0!==c;)l=t.heap[--s],l>e.max_code||(n[2*l+1]!=u&&(t.opt_len+=(u-n[2*l+1])*n[2*l],n[2*l+1]=u),c--)}}(n),function(e,n,i){const r=[];let o,a,s,c=0;for(o=1;o<=MAX_BITS$1;o++)r[o]=c=c+i[o-1]<<1;for(a=0;a<=n;a++)s=e[2*a+1],0!==s&&(e[2*a]=t(r[s]++,s))}(i,e.max_code,n.bl_count)}}function StaticTree(e,t,n,i,r){const o=this;o.static_tree=e,o.extra_bits=t,o.extra_base=n,o.elems=i,o.max_length=r}Tree._length_code=[0,1,2,3,4,5,6,7].concat(...extractArray([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),Tree.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Tree.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Tree.d_code=function(e){return e<256?_dist_code[e]:_dist_code[256+(e>>>7)]},Tree.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Tree.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Tree.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Tree.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],StaticTree.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],StaticTree.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],StaticTree.static_l_desc=new StaticTree(StaticTree.static_ltree,Tree.extra_lbits,LITERALS+1,L_CODES,MAX_BITS$1),StaticTree.static_d_desc=new StaticTree(StaticTree.static_dtree,Tree.extra_dbits,0,D_CODES,MAX_BITS$1),StaticTree.static_bl_desc=new StaticTree(null,Tree.extra_blbits,0,BL_CODES,MAX_BL_BITS);const MAX_MEM_LEVEL=9,DEF_MEM_LEVEL=8;function Config(e,t,n,i,r){const o=this;o.good_length=e,o.max_lazy=t,o.nice_length=n,o.max_chain=i,o.func=r}const STORED$1=0,FAST=1,SLOW=2,config_table=[new Config(0,0,0,0,STORED$1),new Config(4,4,8,4,FAST),new Config(4,5,16,8,FAST),new Config(4,6,32,32,FAST),new Config(4,4,16,16,SLOW),new Config(8,16,32,32,SLOW),new Config(8,16,128,128,SLOW),new Config(8,32,128,256,SLOW),new Config(32,128,258,1024,SLOW),new Config(32,258,258,4096,SLOW)],z_errmsg=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],NeedMore=0,BlockDone=1,FinishStarted=2,FinishDone=3,PRESET_DICT$1=32,INIT_STATE=42,BUSY_STATE=113,FINISH_STATE=666,Z_DEFLATED$1=8,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1;function smaller(e,t,n,i){const r=e[2*t],o=e[2*n];return r<o||r==o&&i[t]<=i[n]}function Deflate$1(){const e=this;let t,n,i,r,o,a,s,c,l,u,d,h,p,f,m,g,_,y,C,T,S,A,v,E,b,x,P,D,w,M,I,R,O;const B=new Tree,L=new Tree,F=new Tree;let N,V,k,U,G,$,z,H;function W(){let t;for(t=0;t<L_CODES;t++)I[2*t]=0;for(t=0;t<D_CODES;t++)R[2*t]=0;for(t=0;t<BL_CODES;t++)O[2*t]=0;I[2*END_BLOCK]=1,e.opt_len=e.static_len=0,k=G=0}function q(e,t){let n,i=-1,r=e[1],o=0,a=7,s=4;0===r&&(a=138,s=3),e[2*(t+1)+1]=65535;for(let c=0;c<=t;c++)n=r,r=e[2*(c+1)+1],++o<a&&n==r||(o<s?O[2*n]+=o:0!==n?(n!=i&&O[2*n]++,O[2*REP_3_6]++):o<=10?O[2*REPZ_3_10]++:O[2*REPZ_11_138]++,o=0,i=n,0===r?(a=138,s=3):n==r?(a=6,s=3):(a=7,s=4))}function j(t){e.pending_buf[e.pending++]=t}function X(e){j(255&e),j(e>>>8&255)}function Y(e,t){let n;const i=t;H>Buf_size-i?(n=e,z|=n<<H&65535,X(z),z=n>>>Buf_size-H,H+=i-Buf_size):(z|=e<<H&65535,H+=i)}function K(e,t){const n=2*e;Y(65535&t[n],65535&t[n+1])}function J(e,t){let n,i,r=-1,o=e[1],a=0,s=7,c=4;for(0===o&&(s=138,c=3),n=0;n<=t;n++)if(i=o,o=e[2*(n+1)+1],!(++a<s&&i==o)){if(a<c)do{K(i,O)}while(0!=--a);else 0!==i?(i!=r&&(K(i,O),a--),K(REP_3_6,O),Y(a-3,2)):a<=10?(K(REPZ_3_10,O),Y(a-3,3)):(K(REPZ_11_138,O),Y(a-11,7));a=0,r=i,0===o?(s=138,c=3):i==o?(s=6,c=3):(s=7,c=4)}}function Q(){16==H?(X(z),z=0,H=0):H>=8&&(j(255&z),z>>>=8,H-=8)}function Z(t,n){let i,r,o;if(e.pending_buf[U+2*k]=t>>>8&255,e.pending_buf[U+2*k+1]=255&t,e.pending_buf[N+k]=255&n,k++,0===t?I[2*n]++:(G++,t--,I[2*(Tree._length_code[n]+LITERALS+1)]++,R[2*Tree.d_code(t)]++),0==(8191&k)&&P>2){for(i=8*k,r=S-_,o=0;o<D_CODES;o++)i+=R[2*o]*(5+Tree.extra_dbits[o]);if(i>>>=3,G<Math.floor(k/2)&&i<Math.floor(r/2))return!0}return k==V-1}function ee(t,n){let i,r,o,a,s=0;if(0!==k)do{i=e.pending_buf[U+2*s]<<8&65280|255&e.pending_buf[U+2*s+1],r=255&e.pending_buf[N+s],s++,0===i?K(r,t):(o=Tree._length_code[r],K(o+LITERALS+1,t),a=Tree.extra_lbits[o],0!==a&&(r-=Tree.base_length[o],Y(r,a)),i--,o=Tree.d_code(i),K(o,n),a=Tree.extra_dbits[o],0!==a&&(i-=Tree.base_dist[o],Y(i,a)))}while(s<k);K(END_BLOCK,t),$=t[2*END_BLOCK+1]}function te(){H>8?X(z):H>0&&j(255&z),z=0,H=0}function ne(t,n,i){Y((STORED_BLOCK<<1)+(i?1:0),3),function(t,n,i){te(),$=8,i&&(X(n),X(~n)),e.pending_buf.set(c.subarray(t,t+n),e.pending),e.pending+=n}(t,n,!0)}function ie(t,n,i){let r,o,a=0;P>0?(B.build_tree(e),L.build_tree(e),a=function(){let t;for(q(I,B.max_code),q(R,L.max_code),F.build_tree(e),t=BL_CODES-1;t>=3&&0===O[2*Tree.bl_order[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(),r=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=r&&(r=o)):r=o=n+5,n+4<=r&&-1!=t?ne(t,n,i):o==r?(Y((STATIC_TREES<<1)+(i?1:0),3),ee(StaticTree.static_ltree,StaticTree.static_dtree)):(Y((DYN_TREES<<1)+(i?1:0),3),function(e,t,n){let i;for(Y(e-257,5),Y(t-1,5),Y(n-4,4),i=0;i<n;i++)Y(O[2*Tree.bl_order[i]+1],3);J(I,e-1),J(R,t-1)}(B.max_code+1,L.max_code+1,a+1),ee(I,R)),W(),i&&te()}function re(e){ie(_>=0?_:-1,S-_,e),_=S,t.flush_pending()}function oe(){let e,n,i,r;do{if(r=l-v-S,0===r&&0===S&&0===v)r=o;else if(-1==r)r--;else if(S>=o+o-MIN_LOOKAHEAD){c.set(c.subarray(o,o+o),0),A-=o,S-=o,_-=o,e=p,i=e;do{n=65535&d[--i],d[i]=n>=o?n-o:0}while(0!=--e);e=o,i=e;do{n=65535&u[--i],u[i]=n>=o?n-o:0}while(0!=--e);r+=o}if(0===t.avail_in)return;e=t.read_buf(c,S+v,r),v+=e,v>=MIN_MATCH&&(h=255&c[S],h=(h<<g^255&c[S+1])&m)}while(v<MIN_LOOKAHEAD&&0!==t.avail_in)}function ae(e){let t,n,i=b,r=S,a=E;const l=S>o-MIN_LOOKAHEAD?S-(o-MIN_LOOKAHEAD):0;let d=M;const h=s,p=S+MAX_MATCH;let f=c[r+a-1],m=c[r+a];E>=w&&(i>>=2),d>v&&(d=v);do{if(t=e,c[t+a]==m&&c[t+a-1]==f&&c[t]==c[r]&&c[++t]==c[r+1]){r+=2,t++;do{}while(c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&c[++r]==c[++t]&&r<p);if(n=MAX_MATCH-(p-r),r=p-MAX_MATCH,n>a){if(A=e,a=n,n>=d)break;f=c[r+a-1],m=c[r+a]}}}while((e=65535&u[e&h])>l&&0!=--i);return a<=v?a:v}function se(t){return t.total_in=t.total_out=0,t.msg=null,e.pending=0,e.pending_out=0,n=BUSY_STATE,r=Z_NO_FLUSH$1,B.dyn_tree=I,B.stat_desc=StaticTree.static_l_desc,L.dyn_tree=R,L.stat_desc=StaticTree.static_d_desc,F.dyn_tree=O,F.stat_desc=StaticTree.static_bl_desc,z=0,H=0,$=8,W(),function(){l=2*o,d[p-1]=0;for(let e=0;e<p-1;e++)d[e]=0;x=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,b=config_table[P].max_chain,S=0,_=0,v=0,y=E=MIN_MATCH-1,T=0,h=0}(),Z_OK$1}e.depth=[],e.bl_count=[],e.heap=[],I=[],R=[],O=[],e.pqdownheap=function(t,n){const i=e.heap,r=i[n];let o=n<<1;for(;o<=e.heap_len&&(o<e.heap_len&&smaller(t,i[o+1],i[o],e.depth)&&o++,!smaller(t,r,i[o],e.depth));)i[n]=i[o],n=o,o<<=1;i[n]=r},e.deflateInit=function(t,n,r,l,h,_){return l||(l=Z_DEFLATED$1),h||(h=DEF_MEM_LEVEL),_||(_=Z_DEFAULT_STRATEGY),t.msg=null,n==Z_DEFAULT_COMPRESSION&&(n=6),h<1||h>MAX_MEM_LEVEL||l!=Z_DEFLATED$1||r<9||r>15||n<0||n>9||_<0||_>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(t.dstate=e,a=r,o=1<<a,s=o-1,f=h+7,p=1<<f,m=p-1,g=Math.floor((f+MIN_MATCH-1)/MIN_MATCH),c=new Uint8Array(2*o),u=[],d=[],V=1<<h+6,e.pending_buf=new Uint8Array(4*V),i=4*V,U=Math.floor(V/2),N=3*V,P=n,D=_,se(t))},e.deflateEnd=function(){return n!=INIT_STATE&&n!=BUSY_STATE&&n!=FINISH_STATE?Z_STREAM_ERROR$1:(e.pending_buf=null,d=null,u=null,c=null,e.dstate=null,n==BUSY_STATE?Z_DATA_ERROR$1:Z_OK$1)},e.deflateParams=function(e,t,n){let i=Z_OK$1;return t==Z_DEFAULT_COMPRESSION&&(t=6),t<0||t>9||n<0||n>Z_HUFFMAN_ONLY?Z_STREAM_ERROR$1:(config_table[P].func!=config_table[t].func&&0!==e.total_in&&(i=e.deflate(Z_PARTIAL_FLUSH)),P!=t&&(P=t,x=config_table[P].max_lazy,w=config_table[P].good_length,M=config_table[P].nice_length,b=config_table[P].max_chain),D=n,i)},e.deflateSetDictionary=function(e,t,i){let r,a=i,l=0;if(!t||n!=INIT_STATE)return Z_STREAM_ERROR$1;if(a<MIN_MATCH)return Z_OK$1;for(a>o-MIN_LOOKAHEAD&&(a=o-MIN_LOOKAHEAD,l=i-a),c.set(t.subarray(l,l+a),0),S=a,_=a,h=255&c[0],h=(h<<g^255&c[1])&m,r=0;r<=a-MIN_MATCH;r++)h=(h<<g^255&c[r+(MIN_MATCH-1)])&m,u[r&s]=d[h],d[h]=r;return Z_OK$1},e.deflate=function(l,f){let b,w,M,I,R;if(f>Z_FINISH$1||f<0)return Z_STREAM_ERROR$1;if(!l.next_out||!l.next_in&&0!==l.avail_in||n==FINISH_STATE&&f!=Z_FINISH$1)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_STREAM_ERROR$1],Z_STREAM_ERROR$1;if(0===l.avail_out)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;var O;if(t=l,I=r,r=f,n==INIT_STATE&&(w=Z_DEFLATED$1+(a-8<<4)<<8,M=(P-1&255)>>1,M>3&&(M=3),w|=M<<6,0!==S&&(w|=PRESET_DICT$1),w+=31-w%31,n=BUSY_STATE,j((O=w)>>8&255),j(255&O)),0!==e.pending){if(t.flush_pending(),0===t.avail_out)return r=-1,Z_OK$1}else if(0===t.avail_in&&f<=I&&f!=Z_FINISH$1)return t.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(n==FINISH_STATE&&0!==t.avail_in)return l.msg=z_errmsg[Z_NEED_DICT$1-Z_BUF_ERROR$1],Z_BUF_ERROR$1;if(0!==t.avail_in||0!==v||f!=Z_NO_FLUSH$1&&n!=FINISH_STATE){switch(R=-1,config_table[P].func){case STORED$1:R=function(e){let n,r=65535;for(r>i-5&&(r=i-5);;){if(v<=1){if(oe(),0===v&&e==Z_NO_FLUSH$1)return NeedMore;if(0===v)break}if(S+=v,v=0,n=_+r,(0===S||S>=n)&&(v=S-n,S=n,re(!1),0===t.avail_out))return NeedMore;if(S-_>=o-MIN_LOOKAHEAD&&(re(!1),0===t.avail_out))return NeedMore}return re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case FAST:R=function(e){let n,i=0;for(;;){if(v<MIN_LOOKAHEAD){if(oe(),v<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===v)break}if(v>=MIN_MATCH&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,i=65535&d[h],u[S&s]=d[h],d[h]=S),0!==i&&(S-i&65535)<=o-MIN_LOOKAHEAD&&D!=Z_HUFFMAN_ONLY&&(y=ae(i)),y>=MIN_MATCH)if(n=Z(S-A,y-MIN_MATCH),v-=y,y<=x&&v>=MIN_MATCH){y--;do{S++,h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,i=65535&d[h],u[S&s]=d[h],d[h]=S}while(0!=--y);S++}else S+=y,y=0,h=255&c[S],h=(h<<g^255&c[S+1])&m;else n=Z(0,255&c[S]),v--,S++;if(n&&(re(!1),0===t.avail_out))return NeedMore}return re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f);break;case SLOW:R=function(e){let n,i,r=0;for(;;){if(v<MIN_LOOKAHEAD){if(oe(),v<MIN_LOOKAHEAD&&e==Z_NO_FLUSH$1)return NeedMore;if(0===v)break}if(v>=MIN_MATCH&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,r=65535&d[h],u[S&s]=d[h],d[h]=S),E=y,C=A,y=MIN_MATCH-1,0!==r&&E<x&&(S-r&65535)<=o-MIN_LOOKAHEAD&&(D!=Z_HUFFMAN_ONLY&&(y=ae(r)),y<=5&&(D==Z_FILTERED||y==MIN_MATCH&&S-A>4096)&&(y=MIN_MATCH-1)),E>=MIN_MATCH&&y<=E){i=S+v-MIN_MATCH,n=Z(S-1-C,E-MIN_MATCH),v-=E-1,E-=2;do{++S<=i&&(h=(h<<g^255&c[S+(MIN_MATCH-1)])&m,r=65535&d[h],u[S&s]=d[h],d[h]=S)}while(0!=--E);if(T=0,y=MIN_MATCH-1,S++,n&&(re(!1),0===t.avail_out))return NeedMore}else if(0!==T){if(n=Z(0,255&c[S-1]),n&&re(!1),S++,v--,0===t.avail_out)return NeedMore}else T=1,S++,v--}return 0!==T&&(n=Z(0,255&c[S-1]),T=0),re(e==Z_FINISH$1),0===t.avail_out?e==Z_FINISH$1?FinishStarted:NeedMore:e==Z_FINISH$1?FinishDone:BlockDone}(f)}if(R!=FinishStarted&&R!=FinishDone||(n=FINISH_STATE),R==NeedMore||R==FinishStarted)return 0===t.avail_out&&(r=-1),Z_OK$1;if(R==BlockDone){if(f==Z_PARTIAL_FLUSH)Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q(),1+$+10-H<9&&(Y(STATIC_TREES<<1,3),K(END_BLOCK,StaticTree.static_ltree),Q()),$=7;else if(ne(0,0,!1),f==Z_FULL_FLUSH)for(b=0;b<p;b++)d[b]=0;if(t.flush_pending(),0===t.avail_out)return r=-1,Z_OK$1}}return f!=Z_FINISH$1?Z_OK$1:Z_STREAM_END$1}}function ZStream$1(){const e=this;e.next_in_index=0,e.next_out_index=0,e.avail_in=0,e.total_in=0,e.avail_out=0,e.total_out=0}function ZipDeflate(e){const t=new ZStream$1,n=getMaximumCompressedSize$1(e&&e.chunkSize?e.chunkSize:65536),i=Z_NO_FLUSH$1,r=new Uint8Array(n);let o=e?e.level:Z_DEFAULT_COMPRESSION;void 0===o&&(o=Z_DEFAULT_COMPRESSION),t.deflateInit(o),t.next_out=r,this.append=function(e,o){let a,s,c=0,l=0,u=0;const d=[];if(e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=n,a=t.deflate(i),a!=Z_OK$1)throw new Error("deflating: "+t.msg);t.next_out_index&&(t.next_out_index==n?d.push(new Uint8Array(r)):d.push(r.slice(0,t.next_out_index))),u+=t.next_out_index,o&&t.next_in_index>0&&t.next_in_index!=c&&(o(t.next_in_index),c=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return d.length>1?(s=new Uint8Array(u),d.forEach((function(e){s.set(e,l),l+=e.length}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let e,i,o=0,a=0;const s=[];do{if(t.next_out_index=0,t.avail_out=n,e=t.deflate(Z_FINISH$1),e!=Z_STREAM_END$1&&e!=Z_OK$1)throw new Error("deflating: "+t.msg);n-t.avail_out>0&&s.push(r.slice(0,t.next_out_index)),a+=t.next_out_index}while(t.avail_in>0||0===t.avail_out);return t.deflateEnd(),i=new Uint8Array(a),s.forEach((function(e){i.set(e,o),o+=e.length})),i}}function getMaximumCompressedSize$1(e){return e+5*(Math.floor(e/16383)+1)}ZStream$1.prototype={deflateInit:function(e,t){const n=this;return n.dstate=new Deflate$1,t||(t=MAX_BITS$1),n.dstate.deflateInit(n,e,t)},deflate:function(e){const t=this;return t.dstate?t.dstate.deflate(t,e):Z_STREAM_ERROR$1},deflateEnd:function(){const e=this;if(!e.dstate)return Z_STREAM_ERROR$1;const t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams:function(e,t){const n=this;return n.dstate?n.dstate.deflateParams(n,e,t):Z_STREAM_ERROR$1},deflateSetDictionary:function(e,t){const n=this;return n.dstate?n.dstate.deflateSetDictionary(n,e,t):Z_STREAM_ERROR$1},read_buf:function(e,t,n){const i=this;let r=i.avail_in;return r>n&&(r=n),0===r?0:(i.avail_in-=r,e.set(i.next_in.subarray(i.next_in_index,i.next_in_index+r),t),i.next_in_index+=r,i.total_in+=r,r)},flush_pending:function(){const e=this;let t=e.dstate.pending;t>e.avail_out&&(t=e.avail_out),0!==t&&(e.next_out.set(e.dstate.pending_buf.subarray(e.dstate.pending_out,e.dstate.pending_out+t),e.next_out_index),e.next_out_index+=t,e.dstate.pending_out+=t,e.total_out+=t,e.avail_out-=t,e.dstate.pending-=t,0===e.dstate.pending&&(e.dstate.pending_out=0))}};const MAX_BITS=15,Z_OK$2=0,Z_STREAM_END$2=1,Z_NEED_DICT$2=2,Z_STREAM_ERROR$2=-2,Z_DATA_ERROR$2=-3,Z_MEM_ERROR$1=-4,Z_BUF_ERROR$2=-5,inflate_mask=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],MANY=1440,Z_NO_FLUSH=0,Z_FINISH$2=4,fixed_bl=9,fixed_bd=5,fixed_tl=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],fixed_td=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],BMAX=15;function InfTree(){let e,t,n,i,r,o;function a(e,t,a,s,c,l,u,d,h,p,f){let m,g,_,y,C,T,S,A,v,E,b,x,P,D,w;E=0,C=a;do{n[e[t+E]]++,E++,C--}while(0!==C);if(n[0]==a)return u[0]=-1,d[0]=0,Z_OK$2;for(A=d[0],T=1;T<=BMAX&&0===n[T];T++);for(S=T,A<T&&(A=T),C=BMAX;0!==C&&0===n[C];C--);for(_=C,A>C&&(A=C),d[0]=A,D=1<<T;T<C;T++,D<<=1)if((D-=n[T])<0)return Z_DATA_ERROR$2;if((D-=n[C])<0)return Z_DATA_ERROR$2;for(n[C]+=D,o[1]=T=0,E=1,P=2;0!=--C;)o[P]=T+=n[E],P++,E++;C=0,E=0;do{0!==(T=e[t+E])&&(f[o[T]++]=C),E++}while(++C<a);for(a=o[_],o[0]=C=0,E=0,y=-1,x=-A,r[0]=0,b=0,w=0;S<=_;S++)for(m=n[S];0!=m--;){for(;S>x+A;){if(y++,x+=A,w=_-x,w=w>A?A:w,(g=1<<(T=S-x))>m+1&&(g-=m+1,P=S,T<w))for(;++T<w&&!((g<<=1)<=n[++P]);)g-=n[P];if(w=1<<T,p[0]+w>MANY)return Z_DATA_ERROR$2;r[y]=b=p[0],p[0]+=w,0!==y?(o[y]=C,i[0]=T,i[1]=A,T=C>>>x-A,i[2]=b-r[y-1]-T,h.set(i,3*(r[y-1]+T))):u[0]=b}for(i[1]=S-x,E>=a?i[0]=192:f[E]<s?(i[0]=f[E]<256?0:96,i[2]=f[E++]):(i[0]=l[f[E]-s]+16+64,i[2]=c[f[E++]-s]),g=1<<S-x,T=C>>>x;T<w;T+=g)h.set(i,3*(b+T));for(T=1<<S-1;0!=(C&T);T>>>=1)C^=T;for(C^=T,v=(1<<x)-1;(C&v)!=o[y];)y--,x-=A,v=(1<<x)-1}return 0!==D&&1!=_?Z_BUF_ERROR$2:Z_OK$2}function s(a){let s;for(e||(e=[],t=[],n=new Int32Array(BMAX+1),i=[],r=new Int32Array(BMAX),o=new Int32Array(BMAX+1)),t.length<a&&(t=[]),s=0;s<a;s++)t[s]=0;for(s=0;s<BMAX+1;s++)n[s]=0;for(s=0;s<3;s++)i[s]=0;r.set(n.subarray(0,BMAX),0),o.set(n.subarray(0,BMAX+1),0)}this.inflate_trees_bits=function(n,i,r,o,c){let l;return s(19),e[0]=0,l=a(n,0,19,19,null,null,r,i,o,e,t),l==Z_DATA_ERROR$2?c.msg="oversubscribed dynamic bit lengths tree":l!=Z_BUF_ERROR$2&&0!==i[0]||(c.msg="incomplete dynamic bit lengths tree",l=Z_DATA_ERROR$2),l},this.inflate_trees_dynamic=function(n,i,r,o,c,l,u,d,h){let p;return s(288),e[0]=0,p=a(r,0,n,257,cplens,cplext,l,o,d,e,t),p!=Z_OK$2||0===o[0]?(p==Z_DATA_ERROR$2?h.msg="oversubscribed literal/length tree":p!=Z_MEM_ERROR$1&&(h.msg="incomplete literal/length tree",p=Z_DATA_ERROR$2),p):(s(288),p=a(r,n,i,0,cpdist,cpdext,u,c,d,e,t),p!=Z_OK$2||0===c[0]&&n>257?(p==Z_DATA_ERROR$2?h.msg="oversubscribed distance tree":p==Z_BUF_ERROR$2?(h.msg="incomplete distance tree",p=Z_DATA_ERROR$2):p!=Z_MEM_ERROR$1&&(h.msg="empty distance tree with lengths",p=Z_DATA_ERROR$2),p):Z_OK$2)}}InfTree.inflate_trees_fixed=function(e,t,n,i){return e[0]=fixed_bl,t[0]=fixed_bd,n[0]=fixed_tl,i[0]=fixed_td,Z_OK$2};const START=0,LEN$1=1,LENEXT$1=2,DIST$1=3,DISTEXT$1=4,COPY$1=5,LIT$1=6,WASH=7,END=8,BADCODE=9;function InfCodes(){const e=this;let t,n,i,r,o=0,a=0,s=0,c=0,l=0,u=0,d=0,h=0,p=0,f=0;function m(e,t,n,i,r,o,a,s){let c,l,u,d,h,p,f,m,g,_,y,C,T,S,A,v;f=s.next_in_index,m=s.avail_in,h=a.bitb,p=a.bitk,g=a.write,_=g<a.read?a.read-g-1:a.end-g,y=inflate_mask[e],C=inflate_mask[t];do{for(;p<20;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(c=h&y,l=n,u=i,v=3*(u+c),0!==(d=l[v]))for(;;){if(h>>=l[v+1],p-=l[v+1],0!=(16&d)){for(d&=15,T=l[v+2]+(h&inflate_mask[d]),h>>=d,p-=d;p<15;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;for(c=h&C,l=r,u=o,v=3*(u+c),d=l[v];;){if(h>>=l[v+1],p-=l[v+1],0!=(16&d)){for(d&=15;p<d;)m--,h|=(255&s.read_byte(f++))<<p,p+=8;if(S=l[v+2]+(h&inflate_mask[d]),h>>=d,p-=d,_-=T,g>=S)A=g-S,g-A>0&&2>g-A?(a.window[g++]=a.window[A++],a.window[g++]=a.window[A++],T-=2):(a.window.set(a.window.subarray(A,A+2),g),g+=2,A+=2,T-=2);else{A=g-S;do{A+=a.end}while(A<0);if(d=a.end-A,T>d){if(T-=d,g-A>0&&d>g-A)do{a.window[g++]=a.window[A++]}while(0!=--d);else a.window.set(a.window.subarray(A,A+d),g),g+=d,A+=d,d=0;A=0}}if(g-A>0&&T>g-A)do{a.window[g++]=a.window[A++]}while(0!=--T);else a.window.set(a.window.subarray(A,A+T),g),g+=T,A+=T,T=0;break}if(0!=(64&d))return s.msg="invalid distance code",T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_DATA_ERROR$2;c+=l[v+2],c+=h&inflate_mask[d],v=3*(u+c),d=l[v]}break}if(0!=(64&d))return 0!=(32&d)?(T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_STREAM_END$2):(s.msg="invalid literal/length code",T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_DATA_ERROR$2);if(c+=l[v+2],c+=h&inflate_mask[d],v=3*(u+c),0===(d=l[v])){h>>=l[v+1],p-=l[v+1],a.window[g++]=l[v+2],_--;break}}else h>>=l[v+1],p-=l[v+1],a.window[g++]=l[v+2],_--}while(_>=258&&m>=10);return T=s.avail_in-m,T=p>>3<T?p>>3:T,m+=T,f-=T,p-=T<<3,a.bitb=h,a.bitk=p,s.avail_in=m,s.total_in+=f-s.next_in_index,s.next_in_index=f,a.write=g,Z_OK$2}e.init=function(e,o,a,s,c,l){t=START,d=e,h=o,i=a,p=s,r=c,f=l,n=null},e.proc=function(e,g,_){let y,C,T,S,A,v,E,b=0,x=0,P=0;for(P=g.next_in_index,S=g.avail_in,b=e.bitb,x=e.bitk,A=e.write,v=A<e.read?e.read-A-1:e.end-A;;)switch(t){case START:if(v>=258&&S>=10&&(e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,_=m(d,h,i,p,r,f,e,g),P=g.next_in_index,S=g.avail_in,b=e.bitb,x=e.bitk,A=e.write,v=A<e.read?e.read-A-1:e.end-A,_!=Z_OK$2)){t=_==Z_STREAM_END$2?WASH:BADCODE;break}s=d,n=i,a=p,t=LEN$1;case LEN$1:for(y=s;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}if(C=3*(a+(b&inflate_mask[y])),b>>>=n[C+1],x-=n[C+1],T=n[C],0===T){c=n[C+2],t=LIT$1;break}if(0!=(16&T)){l=15&T,o=n[C+2],t=LENEXT$1;break}if(0==(64&T)){s=T,a=C/3+n[C+2];break}if(0!=(32&T)){t=WASH;break}return t=BADCODE,g.msg="invalid literal/length code",_=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);case LENEXT$1:for(y=l;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}o+=b&inflate_mask[y],b>>=y,x-=y,s=h,n=r,a=f,t=DIST$1;case DIST$1:for(y=s;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}if(C=3*(a+(b&inflate_mask[y])),b>>=n[C+1],x-=n[C+1],T=n[C],0!=(16&T)){l=15&T,u=n[C+2],t=DISTEXT$1;break}if(0==(64&T)){s=T,a=C/3+n[C+2];break}return t=BADCODE,g.msg="invalid distance code",_=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);case DISTEXT$1:for(y=l;x<y;){if(0===S)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);_=Z_OK$2,S--,b|=(255&g.read_byte(P++))<<x,x+=8}u+=b&inflate_mask[y],b>>=y,x-=y,t=COPY$1;case COPY$1:for(E=A-u;E<0;)E+=e.end;for(;0!==o;){if(0===v&&(A==e.end&&0!==e.read&&(A=0,v=A<e.read?e.read-A-1:e.end-A),0===v&&(e.write=A,_=e.inflate_flush(g,_),A=e.write,v=A<e.read?e.read-A-1:e.end-A,A==e.end&&0!==e.read&&(A=0,v=A<e.read?e.read-A-1:e.end-A),0===v)))return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);e.window[A++]=e.window[E++],v--,E==e.end&&(E=0),o--}t=START;break;case LIT$1:if(0===v&&(A==e.end&&0!==e.read&&(A=0,v=A<e.read?e.read-A-1:e.end-A),0===v&&(e.write=A,_=e.inflate_flush(g,_),A=e.write,v=A<e.read?e.read-A-1:e.end-A,A==e.end&&0!==e.read&&(A=0,v=A<e.read?e.read-A-1:e.end-A),0===v)))return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);_=Z_OK$2,e.window[A++]=c,v--,t=START;break;case WASH:if(x>7&&(x-=8,S++,P--),e.write=A,_=e.inflate_flush(g,_),A=e.write,v=A<e.read?e.read-A-1:e.end-A,e.read!=e.write)return e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);t=END;case END:return _=Z_STREAM_END$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);case BADCODE:return _=Z_DATA_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_);default:return _=Z_STREAM_ERROR$2,e.bitb=b,e.bitk=x,g.avail_in=S,g.total_in+=P-g.next_in_index,g.next_in_index=P,e.write=A,e.inflate_flush(g,_)}},e.free=function(){}}const border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],TYPE$2=0,LENS$2=1,STORED$2=2,TABLE$1=3,BTREE=4,DTREE=5,CODES$2=6,DRY=7,DONELOCKS=8,BADBLOCKS=9;function InfBlocks(e,t){const n=this;let i,r=TYPE$2,o=0,a=0,s=0;const c=[0],l=[0],u=new InfCodes;let d=0,h=new Int32Array(3*MANY);const p=new InfTree;n.bitk=0,n.bitb=0,n.window=new Uint8Array(t),n.end=t,n.read=0,n.write=0,n.reset=function(e,t){t&&(t[0]=0),r==CODES$2&&u.free(e),r=TYPE$2,n.bitk=0,n.bitb=0,n.read=n.write=0},n.reset(e,null),n.inflate_flush=function(e,t){let i,r,o;return r=e.next_out_index,o=n.read,i=(o<=n.write?n.write:n.end)-o,i>e.avail_out&&(i=e.avail_out),0!==i&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=i,e.total_out+=i,e.next_out.set(n.window.subarray(o,o+i),r),r+=i,o+=i,o==n.end&&(o=0,n.write==n.end&&(n.write=0),i=n.write-o,i>e.avail_out&&(i=e.avail_out),0!==i&&t==Z_BUF_ERROR$2&&(t=Z_OK$2),e.avail_out-=i,e.total_out+=i,e.next_out.set(n.window.subarray(o,o+i),r),r+=i,o+=i),e.next_out_index=r,n.read=o,t},n.proc=function(e,t){let f,m,g,_,y,C,T,S;for(_=e.next_in_index,y=e.avail_in,m=n.bitb,g=n.bitk,C=n.write,T=C<n.read?n.read-C-1:n.end-C;;){let A,v,E,b,x,P,D,w;switch(r){case TYPE$2:for(;g<3;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}switch(f=7&m,d=1&f,f>>>1){case 0:m>>>=3,g-=3,f=7&g,m>>>=f,g-=f,r=LENS$2;break;case 1:A=[],v=[],E=[[]],b=[[]],InfTree.inflate_trees_fixed(A,v,E,b),u.init(A[0],v[0],E[0],0,b[0],0),m>>>=3,g-=3,r=CODES$2;break;case 2:m>>>=3,g-=3,r=TABLE$1;break;case 3:return m>>>=3,g-=3,r=BADBLOCKS,e.msg="invalid block type",t=Z_DATA_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t)}break;case LENS$2:for(;g<32;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if((~m>>>16&65535)!=(65535&m))return r=BADBLOCKS,e.msg="invalid stored block lengths",t=Z_DATA_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);o=65535&m,m=g=0,r=0!==o?STORED$2:0!==d?DRY:TYPE$2;break;case STORED$2:if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);if(0===T&&(C==n.end&&0!==n.read&&(C=0,T=C<n.read?n.read-C-1:n.end-C),0===T&&(n.write=C,t=n.inflate_flush(e,t),C=n.write,T=C<n.read?n.read-C-1:n.end-C,C==n.end&&0!==n.read&&(C=0,T=C<n.read?n.read-C-1:n.end-C),0===T)))return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);if(t=Z_OK$2,f=o,f>y&&(f=y),f>T&&(f=T),n.window.set(e.read_buf(_,f),C),_+=f,y-=f,C+=f,T-=f,0!=(o-=f))break;r=0!==d?DRY:TYPE$2;break;case TABLE$1:for(;g<14;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(a=f=16383&m,(31&f)>29||(f>>5&31)>29)return r=BADBLOCKS,e.msg="too many length or distance symbols",t=Z_DATA_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);if(f=258+(31&f)+(f>>5&31),!i||i.length<f)i=[];else for(S=0;S<f;S++)i[S]=0;m>>>=14,g-=14,s=0,r=BTREE;case BTREE:for(;s<4+(a>>>10);){for(;g<3;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}i[border[s++]]=7&m,m>>>=3,g-=3}for(;s<19;)i[border[s++]]=0;if(c[0]=7,f=p.inflate_trees_bits(i,c,l,h,e),f!=Z_OK$2)return(t=f)==Z_DATA_ERROR$2&&(i=null,r=BADBLOCKS),n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);s=0,r=DTREE;case DTREE:for(;f=a,!(s>=258+(31&f)+(f>>5&31));){let o,u;for(f=c[0];g<f;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(f=h[3*(l[0]+(m&inflate_mask[f]))+1],u=h[3*(l[0]+(m&inflate_mask[f]))+2],u<16)m>>>=f,g-=f,i[s++]=u;else{for(S=18==u?7:u-14,o=18==u?11:3;g<f+S;){if(0===y)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);t=Z_OK$2,y--,m|=(255&e.read_byte(_++))<<g,g+=8}if(m>>>=f,g-=f,o+=m&inflate_mask[S],m>>>=S,g-=S,S=s,f=a,S+o>258+(31&f)+(f>>5&31)||16==u&&S<1)return i=null,r=BADBLOCKS,e.msg="invalid bit length repeat",t=Z_DATA_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);u=16==u?i[S-1]:0;do{i[S++]=u}while(0!=--o);s=S}}if(l[0]=-1,x=[],P=[],D=[],w=[],x[0]=9,P[0]=6,f=a,f=p.inflate_trees_dynamic(257+(31&f),1+(f>>5&31),i,x,P,D,w,h,e),f!=Z_OK$2)return f==Z_DATA_ERROR$2&&(i=null,r=BADBLOCKS),t=f,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);u.init(x[0],P[0],h,D[0],h,w[0]),r=CODES$2;case CODES$2:if(n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,(t=u.proc(n,e,t))!=Z_STREAM_END$2)return n.inflate_flush(e,t);if(t=Z_OK$2,u.free(e),_=e.next_in_index,y=e.avail_in,m=n.bitb,g=n.bitk,C=n.write,T=C<n.read?n.read-C-1:n.end-C,0===d){r=TYPE$2;break}r=DRY;case DRY:if(n.write=C,t=n.inflate_flush(e,t),C=n.write,T=C<n.read?n.read-C-1:n.end-C,n.read!=n.write)return n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);r=DONELOCKS;case DONELOCKS:return t=Z_STREAM_END$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);case BADBLOCKS:return t=Z_DATA_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t);default:return t=Z_STREAM_ERROR$2,n.bitb=m,n.bitk=g,e.avail_in=y,e.total_in+=_-e.next_in_index,e.next_in_index=_,n.write=C,n.inflate_flush(e,t)}}},n.free=function(e){n.reset(e,null),n.window=null,h=null},n.set_dictionary=function(e,t,i){n.window.set(e.subarray(t,t+i),0),n.read=n.write=i},n.sync_point=function(){return r==LENS$2?1:0}}const PRESET_DICT=32,Z_DEFLATED$2=8,METHOD=0,FLAG=1,DICT4=2,DICT3=3,DICT2=4,DICT1=5,DICT0=6,BLOCKS=7,DONE$1=12,BAD$2=13,mark=[0,0,255,255];function Inflate$1(){const e=this;function t(e){return e&&e.istate?(e.total_in=e.total_out=0,e.msg=null,e.istate.mode=BLOCKS,e.istate.blocks.reset(e,null),Z_OK$2):Z_STREAM_ERROR$2}e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(t){return e.blocks&&e.blocks.free(t),e.blocks=null,Z_OK$2},e.inflateInit=function(n,i){return n.msg=null,e.blocks=null,i<8||i>15?(e.inflateEnd(n),Z_STREAM_ERROR$2):(e.wbits=i,n.istate.blocks=new InfBlocks(n,1<<i),t(n),Z_OK$2)},e.inflate=function(e,t){let n,i;if(!e||!e.istate||!e.next_in)return Z_STREAM_ERROR$2;const r=e.istate;for(t=t==Z_FINISH$2?Z_BUF_ERROR$2:Z_OK$2,n=Z_BUF_ERROR$2;;)switch(r.mode){case METHOD:if(0===e.avail_in)return n;if(n=t,e.avail_in--,e.total_in++,(15&(r.method=e.read_byte(e.next_in_index++)))!=Z_DEFLATED$2){r.mode=BAD$2,e.msg="unknown compression method",r.marker=5;break}if(8+(r.method>>4)>r.wbits){r.mode=BAD$2,e.msg="invalid window size",r.marker=5;break}r.mode=FLAG;case FLAG:if(0===e.avail_in)return n;if(n=t,e.avail_in--,e.total_in++,i=255&e.read_byte(e.next_in_index++),((r.method<<8)+i)%31!=0){r.mode=BAD$2,e.msg="incorrect header check",r.marker=5;break}if(0==(i&PRESET_DICT)){r.mode=BLOCKS;break}r.mode=DICT4;case DICT4:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,r.need=(255&e.read_byte(e.next_in_index++))<<24&4278190080,r.mode=DICT3;case DICT3:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,r.need+=(255&e.read_byte(e.next_in_index++))<<16&16711680,r.mode=DICT2;case DICT2:if(0===e.avail_in)return n;n=t,e.avail_in--,e.total_in++,r.need+=(255&e.read_byte(e.next_in_index++))<<8&65280,r.mode=DICT1;case DICT1:return 0===e.avail_in?n:(n=t,e.avail_in--,e.total_in++,r.need+=255&e.read_byte(e.next_in_index++),r.mode=DICT0,Z_NEED_DICT$2);case DICT0:return r.mode=BAD$2,e.msg="need dictionary",r.marker=0,Z_STREAM_ERROR$2;case BLOCKS:if(n=r.blocks.proc(e,n),n==Z_DATA_ERROR$2){r.mode=BAD$2,r.marker=0;break}if(n==Z_OK$2&&(n=t),n!=Z_STREAM_END$2)return n;n=t,r.blocks.reset(e,r.was),r.mode=DONE$1;case DONE$1:return Z_STREAM_END$2;case BAD$2:return Z_DATA_ERROR$2;default:return Z_STREAM_ERROR$2}},e.inflateSetDictionary=function(e,t,n){let i=0,r=n;if(!e||!e.istate||e.istate.mode!=DICT0)return Z_STREAM_ERROR$2;const o=e.istate;return r>=1<<o.wbits&&(r=(1<<o.wbits)-1,i=n-r),o.blocks.set_dictionary(t,i,r),o.mode=BLOCKS,Z_OK$2},e.inflateSync=function(e){let n,i,r,o,a;if(!e||!e.istate)return Z_STREAM_ERROR$2;const s=e.istate;if(s.mode!=BAD$2&&(s.mode=BAD$2,s.marker=0),0===(n=e.avail_in))return Z_BUF_ERROR$2;for(i=e.next_in_index,r=s.marker;0!==n&&r<4;)e.read_byte(i)==mark[r]?r++:r=0!==e.read_byte(i)?0:4-r,i++,n--;return e.total_in+=i-e.next_in_index,e.next_in_index=i,e.avail_in=n,s.marker=r,4!=r?Z_DATA_ERROR$2:(o=e.total_in,a=e.total_out,t(e),e.total_in=o,e.total_out=a,s.mode=BLOCKS,Z_OK$2)},e.inflateSyncPoint=function(e){return e&&e.istate&&e.istate.blocks?e.istate.blocks.sync_point():Z_STREAM_ERROR$2}}function ZStream$2(){}function ZipInflate(e){const t=new ZStream$2,n=e&&e.chunkSize?Math.floor(2*e.chunkSize):131072,i=Z_NO_FLUSH,r=new Uint8Array(n);let o=!1;t.inflateInit(),t.next_out=r,this.append=function(e,a){const s=[];let c,l,u=0,d=0,h=0;if(0!==e.length){t.next_in_index=0,t.next_in=e,t.avail_in=e.length;do{if(t.next_out_index=0,t.avail_out=n,0!==t.avail_in||o||(t.next_in_index=0,o=!0),c=t.inflate(i),o&&c===Z_BUF_ERROR$2){if(0!==t.avail_in)throw new Error("inflating: bad input")}else if(c!==Z_OK$2&&c!==Z_STREAM_END$2)throw new Error("inflating: "+t.msg);if((o||c===Z_STREAM_END$2)&&t.avail_in===e.length)throw new Error("inflating: bad input");t.next_out_index&&(t.next_out_index===n?s.push(new Uint8Array(r)):s.push(r.slice(0,t.next_out_index))),h+=t.next_out_index,a&&t.next_in_index>0&&t.next_in_index!=u&&(a(t.next_in_index),u=t.next_in_index)}while(t.avail_in>0||0===t.avail_out);return s.length>1?(l=new Uint8Array(h),s.forEach((function(e){l.set(e,d),d+=e.length}))):l=s[0]||new Uint8Array(0),l}},this.flush=function(){t.inflateEnd()}}ZStream$2.prototype={inflateInit:function(e){const t=this;return t.istate=new Inflate$1,e||(e=MAX_BITS),t.istate.inflateInit(t,e)},inflate:function(e){const t=this;return t.istate?t.istate.inflate(t,e):Z_STREAM_ERROR$2},inflateEnd:function(){const e=this;if(!e.istate)return Z_STREAM_ERROR$2;const t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync:function(){const e=this;return e.istate?e.istate.inflateSync(e):Z_STREAM_ERROR$2},inflateSetDictionary:function(e,t){const n=this;return n.istate?n.istate.inflateSetDictionary(n,e,t):Z_STREAM_ERROR$2},read_byte:function(e){return this.next_in[e]},read_buf:function(e,t){return this.next_in.subarray(e,e+t)}};const DEFAULT_CONFIGURATION={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,terminateWorkerTimeout:5e3,useWebWorkers:!0,workerScripts:void 0},config=Object.assign({},DEFAULT_CONFIGURATION);function getConfiguration(){return config}function configure(e){if(void 0!==e.chunkSize&&(config.chunkSize=e.chunkSize),void 0!==e.maxWorkers&&(config.maxWorkers=e.maxWorkers),void 0!==e.terminateWorkerTimeout&&(config.terminateWorkerTimeout=e.terminateWorkerTimeout),void 0!==e.useWebWorkers&&(config.useWebWorkers=e.useWebWorkers),void 0!==e.Deflate&&(config.Deflate=e.Deflate),void 0!==e.Inflate&&(config.Inflate=e.Inflate),void 0!==e.workerScripts){if(e.workerScripts.deflate){if(!Array.isArray(e.workerScripts.deflate))throw new Error("workerScripts.deflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.deflate=e.workerScripts.deflate}if(e.workerScripts.inflate){if(!Array.isArray(e.workerScripts.inflate))throw new Error("workerScripts.inflate must be an array");config.workerScripts||(config.workerScripts={}),config.workerScripts.inflate=e.workerScripts.inflate}}}function getMimeType(){return"application/octet-stream"}const MINIMUM_CHUNK_SIZE=64,ERR_ABORT="Abort error";async function processData(e,t,n,i,r,o,a){const s=Math.max(o.chunkSize,MINIMUM_CHUNK_SIZE);return async function o(c=0,l=0){const u=a.signal;if(c<r){testAborted(u,e);const d=await t.readUint8Array(c+i,Math.min(s,r-c)),h=d.length;testAborted(u,e);const p=await e.append(d);if(testAborted(u,e),l+=await writeData(n,p),a.onprogress)try{a.onprogress(c+h,r)}catch(e){}return o(c+s,l)}{const t=await e.flush();return l+=await writeData(n,t.data),{signature:t.signature,length:l}}}()}function testAborted(e,t){if(e&&e.aborted)throw t.flush(),new Error(ERR_ABORT)}async function writeData(e,t){return t.length&&await e.writeUint8Array(t),t.length}const ERR_HTTP_STATUS="HTTP error ",ERR_HTTP_RANGE="HTTP Range not supported",CONTENT_TYPE_TEXT_PLAIN="text/plain",HTTP_HEADER_CONTENT_LENGTH="Content-Length",HTTP_HEADER_CONTENT_RANGE="Content-Range",HTTP_HEADER_ACCEPT_RANGES="Accept-Ranges",HTTP_HEADER_RANGE="Range",HTTP_METHOD_HEAD="HEAD",HTTP_METHOD_GET="GET",HTTP_RANGE_UNIT="bytes";class Stream{constructor(){this.size=0}init(){this.initialized=!0}}class Reader extends Stream{}class Writer extends Stream{writeUint8Array(e){this.size+=e.length}}class TextReader extends Reader{constructor(e){super(),this.blobReader=new BlobReader(new Blob([e],{type:CONTENT_TYPE_TEXT_PLAIN}))}async init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}async readUint8Array(e,t){return this.blobReader.readUint8Array(e,t)}}class TextWriter extends Writer{constructor(e){super(),this.encoding=e,this.blob=new Blob([],{type:CONTENT_TYPE_TEXT_PLAIN})}async writeUint8Array(e){super.writeUint8Array(e),this.blob=new Blob([this.blob,e.buffer],{type:CONTENT_TYPE_TEXT_PLAIN})}getData(){if(this.blob.text)return this.blob.text();{const e=new FileReader;return new Promise(((t,n)=>{e.onload=e=>t(e.target.result),e.onerror=()=>n(e.error),e.readAsText(this.blob,this.encoding)}))}}}class Data64URIReader extends Reader{constructor(e){super(),this.dataURI=e;let t=e.length;for(;"="==e.charAt(t-1);)t--;this.dataStart=e.indexOf(",")+1,this.size=Math.floor(.75*(t-this.dataStart))}async readUint8Array(e,t){const n=new Uint8Array(t),i=4*Math.floor(e/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((e+t)/3)+this.dataStart)),o=e-3*Math.floor(i/4);for(let e=o;e<o+t;e++)n[e-o]=r.charCodeAt(e);return n}}class Data64URIWriter extends Writer{constructor(e){super(),this.data="data:"+(e||"")+";base64,",this.pending=[]}async writeUint8Array(e){super.writeUint8Array(e);let t=0,n=this.pending;const i=this.pending.length;for(this.pending="",t=0;t<3*Math.floor((i+e.length)/3)-i;t++)n+=String.fromCharCode(e[t]);for(;t<e.length;t++)this.pending+=String.fromCharCode(e[t]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}}class BlobReader extends Reader{constructor(e){super(),this.blob=e,this.size=e.size}async readUint8Array(e,t){if(this.blob.arrayBuffer)return new Uint8Array(await this.blob.slice(e,e+t).arrayBuffer());{const n=new FileReader;return new Promise(((i,r)=>{n.onload=e=>i(new Uint8Array(e.target.result)),n.onerror=()=>r(n.error),n.readAsArrayBuffer(this.blob.slice(e,e+t))}))}}}class BlobWriter extends Writer{constructor(e){super(),this.contentType=e,this.arrayBuffers=[]}async writeUint8Array(e){super.writeUint8Array(e),this.arrayBuffers.push(e.buffer)}getData(){return this.blob||(this.blob=new Blob(this.arrayBuffers,{type:this.contentType})),this.blob}}class FetchReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests,this.options=Object.assign({},t),delete this.options.preventHeadRequest,delete this.options.useRangeHeader,delete this.options.forceRangeRequests,delete this.options.useXHR}async init(){super.init(),await initHttpReader(this,sendFetchRequest,getFetchRequestData)}async readUint8Array(e,t){return readUint8ArrayHttpReader(this,e,t,sendFetchRequest,getFetchRequestData)}}class XHRReader extends Reader{constructor(e,t){super(),this.url=e,this.preventHeadRequest=t.preventHeadRequest,this.useRangeHeader=t.useRangeHeader,this.forceRangeRequests=t.forceRangeRequests,this.options=t}async init(){super.init(),await initHttpReader(this,sendXMLHttpRequest,getXMLHttpRequestData)}async readUint8Array(e,t){return readUint8ArrayHttpReader(this,e,t,sendXMLHttpRequest,getXMLHttpRequestData)}}async function initHttpReader(e,t,n){if(isHttpFamily(e.url)&&(e.useRangeHeader||e.forceRangeRequests)){const i=await t(HTTP_METHOD_GET,e,getRangeHeaders(e));if(!e.forceRangeRequests&&i.headers.get(HTTP_HEADER_ACCEPT_RANGES)!=HTTP_RANGE_UNIT)throw new Error(ERR_HTTP_RANGE);{let r;const o=i.headers.get(HTTP_HEADER_CONTENT_RANGE);if(o){const e=o.trim().split(/\s*\/\s*/);if(e.length){const t=e[1];t&&"*"!=t&&(r=Number(t))}}void 0===r?await getContentLength(e,t,n):e.size=r}}else await getContentLength(e,t,n)}async function readUint8ArrayHttpReader(e,t,n,i,r){if(e.useRangeHeader||e.forceRangeRequests){const r=await i(HTTP_METHOD_GET,e,getRangeHeaders(e,t,n));if(206!=r.status)throw new Error(ERR_HTTP_RANGE);return new Uint8Array(await r.arrayBuffer())}return e.data||await r(e,e.options),new Uint8Array(e.data.subarray(t,t+n))}function getRangeHeaders(e,t=0,n=1){return Object.assign({},getHeaders(e),{[HTTP_HEADER_RANGE]:HTTP_RANGE_UNIT+"="+t+"-"+(t+n-1)})}function getHeaders(e){let t=e.options.headers;if(t)return Symbol.iterator in t?Object.fromEntries(t):t}async function getFetchRequestData(e){await getRequestData(e,sendFetchRequest)}async function getXMLHttpRequestData(e){await getRequestData(e,sendXMLHttpRequest)}async function getRequestData(e,t){const n=await t(HTTP_METHOD_GET,e,getHeaders(e));e.data=new Uint8Array(await n.arrayBuffer()),e.size||(e.size=e.data.length)}async function getContentLength(e,t,n){if(e.preventHeadRequest)await n(e,e.options);else{const i=(await t(HTTP_METHOD_HEAD,e,getHeaders(e))).headers.get(HTTP_HEADER_CONTENT_LENGTH);i?e.size=Number(i):await n(e,e.options)}}async function sendFetchRequest(e,{options:t,url:n},i){const r=await fetch(n,Object.assign({},t,{method:e,headers:i}));if(r.status<400)return r;throw new Error(ERR_HTTP_STATUS+(r.statusText||r.status))}function sendXMLHttpRequest(e,{url:t},n){return new Promise(((i,r)=>{const o=new XMLHttpRequest;if(o.addEventListener("load",(()=>{if(o.status<400){const e=[];o.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{const n=t.trim().split(/\s*:\s*/);n[0]=n[0].trim().replace(/^[a-z]|-[a-z]/g,(e=>e.toUpperCase())),e.push(n)})),i({status:o.status,arrayBuffer:()=>o.response,headers:new Map(e)})}else r(new Error(ERR_HTTP_STATUS+(o.statusText||o.status)))}),!1),o.addEventListener("error",(e=>r(e.detail.error)),!1),o.open(e,t),n)for(const e of Object.entries(n))o.setRequestHeader(e[0],e[1]);o.responseType="arraybuffer",o.send()}))}class HttpReader extends Reader{constructor(e,t={}){super(),this.url=e,t.useXHR?this.reader=new XHRReader(e,t):this.reader=new FetchReader(e,t)}set size(e){}get size(){return this.reader.size}async init(){super.init(),await this.reader.init()}async readUint8Array(e,t){return this.reader.readUint8Array(e,t)}}class HttpRangeReader extends HttpReader{constructor(e,t={}){t.useRangeHeader=!0,super(e,t)}}class Uint8ArrayReader extends Reader{constructor(e){super(),this.array=e,this.size=e.length}async readUint8Array(e,t){return this.array.slice(e,e+t)}}class Uint8ArrayWriter extends Writer{constructor(){super(),this.array=new Uint8Array(0)}async writeUint8Array(e){super.writeUint8Array(e);const t=this.array;this.array=new Uint8Array(t.length+e.length),this.array.set(t),this.array.set(e,t.length)}getData(){return this.array}}function isHttpFamily(e){if("undefined"!=typeof document){const t=document.createElement("a");return t.href=e,"http:"==t.protocol||"https:"==t.protocol}return/^https?:\/\//i.test(e)}const MAX_32_BITS=4294967295,MAX_16_BITS=65535,COMPRESSION_METHOD_DEFLATE=8,COMPRESSION_METHOD_STORE=0,COMPRESSION_METHOD_AES=99,LOCAL_FILE_HEADER_SIGNATURE=67324752,DATA_DESCRIPTOR_RECORD_SIGNATURE=134695760,CENTRAL_FILE_HEADER_SIGNATURE=33639248,END_OF_CENTRAL_DIR_SIGNATURE=101010256,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE=101075792,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE=117853008,END_OF_CENTRAL_DIR_LENGTH=22,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH=20,ZIP64_END_OF_CENTRAL_DIR_LENGTH=56,ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH=END_OF_CENTRAL_DIR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH+ZIP64_END_OF_CENTRAL_DIR_LENGTH,ZIP64_TOTAL_NUMBER_OF_DISKS=1,EXTRAFIELD_TYPE_ZIP64=1,EXTRAFIELD_TYPE_AES=39169,EXTRAFIELD_TYPE_NTFS=10,EXTRAFIELD_TYPE_NTFS_TAG1=1,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP=21589,EXTRAFIELD_TYPE_UNICODE_PATH=28789,EXTRAFIELD_TYPE_UNICODE_COMMENT=25461,BITFLAG_ENCRYPTED=1,BITFLAG_LEVEL=6,BITFLAG_DATA_DESCRIPTOR=8,BITFLAG_LANG_ENCODING_FLAG=2048,FILE_ATTR_MSDOS_DIR_MASK=16,VERSION_DEFLATE=20,VERSION_ZIP64=45,VERSION_AES=51,DIRECTORY_SIGNATURE="/",MAX_DATE=new Date(2107,11,31),MIN_DATE=new Date(1980,0,1),table=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;table[e]=t}class Crc32{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,i=0|e.length;n<i;n++)t=t>>>8^table[255&(t^e[n])];this.crc=t}get(){return~this.crc}}function encodeText(e){if("undefined"==typeof TextEncoder){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new TextEncoder).encode(e)}const bitArray={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],i=bitArray.getPartial(n);return 32===i?e.concat(t):bitArray._shiftRight(t,i,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+bitArray.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,Math.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=bitArray.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>Math.round(e/1099511627776)||32,_shiftRight(e,t,n,i){for(void 0===i&&(i=[]);t>=32;t-=32)i.push(n),n=0;if(0===t)return i.concat(e);for(let r=0;r<e.length;r++)i.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,o=bitArray.getPartial(r);return i.push(bitArray.partial(t+o&31,t+o>32?n:i.pop(),1)),i}},codec={bytes:{fromBits(e){const t=bitArray.bitLength(e)/8,n=new Uint8Array(t);let i;for(let r=0;r<t;r++)0==(3&r)&&(i=e[r/4]),n[r]=i>>>24,i<<=8;return n},toBits(e){const t=[];let n,i=0;for(n=0;n<e.length;n++)i=i<<8|e[n],3==(3&n)&&(t.push(i),i=0);return 3&n&&t.push(bitArray.partial(8*(3&n),i)),t}}},hash={sha1:function(e){e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()}};hash.sha1.prototype={blockSize:512,reset:function(){const e=this;return e._h=this._init.slice(0),e._buffer=[],e._length=0,e},update:function(e){const t=this;"string"==typeof e&&(e=codec.utf8String.toBits(e));const n=t._buffer=bitArray.concat(t._buffer,e),i=t._length,r=t._length=i+bitArray.bitLength(e);if(r>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const o=new Uint32Array(n);let a=0;for(let e=t.blockSize+i-(t.blockSize+i&t.blockSize-1);e<=r;e+=t.blockSize)t._block(o.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),t},finalize:function(){const e=this;let t=e._buffer;const n=e._h;t=bitArray.concat(t,[bitArray.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(e,t,n,i){return e<=19?t&n|~t&i:e<=39?t^n^i:e<=59?t&n|t&i|n&i:e<=79?t^n^i:void 0},_S:function(e,t){return t<<e|t>>>32-e},_block:function(e){const t=this,n=t._h,i=Array(80);for(let t=0;t<16;t++)i[t]=e[t];let r=n[0],o=n[1],a=n[2],s=n[3],c=n[4];for(let e=0;e<=79;e++){e>=16&&(i[e]=t._S(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const n=t._S(5,r)+t._f(e,o,a,s)+c+i[e]+t._key[Math.floor(e/20)]|0;c=s,s=a,a=t._S(30,o),o=r,r=n}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0}};const cipher={aes:class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],i=t._tables[1],r=e.length;let o,a,s,c=1;if(4!==r&&6!==r&&8!==r)throw new Error("invalid aes key size");for(t._key=[a=e.slice(0),s=[]],o=r;o<4*r+28;o++){let e=a[o-1];(o%r==0||8===r&&o%r==4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%r==0&&(e=e<<8^e>>>24^c<<24,c=c<<1^283*(c>>7))),a[o]=a[o-r]^e}for(let e=0;o;e++,o--){const t=a[3&e?o:o-4];s[e]=o<=4||e<4?t:i[0][n[t>>>24]]^i[1][n[t>>16&255]]^i[2][n[t>>8&255]]^i[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],i=t[4],r=[],o=[];let a,s,c,l;for(let e=0;e<256;e++)o[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=a=0;!n[u];u^=s||1,a=o[a]||1){let o=a^a<<1^a<<2^a<<3^a<<4;o=o>>8^255&o^99,n[u]=o,i[o]=u,l=r[c=r[s=r[u]]];let d=16843009*l^65537*c^257*s^16843008*u,h=257*r[o]^16843008*o;for(let n=0;n<4;n++)e[n][u]=h=h<<24^h>>>8,t[n][o]=d=d<<24^d>>>8}for(let n=0;n<5;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new Error("invalid aes block size");const n=this._key[t],i=n.length/4-2,r=[0,0,0,0],o=this._tables[t],a=o[0],s=o[1],c=o[2],l=o[3],u=o[4];let d,h,p,f=e[0]^n[0],m=e[t?3:1]^n[1],g=e[2]^n[2],_=e[t?1:3]^n[3],y=4;for(let e=0;e<i;e++)d=a[f>>>24]^s[m>>16&255]^c[g>>8&255]^l[255&_]^n[y],h=a[m>>>24]^s[g>>16&255]^c[_>>8&255]^l[255&f]^n[y+1],p=a[g>>>24]^s[_>>16&255]^c[f>>8&255]^l[255&m]^n[y+2],_=a[_>>>24]^s[f>>16&255]^c[m>>8&255]^l[255&g]^n[y+3],y+=4,f=d,m=h,g=p;for(let e=0;e<4;e++)r[t?3&-e:e]=u[f>>>24]<<24^u[m>>16&255]<<16^u[g>>8&255]<<8^u[255&_]^n[y++],d=f,f=m,m=g,g=_,_=d;return r}}},mode={ctrGladman:class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255==(e>>24&255)){let t=e>>16&255,n=e>>8&255,i=255&e;255===t?(t=0,255===n?(n=0,255===i?i=0:++i):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=i}else e+=1<<24;return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let i;if(!(i=t.length))return[];const r=bitArray.bitLength(t);for(let r=0;r<i;r+=4){this.incCounter(n);const i=e.encrypt(n);t[r]^=i[0],t[r+1]^=i[1],t[r+2]^=i[2],t[r+3]^=i[3]}return bitArray.clamp(t,r)}}},misc={hmacSha1:class{constructor(e){const t=this,n=t._hash=hash.sha1,i=[[],[]],r=n.prototype.blockSize/32;t._baseHash=[new n,new n],e.length>r&&(e=n.hash(e));for(let t=0;t<r;t++)i[0][t]=909522486^e[t],i[1][t]=1549556828^e[t];t._baseHash[0].update(i[0]),t._baseHash[1].update(i[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}}},ERR_INVALID_PASSWORD="Invalid pasword",BLOCK_LENGTH=16,RAW_FORMAT="raw",PBKDF2_ALGORITHM={name:"PBKDF2"},HASH_ALGORITHM={name:"HMAC"},HASH_FUNCTION="SHA-1",BASE_KEY_ALGORITHM=Object.assign({hash:HASH_ALGORITHM},PBKDF2_ALGORITHM),DERIVED_BITS_ALGORITHM=Object.assign({iterations:1e3,hash:{name:HASH_FUNCTION}},PBKDF2_ALGORITHM),DERIVED_BITS_USAGE=["deriveBits"],SALT_LENGTH=[8,12,16],KEY_LENGTH=[16,24,32],SIGNATURE_LENGTH=10,COUNTER_DEFAULT_VALUE=[0,0,0,0],codecBytes=codec.bytes,Aes=cipher.aes,CtrGladman=mode.ctrGladman,HmacSha1=misc.hmacSha1;class AESDecrypt{constructor(e,t,n){Object.assign(this,{password:e,signed:t,strength:n-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;if(t.password){const n=subarray(e,0,SALT_LENGTH[t.strength]+2);await createDecryptionKeys(t,n,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication),e=subarray(e,SALT_LENGTH[t.strength]+2)}return append(t,e,new Uint8Array(e.length-SIGNATURE_LENGTH-(e.length-SIGNATURE_LENGTH)%BLOCK_LENGTH),0,SIGNATURE_LENGTH,!0)}flush(){const e=this,t=e.pendingInput,n=subarray(t,0,t.length-SIGNATURE_LENGTH),i=subarray(t,t.length-SIGNATURE_LENGTH);let r=new Uint8Array(0);if(n.length){const t=codecBytes.toBits(n);e.hmac.update(t);const i=e.aesCtrGladman.update(t);r=codecBytes.fromBits(i)}let o=!0;if(e.signed){const t=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);for(let e=0;e<SIGNATURE_LENGTH;e++)t[e]!=i[e]&&(o=!1)}return{valid:o,data:r}}}class AESEncrypt{constructor(e,t){Object.assign(this,{password:e,strength:t-1,pendingInput:new Uint8Array(0)})}async append(e){const t=this;let n=new Uint8Array(0);t.password&&(n=await createEncryptionKeys(t,t.password),t.password=null,t.aesCtrGladman=new CtrGladman(new Aes(t.keys.key),Array.from(COUNTER_DEFAULT_VALUE)),t.hmac=new HmacSha1(t.keys.authentication));const i=new Uint8Array(n.length+e.length-e.length%BLOCK_LENGTH);return i.set(n,0),append(t,e,i,n.length,0)}flush(){const e=this;let t=new Uint8Array(0);if(e.pendingInput.length){const n=e.aesCtrGladman.update(codecBytes.toBits(e.pendingInput));e.hmac.update(n),t=codecBytes.fromBits(n)}const n=subarray(codecBytes.fromBits(e.hmac.digest()),0,SIGNATURE_LENGTH);return{data:concat(t,n),signature:n}}}function append(e,t,n,i,r,o){const a=t.length-r;let s;for(e.pendingInput.length&&(t=concat(e.pendingInput,t),n=expand(n,a-a%BLOCK_LENGTH)),s=0;s<=a-BLOCK_LENGTH;s+=BLOCK_LENGTH){const r=codecBytes.toBits(subarray(t,s,s+BLOCK_LENGTH));o&&e.hmac.update(r);const a=e.aesCtrGladman.update(r);o||e.hmac.update(a),n.set(codecBytes.fromBits(a),s+i)}return e.pendingInput=subarray(t,s),n}async function createDecryptionKeys(e,t,n){await createKeys$1(e,n,subarray(t,0,SALT_LENGTH[e.strength]));const i=subarray(t,SALT_LENGTH[e.strength]),r=e.keys.passwordVerification;if(r[0]!=i[0]||r[1]!=i[1])throw new Error(ERR_INVALID_PASSWORD)}async function createEncryptionKeys(e,t){const n=crypto.getRandomValues(new Uint8Array(SALT_LENGTH[e.strength]));return await createKeys$1(e,t,n),concat(n,e.keys.passwordVerification)}async function createKeys$1(e,t,n){const i=encodeText(t),r=await crypto.subtle.importKey(RAW_FORMAT,i,BASE_KEY_ALGORITHM,!1,DERIVED_BITS_USAGE),o=await crypto.subtle.deriveBits(Object.assign({salt:n},DERIVED_BITS_ALGORITHM),r,8*(2*KEY_LENGTH[e.strength]+2)),a=new Uint8Array(o);e.keys={key:codecBytes.toBits(subarray(a,0,KEY_LENGTH[e.strength])),authentication:codecBytes.toBits(subarray(a,KEY_LENGTH[e.strength],2*KEY_LENGTH[e.strength])),passwordVerification:subarray(a,2*KEY_LENGTH[e.strength])}}function concat(e,t){let n=e;return e.length+t.length&&(n=new Uint8Array(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function expand(e,t){if(t&&t>e.length){const n=e;(e=new Uint8Array(t)).set(n,0)}return e}function subarray(e,t,n){return e.subarray(t,n)}const HEADER_LENGTH=12;class ZipCryptoDecrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;if(t.password){const n=decrypt(t,e.subarray(0,HEADER_LENGTH));if(t.password=null,n[HEADER_LENGTH-1]!=t.passwordVerification)throw new Error(ERR_INVALID_PASSWORD);e=e.subarray(HEADER_LENGTH)}return decrypt(t,e)}flush(){return{valid:!0,data:new Uint8Array(0)}}}class ZipCryptoEncrypt{constructor(e,t){Object.assign(this,{password:e,passwordVerification:t}),createKeys(this,e)}append(e){const t=this;let n,i;if(t.password){t.password=null;const r=crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));r[HEADER_LENGTH-1]=t.passwordVerification,n=new Uint8Array(e.length+r.length),n.set(encrypt(t,r),0),i=HEADER_LENGTH}else n=new Uint8Array(e.length),i=0;return n.set(encrypt(t,e),i),n}flush(){return{data:new Uint8Array(0)}}}function decrypt(e,t){const n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=getByte(e)^t[i],updateKeys(e,n[i]);return n}function encrypt(e,t){const n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=getByte(e)^t[i],updateKeys(e,t[i]);return n}function createKeys(e,t){e.keys=[305419896,591751049,878082192],e.crcKey0=new Crc32(e.keys[0]),e.crcKey2=new Crc32(e.keys[2]);for(let n=0;n<t.length;n++)updateKeys(e,t.charCodeAt(n))}function updateKeys(e,t){e.crcKey0.append([t]),e.keys[0]=~e.crcKey0.get(),e.keys[1]=getInt32(e.keys[1]+getInt8(e.keys[0])),e.keys[1]=getInt32(Math.imul(e.keys[1],134775813)+1),e.crcKey2.append([e.keys[1]>>>24]),e.keys[2]=~e.crcKey2.get()}function getByte(e){const t=2|e.keys[2];return getInt8(Math.imul(t,1^t)>>>8)}function getInt8(e){return 255&e}function getInt32(e){return 4294967295&e}const CODEC_DEFLATE="deflate",CODEC_INFLATE="inflate",ERR_INVALID_SIGNATURE="Invalid signature";class Inflate$2{constructor(e,{signature:t,password:n,signed:i,compressed:r,zipCrypto:o,passwordVerification:a,encryptionStrength:s},{chunkSize:c}){const l=Boolean(n);Object.assign(this,{signature:t,encrypted:l,signed:i,compressed:r,inflate:r&&new e({chunkSize:c}),crc32:i&&new Crc32,zipCrypto:o,decrypt:l&&o?new ZipCryptoDecrypt(n,a):new AESDecrypt(n,i,s)})}async append(e){const t=this;return t.encrypted&&e.length&&(e=await t.decrypt.append(e)),t.compressed&&e.length&&(e=await t.inflate.append(e)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),e}async flush(){const e=this;let t,n=new Uint8Array(0);if(e.encrypted){const t=e.decrypt.flush();if(!t.valid)throw new Error(ERR_INVALID_SIGNATURE);n=t.data}if((!e.encrypted||e.zipCrypto)&&e.signed){const n=new DataView(new Uint8Array(4).buffer);if(t=e.crc32.get(),n.setUint32(0,t),e.signature!=n.getUint32(0,!1))throw new Error(ERR_INVALID_SIGNATURE)}return e.compressed&&(n=await e.inflate.append(n)||new Uint8Array(0),await e.inflate.flush()),{data:n,signature:t}}}class Deflate{constructor(e,{encrypted:t,signed:n,compressed:i,level:r,zipCrypto:o,password:a,passwordVerification:s,encryptionStrength:c},{chunkSize:l}){Object.assign(this,{encrypted:t,signed:n,compressed:i,deflate:i&&new e({level:r||5,chunkSize:l}),crc32:n&&new Crc32,zipCrypto:o,encrypt:t&&o?new ZipCryptoEncrypt(a,s):new AESEncrypt(a,c)})}async append(e){const t=this;let n=e;return t.compressed&&e.length&&(n=await t.deflate.append(e)),t.encrypted&&n.length&&(n=await t.encrypt.append(n)),(!t.encrypted||t.zipCrypto)&&t.signed&&e.length&&t.crc32.append(e),n}async flush(){const e=this;let t,n=new Uint8Array(0);if(e.compressed&&(n=await e.deflate.flush()||new Uint8Array(0)),e.encrypted){n=await e.encrypt.append(n);const i=e.encrypt.flush();t=i.signature;const r=new Uint8Array(n.length+i.data.length);r.set(n,0),r.set(i.data,n.length),n=r}return e.encrypted&&!e.zipCrypto||!e.signed||(t=e.crc32.get()),{data:n,signature:t}}}function createCodec$1(e,t,n){return t.codecType.startsWith(CODEC_DEFLATE)?new Deflate(e,t,n):t.codecType.startsWith(CODEC_INFLATE)?new Inflate$2(e,t,n):void 0}const MESSAGE_INIT="init",MESSAGE_APPEND="append",MESSAGE_FLUSH="flush",MESSAGE_EVENT_TYPE="message";let classicWorkersSupported=!0;var getWorker=(e,t,n,i,r,o,a)=>(Object.assign(e,{busy:!0,codecConstructor:t,options:Object.assign({},n),scripts:a,terminate(){e.worker&&!e.busy&&(e.worker.terminate(),e.interface=null)},onTaskFinished(){e.busy=!1,r(e)}}),o?createWebWorkerInterface(e,i):createWorkerInterface(e,i));function createWorkerInterface(e,t){const n=createCodec$1(e.codecConstructor,e.options,t);return{async append(t){try{return await n.append(t)}catch(t){throw e.onTaskFinished(),t}},async flush(){try{return await n.flush()}finally{e.onTaskFinished()}}}}function createWebWorkerInterface(e,t){let n;const i={type:"module"};if(!e.interface){if(classicWorkersSupported)try{e.worker=r()}catch(t){classicWorkersSupported=!1,e.worker=r(i)}else e.worker=r(i);e.worker.addEventListener(MESSAGE_EVENT_TYPE,(function(t){const i=t.data;if(n){const t=i.error,r=i.type;if(t){const i=new Error(t.message);i.stack=t.stack,n.reject(i),n=null,e.onTaskFinished()}else if(r==MESSAGE_INIT||r==MESSAGE_FLUSH||r==MESSAGE_APPEND){const t=i.data;r==MESSAGE_FLUSH?(n.resolve({data:new Uint8Array(t),signature:i.signature}),n=null,e.onTaskFinished()):n.resolve(t&&new Uint8Array(t))}}}),!1),e.interface={append:e=>o({type:MESSAGE_APPEND,data:e}),flush:()=>o({type:MESSAGE_FLUSH})}}return e.interface;function r(t={}){let n;try{n=new URL(e.scripts[0],"undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("Cesium.js",document.baseURI).href)}catch(t){n=e.scripts[0]}return new Worker(n,t)}async function o(i){if(!n){const n=e.options,i=e.scripts.slice(1);await a({scripts:i,type:MESSAGE_INIT,options:n,config:{chunkSize:t.chunkSize}})}return a(i)}function a(t){const i=e.worker,r=new Promise(((e,t)=>n={resolve:e,reject:t}));try{if(t.data)try{t.data=t.data.buffer,i.postMessage(t,[t.data])}catch(e){i.postMessage(t)}else i.postMessage(t)}catch(t){n.reject(t),n=null,e.onTaskFinished()}return r}}let pool=[],pendingRequests=[];function createCodec(e,t,n){const i=!(!t.compressed&&!t.signed&&!t.encrypted)&&(t.useWebWorkers||void 0===t.useWebWorkers&&n.useWebWorkers),r=i&&n.workerScripts?n.workerScripts[t.codecType]:[];if(pool.length<n.maxWorkers){const a={};return pool.push(a),getWorker(a,e,t,n,o,i,r)}{const a=pool.find((e=>!e.busy));return a?(clearTerminateTimeout(a),getWorker(a,e,t,n,o,i,r)):new Promise((n=>pendingRequests.push({resolve:n,codecConstructor:e,options:t,webWorker:i,scripts:r})))}function o(e){if(pendingRequests.length){const[{resolve:t,codecConstructor:i,options:r,webWorker:a,scripts:s}]=pendingRequests.splice(0,1);t(getWorker(e,i,r,n,o,a,s))}else e.worker?(clearTerminateTimeout(e),Number.isFinite(n.terminateWorkerTimeout)&&n.terminateWorkerTimeout>=0&&(e.terminateTimeout=setTimeout((()=>{pool=pool.filter((t=>t!=e)),e.terminate()}),n.terminateWorkerTimeout))):pool=pool.filter((t=>t!=e))}}function clearTerminateTimeout(e){e.terminateTimeout&&(clearTimeout(e.terminateTimeout),e.terminateTimeout=null)}const CP437="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");var decodeCP437=e=>{let t="";for(let n=0;n<e.length;n++)t+=CP437[e[n]];return t};async function decodeText(e,t){if(t&&"cp437"==t.trim().toLowerCase())return decodeCP437(e);if("undefined"==typeof TextDecoder){const t=new FileReader;return new Promise(((n,i)=>{t.onload=e=>n(e.target.result),t.onerror=()=>i(t.error),t.readAsText(new Blob([e]))}))}return new TextDecoder(t).decode(e)}const PROPERTY_NAMES=["filename","rawFilename","directory","encrypted","compressedSize","uncompressedSize","lastModDate","rawLastModDate","comment","rawComment","signature","extraField","rawExtraField","bitFlag","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","filenameUTF8","commentUTF8","offset","zip64","compressionMethod","extraFieldNTFS","lastAccessDate","creationDate","extraFieldExtendedTimestamp","version","versionMadeBy","msDosCompatible","internalFileAttribute","externalFileAttribute"];class Entry{constructor(e){PROPERTY_NAMES.forEach((t=>this[t]=e[t]))}}const ERR_BAD_FORMAT="File format is not recognized",ERR_EOCDR_NOT_FOUND="End of central directory not found",ERR_EOCDR_ZIP64_NOT_FOUND="End of Zip64 central directory not found",ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND="End of Zip64 central directory locator not found",ERR_CENTRAL_DIRECTORY_NOT_FOUND="Central directory header not found",ERR_LOCAL_FILE_HEADER_NOT_FOUND="Local file header not found",ERR_EXTRAFIELD_ZIP64_NOT_FOUND="Zip64 extra field not found",ERR_ENCRYPTED="File contains encrypted entry",ERR_UNSUPPORTED_ENCRYPTION="Encryption method not supported",ERR_UNSUPPORTED_COMPRESSION="Compression method not supported",CHARSET_UTF8="utf-8",CHARSET_CP437="cp437",ZIP64_PROPERTIES=["uncompressedSize","compressedSize","offset"];class ZipReader{constructor(e,t={}){Object.assign(this,{reader:e,options:t,config:getConfiguration()})}async getEntries(e={}){const t=this,n=t.reader;if(n.initialized||await n.init(),n.size<END_OF_CENTRAL_DIR_LENGTH)throw new Error(ERR_BAD_FORMAT);const i=await seekSignature(n,END_OF_CENTRAL_DIR_SIGNATURE,n.size,END_OF_CENTRAL_DIR_LENGTH,16*MAX_16_BITS);if(!i)throw new Error(ERR_EOCDR_NOT_FOUND);const r=getDataView$1(i);let o=getUint32(r,12),a=getUint32(r,16),s=getUint16(r,8),c=0;if(a==MAX_32_BITS||o==MAX_32_BITS||s==MAX_16_BITS){const e=getDataView$1(await readUint8Array(n,i.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH));if(getUint32(e,0)!=ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE)throw new Error(ERR_EOCDR_ZIP64_NOT_FOUND);a=getBigUint64(e,8);let t=await readUint8Array(n,a,ZIP64_END_OF_CENTRAL_DIR_LENGTH),r=getDataView$1(t);const l=i.offset-ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH-ZIP64_END_OF_CENTRAL_DIR_LENGTH;if(getUint32(r,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE&&a!=l){const e=a;a=l,c=a-e,t=await readUint8Array(n,a,ZIP64_END_OF_CENTRAL_DIR_LENGTH),r=getDataView$1(t)}if(getUint32(r,0)!=ZIP64_END_OF_CENTRAL_DIR_SIGNATURE)throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);s=getBigUint64(r,32),o=getBigUint64(r,40),a-=o}if(a<0||a>=n.size)throw new Error(ERR_BAD_FORMAT);let l=0,u=await readUint8Array(n,a,o),d=getDataView$1(u);const h=i.offset-o;if(getUint32(d,l)!=CENTRAL_FILE_HEADER_SIGNATURE&&a!=h){const e=a;a=h,c=a-e,u=await readUint8Array(n,a,o),d=getDataView$1(u)}if(a<0||a>=n.size)throw new Error(ERR_BAD_FORMAT);const p=[];for(let i=0;i<s;i++){const r=new ZipEntry(n,t.config,t.options);if(getUint32(d,l)!=CENTRAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);readCommonHeader(r,d,l+6);const o=Boolean(r.bitFlag.languageEncodingFlag),a=l+46,h=a+r.filenameLength,f=h+r.extraFieldLength,m=getUint16(d,l+4),g=0==(0&m);Object.assign(r,{versionMadeBy:m,msDosCompatible:g,compressedSize:0,uncompressedSize:0,commentLength:getUint16(d,l+32),directory:g&&(getUint8(d,l+38)&FILE_ATTR_MSDOS_DIR_MASK)==FILE_ATTR_MSDOS_DIR_MASK,offset:getUint32(d,l+42)+c,internalFileAttribute:getUint32(d,l+34),externalFileAttribute:getUint32(d,l+38),rawFilename:u.subarray(a,h),filenameUTF8:o,commentUTF8:o,rawExtraField:u.subarray(h,f)});const _=f+r.commentLength;r.rawComment=u.subarray(f,_);const y=getOptionValue$1(t,e,"filenameEncoding"),C=getOptionValue$1(t,e,"commentEncoding"),[T,S]=await Promise.all([decodeText(r.rawFilename,r.filenameUTF8?CHARSET_UTF8:y||CHARSET_CP437),decodeText(r.rawComment,r.commentUTF8?CHARSET_UTF8:C||CHARSET_CP437)]);r.filename=T,r.comment=S,!r.directory&&r.filename.endsWith(DIRECTORY_SIGNATURE)&&(r.directory=!0),await readCommonFooter(r,r,d,l+6);const A=new Entry(r);if(A.getData=(e,t)=>r.getData(e,A,t),p.push(A),l=_,e.onprogress)try{e.onprogress(i+1,s,new Entry(r))}catch(e){}}return p}async close(){}}class ZipEntry{constructor(e,t,n){Object.assign(this,{reader:e,config:t,options:n})}async getData(e,t,n={}){const i=this,{reader:r,offset:o,extraFieldAES:a,compressionMethod:s,config:c,bitFlag:l,signature:u,rawLastModDate:d,compressedSize:h}=i,p=i.localDirectory={};r.initialized||await r.init();let f=await readUint8Array(r,o,30);const m=getDataView$1(f);let g=getOptionValue$1(i,n,"password");if(g=g&&g.length&&g,a&&a.originalCompressionMethod!=COMPRESSION_METHOD_AES)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(s!=COMPRESSION_METHOD_STORE&&s!=COMPRESSION_METHOD_DEFLATE)throw new Error(ERR_UNSUPPORTED_COMPRESSION);if(getUint32(m,0)!=LOCAL_FILE_HEADER_SIGNATURE)throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);readCommonHeader(p,m,4),f=await readUint8Array(r,o,30+p.filenameLength+p.extraFieldLength),p.rawExtraField=f.subarray(30+p.filenameLength),await readCommonFooter(i,p,m,4),t.lastAccessDate=p.lastAccessDate,t.creationDate=p.creationDate;const _=i.encrypted&&p.encrypted,y=_&&!a;if(_){if(!y&&void 0===a.strength)throw new Error(ERR_UNSUPPORTED_ENCRYPTION);if(!g)throw new Error(ERR_ENCRYPTED)}const C=await createCodec(c.Inflate,{codecType:CODEC_INFLATE,password:g,zipCrypto:y,encryptionStrength:a&&a.strength,signed:getOptionValue$1(i,n,"checkSignature"),passwordVerification:y&&(l.dataDescriptor?d>>>8&255:u>>>24&255),signature:u,compressed:0!=s,encrypted:_,useWebWorkers:getOptionValue$1(i,n,"useWebWorkers")},c);e.initialized||await e.init();const T=getOptionValue$1(i,n,"signal"),S=o+30+p.filenameLength+p.extraFieldLength;return await processData(C,r,e,S,h,c,{onprogress:n.onprogress,signal:T}),e.getData()}}function readCommonHeader(e,t,n){const i=e.rawBitFlag=getUint16(t,n+2),r=(i&BITFLAG_ENCRYPTED)==BITFLAG_ENCRYPTED,o=getUint32(t,n+6);Object.assign(e,{encrypted:r,version:getUint16(t,n),bitFlag:{level:(i&BITFLAG_LEVEL)>>1,dataDescriptor:(i&BITFLAG_DATA_DESCRIPTOR)==BITFLAG_DATA_DESCRIPTOR,languageEncodingFlag:(i&BITFLAG_LANG_ENCODING_FLAG)==BITFLAG_LANG_ENCODING_FLAG},rawLastModDate:o,lastModDate:getDate(o),filenameLength:getUint16(t,n+22),extraFieldLength:getUint16(t,n+24)})}async function readCommonFooter(e,t,n,i){const r=t.rawExtraField,o=t.extraField=new Map,a=getDataView$1(new Uint8Array(r));let s=0;try{for(;s<r.length;){const e=getUint16(a,s),t=getUint16(a,s+2);o.set(e,{type:e,data:r.slice(s+4,s+4+t)}),s+=4+t}}catch(e){}const c=getUint16(n,i+4);t.signature=getUint32(n,i+10),t.uncompressedSize=getUint32(n,i+18),t.compressedSize=getUint32(n,i+14);const l=o.get(EXTRAFIELD_TYPE_ZIP64);l&&(readExtraFieldZip64(l,t),t.extraFieldZip64=l);const u=o.get(EXTRAFIELD_TYPE_UNICODE_PATH);u&&(await readExtraFieldUnicode(u,"filename","rawFilename",t,e),t.extraFieldUnicodePath=u);const d=o.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);d&&(await readExtraFieldUnicode(d,"comment","rawComment",t,e),t.extraFieldUnicodeComment=d);const h=o.get(EXTRAFIELD_TYPE_AES);h?(readExtraFieldAES(h,t,c),t.extraFieldAES=h):t.compressionMethod=c;const p=o.get(EXTRAFIELD_TYPE_NTFS);p&&(readExtraFieldNTFS(p,t),t.extraFieldNTFS=p);const f=o.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);f&&(readExtraFieldExtendedTimestamp(f,t),t.extraFieldExtendedTimestamp=f)}function readExtraFieldZip64(e,t){t.zip64=!0;const n=getDataView$1(e.data);e.values=[];for(let t=0;t<Math.floor(e.data.length/8);t++)e.values.push(getBigUint64(n,0+8*t));const i=ZIP64_PROPERTIES.filter((e=>t[e]==MAX_32_BITS));for(let t=0;t<i.length;t++)e[i[t]]=e.values[t];ZIP64_PROPERTIES.forEach((n=>{if(t[n]==MAX_32_BITS){if(void 0===e[n])throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);t[n]=e[n]}}))}async function readExtraFieldUnicode(e,t,n,i,r){const o=getDataView$1(e.data);e.version=getUint8(o,0),e.signature=getUint32(o,1);const a=new Crc32;a.append(r[n]);const s=getDataView$1(new Uint8Array(4));s.setUint32(0,a.get(),!0),e[t]=await decodeText(e.data.subarray(5)),e.valid=!r.bitFlag.languageEncodingFlag&&e.signature==getUint32(s,0),e.valid&&(i[t]=e[t],i[t+"UTF8"]=!0)}function readExtraFieldAES(e,t,n){const i=getDataView$1(e.data);e.vendorVersion=getUint8(i,0),e.vendorId=getUint8(i,2);const r=getUint8(i,4);e.strength=r,e.originalCompressionMethod=n,t.compressionMethod=e.compressionMethod=getUint16(i,5)}function readExtraFieldNTFS(e,t){const n=getDataView$1(e.data);let i,r=4;try{for(;r<e.data.length&&!i;){const t=getUint16(n,r),o=getUint16(n,r+2);t==EXTRAFIELD_TYPE_NTFS_TAG1&&(i=e.data.slice(r+4,r+4+o)),r+=4+o}}catch(e){}try{if(i&&24==i.length){const n=getDataView$1(i),r=n.getBigUint64(0,!0),o=n.getBigUint64(8,!0),a=n.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:r,rawLastAccessDate:o,rawCreationDate:a});const s=getDateNTFS(r),c=getDateNTFS(o),l={lastModDate:s,lastAccessDate:c,creationDate:getDateNTFS(a)};Object.assign(e,l),Object.assign(t,l)}}catch(e){}}function readExtraFieldExtendedTimestamp(e,t){const n=getDataView$1(e.data),i=getUint8(n,0),r=[],o=[];1==(1&i)&&(r.push("lastModDate"),o.push("rawLastModDate")),2==(2&i)&&(r.push("lastAccessDate"),o.push("rawLastAccessDate")),4==(4&i)&&(r.push("creationDate"),o.push("rawCreationDate"));let a=1;r.forEach(((i,r)=>{if(e.data.length>=a+4){const s=getUint32(n,a);t[i]=e[i]=new Date(1e3*s);const c=o[r];e[c]=s}a+=4}))}async function seekSignature(e,t,n,i,r){const o=new Uint8Array(4);setUint32$1(getDataView$1(o),0,t);const a=i+r;return await s(i)||await s(Math.min(a,n));async function s(t){const r=n-t,a=await readUint8Array(e,r,t);for(let e=a.length-i;e>=0;e--)if(a[e]==o[0]&&a[e+1]==o[1]&&a[e+2]==o[2]&&a[e+3]==o[3])return{offset:r+e,buffer:a.slice(e,e+i).buffer}}}function getOptionValue$1(e,t,n){return void 0===t[n]?e.options[n]:t[n]}function getDate(e){const t=(4294901760&e)>>16,n=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(e){}}function getDateNTFS(e){return new Date(Number(e/BigInt(1e4)-BigInt(116444736e5)))}function getUint8(e,t){return e.getUint8(t)}function getUint16(e,t){return e.getUint16(t,!0)}function getUint32(e,t){return e.getUint32(t,!0)}function getBigUint64(e,t){return Number(e.getBigUint64(t,!0))}function setUint32$1(e,t,n){e.setUint32(t,n,!0)}function getDataView$1(e){return new DataView(e.buffer)}function readUint8Array(e,t,n){return e.readUint8Array(t,n)}const ERR_DUPLICATED_NAME="File already exists",ERR_INVALID_COMMENT="Zip file comment exceeds 64KB",ERR_INVALID_ENTRY_COMMENT="File entry comment exceeds 64KB",ERR_INVALID_ENTRY_NAME="File entry name exceeds 64KB",ERR_INVALID_VERSION="Version exceeds 65535",ERR_INVALID_ENCRYPTION_STRENGTH="The strength must equal 1, 2, or 3",ERR_INVALID_EXTRAFIELD_TYPE="Extra field type exceeds 65535",ERR_INVALID_EXTRAFIELD_DATA="Extra field data exceeds 64KB",ERR_UNSUPPORTED_FORMAT="Zip64 is not supported",EXTRAFIELD_DATA_AES=new Uint8Array([7,0,2,0,65,69,3,0,0]),EXTRAFIELD_LENGTH_ZIP64=24;let workers=0;class ZipWriter{constructor(e,t={}){Object.assign(this,{writer:e,options:t,config:getConfiguration(),files:new Map,offset:e.size,pendingCompressedSize:0,pendingEntries:[]})}async add(e="",t,n={}){const i=this;if(!(workers<i.config.maxWorkers))return new Promise(((r,o)=>i.pendingEntries.push({name:e,reader:t,options:n,resolve:r,reject:o})));workers++;try{return await addFile(i,e,t,n)}finally{workers--;const e=i.pendingEntries.shift();e&&i.add(e.name,e.reader,e.options).then(e.resolve).catch(e.reject)}}async close(e=new Uint8Array(0),t={}){return await closeFile(this,e,t),this.writer.getData()}}async function addFile(e,t,n,i){if(t=t.trim(),i.directory&&!t.endsWith(DIRECTORY_SIGNATURE)?t+=DIRECTORY_SIGNATURE:i.directory=t.endsWith(DIRECTORY_SIGNATURE),e.files.has(t))throw new Error(ERR_DUPLICATED_NAME);const r=encodeText(t);if(r.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_NAME);const o=i.comment||"",a=encodeText(o);if(a.length>MAX_16_BITS)throw new Error(ERR_INVALID_ENTRY_COMMENT);const s=e.options.version||i.version||0;if(s>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const c=e.options.versionMadeBy||i.versionMadeBy||20;if(c>MAX_16_BITS)throw new Error(ERR_INVALID_VERSION);const l=getOptionValue(e,i,"lastModDate")||new Date,u=getOptionValue(e,i,"lastAccessDate"),d=getOptionValue(e,i,"creationDate"),h=getOptionValue(e,i,"password"),p=getOptionValue(e,i,"encryptionStrength")||3,f=getOptionValue(e,i,"zipCrypto");if(void 0!==h&&void 0!==p&&(p<1||p>3))throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);let m=new Uint8Array(0);const g=i.extraField;if(g){let e=0,t=0;g.forEach((t=>e+=4+t.length)),m=new Uint8Array(e),g.forEach(((e,n)=>{if(n>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);if(e.length>MAX_16_BITS)throw new Error(ERR_INVALID_EXTRAFIELD_DATA);arraySet(m,new Uint16Array([n]),t),arraySet(m,new Uint16Array([e.length]),t+2),arraySet(m,e,t+4),t+=4+e.length}))}let _=getOptionValue(e,i,"extendedTimestamp");void 0===_&&(_=!0);let y=0,C=getOptionValue(e,i,"keepOrder");void 0===C&&(C=!0);let T=0,S=getOptionValue(e,i,"msDosCompatible");void 0===S&&(S=!0);const A=getOptionValue(e,i,"internalFileAttribute")||0,v=getOptionValue(e,i,"externalFileAttribute")||0;n&&(n.initialized||await n.init(),T=n.size,y=getMaximumCompressedSize(T));let E=i.zip64||e.options.zip64||!1;if(e.offset+e.pendingCompressedSize>=MAX_32_BITS||T>=MAX_32_BITS||y>=MAX_32_BITS){if(!1===i.zip64||!1===e.options.zip64||!C)throw new Error(ERR_UNSUPPORTED_FORMAT);E=!0}e.pendingCompressedSize+=y,await Promise.resolve();const b=getOptionValue(e,i,"level"),x=getOptionValue(e,i,"useWebWorkers"),P=getOptionValue(e,i,"bufferedWrite");let D=getOptionValue(e,i,"dataDescriptor"),w=getOptionValue(e,i,"dataDescriptorSignature");const M=getOptionValue(e,i,"signal");void 0===D&&(D=!0),D&&void 0===w&&(w=!0);const I=await getFileEntry(e,t,n,Object.assign({},i,{rawFilename:r,rawComment:a,version:s,versionMadeBy:c,lastModDate:l,lastAccessDate:u,creationDate:d,rawExtraField:m,zip64:E,password:h,level:b,useWebWorkers:x,encryptionStrength:p,extendedTimestamp:_,zipCrypto:f,bufferedWrite:P,keepOrder:C,dataDescriptor:D,dataDescriptorSignature:w,signal:M,msDosCompatible:S,internalFileAttribute:A,externalFileAttribute:v}));return y&&(e.pendingCompressedSize-=y),Object.assign(I,{name:t,comment:o,extraField:g}),new Entry(I)}async function getFileEntry(e,t,n,i){const r=e.files,o=e.writer,a=Array.from(r.values()).pop();let s,c,l,u={};r.set(t,u);try{let d,h,p;if(i.keepOrder&&(d=a&&a.lock),u.lock=p=new Promise((e=>l=e)),i.bufferedWrite||e.lockWrite||!i.dataDescriptor?(h=new BlobWriter,h.init(),s=!0):(e.lockWrite=new Promise((e=>c=e)),o.initialized||await o.init(),h=o),u=await createFileEntry(n,h,e.config,i),u.lock=p,r.set(t,u),u.filename=t,s){let t=0;const n=h.getData();let a;await Promise.all([e.lockWrite,d]);do{a=Array.from(r.values()).find((e=>e.writingBufferedData)),a&&await a.lock}while(a&&a.lock);if(u.writingBufferedData=!0,!i.dataDescriptor){const e=26,r=await sliceAsArrayBuffer(n,0,e),a=new DataView(r);u.encrypted&&!i.zipCrypto||setUint32(a,14,u.signature),u.zip64?(setUint32(a,18,MAX_32_BITS),setUint32(a,22,MAX_32_BITS)):(setUint32(a,18,u.compressedSize),setUint32(a,22,u.uncompressedSize)),await o.writeUint8Array(new Uint8Array(r)),t=e}await writeBlob(o,n,t),delete u.writingBufferedData}if(u.offset=e.offset,u.zip64){setBigUint64(getDataView(u.rawExtraFieldZip64),20,BigInt(u.offset))}else if(u.offset>=MAX_32_BITS)throw new Error(ERR_UNSUPPORTED_FORMAT);return e.offset+=u.length,u}catch(n){throw(s&&u.writingBufferedData||!s&&u.dataWritten)&&(n.corruptedEntry=e.hasCorruptedEntries=!0,u.uncompressedSize&&(e.offset+=u.uncompressedSize)),r.delete(t),n}finally{l(),c&&c()}}async function createFileEntry(e,t,n,i){const{rawFilename:r,lastAccessDate:o,creationDate:a,password:s,level:c,zip64:l,zipCrypto:u,dataDescriptor:d,dataDescriptorSignature:h,directory:p,version:f,versionMadeBy:m,rawComment:g,rawExtraField:_,useWebWorkers:y,onprogress:C,signal:T,encryptionStrength:S,extendedTimestamp:A,msDosCompatible:v,internalFileAttribute:E,externalFileAttribute:b}=i,x=Boolean(s&&s.length),P=0!==c&&!p;let D,w,M;if(x&&!u){D=new Uint8Array(EXTRAFIELD_DATA_AES.length+2);const e=getDataView(D);setUint16(e,0,EXTRAFIELD_TYPE_AES),arraySet(D,EXTRAFIELD_DATA_AES,2),setUint8(e,8,S)}else D=new Uint8Array(0);if(A){M=new Uint8Array(9+(o?4:0)+(a?4:0));const e=getDataView(M);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,M.length-4);setUint8(e,4,1+(o?2:0)+(a?4:0)),setUint32(e,5,Math.floor(i.lastModDate.getTime()/1e3)),o&&setUint32(e,9,Math.floor(o.getTime()/1e3)),a&&setUint32(e,13,Math.floor(a.getTime()/1e3));try{w=new Uint8Array(36);const e=getDataView(w),t=getTimeNTFS(i.lastModDate);setUint16(e,0,EXTRAFIELD_TYPE_NTFS),setUint16(e,2,32),setUint16(e,8,EXTRAFIELD_TYPE_NTFS_TAG1),setUint16(e,10,24),setBigUint64(e,12,t),setBigUint64(e,20,getTimeNTFS(o)||t),setBigUint64(e,28,getTimeNTFS(a)||t)}catch(e){w=new Uint8Array(0)}}else w=M=new Uint8Array(0);const I={version:f||VERSION_DEFLATE,versionMadeBy:m,zip64:l,directory:Boolean(p),filenameUTF8:!0,rawFilename:r,commentUTF8:!0,rawComment:g,rawExtraFieldZip64:l?new Uint8Array(EXTRAFIELD_LENGTH_ZIP64+4):new Uint8Array(0),rawExtraFieldExtendedTimestamp:M,rawExtraFieldNTFS:w,rawExtraFieldAES:D,rawExtraField:_,extendedTimestamp:A,msDosCompatible:v,internalFileAttribute:E,externalFileAttribute:b};let R=I.uncompressedSize=0,O=BITFLAG_LANG_ENCODING_FLAG;d&&(O|=BITFLAG_DATA_DESCRIPTOR);let B=COMPRESSION_METHOD_STORE;P&&(B=COMPRESSION_METHOD_DEFLATE),l&&(I.version=I.version>VERSION_ZIP64?I.version:VERSION_ZIP64),x&&(O|=BITFLAG_ENCRYPTED,u||(I.version=I.version>VERSION_AES?I.version:VERSION_AES,B=COMPRESSION_METHOD_AES,P&&(I.rawExtraFieldAES[9]=COMPRESSION_METHOD_DEFLATE))),I.compressionMethod=B;const L=I.headerArray=new Uint8Array(26),F=getDataView(L);setUint16(F,0,I.version),setUint16(F,2,O),setUint16(F,4,B);const N=new Uint32Array(1),V=getDataView(N);let k;k=i.lastModDate<MIN_DATE?MIN_DATE:i.lastModDate>MAX_DATE?MAX_DATE:i.lastModDate,setUint16(V,0,(k.getHours()<<6|k.getMinutes())<<5|k.getSeconds()/2),setUint16(V,2,(k.getFullYear()-1980<<4|k.getMonth()+1)<<5|k.getDate());const U=N[0];setUint32(F,6,U),setUint16(F,22,r.length);const G=D.length+M.length+w.length+I.rawExtraField.length;setUint16(F,24,G);const $=new Uint8Array(30+r.length+G);let z;setUint32(getDataView($),0,LOCAL_FILE_HEADER_SIGNATURE),arraySet($,L,4),arraySet($,r,30),arraySet($,D,30+r.length),arraySet($,M,30+r.length+D.length),arraySet($,w,30+r.length+D.length+M.length),arraySet($,I.rawExtraField,30+r.length+D.length+M.length+w.length);let H=0;if(e){R=I.uncompressedSize=e.size;const i=await createCodec(n.Deflate,{codecType:CODEC_DEFLATE,level:c,password:s,encryptionStrength:S,zipCrypto:x&&u,passwordVerification:x&&u&&U>>8&255,signed:!0,compressed:P,encrypted:x,useWebWorkers:y},n);await t.writeUint8Array($),I.dataWritten=!0,z=await processData(i,e,t,0,R,n,{onprogress:C,signal:T}),H=z.length}else await t.writeUint8Array($),I.dataWritten=!0;let W,q=new Uint8Array(0),j=0;if(d&&(q=new Uint8Array(l?h?24:20:h?16:12),W=getDataView(q),h&&(j=4,setUint32(W,0,DATA_DESCRIPTOR_RECORD_SIGNATURE))),e){const e=z.signature;if(x&&!u||void 0===e||(setUint32(F,10,e),I.signature=e,d&&setUint32(W,j,e)),l){const e=getDataView(I.rawExtraFieldZip64);setUint16(e,0,EXTRAFIELD_TYPE_ZIP64),setUint16(e,2,EXTRAFIELD_LENGTH_ZIP64),setUint32(F,14,MAX_32_BITS),setBigUint64(e,12,BigInt(H)),setUint32(F,18,MAX_32_BITS),setBigUint64(e,4,BigInt(R)),d&&(setBigUint64(W,j+4,BigInt(H)),setBigUint64(W,j+12,BigInt(R)))}else setUint32(F,14,H),setUint32(F,18,R),d&&(setUint32(W,j+4,H),setUint32(W,j+8,R))}d&&await t.writeUint8Array(q);const X=$.length+H+q.length;return Object.assign(I,{compressedSize:H,lastModDate:k,rawLastModDate:U,creationDate:a,lastAccessDate:o,encrypted:x,length:X}),I}async function closeFile(e,t,n){const i=e.writer,r=e.files;let o=0,a=0,s=e.offset,c=r.size;for(const[,e]of r)a+=46+e.rawFilename.length+e.rawComment.length+e.rawExtraFieldZip64.length+e.rawExtraFieldAES.length+e.rawExtraFieldExtendedTimestamp.length+e.rawExtraFieldNTFS.length+e.rawExtraField.length;let l=n.zip64||e.options.zip64||!1;if(s>=MAX_32_BITS||a>=MAX_32_BITS||c>=MAX_16_BITS){if(!1===n.zip64||!1===e.options.zip64)throw new Error(ERR_UNSUPPORTED_FORMAT);l=!0}const u=new Uint8Array(a+(l?ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH:END_OF_CENTRAL_DIR_LENGTH)),d=getDataView(u);if(t&&t.length){if(!(t.length<=MAX_16_BITS))throw new Error(ERR_INVALID_COMMENT);setUint16(d,o+20,t.length)}for(const[e,t]of Array.from(r.values()).entries()){const{rawFilename:i,rawExtraFieldZip64:a,rawExtraFieldAES:s,rawExtraField:c,rawComment:l,versionMadeBy:h,headerArray:p,directory:f,zip64:m,msDosCompatible:g,internalFileAttribute:_,externalFileAttribute:y}=t;let C,T;if(t.extendedTimestamp){T=t.rawExtraFieldNTFS,C=new Uint8Array(9);const e=getDataView(C);setUint16(e,0,EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP),setUint16(e,2,C.length-4),setUint8(e,4,1),setUint32(e,5,Math.floor(t.lastModDate.getTime()/1e3))}else T=C=new Uint8Array(0);const S=a.length+s.length+C.length+T.length+c.length;if(setUint32(d,o,CENTRAL_FILE_HEADER_SIGNATURE),setUint16(d,o+4,h),arraySet(u,p,o+6),setUint16(d,o+30,S),setUint16(d,o+32,l.length),setUint32(d,o+34,_),y?setUint32(d,o+38,y):f&&g&&setUint8(d,o+38,FILE_ATTR_MSDOS_DIR_MASK),setUint32(d,o+42,m?MAX_32_BITS:t.offset),arraySet(u,i,o+46),arraySet(u,a,o+46+i.length),arraySet(u,s,o+46+i.length+a.length),arraySet(u,C,o+46+i.length+a.length+s.length),arraySet(u,T,o+46+i.length+a.length+s.length+C.length),arraySet(u,c,o+46+i.length+a.length+s.length+C.length+T.length),arraySet(u,l,o+46+i.length+S),o+=46+i.length+S+l.length,n.onprogress)try{n.onprogress(e+1,r.size,new Entry(t))}catch(e){}}l&&(setUint32(d,o,ZIP64_END_OF_CENTRAL_DIR_SIGNATURE),setBigUint64(d,o+4,BigInt(44)),setUint16(d,o+12,45),setUint16(d,o+14,45),setBigUint64(d,o+24,BigInt(c)),setBigUint64(d,o+32,BigInt(c)),setBigUint64(d,o+40,BigInt(a)),setBigUint64(d,o+48,BigInt(s)),setUint32(d,o+56,ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE),setBigUint64(d,o+64,BigInt(s)+BigInt(a)),setUint32(d,o+72,ZIP64_TOTAL_NUMBER_OF_DISKS),c=MAX_16_BITS,s=MAX_32_BITS,a=MAX_32_BITS,o+=76),setUint32(d,o,END_OF_CENTRAL_DIR_SIGNATURE),setUint16(d,o+8,c),setUint16(d,o+10,c),setUint32(d,o+12,a),setUint32(d,o+16,s),await i.writeUint8Array(u),t&&t.length&&await i.writeUint8Array(t)}function sliceAsArrayBuffer(e,t,n){if(e.arrayBuffer)return t||n?e.slice(t,n).arrayBuffer():e.arrayBuffer();{const i=new FileReader;return new Promise(((r,o)=>{i.onload=e=>r(e.target.result),i.onerror=()=>o(i.error),i.readAsArrayBuffer(t||n?e.slice(t,n):e)}))}}async function writeBlob(e,t,n=0){const i=536870912;await async function r(){if(n<t.size){const o=await sliceAsArrayBuffer(t,n,n+i);await e.writeUint8Array(new Uint8Array(o)),n+=i,await r()}}()}function getTimeNTFS(e){if(e)return(BigInt(e.getTime())+BigInt(116444736e5))*BigInt(1e4)}function getOptionValue(e,t,n){return void 0===t[n]?e.options[n]:t[n]}function getMaximumCompressedSize(e){return e+5*(Math.floor(e/16383)+1)}function setUint8(e,t,n){e.setUint8(t,n)}function setUint16(e,t,n){e.setUint16(t,n,!0)}function setUint32(e,t,n){e.setUint32(t,n,!0)}function setBigUint64(e,t,n){e.setBigUint64(t,n,!0)}function arraySet(e,t,n){e.set(t,n)}function getDataView(e){return new DataView(e.buffer)}configure({Deflate:ZipDeflate,Inflate:ZipInflate});var zipNoWorker=Object.freeze({__proto__:null,configure:configure,getMimeType:getMimeType,ERR_ABORT:ERR_ABORT,Reader:Reader,Writer:Writer,TextReader:TextReader,TextWriter:TextWriter,Data64URIReader:Data64URIReader,Data64URIWriter:Data64URIWriter,BlobReader:BlobReader,BlobWriter:BlobWriter,Uint8ArrayReader:Uint8ArrayReader,Uint8ArrayWriter:Uint8ArrayWriter,HttpReader:HttpReader,HttpRangeReader:HttpRangeReader,ERR_HTTP_RANGE:ERR_HTTP_RANGE,ZipReader:ZipReader,ERR_BAD_FORMAT:ERR_BAD_FORMAT,ERR_EOCDR_NOT_FOUND:ERR_EOCDR_NOT_FOUND,ERR_EOCDR_ZIP64_NOT_FOUND:ERR_EOCDR_ZIP64_NOT_FOUND,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,ERR_CENTRAL_DIRECTORY_NOT_FOUND:ERR_CENTRAL_DIRECTORY_NOT_FOUND,ERR_LOCAL_FILE_HEADER_NOT_FOUND:ERR_LOCAL_FILE_HEADER_NOT_FOUND,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:ERR_EXTRAFIELD_ZIP64_NOT_FOUND,ERR_ENCRYPTED:ERR_ENCRYPTED,ERR_UNSUPPORTED_ENCRYPTION:ERR_UNSUPPORTED_ENCRYPTION,ERR_UNSUPPORTED_COMPRESSION:ERR_UNSUPPORTED_COMPRESSION,ERR_INVALID_SIGNATURE:ERR_INVALID_SIGNATURE,ERR_INVALID_PASSWORD:ERR_INVALID_PASSWORD,ZipWriter:ZipWriter,ERR_DUPLICATED_NAME:ERR_DUPLICATED_NAME,ERR_INVALID_COMMENT:ERR_INVALID_COMMENT,ERR_INVALID_ENTRY_NAME:ERR_INVALID_ENTRY_NAME,ERR_INVALID_ENTRY_COMMENT:ERR_INVALID_ENTRY_COMMENT,ERR_INVALID_VERSION:ERR_INVALID_VERSION,ERR_INVALID_EXTRAFIELD_TYPE:ERR_INVALID_EXTRAFIELD_TYPE,ERR_INVALID_EXTRAFIELD_DATA:ERR_INVALID_EXTRAFIELD_DATA,ERR_INVALID_ENCRYPTION_STRENGTH:ERR_INVALID_ENCRYPTION_STRENGTH,ERR_UNSUPPORTED_FORMAT:ERR_UNSUPPORTED_FORMAT});const BILLBOARD_SIZE$1=32,kmlNamespace="http://www.opengis.net/kml/2.2",gxNamespace="http://www.google.com/kml/ext/2.2",xmlnsNamespace="http://www.w3.org/2000/xmlns/";function ExternalFileHandler(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}const imageTypeRegex=/^data:image\/([^,;]+)/;function getModelBlobHander(e,t){return function(n){e._files[t]=n}}function ValueGetter(e){this._time=e}function StyleCache(){this._ids={},this._styles={},this._count=0}function IdManager(){this._ids={}}function exportKml(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).entities,n=defaultValue(e.kmz,!1),i=exportKml._createState(e),r=t.values.filter((function(e){return!defined(e.parent)})),o=i.kmlDoc,a=o.documentElement;a.setAttributeNS(xmlnsNamespace,"xmlns:gx",gxNamespace);const s=o.createElement("Document");a.appendChild(s),recurseEntities(i,s,r),i.styleCache.save(s);const c=i.externalFileHandler;return c.promise.then((function(){const e=(new XMLSerializer).serializeToString(i.kmlDoc);return n?createKmz(e,c.files):{kml:e,externalFiles:c.files}}))}function createKmz(e,t){const n=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[n,"./pako_deflate.min.js"],inflate:[n,"./pako_inflate.min.js"]}});const i=new zipNoWorker.BlobWriter,r=new zipNoWorker.ZipWriter(i);return when(r.add("doc.kml",new zipNoWorker.TextReader(e))).then((function(){const e=Object.keys(t);return addExternalFilesToZip(r,e,t,0)})).then((function(){return when(r.close()).then((function(e){return{kmz:e}}))}))}function addExternalFilesToZip(e,t,n,i){if(t.length===i)return;const r=t[i];return when(e.add(r,new zipNoWorker.BlobReader(n[r]))).then((function(){return addExternalFilesToZip(e,t,n,i+1)}))}function recurseEntities(e,t,n){const i=e.kmlDoc,r=e.styleCache,o=e.valueGetter,a=e.idManager,s=n.length;let c,l,u;for(let d=0;d<s;++d){const s=n[d];let h;c=[],l=[],u=[],createPoint$1(e,s,l,u),createLineString$1(e,s.polyline,l,u),createPolygon$1(e,s.rectangle,l,u,c),createPolygon$1(e,s.polygon,l,u,c),createModel(e,s,s.model,l,u);const p=s.availability;defined(p)&&(h=i.createElement("TimeSpan"),JulianDate.equals(p.start,Iso8601.MINIMUM_VALUE)||h.appendChild(createBasicElementWithText(i,"begin",JulianDate.toIso8601(p.start))),JulianDate.equals(p.stop,Iso8601.MAXIMUM_VALUE)||h.appendChild(createBasicElementWithText(i,"end",JulianDate.toIso8601(p.stop))));for(let e=0;e<c.length;++e){const n=c[e];n.setAttribute("id",a.get(s.id)),n.appendChild(createBasicElementWithText(i,"name",s.name)),n.appendChild(createBasicElementWithText(i,"visibility",s.show)),n.appendChild(createBasicElementWithText(i,"description",s.description)),defined(h)&&n.appendChild(h),t.appendChild(n)}const f=l.length;if(f>0){const e=i.createElement("Placemark");e.setAttribute("id",a.get(s.id));let n=s.name;const c=s.label;if(defined(c)){const e=i.createElement("LabelStyle"),t=o.get(c.text);n=defined(t)&&t.length>0?t:n;const r=o.getColor(c.fillColor);defined(r)&&(e.appendChild(createBasicElementWithText(i,"color",r)),e.appendChild(createBasicElementWithText(i,"colorMode","normal")));const a=o.get(c.scale);defined(a)&&e.appendChild(createBasicElementWithText(i,"scale",a)),u.push(e)}e.appendChild(createBasicElementWithText(i,"name",n)),e.appendChild(createBasicElementWithText(i,"visibility",s.show)),e.appendChild(createBasicElementWithText(i,"description",s.description)),defined(h)&&e.appendChild(h),t.appendChild(e);const d=u.length;if(d>0){const t=i.createElement("Style");for(let e=0;e<d;++e)t.appendChild(u[e]);e.appendChild(createBasicElementWithText(i,"styleUrl",r.get(t)))}if(1===l.length)e.appendChild(l[0]);else if(l.length>1){const t=i.createElement("MultiGeometry");for(let e=0;e<f;++e)t.appendChild(l[e]);e.appendChild(t)}}const m=s._children;if(m.length>0){const n=i.createElement("Folder");n.setAttribute("id",a.get(s.id)),n.appendChild(createBasicElementWithText(i,"name",s.name)),n.appendChild(createBasicElementWithText(i,"visibility",s.show)),n.appendChild(createBasicElementWithText(i,"description",s.description)),t.appendChild(n),recurseEntities(e,n,m)}}}ExternalFileHandler.prototype.texture=function(e){const t=this;let n;if("string"==typeof e||e instanceof Resource){if(!(e=Resource.createIfNeeded(e)).isDataUri)return e.url;const i=e.url.match(imageTypeRegex);n="texture_"+ ++this._count,defined(i)&&(n+="."+i[1]);const r=e.fetchBlob().then((function(e){t._files[n]=e}));return this._promises.push(r),n}if(e instanceof HTMLCanvasElement){const i=when.defer();return this._promises.push(i.promise),n="texture_"+ ++this._count+".png",e.toBlob((function(e){t._files[n]=e,i.resolve()})),n}return""},ExternalFileHandler.prototype.model=function(e,t){const n=this._modelCallback;if(!defined(n))throw new RuntimeError("Encountered a model entity while exporting to KML, but no model callback was supplied.");const i={},r=n(e,t,i);for(const e in i)if(i.hasOwnProperty(e)){const t=when(i[e]);this._promises.push(t),t.then(getModelBlobHander(this,e))}return r},Object.defineProperties(ExternalFileHandler.prototype,{promise:{get:function(){return when.all(this._promises)}},files:{get:function(){return this._files}}}),ValueGetter.prototype.get=function(e,t,n){let i;return defined(e)&&(i=defined(e.getValue)?e.getValue(this._time,n):e),defaultValue(i,t)},ValueGetter.prototype.getColor=function(e,t){const n=this.get(e,t);if(defined(n))return colorToString(n)},ValueGetter.prototype.getMaterialType=function(e){if(defined(e))return e.getType(this._time)},StyleCache.prototype.get=function(e){const t=this._ids,n=e.innerHTML;if(defined(t[n]))return t[n];let i="style-"+ ++this._count;return e.setAttribute("id",i),i="#"+i,t[n]=i,this._styles[n]=e,i},StyleCache.prototype.save=function(e){const t=this._styles,n=e.childNodes[0];for(const i in t)t.hasOwnProperty(i)&&e.insertBefore(t[i],n)},IdManager.prototype.get=function(e){if(!defined(e))return this.get(createGuid());const t=this._ids;return defined(t[e])?e.toString()+"-"+ ++t[e]:(t[e]=0,e)},exportKml._createState=function(e){const t=e.entities,n=new StyleCache,i=t.computeAvailability(),r=defined(e.time)?e.time:i.start;let o=defaultValue(e.defaultAvailability,i);const a=defaultValue(e.sampleDuration,60);o.start===Iso8601.MINIMUM_VALUE?o.stop===Iso8601.MAXIMUM_VALUE?o=new TimeInterval:JulianDate.addSeconds(o.stop,-10*a,o.start):o.stop===Iso8601.MAXIMUM_VALUE&&JulianDate.addSeconds(o.start,10*a,o.stop);const s=new ExternalFileHandler(e.modelCallback);return{kmlDoc:document.implementation.createDocument(kmlNamespace,"kml"),ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84),idManager:new IdManager,styleCache:n,externalFileHandler:s,time:r,valueGetter:new ValueGetter(r),sampleDuration:a,defaultAvailability:new TimeIntervalCollection([o])}};const scratchCartesian3$3=new Cartesian3,scratchCartographic$7=new Cartographic,scratchJulianDate=new JulianDate;function createPoint$1(e,t,n,i){const r=e.kmlDoc,o=e.ellipsoid,a=e.valueGetter,s=defaultValue(t.billboard,t.point);if(!defined(s)&&!defined(t.path))return;const c=t.position;if(!c.isConstant)return void createTracks(e,t,s,n,i);a.get(c,void 0,scratchCartesian3$3);const l=createBasicElementWithText(r,"coordinates",getCoordinates(scratchCartesian3$3,o)),u=r.createElement("Point"),d=r.createElement("altitudeMode");d.appendChild(getAltitudeMode(e,s.heightReference)),u.appendChild(d),u.appendChild(l),n.push(u);const h=s instanceof BillboardGraphics?createIconStyleFromBillboard(e,s):createIconStyleFromPoint(e,s);i.push(h)}function createTracks(e,t,n,i,r){const o=e.kmlDoc,a=e.ellipsoid,s=e.valueGetter;let c;const l=t.position;let u=!0;l instanceof CompositePositionProperty?(c=l.intervals,u=!1):c=defaultValue(t.availability,e.defaultAvailability);const d=n instanceof ModelGraphics;let h,p,f;const m=[];for(h=0;h<c.length;++h){const t=c.get(h);let i=u?l:t.data;const r=o.createElement("altitudeMode");i instanceof ScaledPositionProperty?(i=i._value,r.appendChild(getAltitudeMode(e,HeightReference$1.CLAMP_TO_GROUND))):defined(n)?r.appendChild(getAltitudeMode(e,n.heightReference)):r.appendChild(getAltitudeMode(e,HeightReference$1.NONE));const g=[],_=[];if(i.isConstant){s.get(i,void 0,scratchCartesian3$3);const e=createBasicElementWithText(o,"coordinates",getCoordinates(scratchCartesian3$3,a));g.push(JulianDate.toIso8601(t.start)),_.push(e),g.push(JulianDate.toIso8601(t.stop)),_.push(e)}else if(i instanceof SampledPositionProperty)for(f=i._property._times,p=0;p<f.length;++p)g.push(JulianDate.toIso8601(f[p])),i.getValueInReferenceFrame(f[p],ReferenceFrame$1.FIXED,scratchCartesian3$3),_.push(getCoordinates(scratchCartesian3$3,a));else if(i instanceof SampledProperty){f=i._times;const e=i._values;for(p=0;p<f.length;++p)g.push(JulianDate.toIso8601(f[p])),Cartesian3.fromArray(e,3*p,scratchCartesian3$3),_.push(getCoordinates(scratchCartesian3$3,a))}else{const n=e.sampleDuration;t.start.clone(scratchJulianDate),t.isStartIncluded||JulianDate.addSeconds(scratchJulianDate,n,scratchJulianDate);const r=t.stop;for(;JulianDate.lessThan(scratchJulianDate,r);)i.getValue(scratchJulianDate,scratchCartesian3$3),g.push(JulianDate.toIso8601(scratchJulianDate)),_.push(getCoordinates(scratchCartesian3$3,a)),JulianDate.addSeconds(scratchJulianDate,n,scratchJulianDate);t.isStopIncluded&&JulianDate.equals(scratchJulianDate,r)&&(i.getValue(scratchJulianDate,scratchCartesian3$3),g.push(JulianDate.toIso8601(scratchJulianDate)),_.push(getCoordinates(scratchCartesian3$3,a)))}const y=o.createElementNS(gxNamespace,"Track");y.appendChild(r);for(let e=0;e<g.length;++e){const t=createBasicElementWithText(o,"when",g[e]),n=createBasicElementWithText(o,"coord",_[e],gxNamespace);y.appendChild(t),y.appendChild(n)}d&&y.appendChild(createModelGeometry(e,n)),m.push(y)}if(1===m.length)i.push(m[0]);else if(m.length>1){const e=o.createElementNS(gxNamespace,"MultiTrack");for(h=0;h<m.length;++h)e.appendChild(m[h]);i.push(e)}if(defined(n)&&!d){const t=n instanceof BillboardGraphics?createIconStyleFromBillboard(e,n):createIconStyleFromPoint(e,n);r.push(t)}const g=t.path;if(defined(g)){const t=s.get(g.width),n=g.material;if(defined(n)||defined(t)){const i=o.createElement("LineStyle");defined(t)&&i.appendChild(createBasicElementWithText(o,"width",t)),processMaterial(e,n,i),r.push(i)}}}function createIconStyleFromPoint(e,t){const n=e.kmlDoc,i=e.valueGetter,r=n.createElement("IconStyle"),o=i.getColor(t.color);defined(o)&&(r.appendChild(createBasicElementWithText(n,"color",o)),r.appendChild(createBasicElementWithText(n,"colorMode","normal")));const a=i.get(t.pixelSize);return defined(a)&&r.appendChild(createBasicElementWithText(n,"scale",a/BILLBOARD_SIZE$1)),r}function createIconStyleFromBillboard(e,t){const n=e.kmlDoc,i=e.valueGetter,r=e.externalFileHandler,o=n.createElement("IconStyle");let a=i.get(t.image);if(defined(a)){a=r.texture(a);const e=n.createElement("Icon");e.appendChild(createBasicElementWithText(n,"href",a));const s=i.get(t.imageSubRegion);defined(s)&&(e.appendChild(createBasicElementWithText(n,"x",s.x,gxNamespace)),e.appendChild(createBasicElementWithText(n,"y",s.y,gxNamespace)),e.appendChild(createBasicElementWithText(n,"w",s.width,gxNamespace)),e.appendChild(createBasicElementWithText(n,"h",s.height,gxNamespace))),o.appendChild(e)}const s=i.getColor(t.color);defined(s)&&(o.appendChild(createBasicElementWithText(n,"color",s)),o.appendChild(createBasicElementWithText(n,"colorMode","normal")));let c=i.get(t.scale);defined(c)&&o.appendChild(createBasicElementWithText(n,"scale",c));const l=i.get(t.pixelOffset);if(defined(l)){c=defaultValue(c,1),Cartesian2.divideByScalar(l,c,l);const e=i.get(t.width,BILLBOARD_SIZE$1),r=i.get(t.height,BILLBOARD_SIZE$1),a=i.get(t.horizontalOrigin,HorizontalOrigin$1.CENTER);a===HorizontalOrigin$1.CENTER?l.x-=.5*e:a===HorizontalOrigin$1.RIGHT&&(l.x-=e);const s=i.get(t.verticalOrigin,VerticalOrigin$1.CENTER);s===VerticalOrigin$1.TOP?l.y+=r:s===VerticalOrigin$1.CENTER&&(l.y+=.5*r);const u=n.createElement("hotSpot");u.setAttribute("x",-l.x),u.setAttribute("y",l.y),u.setAttribute("xunits","pixels"),u.setAttribute("yunits","pixels"),o.appendChild(u)}let u=i.get(t.rotation);const d=i.get(t.alignedAxis);return defined(u)&&Cartesian3.equals(Cartesian3.UNIT_Z,d)&&(u=CesiumMath.toDegrees(-u),0===u&&(u=360),o.appendChild(createBasicElementWithText(n,"heading",u))),o}function createLineString$1(e,t,n,i){const r=e.kmlDoc,o=e.ellipsoid,a=e.valueGetter;if(!defined(t))return;const s=r.createElement("LineString"),c=r.createElement("altitudeMode"),l=a.get(t.clampToGround,!1);let u;l?(s.appendChild(createBasicElementWithText(r,"tessellate",!0)),u=r.createTextNode("clampToGround")):u=r.createTextNode("absolute"),c.appendChild(u),s.appendChild(c);const d=t.positions,h=createBasicElementWithText(r,"coordinates",getCoordinates(a.get(d),o));s.appendChild(h);const p=a.get(t.zIndex);l&&defined(p)&&s.appendChild(createBasicElementWithText(r,"drawOrder",p,gxNamespace)),n.push(s);const f=r.createElement("LineStyle"),m=a.get(t.width);defined(m)&&f.appendChild(createBasicElementWithText(r,"width",m)),processMaterial(e,t.material,f),i.push(f)}function getRectangleBoundaries(e,t,n){const i=e.kmlDoc,r=e.valueGetter;let o=r.get(t.height,0);n>0&&(o=n);const a=t.coordinates,s=r.get(a),c=[],l=[Rectangle.northeast,Rectangle.southeast,Rectangle.southwest,Rectangle.northwest];for(let e=0;e<4;++e)l[e](s,scratchCartographic$7),c.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+o);const u=createBasicElementWithText(i,"coordinates",c.join(" ")),d=i.createElement("outerBoundaryIs"),h=i.createElement("LinearRing");return h.appendChild(u),d.appendChild(h),[d]}function getLinearRing(e,t,n,i){const r=e.kmlDoc,o=e.ellipsoid,a=[],s=t.length;for(let e=0;e<s;++e)Cartographic.fromCartesian(t[e],o,scratchCartographic$7),a.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+(i?scratchCartographic$7.height:n));const c=createBasicElementWithText(r,"coordinates",a.join(" ")),l=r.createElement("LinearRing");return l.appendChild(c),l}function getPolygonBoundaries(e,t,n){const i=e.kmlDoc,r=e.valueGetter;let o=r.get(t.height,0);const a=r.get(t.perPositionHeight,!1);!a&&n>0&&(o=n);const s=[],c=t.hierarchy,l=r.get(c),u=Array.isArray(l)?l:l.positions,d=i.createElement("outerBoundaryIs");d.appendChild(getLinearRing(e,u,o,a)),s.push(d);const h=l.holes;if(defined(h)){const t=h.length;for(let n=0;n<t;++n){const t=i.createElement("innerBoundaryIs");t.appendChild(getLinearRing(e,h[n].positions,o,a)),s.push(t)}}return s}function createPolygon$1(e,t,n,i,r){const o=e.kmlDoc,a=e.valueGetter;if(!defined(t))return;const s=t instanceof RectangleGraphics;if(s&&"Image"===a.getMaterialType(t.material))return void createGroundOverlay(e,t,r);const c=o.createElement("Polygon"),l=a.get(t.extrudedHeight,0);l>0&&c.appendChild(createBasicElementWithText(o,"extrude",!0));const u=s?getRectangleBoundaries(e,t,l):getPolygonBoundaries(e,t,l),d=u.length;for(let e=0;e<d;++e)c.appendChild(u[e]);const h=o.createElement("altitudeMode");h.appendChild(getAltitudeMode(e,t.heightReference)),c.appendChild(h),n.push(c);const p=o.createElement("PolyStyle"),f=a.get(t.fill,!1);f&&p.appendChild(createBasicElementWithText(o,"fill",f)),processMaterial(e,t.material,p);const m=a.get(t.outline,!1);if(m){p.appendChild(createBasicElementWithText(o,"outline",m));const e=o.createElement("LineStyle"),n=a.get(t.outlineWidth,1);e.appendChild(createBasicElementWithText(o,"width",n));const r=a.getColor(t.outlineColor,Color.BLACK);e.appendChild(createBasicElementWithText(o,"color",r)),e.appendChild(createBasicElementWithText(o,"colorMode","normal")),i.push(e)}i.push(p)}function createGroundOverlay(e,t,n){const i=e.kmlDoc,r=e.valueGetter,o=e.externalFileHandler,a=i.createElement("GroundOverlay"),s=i.createElement("altitudeMode");s.appendChild(getAltitudeMode(e,t.heightReference)),a.appendChild(s);const c=r.get(t.height);defined(c)&&a.appendChild(createBasicElementWithText(i,"altitude",c));const l=r.get(t.coordinates),u=i.createElement("LatLonBox");u.appendChild(createBasicElementWithText(i,"north",CesiumMath.toDegrees(l.north))),u.appendChild(createBasicElementWithText(i,"south",CesiumMath.toDegrees(l.south))),u.appendChild(createBasicElementWithText(i,"east",CesiumMath.toDegrees(l.east))),u.appendChild(createBasicElementWithText(i,"west",CesiumMath.toDegrees(l.west))),a.appendChild(u);const d=r.get(t.material),h=o.texture(d.image),p=i.createElement("Icon");p.appendChild(createBasicElementWithText(i,"href",h)),a.appendChild(p);defined(d.color)&&a.appendChild(createBasicElementWithText(i,"color",colorToString(d.color))),n.push(a)}function createModelGeometry(e,t){const n=e.kmlDoc,i=e.valueGetter,r=e.externalFileHandler,o=n.createElement("Model"),a=i.get(t.scale);if(defined(a)){const e=n.createElement("scale");e.appendChild(createBasicElementWithText(n,"x",a)),e.appendChild(createBasicElementWithText(n,"y",a)),e.appendChild(createBasicElementWithText(n,"z",a)),o.appendChild(e)}const s=n.createElement("Link"),c=r.model(t,e.time);return s.appendChild(createBasicElementWithText(n,"href",c)),o.appendChild(s),o}function createModel(e,t,n,i,r){const o=e.kmlDoc,a=e.ellipsoid,s=e.valueGetter;if(!defined(n))return;const c=t.position;if(!c.isConstant)return void createTracks(e,t,n,i,r);const l=createModelGeometry(e,n),u=o.createElement("altitudeMode");u.appendChild(getAltitudeMode(e,n.heightReference)),l.appendChild(u),s.get(c,void 0,scratchCartesian3$3),Cartographic.fromCartesian(scratchCartesian3$3,a,scratchCartographic$7);const d=o.createElement("Location");d.appendChild(createBasicElementWithText(o,"longitude",CesiumMath.toDegrees(scratchCartographic$7.longitude))),d.appendChild(createBasicElementWithText(o,"latitude",CesiumMath.toDegrees(scratchCartographic$7.latitude))),d.appendChild(createBasicElementWithText(o,"altitude",scratchCartographic$7.height)),l.appendChild(d),i.push(l)}function processMaterial(e,t,n){const i=e.kmlDoc,r=e.valueGetter;if(!defined(t))return;const o=r.get(t);if(!defined(o))return;let a;let s,c;switch(r.getMaterialType(t)){case"Image":a=colorToString(Color.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":a=colorToString(o.color);break;case"PolylineOutline":a=colorToString(o.color),s=colorToString(o.outlineColor),c=o.outlineWidth,n.appendChild(createBasicElementWithText(i,"outerColor",s,gxNamespace)),n.appendChild(createBasicElementWithText(i,"outerWidth",c,gxNamespace));break;case"Stripe":a=colorToString(o.oddColor)}defined(a)&&(n.appendChild(createBasicElementWithText(i,"color",a)),n.appendChild(createBasicElementWithText(i,"colorMode","normal")))}function getAltitudeMode(e,t){const n=e.kmlDoc;let i;switch(e.valueGetter.get(t,HeightReference$1.NONE)){case HeightReference$1.NONE:i=n.createTextNode("absolute");break;case HeightReference$1.CLAMP_TO_GROUND:i=n.createTextNode("clampToGround");break;case HeightReference$1.RELATIVE_TO_GROUND:i=n.createTextNode("relativeToGround")}return i}function getCoordinates(e,t){Array.isArray(e)||(e=[e]);const n=e.length,i=[];for(let r=0;r<n;++r)Cartographic.fromCartesian(e[r],t,scratchCartographic$7),i.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+scratchCartographic$7.height);return i.join(" ")}function createBasicElementWithText(e,t,n,i){"boolean"==typeof(n=defaultValue(n,""))&&(n=n?"1":"0");const r=defined(i)?e.createElementNS(i,t):e.createElement(t),o="string"===n&&-1!==n.indexOf("<")?e.createCDATASection(n):e.createTextNode(n);return r.appendChild(o),r}function colorToString(e){let t="";const n=e.toBytes();for(let e=3;e>=0;--e)t+=n[e]<16?"0"+n[e].toString(16):n[e].toString(16);return t}function identity(e){return e}function transform$1(e){if(null==e)return identity;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=new Array(l);for(u[0]=(t+=e[0])*i+o,u[1]=(n+=e[1])*r+a;c<l;)u[c]=e[c],++c;return u}}function bbox(e){var t,n=transform$1(e.transform),i=1/0,r=i,o=-i,a=-i;function s(e){(e=n(e))[0]<i&&(i=e[0]),e[0]>o&&(o=e[0]),e[1]<r&&(r=e[1]),e[1]>a&&(a=e[1])}function c(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(c);break;case"Point":s(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(s)}}for(t in e.arcs.forEach((function(e){for(var t,s=-1,c=e.length;++s<c;)(t=n(e[s],s))[0]<i&&(i=t[0]),t[0]>o&&(o=t[0]),t[1]<r&&(r=t[1]),t[1]>a&&(a=t[1])})),e.objects)c(e.objects[t]);return[i,r,o,a]}function reverse(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}function feature(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return feature$1(e,t)}))}:feature$1(e,t)}function feature$1(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=object(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function object(e,t){var n=transform$1(e.transform),i=e.arcs;function r(e,t){t.length&&t.pop();for(var r=i[e<0?~e:e],o=0,a=r.length;o<a;++o)t.push(n(r[o],o));e<0&&reverse(t,a)}function o(e){return n(e)}function a(e){for(var t=[],n=0,i=e.length;n<i;++n)r(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}return function e(t){var n,i=t.type;switch(i){case"GeometryCollection":return{type:i,geometries:t.geometries.map(e)};case"Point":n=o(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(o);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=c(t.arcs);break;case"MultiPolygon":n=t.arcs.map(c);break;default:return null}return{type:i,coordinates:n}}(t)}function stitch(e,t){var n={},i={},r={},o=[],a=-1;function s(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[e<0?~e:e]=1})),o.push(r)}}return t.forEach((function(n,i){var r,o=e.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(r=t[++a],t[a]=n,t[i]=r)})),t.forEach((function(t){var n,o,a=function(t){var n,i=e.arcs[t<0?~t:t],r=i[0];e.transform?(n=[0,0],i.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=i[i.length-1];return t<0?[n,r]:[r,n]}(t),s=a[0],c=a[1];if(n=r[s])if(delete r[n.end],n.push(t),n.end=c,o=i[c]){delete i[o.start];var l=o===n?n:n.concat(o);i[l.start=n.start]=r[l.end=o.end]=l}else i[n.start]=r[n.end]=n;else if(n=i[c])if(delete i[n.start],n.unshift(t),n.start=s,o=r[s]){delete r[o.end];var u=o===n?n:o.concat(n);i[u.start=o.start]=r[u.end=n.end]=u}else i[n.start]=r[n.end]=n;else i[(n=[t]).start=s]=r[n.end=c]=n})),s(r,i),s(i,r),t.forEach((function(e){n[e<0?~e:e]||o.push([e])})),o}function mesh(e){return object(e,meshArcs.apply(this,arguments))}function meshArcs(e,t,n){var i,r,o;if(arguments.length>1)i=extractArcs(e,t,n);else for(r=0,i=new Array(o=e.arcs.length);r<o;++r)i[r]=r;return{type:"MultiLineString",arcs:stitch(e,i)}}function extractArcs(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function c(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":c(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(c)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}function planarRingArea(e){for(var t,n=-1,i=e.length,r=e[i-1],o=0;++n<i;)t=r,r=e[n],o+=t[0]*r[1]-t[1]*r[0];return Math.abs(o)}function merge(e){return object(e,mergeArcs.apply(this,arguments))}function mergeArcs(e,t){var n={},i=[],r=[];function o(e){e.forEach((function(t){t.forEach((function(t){(n[t=t<0?~t:t]||(n[t]=[])).push(e)}))})),i.push(e)}function a(t){return planarRingArea(object(e,{type:"Polygon",arcs:[t]}).coordinates[0])}return t.forEach((function e(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"Polygon":o(t.arcs);break;case"MultiPolygon":t.arcs.forEach(o)}})),i.forEach((function(e){if(!e._){var t=[],i=[e];for(e._=1,r.push(t);e=i.pop();)t.push(e),e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].forEach((function(e){e._||(e._=1,i.push(e))}))}))}))}})),i.forEach((function(e){delete e._})),{type:"MultiPolygon",arcs:r.map((function(t){var i,r=[];if(t.forEach((function(e){e.forEach((function(e){e.forEach((function(e){n[e<0?~e:e].length<2&&r.push(e)}))}))})),(i=(r=stitch(e,r)).length)>1)for(var o,s,c=1,l=a(r[0]);c<i;++c)(o=a(r[c]))>l&&(s=r[0],r[0]=r[c],r[c]=s,l=o);return r})).filter((function(e){return e.length>0}))}}function bisect(e,t){for(var n=0,i=e.length;n<i;){var r=n+i>>>1;e[r]<t?n=r+1:i=r}return n}function neighbors(e){var t={},n=e.map((function(){return[]}));function i(e,n){e.forEach((function(e){e<0&&(e=~e);var i=t[e];i?i.push(n):t[e]=[n]}))}function r(e,t){e.forEach((function(e){i(e,t)}))}var o={LineString:i,MultiLineString:r,Polygon:r,MultiPolygon:function(e,t){e.forEach((function(e){r(e,t)}))}};for(var a in e.forEach((function e(t,n){"GeometryCollection"===t.type?t.geometries.forEach((function(t){e(t,n)})):t.type in o&&o[t.type](t.arcs,n)})),t)for(var s=t[a],c=s.length,l=0;l<c;++l)for(var u=l+1;u<c;++u){var d,h=s[l],p=s[u];(d=n[h])[a=bisect(d,p)]!==p&&d.splice(a,0,p),(d=n[p])[a=bisect(d,h)]!==h&&d.splice(a,0,h)}return n}function untransform(e){if(null==e)return identity;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=new Array(l),d=Math.round((e[0]-o)/i),h=Math.round((e[1]-a)/r);for(u[0]=d-t,t=d,u[1]=h-n,n=h;c<l;)u[c]=e[c],++c;return u}}function quantize(e,t){if(e.transform)throw new Error("already quantized");if(t&&t.scale)s=e.bbox;else{if(!((n=Math.floor(t))>=2))throw new Error("n must be ≥2");var n,i=(s=e.bbox||bbox(e))[0],r=s[1],o=s[2],a=s[3];t={scale:[o-i?(o-i)/(n-1):1,a-r?(a-r)/(n-1):1],translate:[i,r]}}var s,c,l=untransform(t),u=e.objects,d={};function h(e){return l(e)}function p(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(p)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(c in u)d[c]=p(u[c]);return{type:"Topology",bbox:s,transform:t,objects:d,arcs:e.arcs.map((function(e){var t,n=0,i=1,r=e.length,o=new Array(r);for(o[0]=l(e[0],0);++n<r;)((t=l(e[n],n))[0]||t[1])&&(o[i++]=t);return 1===i&&(o[i++]=[0,0]),o.length=i,o}))}}var index=Object.freeze({__proto__:null,bbox:bbox,feature:feature,mesh:mesh,meshArcs:meshArcs,merge:merge,mergeArcs:mergeArcs,neighbors:neighbors,quantize:quantize,transform:transform$1,untransform:untransform});function defaultCrsFunction(e){return Cartesian3.fromDegrees(e[0],e[1],e[2])}const crsNames={"urn:ogc:def:crs:OGC:1.3:CRS84":defaultCrsFunction,"EPSG:4326":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4326":defaultCrsFunction},crsLinkHrefs={},crsLinkTypes={};let defaultMarkerSize=48,defaultMarkerSymbol,defaultMarkerColor=Color.ROYALBLUE,defaultStroke=Color.YELLOW,defaultStrokeWidth=2,defaultFill=Color.fromBytes(255,255,0,100),defaultClampToGround=!1;const sizes={small:24,medium:48,large:64},simpleStyleIdentifiers=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function defaultDescribe(e,t){let n="";for(const i in e)if(e.hasOwnProperty(i)){if(i===t||-1!==simpleStyleIdentifiers.indexOf(i))continue;const r=e[i];defined(r)&&(n+="object"==typeof r?"<tr><th>"+i+"</th><td>"+defaultDescribe(r)+"</td></tr>":"<tr><th>"+i+"</th><td>"+r+"</td></tr>")}return n.length>0&&(n='<table class="cesium-infoBox-defaultTable"><tbody>'+n+"</tbody></table>"),n}function createDescriptionCallback(e,t,n){let i;return function(r,o){return defined(i)||(i=e(t,n)),i}}function defaultDescribeProperty(e,t){return new CallbackProperty(createDescriptionCallback(defaultDescribe,e,t),!0)}function createObject(e,t,n){let i=e.id;if(defined(i)&&"Feature"===e.type){let e=2,n=i;for(;defined(t.getById(n));)n=i+"_"+e,e++;i=n}else i=createGuid();const r=t.getOrCreateEntity(i),o=e.properties;if(defined(o)){let e;r.properties=o;const t=o.title;if(defined(t))r.name=t,e="title";else{let t=Number.MAX_VALUE;for(const n in o)if(o.hasOwnProperty(n)&&o[n]){const i=n.toLowerCase();if(t>1&&"title"===i){t=1,e=n;break}t>2&&"name"===i?(t=2,e=n):t>3&&/title/i.test(n)?(t=3,e=n):t>4&&/name/i.test(n)&&(t=4,e=n)}defined(e)&&(r.name=o[e])}const i=o.description;null!==i&&(r.description=defined(i)?new ConstantProperty(i):n(o,e))}return r}function coordinatesArrayToCartesianArray(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=t(e[i]);return n}const geoJsonObjectTypes={Feature:processFeature$1,FeatureCollection:processFeatureCollection,GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology},geometryTypes$1={GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology};function processFeature$1(e,t,n,i,r){if(null===t.geometry)return void createObject(t,e._entityCollection,r.describe);if(!defined(t.geometry))throw new RuntimeError("feature.geometry is required.");const o=t.geometry.type,a=geometryTypes$1[o];if(!defined(a))throw new RuntimeError("Unknown geometry type: "+o);a(e,t,t.geometry,i,r)}function processFeatureCollection(e,t,n,i,r){const o=t.features;for(let t=0,n=o.length;t<n;t++)processFeature$1(e,o[t],void 0,i,r)}function processGeometryCollection(e,t,n,i,r){const o=n.geometries;for(let n=0,a=o.length;n<a;n++){const a=o[n],s=a.type,c=geometryTypes$1[s];if(!defined(c))throw new RuntimeError("Unknown geometry type: "+s);c(e,t,a,i,r)}}function createPoint(e,t,n,i,r){let o=r.markerSymbol,a=r.markerColor,s=r.markerSize;const c=t.properties;if(defined(c)){const e=c["marker-color"];defined(e)&&(a=Color.fromCssColorString(e)),s=defaultValue(sizes[c["marker-size"]],s);const t=c["marker-symbol"];defined(t)&&(o=t)}let l;l=defined(o)?1===o.length?e._pinBuilder.fromText(o.toUpperCase(),a,s):e._pinBuilder.fromMakiIconId(o,a,s):e._pinBuilder.fromColor(a,s);const u=new BillboardGraphics;u.verticalOrigin=new ConstantProperty(VerticalOrigin$1.BOTTOM),2===i.length&&r.clampToGround&&(u.heightReference=HeightReference$1.CLAMP_TO_GROUND);const d=createObject(t,e._entityCollection,r.describe);d.billboard=u,d.position=new ConstantPositionProperty(n(i));const h=when(l).then((function(e){u.image=new ConstantProperty(e)})).otherwise((function(){u.image=new ConstantProperty(e._pinBuilder.fromColor(a,s))}));e._promises.push(h)}function processPoint$1(e,t,n,i,r){createPoint(e,t,i,n.coordinates,r)}function processMultiPoint(e,t,n,i,r){const o=n.coordinates;for(let n=0;n<o.length;n++)createPoint(e,t,i,o[n],r)}function createLineString(e,t,n,i,r){let o=r.strokeMaterialProperty,a=r.strokeWidthProperty;const s=t.properties;if(defined(s)){const e=s["stroke-width"];let t;defined(e)&&(a=new ConstantProperty(e));const n=s.stroke;defined(n)&&(t=Color.fromCssColorString(n));const i=s["stroke-opacity"];defined(i)&&1!==i&&(defined(t)||(t=o.color.getValue().clone()),t.alpha=i),defined(t)&&(o=new ColorMaterialProperty(t))}const c=createObject(t,e._entityCollection,r.describe),l=new PolylineGraphics;c.polyline=l,l.clampToGround=r.clampToGround,l.material=o,l.width=a,l.positions=new ConstantProperty(coordinatesArrayToCartesianArray(i,n)),l.arcType=ArcType$1.RHUMB}function processLineString(e,t,n,i,r){createLineString(e,t,i,n.coordinates,r)}function processMultiLineString(e,t,n,i,r){const o=n.coordinates;for(let n=0;n<o.length;n++)createLineString(e,t,i,o[n],r)}function createPolygon(e,t,n,i,r){if(0===i.length||0===i[0].length)return;let o=r.strokeMaterialProperty.color,a=r.fillMaterialProperty,s=r.strokeWidthProperty;const c=t.properties;if(defined(c)){const e=c["stroke-width"];let t;defined(e)&&(s=new ConstantProperty(e));const n=c.stroke;defined(n)&&(t=Color.fromCssColorString(n));let i,r=c["stroke-opacity"];defined(r)&&1!==r&&(defined(t)||(t=o.getValue().clone()),t.alpha=r),defined(t)&&(o=new ConstantProperty(t));const l=c.fill,u=a.color.getValue();defined(l)&&(i=Color.fromCssColorString(l),i.alpha=u.alpha),r=c["fill-opacity"],defined(r)&&r!==u.alpha&&(defined(i)||(i=u.clone()),i.alpha=r),defined(i)&&(a=new ColorMaterialProperty(i))}const l=new PolygonGraphics;l.outline=new ConstantProperty(!0),l.outlineColor=o,l.outlineWidth=s,l.material=a,l.arcType=ArcType$1.RHUMB;const u=[];for(let e=1,t=i.length;e<t;e++)u.push(new PolygonHierarchy(coordinatesArrayToCartesianArray(i[e],n)));const d=i[0];l.hierarchy=new ConstantProperty(new PolygonHierarchy(coordinatesArrayToCartesianArray(d,n),u)),d[0].length>2?l.perPositionHeight=new ConstantProperty(!0):r.clampToGround||(l.height=0);createObject(t,e._entityCollection,r.describe).polygon=l}function processPolygon$1(e,t,n,i,r){createPolygon(e,t,i,n.coordinates,r)}function processMultiPolygon(e,t,n,i,r){const o=n.coordinates;for(let n=0;n<o.length;n++)createPolygon(e,t,i,o[n],r)}function processTopology(e,t,n,i,r){for(const t in n.objects)if(n.objects.hasOwnProperty(t)){const o=index.feature(n,n.objects[t]);(0,geoJsonObjectTypes[o.type])(e,o,o,i,r)}}function GeoJsonDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._promises=[],this._pinBuilder=new PinBuilder,this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function load$1(e,t,n,i){let r;defined(i)&&(r=getFilenameFromUri(i)),defined(r)&&e._name!==r&&(e._name=r,e._changed.raiseEvent(e));const o=geoJsonObjectTypes[t.type];if(!defined(o))throw new RuntimeError("Unsupported GeoJSON object type: "+t.type);const a=t.crs;let s=null!==a?defaultCrsFunction:null;if(defined(a)){if(!defined(a.properties))throw new RuntimeError("crs.properties is undefined.");const e=a.properties;if("name"===a.type){if(s=crsNames[e.name],!defined(s))throw new RuntimeError("Unknown crs name: "+e.name)}else if("link"===a.type){let t=crsLinkHrefs[e.href];if(defined(t)||(t=crsLinkTypes[e.type]),!defined(t))throw new RuntimeError("Unable to resolve crs link: "+JSON.stringify(e));s=t(e)}else{if("EPSG"!==a.type)throw new RuntimeError("Unknown crs type: "+a.type);if(s=crsNames["EPSG:"+e.code],!defined(s))throw new RuntimeError("Unknown crs EPSG code: "+e.code)}}return when(s,(function(i){return e._entityCollection.removeAll(),null!==i&&o(e,t,t,i,n),when.all(e._promises,(function(){return e._promises.length=0,DataSource.setLoading(e,!1),e}))}))}function KmlCamera(e,t){this.position=e,this.headingPitchRoll=t}function defaults(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}function ellipsis(e,t,n){var i;return e.length>t&&(null==n?(n="&hellip;",i=3):i=n.length,e=e.substring(0,t-i)+n),e}function indexOf(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}function remove$1(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function splitAndCapture(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,i=[],r=0;n=t.exec(e);)i.push(e.substring(r,n.index)),i.push(n[0]),r=n.index+n[0].length;return i.push(e.substring(r)),i}function throwUnhandledCaseError(e){throw new Error("Unhandled case for value: '"+e+"'")}GeoJsonDataSource.load=function(e,t){return(new GeoJsonDataSource).load(e,t)},Object.defineProperties(GeoJsonDataSource,{markerSize:{get:function(){return defaultMarkerSize},set:function(e){defaultMarkerSize=e}},markerSymbol:{get:function(){return defaultMarkerSymbol},set:function(e){defaultMarkerSymbol=e}},markerColor:{get:function(){return defaultMarkerColor},set:function(e){defaultMarkerColor=e}},stroke:{get:function(){return defaultStroke},set:function(e){defaultStroke=e}},strokeWidth:{get:function(){return defaultStrokeWidth},set:function(e){defaultStrokeWidth=e}},fill:{get:function(){return defaultFill},set:function(e){defaultFill=e}},clampToGround:{get:function(){return defaultClampToGround},set:function(e){defaultClampToGround=e}},crsNames:{get:function(){return crsNames}},crsLinkHrefs:{get:function(){return crsLinkHrefs}},crsLinkTypes:{get:function(){return crsLinkTypes}}}),Object.defineProperties(GeoJsonDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},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}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),GeoJsonDataSource.prototype.load=function(e,t){DataSource.setLoading(this,!0);let n=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n;let i=e,r=t.sourceUri;if("string"==typeof e||e instanceof Resource){i=(e=Resource.createIfNeeded(e)).fetchJson(),r=defaultValue(r,e.getUrlComponent());const t=this._resourceCredits,n=e.credits;if(defined(n)){const e=n.length;for(let i=0;i<e;i++)t.push(n[i])}}t={describe:defaultValue(t.describe,defaultDescribeProperty),markerSize:defaultValue(t.markerSize,defaultMarkerSize),markerSymbol:defaultValue(t.markerSymbol,defaultMarkerSymbol),markerColor:defaultValue(t.markerColor,defaultMarkerColor),strokeWidthProperty:new ConstantProperty(defaultValue(t.strokeWidth,defaultStrokeWidth)),strokeMaterialProperty:new ColorMaterialProperty(defaultValue(t.stroke,defaultStroke)),fillMaterialProperty:new ColorMaterialProperty(defaultValue(t.fill,defaultFill)),clampToGround:defaultValue(t.clampToGround,defaultClampToGround)};const o=this;return when(i,(function(e){return load$1(o,e,t,r)})).otherwise((function(e){return DataSource.setLoading(o,!1),o._error.raiseEvent(o,e),console.log(e),when.reject(e)}))},GeoJsonDataSource.prototype.update=function(e){return!0};var HtmlTag=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),i=this.whitespaceRegex,r=n?n.split(i):[],o=e.split(i);t=o.shift();)-1===indexOf(r,t)&&r.push(t);return this.getAttrs().class=r.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),i=this.whitespaceRegex,r=n?n.split(i):[],o=e.split(i);r.length&&(t=o.shift());){var a=indexOf(r,t);-1!==a&&r.splice(a,1)}return this.getAttrs().class=r.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}();function truncateSmart(e,t,n){var i,r;null==n?(n="&hellip;",r=3,i=8):(r=n.length,i=n.length);var o=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},a=function(e,t){var i=t/2,r=Math.ceil(i),o=-1*Math.floor(i),a="";return o<0&&(a=e.substr(o)),e.substr(0,r)+n+a};if(e.length<=t)return e;var s=t-r,c=function(e){var t={},n=e,i=n.match(/^([a-z]+):\/\//i);return i&&(t.scheme=i[1],n=n.substr(i[0].length)),(i=n.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=i[1],n=n.substr(i[0].length)),(i=n.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=i[1],n=n.substr(i[0].length)),(i=n.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=i[1],n=n.substr(i[0].length)),(i=n.match(/^#(.*?)$/i))&&(t.fragment=i[1]),t}(e);if(c.query){var l=c.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);l&&(c.query=c.query.substr(0,l[1].length),e=o(c))}if(e.length<=t)return e;if(c.host&&(c.host=c.host.replace(/^www\./,""),e=o(c)),e.length<=t)return e;var u="";if(c.host&&(u+=c.host),u.length>=s)return c.host.length==t?(c.host.substr(0,t-r)+n).substr(0,s+i):a(u,s).substr(0,s+i);var d="";if(c.path&&(d+="/"+c.path),c.query&&(d+="?"+c.query),d){if((u+d).length>=s)return(u+d).length==t?(u+d).substr(0,t):(u+a(d,s-u.length)).substr(0,s+i);u+=d}if(c.fragment){var h="#"+c.fragment;if((u+h).length>=s)return(u+h).length==t?(u+h).substr(0,t):(u+a(h,s-u.length)).substr(0,s+i);u+=h}if(c.scheme&&c.host){var p=c.scheme+"://";if((u+p).length<s)return(p+u).substr(0,t)}if(u.length<=t)return u;var f="";return s>0&&(f=u.substr(-1*Math.floor(s/2))),(u.substr(0,Math.ceil(s/2))+n+f).substr(0,s+i)}function truncateMiddle(e,t,n){if(e.length<=t)return e;var i,r;null==n?(n="&hellip;",i=8,r=3):(i=n.length,r=n.length);var o=t-r,a="";return o>0&&(a=e.substr(-1*Math.floor(o/2))),(e.substr(0,Math.ceil(o/2))+n+a).substr(0,o+i)}function truncateEnd(e,t,n){return ellipsis(e,t,n)}var AnchorTagBuilder=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new HtmlTag({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],i=e.getCssClassSuffixes(),r=0,o=i.length;r<o;r++)n.push(t+"-"+i[r]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n=t.length,i=t.location;return"smart"===i?truncateSmart(e,n):"middle"===i?truncateMiddle(e,n):truncateEnd(e,n)},e}(),Match=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},__assign.apply(this,arguments)},EmailMatch=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return __extends(t,e),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Match),HashtagMatch=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return __extends(t,e),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.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;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(Match),MentionMatch=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return __extends(t,e),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(Match),PhoneMatch=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return __extends(t,e),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Match),UrlMatch=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return __extends(t,e),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}},t}(Match),Matcher=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},letterRe=/[A-Za-z]/,digitRe=/[\d]/,nonDigitRe=/[\D]/,whitespaceRe=/\s/,quoteRe=/['"]/,controlCharsRe=/[\x00-\x1F\x7F]/,alphaCharsStr=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,emojiStr=/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source,marksStr=/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,alphaCharsAndMarksStr=alphaCharsStr+emojiStr+marksStr,decimalNumbersStr=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,alphaNumericCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,alphaNumericAndMarksCharsStr=alphaCharsAndMarksStr+decimalNumbersStr,ipStr="(?:["+decimalNumbersStr+"]{1,3}\\.){3}["+decimalNumbersStr+"]{1,3}",domainLabelStr="["+alphaNumericAndMarksCharsStr+"](?:["+alphaNumericAndMarksCharsStr+"\\-]{0,61}["+alphaNumericAndMarksCharsStr+"])?",getDomainLabelStr=function(e){return"(?=("+domainLabelStr+"))\\"+e},getDomainNameStr=function(e){return"(?:"+getDomainLabelStr(e)+"(?:\\."+getDomainLabelStr(e+1)+"){0,126}|"+ipStr+")"},domainNameCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),tldRegex=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|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|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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,localPartCharRegex=new RegExp("["+alphaNumericAndMarksCharsStr+"!#$%&'*+/=?^_`{|}~-]"),strictTldRegex=new RegExp("^"+tldRegex.source+"$"),EmailMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=localPartCharRegex,t.strictTldRegex=strictTldRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,i=this.strictTldRegex,r=[],o=e.length,a=new CurrentEmailMatch,s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,l=0,u=a;c<o;){var d=e.charAt(c);switch(l){case 0:h(d);break;case 1:p(e.charAt(c-1),d);break;case 2:f(d);break;case 3:m(d);break;case 4:g(d);break;case 5:_(d);break;case 6:y(d);break;case 7:C(d);break;default:throwUnhandledCaseError(l)}c++}return A(),r;function h(e){"m"===e?T(1):n.test(e)&&T()}function p(e,t){":"===e?n.test(t)?(l=2,u=new CurrentEmailMatch(__assign(__assign({},u),{hasMailtoPrefix:!0}))):S():s[e]===t||(n.test(t)?l=2:"."===t?l=3:"@"===t?l=4:S())}function f(e){"."===e?l=3:"@"===e?l=4:n.test(e)||S()}function m(e){"."===e||"@"===e?S():n.test(e)?l=2:S()}function g(e){domainNameCharRegex.test(e)?l=5:S()}function _(e){"."===e?l=7:"-"===e?l=6:domainNameCharRegex.test(e)||A()}function y(e){"-"===e||"."===e?A():domainNameCharRegex.test(e)?l=5:A()}function C(e){"."===e||"-"===e?A():domainNameCharRegex.test(e)?(l=5,u=new CurrentEmailMatch(__assign(__assign({},u),{hasDomainDot:!0}))):A()}function T(e){void 0===e&&(e=2),l=e,u=new CurrentEmailMatch({idx:c})}function S(){l=0,u=a}function A(){if(u.hasDomainDot){var n=e.slice(u.idx,c);/[-.]$/.test(n)&&(n=n.slice(0,-1));var o=u.hasMailtoPrefix?n.slice("mailto:".length):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return i.test(t)})(o)&&r.push(new EmailMatch({tagBuilder:t,matchedText:n,offset:u.idx,email:o}))}S()}},t}(Matcher),CurrentEmailMatch=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},UrlMatchValidator=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t)&&(!this.hasFullProtocolRegex.test(t)&&!this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+alphaCharsStr+"]"),e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,e}(),matcherRegex$1=(urlSuffixRegex=new RegExp("[/?#](?:["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+alphaNumericAndMarksCharsStr+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,getDomainNameStr(2),")","|","(","(//)?",/(?:www\.)/.source,getDomainNameStr(6),")","|","(","(//)?",getDomainNameStr(10)+"\\.",tldRegex.source,"(?![-"+alphaNumericCharsStr+"])",")",")","(?::[0-9]+)?","(?:"+urlSuffixRegex.source+")?"].join(""),"gi")),urlSuffixRegex,wordCharRegExp=new RegExp("["+alphaNumericAndMarksCharsStr+"]"),UrlMatcher=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=matcherRegex$1,n.wordCharRegExp=wordCharRegExp,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,i=this.stripPrefix,r=this.stripTrailingSlash,o=this.decodePercentEncoding,a=this.tagBuilder,s=[],c=function(){var n=t[0],c=t[1],u=t[4],d=t[5],h=t[9],p=t.index,f=d||h,m=e.charAt(p-1);if(!UrlMatchValidator.isValid(n,c))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),l.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var g=l.matchHasInvalidCharAfterTld(n,c);g>-1&&(n=n.substr(0,g))}var _=["http://","https://"].find((function(e){return!!c&&-1!==c.indexOf(e)}));if(_){var y=n.indexOf(_);n=n.substr(y),c=c.substr(y),p+=y}var C=c?"scheme":u?"www":"tld",T=!!c;s.push(new UrlMatch({tagBuilder:a,matchedText:n,offset:p,urlMatchType:C,url:n,protocolUrlMatch:T,protocolRelativeMatch:!!f,stripPrefix:i,stripTrailingSlash:r,decodePercentEncoding:o}))},l=this;null!==(t=n.exec(e));)c();return s},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var i=0,r=0,o=e.length-1;r<o;r++){var a=e.charAt(r);a===t?i++:a===n&&(i=Math.max(i-1,0))}return 0===i},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var i=new RegExp("^((.?//)?[-."+alphaNumericAndMarksCharsStr+"]*[-"+alphaNumericAndMarksCharsStr+"]\\.[-"+alphaNumericAndMarksCharsStr+"]+)").exec(e);return null===i?-1:(n+=i[1].length,e=e.slice(i[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(Matcher),matcherRegex=new RegExp("#[_"+alphaNumericAndMarksCharsStr+"]{1,139}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex$1=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),HashtagMatcher=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=matcherRegex,n.nonWordCharRegex=nonWordCharRegex$1,n.serviceName=t.serviceName,n}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,i=this.nonWordCharRegex,r=this.serviceName,o=this.tagBuilder,a=[];null!==(t=n.exec(e));){var s=t.index,c=e.charAt(s-1);if(0===s||i.test(c)){var l=t[0],u=t[0].slice(1);a.push(new HashtagMatch({tagBuilder:o,matchedText:l,offset:s,serviceName:r,hashtag:u}))}}return a},t}(Matcher),mostPhoneNumbers=/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/,japanesePhoneRe=/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/,phoneMatcherRegex=new RegExp(mostPhoneNumbers.source+"|"+japanesePhoneRe.source,"g"),PhoneMatcher=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=phoneMatcherRegex,t}return __extends(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,i=this.tagBuilder,r=[];null!==(t=n.exec(e));){var o=t[0],a=o.replace(/[^0-9,;#]/g,""),s=!(!t[1]&&!t[2]),c=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+o.length,1),u=!c.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(o)&&u&&r.push(new PhoneMatch({tagBuilder:i,matchedText:o,offset:t.index,number:a,plusSign:s}))}return r},t.prototype.testMatch=function(e){return nonDigitRe.test(e)},t}(Matcher),twitterRegex=new RegExp("@[_"+alphaNumericAndMarksCharsStr+"]{1,50}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),instagramRegex=new RegExp("@[_."+alphaNumericAndMarksCharsStr+"]{1,30}(?![_"+alphaNumericAndMarksCharsStr+"])","g"),soundcloudRegex=new RegExp("@[-_."+alphaNumericAndMarksCharsStr+"]{1,50}(?![-_"+alphaNumericAndMarksCharsStr+"])","g"),nonWordCharRegex=new RegExp("[^"+alphaNumericAndMarksCharsStr+"]"),MentionMatcher=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:twitterRegex,instagram:instagramRegex,soundcloud:soundcloudRegex},n.nonWordCharRegex=nonWordCharRegex,n.serviceName=t.serviceName,n}return __extends(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,i=this.matcherRegexes[this.serviceName],r=this.nonWordCharRegex,o=this.tagBuilder,a=[];if(!i)return a;for(;null!==(t=i.exec(e));){var s=t.index,c=e.charAt(s-1);if(0===s||r.test(c)){var l=t[0].replace(/\.+$/g,""),u=l.slice(1);a.push(new MentionMatch({tagBuilder:o,matchedText:l,offset:s,serviceName:n,mention:u}))}}return a},t}(Matcher);function parseHtml(e,t){for(var n=t.onOpenTag,i=t.onCloseTag,r=t.onText,o=t.onComment,a=t.onDoctype,s=new CurrentTag,c=0,l=e.length,u=0,d=0,h=s;c<l;){var p=e.charAt(c);switch(u){case 0:f(p);break;case 1:m(p);break;case 2:_(p);break;case 3:g(p);break;case 4:y(p);break;case 5:C(p);break;case 6:T(p);break;case 7:S(p);break;case 8:A(p);break;case 9:v(p);break;case 10:E(p);break;case 11:b(p);break;case 12:x(p);break;case 13:P();break;case 14:D(p);break;case 15:w(p);break;case 16:M(p);break;case 17:I(p);break;case 18:R(p);break;case 19:O(p);break;case 20:B(p);break;default:throwUnhandledCaseError(u)}c++}function f(e){"<"===e&&F()}function m(e){"!"===e?u=13:"/"===e?(u=2,h=new CurrentTag(__assign(__assign({},h),{isClosing:!0}))):"<"===e?F():letterRe.test(e)?(u=3,h=new CurrentTag(__assign(__assign({},h),{isOpening:!0}))):(u=0,h=s)}function g(e){whitespaceRe.test(e)?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=4):"<"===e?F():"/"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),u=12):">"===e?(h=new CurrentTag(__assign(__assign({},h),{name:V()})),N()):letterRe.test(e)||digitRe.test(e)||":"===e||L()}function _(e){">"===e?L():letterRe.test(e)?u=3:L()}function y(e){whitespaceRe.test(e)||("/"===e?u=12:">"===e?N():"<"===e?F():"="===e||quoteRe.test(e)||controlCharsRe.test(e)?L():u=5)}function C(e){whitespaceRe.test(e)?u=6:"/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)&&L()}function T(e){whitespaceRe.test(e)||("/"===e?u=12:"="===e?u=7:">"===e?N():"<"===e?F():quoteRe.test(e)?L():u=5)}function S(e){whitespaceRe.test(e)||('"'===e?u=8:"'"===e?u=9:/[>=`]/.test(e)?L():"<"===e?F():u=10)}function A(e){'"'===e&&(u=11)}function v(e){"'"===e&&(u=11)}function E(e){whitespaceRe.test(e)?u=4:">"===e?N():"<"===e&&F()}function b(e){whitespaceRe.test(e)?u=4:"/"===e?u=12:">"===e?N():"<"===e?F():(u=4,c--)}function x(e){">"===e?(h=new CurrentTag(__assign(__assign({},h),{isClosing:!0})),N()):u=4}function P(t){"--"===e.substr(c,2)?(c+=2,h=new CurrentTag(__assign(__assign({},h),{type:"comment"})),u=14):"DOCTYPE"===e.substr(c,7).toUpperCase()?(c+=7,h=new CurrentTag(__assign(__assign({},h),{type:"doctype"})),u=20):L()}function D(e){"-"===e?u=15:">"===e?L():u=16}function w(e){"-"===e?u=18:">"===e?L():u=16}function M(e){"-"===e&&(u=17)}function I(e){u="-"===e?18:16}function R(e){">"===e?N():"!"===e?u=19:"-"===e||(u=16)}function O(e){"-"===e?u=17:">"===e?N():u=16}function B(e){">"===e?N():"<"===e&&F()}function L(){u=0,h=s}function F(){u=1,h=new CurrentTag({idx:c})}function N(){var t=e.slice(d,h.idx);t&&r(t,d),"comment"===h.type?o(h.idx):"doctype"===h.type?a(h.idx):(h.isOpening&&n(h.name,h.idx),h.isClosing&&i(h.name,h.idx)),L(),d=c+1}function V(){var t=h.idx+(h.isClosing?2:1);return e.slice(t,c).toLowerCase()}d<c&&function(){var t=e.slice(d,c);r(t,d),d=c+1}()}var CurrentTag=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Autolinker=function(){function e(t){void 0===t&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&"twitter"!==n&&"instagram"!==n&&"soundcloud"!==n)throw new Error("invalid `mention` cfg - see docs");var i=this.hashtag;if(!1!==i&&"twitter"!==i&&"facebook"!==i&&"instagram"!==i)throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:defaults(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],i=0,r=[];return parseHtml(e,{onOpenTag:function(e){n.indexOf(e)>=0&&i++},onText:function(e,n){if(0===i){var o=splitAndCapture(e,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),a=n;o.forEach((function(e,n){if(n%2==0){var i=t.parseText(e,a);r.push.apply(r,i)}a+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(i=Math.max(i-1,0))},onComment:function(e){},onDoctype:function(e){}}),r=this.compactMatches(r),r=this.removeUnwantedMatches(r)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var n=e[t],i=n.getOffset(),r=n.getMatchedText().length,o=i+r;if(t+1<e.length){if(e[t+1].getOffset()===i){var a=e[t+1].getMatchedText().length>r?t:t+1;e.splice(a,1);continue}e[t+1].getOffset()<o&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||remove$1(e,(function(e){return"hashtag"===e.getType()})),this.email||remove$1(e,(function(e){return"email"===e.getType()})),this.phone||remove$1(e,(function(e){return"phone"===e.getType()})),this.mention||remove$1(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||remove$1(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||remove$1(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||remove$1(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),i=[],r=0,o=n.length;r<o;r++){for(var a=n[r].parseMatches(e),s=0,c=a.length;s<c;s++)a[s].setOffset(t+a[s].getOffset());i.push.apply(i,a)}return i},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var t=this.parse(e),n=[],i=0,r=0,o=t.length;r<o;r++){var a=t[r];n.push(e.substring(i,a.getOffset())),n.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return n.push(e.substring(i)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof HtmlTag?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new HashtagMatcher({tagBuilder:e,serviceName:this.hashtag}),new EmailMatcher({tagBuilder:e}),new PhoneMatcher({tagBuilder:e}),new MentionMatcher({tagBuilder:e,serviceName:this.mention}),new UrlMatcher({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=AnchorTagBuilder,e.HtmlTag=HtmlTag,e.matcher={Email:EmailMatcher,Hashtag:HashtagMatcher,Matcher:Matcher,Mention:MentionMatcher,Phone:PhoneMatcher,Url:UrlMatcher},e.match={Email:EmailMatch,Hashtag:HashtagMatch,Match:Match,Mention:MentionMatch,Phone:PhoneMatch,Url:UrlMatch},e}();function getElement(e){if("string"==typeof e){e=document.getElementById(e)}return e}function KmlLookAt(e,t){this.position=e,this.headingPitchRange=t}function KmlTour(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new Event,this.tourEnd=new Event,this.entryStart=new Event,this.entryEnd=new Event,this._activeEntries=[]}function cancelAllEntries(e){for(let t=e.pop();void 0!==t;t=e.pop())t.stop()}function playEntry(e,t,n){const i=this.playlist[this.playlistIndex];if(i){const r=playNext.bind(this,e,t,n);if(this._activeEntries.push(i),this.entryStart.raiseEvent(i),i.blocking)i.play(r,e.scene.camera,t);else{const o=this;i.play((function(){o.entryEnd.raiseEvent(i);const e=o._activeEntries.indexOf(i);e>=0&&o._activeEntries.splice(e,1)})),r(e,t,n)}}else defined(n)&&n(!1)}function playNext(e,t,n,i){const r=this.playlist[this.playlistIndex];if(this.entryEnd.raiseEvent(r,i),i)n(i);else{const i=this._activeEntries.indexOf(r);i>=0&&this._activeEntries.splice(i,1),this.playlistIndex++,playEntry.call(this,e,t,n)}}function KmlTourFlyTo(e,t,n){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=n,this.flyToMode=t}function KmlTourWait(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}KmlTour.prototype.addPlaylistEntry=function(e){this.playlist.push(e)},KmlTour.prototype.play=function(e,t){this.tourStart.raiseEvent();const n=this;playEntry.call(this,e,t,(function(e){n.playlistIndex=0,e||cancelAllEntries(n._activeEntries),n.tourEnd.raiseEvent(e)}))},KmlTour.prototype.stop=function(){cancelAllEntries(this._activeEntries)},KmlTourFlyTo.prototype.play=function(e,t,n){if(this.activeCamera=t,defined(e)&&null!==e){const t=this;this.activeCallback=function(n){delete t.activeCallback,delete t.activeCamera,e(!defined(n)&&n)}}const i=this.getCameraOptions(n);if(this.view.headingPitchRoll)t.flyTo(i);else if(this.view.headingPitchRange){const e=new BoundingSphere(this.view.position);t.flyToBoundingSphere(e,i)}},KmlTourFlyTo.prototype.stop=function(){defined(this.activeCamera)&&this.activeCamera.cancelFlight(),defined(this.activeCallback)&&this.activeCallback(!0)},KmlTourFlyTo.prototype.getCameraOptions=function(e){let t={duration:this.duration};return defined(this.activeCallback)&&(t.complete=this.activeCallback),"smooth"===this.flyToMode&&(t.easingFunction=EasingFunction$1.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),defined(e)&&(t=combine$2(t,e)),t},KmlTourWait.prototype.play=function(e){const t=this;this.activeCallback=e,this.timeout=setTimeout((function(){delete t.activeCallback,e(!1)}),1e3*this.duration)},KmlTourWait.prototype.stop=function(){clearTimeout(this.timeout),defined(this.activeCallback)&&this.activeCallback(!0)};const MimeTypes={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){let t=e.toLowerCase();return t=getExtensionFromUri(t),MimeTypes[t]}};let parser;"undefined"!=typeof DOMParser&&(parser=new DOMParser);const autolinker=new Autolinker({stripPrefix:!1,email:!1,replaceFn:function(e){if(!e.protocolUrlMatch)return!1}}),BILLBOARD_SIZE=32,BILLBOARD_NEAR_DISTANCE=2414016,BILLBOARD_NEAR_RATIO=1,BILLBOARD_FAR_DISTANCE=16093e3,BILLBOARD_FAR_RATIO=.1,kmlNamespaces=[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"],gxNamespaces=["http://www.google.com/kml/ext/2.2"],atomNamespaces=["http://www.w3.org/2005/Atom"],namespaces={kml:kmlNamespaces,gx:gxNamespaces,atom:atomNamespaces,kmlgx:kmlNamespaces.concat(gxNamespaces)},featureTypes={Document:processDocument,Folder:processFolder,Placemark:processPlacemark,NetworkLink:processNetworkLink,GroundOverlay:processGroundOverlay,PhotoOverlay:processUnsupportedFeature,ScreenOverlay:processScreenOverlay,Tour:processTour};function DeferredLoading(e){this._dataSource=e,this._deferred=when.defer(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}function isZipFile(e){const t=e.slice(0,Math.min(4,e.size)),n=when.defer(),i=new FileReader;return i.addEventListener("load",(function(){n.resolve(1347093252===new DataView(i.result).getUint32(0,!1))})),i.addEventListener("error",(function(){n.reject(i.error)})),i.readAsArrayBuffer(t),n.promise}function readBlobAsText(e){const t=when.defer(),n=new FileReader;return n.addEventListener("load",(function(){t.resolve(n.result)})),n.addEventListener("error",(function(){t.reject(n.error)})),n.readAsText(e),t.promise}function insertNamespaces(e){const t={xsi:"http://www.w3.org/2001/XMLSchema-instance"};let n,i,r,o;for(const a in t)t.hasOwnProperty(a)&&(r=RegExp("[< ]"+a+":"),o="xmlns:"+a+"=",r.test(e)&&-1===e.indexOf(o)&&(defined(n)||(n=e.substr(0,e.indexOf("<kml")+4),i=e.substr(n.length)),n+=" "+o+'"'+t[a]+'"'));return defined(n)&&(e=n+i),e}function removeDuplicateNamespaces(e){let t=e.indexOf("xmlns:");const n=e.indexOf(">",t);let i,r,o;for(;-1!==t&&t<n;)i=e.slice(t,e.indexOf('"',t)),r=t,t=e.indexOf(i,t+1),-1!==t?(o=e.indexOf('"',e.indexOf('"',t)+1),t=(e=e.slice(0,t-1)+e.slice(o+1,e.length)).indexOf("xmlns:",r-1)):t=e.indexOf("xmlns:",r+1);return e}function loadXmlFromZip(e,t){return when(e.getData(new zipNoWorker.TextWriter)).then((function(e){e=removeDuplicateNamespaces(e=insertNamespaces(e)),t.kml=parser.parseFromString(e,"application/xml")}))}function loadDataUriFromZip(e,t){const n=defaultValue(MimeTypes.detectFromFilename(e.filename),"application/octet-stream");return when(e.getData(new zipNoWorker.Data64URIWriter(n))).then((function(n){t[e.filename]=n}))}function embedDataUris(e,t,n,i){const r=i.keys,o=new URI("."),a=e.querySelectorAll(t);for(let e=0;e<a.length;e++){const s=a[e],c=s.getAttribute(n),l=new URI(c).absoluteTo(o).toString(),u=r.indexOf(l);if(-1!==u){const e=r[u];s.setAttribute(n,i[e]),"a"===t&&null===s.getAttribute("download")&&s.setAttribute("download",e)}}}function applyBasePath(e,t,n,i){const r=e.querySelectorAll(t);for(let e=0;e<r.length;e++){const t=r[e],o=resolveHref(t.getAttribute(n),i);t.setAttribute(n,o.url)}}function createEntity(e,t,n){let i=queryStringAttribute(e,"id");i=defined(i)&&0!==i.length?i:createGuid(),defined(n)&&(i=n+i);let r=t.getById(i);return defined(r)&&(i=createGuid(),defined(n)&&(i=n+i)),r=t.add(new Entity({id:i})),defined(r.kml)||(r.addProperty("kml"),r.kml=new KmlFeatureData),r}function isExtrudable(e,t){return"absolute"===e||"relativeToGround"===e||"relativeToSeaFloor"===t}function readCoordinate(e,t){if(!defined(e))return Cartesian3.fromDegrees(0,0,0,t);const n=e.match(/[^\s,\n]+/g);if(!defined(n))return Cartesian3.fromDegrees(0,0,0,t);let i=parseFloat(n[0]),r=parseFloat(n[1]),o=parseFloat(n[2]);return i=isNaN(i)?0:i,r=isNaN(r)?0:r,o=isNaN(o)?0:o,Cartesian3.fromDegrees(i,r,o,t)}function readCoordinates(e,t){if(!defined(e))return;const n=e.textContent.match(/[^\s\n]+/g);if(!defined(n))return;const i=n.length,r=new Array(i);let o=0;for(let e=0;e<i;e++)r[o++]=readCoordinate(n[e],t);return r}function queryNumericAttribute(e,t){if(!defined(e))return;const n=e.getAttribute(t);if(null!==n){const e=parseFloat(n);return isNaN(e)?void 0:e}}function queryStringAttribute(e,t){if(!defined(e))return;const n=e.getAttribute(t);return null!==n?n:void 0}function queryFirstNode(e,t,n){if(!defined(e))return;const i=e.childNodes,r=i.length;for(let e=0;e<r;e++){const r=i[e];if(r.localName===t&&-1!==n.indexOf(r.namespaceURI))return r}}function queryNodes(e,t,n){if(!defined(e))return;const i=[],r=e.getElementsByTagNameNS("*",t),o=r.length;for(let e=0;e<o;e++){const o=r[e];o.localName===t&&-1!==n.indexOf(o.namespaceURI)&&i.push(o)}return i}function queryChildNodes(e,t,n){if(!defined(e))return[];const i=[],r=e.childNodes,o=r.length;for(let e=0;e<o;e++){const o=r[e];o.localName===t&&-1!==n.indexOf(o.namespaceURI)&&i.push(o)}return i}function queryNumericValue(e,t,n){const i=queryFirstNode(e,t,n);if(defined(i)){const e=parseFloat(i.textContent);return isNaN(e)?void 0:e}}function queryStringValue(e,t,n){const i=queryFirstNode(e,t,n);if(defined(i))return i.textContent.trim()}function queryBooleanValue(e,t,n){const i=queryFirstNode(e,t,n);if(defined(i)){const e=i.textContent.trim();return"1"===e||/^true$/i.test(e)}}function resolveHref(e,t,n){if(!defined(e))return;let i;if(defined(n)){let r=n[e=e.replace(/\\/g,"/")];if(defined(r))i=new Resource({url:r});else{const o=new URI(t.getUrlComponent());r=n[new URI(e).absoluteTo(o)],defined(r)&&(i=new Resource({url:r}))}}return defined(i)||(i=t.getDerivedResource({url:e})),i}Object.defineProperties(DeferredLoading.prototype,{dataSource:{get:function(){return this._dataSource}}}),DeferredLoading.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0},DeferredLoading.prototype.addPromise=function(e){this._promises.push(e)},DeferredLoading.prototype.wait=function(){const e=this._deferred;return this._used||e.resolve(),when.join(e.promise,when.all(this._promises))},DeferredLoading.prototype.process=function(){const e=1===this._stack.length;return e&&(this._started=KmlDataSource._getTimestamp()),this._process(e)},DeferredLoading.prototype._giveUpTime=function(){if(this._timeoutSet)return;this._timeoutSet=!0,this._timeThreshold=50;const e=this;setTimeout((function(){e._timeoutSet=!1,e._started=KmlDataSource._getTimestamp(),e._process(!0)}),0)},DeferredLoading.prototype._nextNode=function(){const e=this._stack,t=e[e.length-1],n=t.index,i=t.nodes;if(n!==i.length)return++t.index,i[n]},DeferredLoading.prototype._pop=function(){const e=this._stack;return e.pop(),0!==e.length||(this._deferred.resolve(),!1)},DeferredLoading.prototype._process=function(e){const t=this.dataSource,n=this._stack[this._stack.length-1].processingData;let i=this._nextNode();for(;defined(i);){const e=featureTypes[i.localName];if(defined(e)&&(-1!==namespaces.kml.indexOf(i.namespaceURI)||-1!==namespaces.gx.indexOf(i.namespaceURI))&&(e(t,i,n,this),this._timeoutSet||KmlDataSource._getTimestamp()>this._started+this._timeThreshold))return void this._giveUpTime();i=this._nextNode()}this._pop()&&e&&this._process(!0)};const colorOptions={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function parseColorString(e,t){if(!defined(e)||/^\s*$/gm.test(e))return;"#"===e[0]&&(e=e.substring(1));const n=parseInt(e.substring(0,2),16)/255,i=parseInt(e.substring(2,4),16)/255,r=parseInt(e.substring(4,6),16)/255,o=parseInt(e.substring(6,8),16)/255;return t?(o>0?(colorOptions.maximumRed=o,colorOptions.red=void 0):(colorOptions.maximumRed=void 0,colorOptions.red=0),r>0?(colorOptions.maximumGreen=r,colorOptions.green=void 0):(colorOptions.maximumGreen=void 0,colorOptions.green=0),i>0?(colorOptions.maximumBlue=i,colorOptions.blue=void 0):(colorOptions.maximumBlue=void 0,colorOptions.blue=0),colorOptions.alpha=n,Color.fromRandom(colorOptions)):new Color(o,r,i,n)}function queryColorValue(e,t,n){const i=queryStringValue(e,t,n);if(defined(i))return parseColorString(i,"random"===queryStringValue(e,"colorMode",n))}function processTimeStamp(e){const t=queryFirstNode(e,"TimeStamp",namespaces.kmlgx),n=queryStringValue(t,"when",namespaces.kmlgx);if(!defined(t)||!defined(n)||0===n.length)return;const i=JulianDate.fromIso8601(n),r=new TimeIntervalCollection;return r.addInterval(new TimeInterval({start:i,stop:Iso8601.MAXIMUM_VALUE})),r}function processTimeSpan(e){const t=queryFirstNode(e,"TimeSpan",namespaces.kmlgx);if(!defined(t))return;let n;const i=queryFirstNode(t,"begin",namespaces.kmlgx);let r=defined(i)?JulianDate.fromIso8601(i.textContent):void 0;const o=queryFirstNode(t,"end",namespaces.kmlgx);let a=defined(o)?JulianDate.fromIso8601(o.textContent):void 0;if(defined(r)&&defined(a)){if(JulianDate.lessThan(a,r)){const e=r;r=a,a=e}n=new TimeIntervalCollection,n.addInterval(new TimeInterval({start:r,stop:a}))}else defined(r)?(n=new TimeIntervalCollection,n.addInterval(new TimeInterval({start:r,stop:Iso8601.MAXIMUM_VALUE}))):defined(a)&&(n=new TimeIntervalCollection,n.addInterval(new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:a})));return n}function createDefaultBillboard(){const e=new BillboardGraphics;return e.width=BILLBOARD_SIZE,e.height=BILLBOARD_SIZE,e.scaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e.pixelOffsetScaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e}function createDefaultPolygon(){const e=new PolygonGraphics;return e.outline=!0,e.outlineColor=Color.WHITE,e}function createDefaultLabel(){const e=new LabelGraphics;return e.translucencyByDistance=new NearFarScalar(3e6,1,5e6,0),e.pixelOffset=new Cartesian2(17,0),e.horizontalOrigin=HorizontalOrigin$1.LEFT,e.font="16px sans-serif",e.style=LabelStyle$1.FILL_AND_OUTLINE,e}function getIconHref(e,t,n,i,r){let o=queryStringValue(e,"href",namespaces.kml);if(!defined(o)||0===o.length)return;if(0===o.indexOf("root://icons/palette-")){const t=o.charAt(21);let n=defaultValue(queryNumericValue(e,"x",namespaces.gx),0),i=defaultValue(queryNumericValue(e,"y",namespaces.gx),0);n=Math.min(n/32,7),i=7-Math.min(i/32,7);o="https://maps.google.com/mapfiles/kml/pal"+t+"/icon"+(8*i+n)+".png"}const a=resolveHref(o,n,i);if(r){const n=queryStringValue(e,"refreshMode",namespaces.kml),i=queryStringValue(e,"viewRefreshMode",namespaces.kml);"onInterval"===n||"onExpire"===n?oneTimeWarning("kml-refreshMode-"+n,"KML - Unsupported Icon refreshMode: "+n):"onStop"!==i&&"onRegion"!==i||oneTimeWarning("kml-refreshMode-"+i,"KML - Unsupported Icon viewRefreshMode: "+i);const r=defaultValue(queryStringValue(e,"viewBoundScale",namespaces.kml),1),o="onStop"===i?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",s=defaultValue(queryStringValue(e,"viewFormat",namespaces.kml),o),c=queryStringValue(e,"httpQuery",namespaces.kml);defined(s)&&a.setQueryParameters(queryToObject(cleanupString(s))),defined(c)&&a.setQueryParameters(queryToObject(cleanupString(c)));const l=t._ellipsoid;return processNetworkLinkQueryString(a,t._camera,t._canvas,r,t._lastCameraView.bbox,l),a}return a}function processBillboardIcon(e,t,n,i,r){let o=queryNumericValue(t,"scale",namespaces.kml);const a=queryNumericValue(t,"heading",namespaces.kml),s=queryColorValue(t,"color",namespaces.kml),c=queryFirstNode(t,"Icon",namespaces.kml);let l=getIconHref(c,e,i,r,!1);defined(c)&&!defined(l)&&(l=!1);const u=queryNumericValue(c,"x",namespaces.gx),d=queryNumericValue(c,"y",namespaces.gx),h=queryNumericValue(c,"w",namespaces.gx),p=queryNumericValue(c,"h",namespaces.gx),f=queryFirstNode(t,"hotSpot",namespaces.kml),m=queryNumericAttribute(f,"x"),g=queryNumericAttribute(f,"y"),_=queryStringAttribute(f,"xunits"),y=queryStringAttribute(f,"yunits");let C,T,S=n.billboard;defined(S)||(S=createDefaultBillboard(),n.billboard=S),S.image=l,S.scale=o,S.color=s,(defined(u)||defined(d)||defined(h)||defined(p))&&(S.imageSubRegion=new BoundingRectangle(u,d,h,p)),defined(a)&&0!==a&&(S.rotation=CesiumMath.toRadians(-a),S.alignedAxis=Cartesian3.UNIT_Z),o=defaultValue(o,1),defined(m)&&("pixels"===_?C=-m*o:"insetPixels"===_?C=(m-BILLBOARD_SIZE)*o:"fraction"===_&&(C=-m*BILLBOARD_SIZE*o),C+=.5*BILLBOARD_SIZE*o),defined(g)&&("pixels"===y?T=g*o:"insetPixels"===y?T=(-g+BILLBOARD_SIZE)*o:"fraction"===y&&(T=g*BILLBOARD_SIZE*o),T-=.5*BILLBOARD_SIZE*o),(defined(C)||defined(T))&&(S.pixelOffset=new Cartesian2(C,T))}function applyStyle(e,t,n,i,r){for(let o=0,a=t.childNodes.length;o<a;o++){const a=t.childNodes.item(o);if("IconStyle"===a.localName)processBillboardIcon(e,a,n,i,r);else if("LabelStyle"===a.localName){let e=n.label;defined(e)||(e=createDefaultLabel(),n.label=e),e.scale=defaultValue(queryNumericValue(a,"scale",namespaces.kml),e.scale),e.fillColor=defaultValue(queryColorValue(a,"color",namespaces.kml),e.fillColor),e.text=n.name}else if("LineStyle"===a.localName){let e=n.polyline;defined(e)||(e=new PolylineGraphics,n.polyline=e),e.width=queryNumericValue(a,"width",namespaces.kml),e.material=queryColorValue(a,"color",namespaces.kml),defined(queryColorValue(a,"outerColor",namespaces.gx))&&oneTimeWarning("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),defined(queryNumericValue(a,"outerWidth",namespaces.gx))&&oneTimeWarning("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),defined(queryNumericValue(a,"physicalWidth",namespaces.gx))&&oneTimeWarning("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),defined(queryBooleanValue(a,"labelVisibility",namespaces.gx))&&oneTimeWarning("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if("PolyStyle"===a.localName){let e=n.polygon;defined(e)||(e=createDefaultPolygon(),n.polygon=e),e.material=defaultValue(queryColorValue(a,"color",namespaces.kml),e.material),e.fill=defaultValue(queryBooleanValue(a,"fill",namespaces.kml),e.fill),e.outline=defaultValue(queryBooleanValue(a,"outline",namespaces.kml),e.outline)}else if("BalloonStyle"===a.localName){const e=defaultValue(parseColorString(queryStringValue(a,"bgColor",namespaces.kml)),Color.WHITE),t=defaultValue(parseColorString(queryStringValue(a,"textColor",namespaces.kml)),Color.BLACK),i=queryStringValue(a,"text",namespaces.kml);n.addProperty("balloonStyle"),n.balloonStyle={bgColor:e,textColor:t,text:i}}else if("ListStyle"===a.localName){const e=queryStringValue(a,"listItemType",namespaces.kml);"radioFolder"!==e&&"checkOffOnly"!==e||oneTimeWarning("kml-listStyle-"+e,"KML - Unsupported ListStyle with listItemType: "+e)}}}function computeFinalStyle(e,t,n,i,r){const o=new Entity;let a,s=-1;const c=t.childNodes,l=c.length;for(let e=0;e<l;e++){const t=c[e];"Style"!==t.localName&&"StyleMap"!==t.localName||(s=e)}if(-1!==s){const t=c[s];if("Style"===t.localName)applyStyle(e,t,o,i,r);else{const s=queryChildNodes(t,"Pair",namespaces.kml);for(let t=0;t<s.length;t++){const c=s[t],l=queryStringValue(c,"key",namespaces.kml);if("normal"===l){const t=queryStringValue(c,"styleUrl",namespaces.kml);if(defined(t))a=n.getById(t),defined(a)||(a=n.getById("#"+t)),defined(a)&&o.merge(a);else{applyStyle(e,queryFirstNode(c,"Style",namespaces.kml),o,i,r)}}else oneTimeWarning("kml-styleMap-"+l,"KML - Unsupported StyleMap key: "+l)}}}const u=queryStringValue(t,"styleUrl",namespaces.kml);if(defined(u)){let e=u;if("#"!==u[0]&&-1!==u.indexOf("#")){const t=u.split("#"),n=t[0];e=i.getDerivedResource({url:n}).getUrlComponent()+"#"+t[1]}a=n.getById(e),defined(a)||(a=n.getById("#"+e)),defined(a)&&o.merge(a)}return o}function processExternalStyles(e,t,n){return t.fetchXML().then((function(i){return processStyles(e,i,n,t,!0)}))}function processStyles(e,t,n,i,r,o){let a,s,c,l;const u=queryNodes(t,"Style",namespaces.kml);if(defined(u)){const t=u.length;for(a=0;a<t;a++)l=u[a],s=queryStringAttribute(l,"id"),defined(s)&&(s="#"+s,r&&defined(i)&&(s=i.getUrlComponent()+s),defined(n.getById(s))||(c=new Entity({id:s}),n.add(c),applyStyle(e,l,c,i,o)))}const d=queryNodes(t,"StyleMap",namespaces.kml);if(defined(d)){const t=d.length;for(a=0;a<t;a++){const t=d[a];if(s=queryStringAttribute(t,"id"),defined(s)){const a=queryChildNodes(t,"Pair",namespaces.kml);for(let t=0;t<a.length;t++){const u=a[t],d=queryStringValue(u,"key",namespaces.kml);if("normal"===d){if(s="#"+s,r&&defined(i)&&(s=i.getUrlComponent()+s),!defined(n.getById(s))){c=n.getOrCreateEntity(s);let t=queryStringValue(u,"styleUrl",namespaces.kml);if(defined(t)){"#"!==t[0]&&(t="#"+t),r&&defined(i)&&(t=i.getUrlComponent()+t);const e=n.getById(t);defined(e)&&c.merge(e)}else l=queryFirstNode(u,"Style",namespaces.kml),applyStyle(e,l,c,i,o)}}else oneTimeWarning("kml-styleMap-"+d,"KML - Unsupported StyleMap key: "+d)}}}}const h=[],p=t.getElementsByTagName("styleUrl"),f=p.length;for(a=0;a<f;a++){const t=p[a].textContent;if("#"!==t[0]){const r=t.split("#");if(2===r.length){const t=r[0],o=i.getDerivedResource({url:t});h.push(processExternalStyles(e,o,n))}}}return h}function createDropLine(e,t,n){const i=new ReferenceProperty(e,t.id,["position"]),r=new ScaledPositionProperty(t.position);t.polyline=defined(n.polyline)?n.polyline.clone():new PolylineGraphics,t.polyline.positions=new PositionPropertyArray([i,r])}function heightReferenceFromAltitudeMode(e,t){return!defined(e)&&!defined(t)||"clampToGround"===e?HeightReference$1.CLAMP_TO_GROUND:"relativeToGround"===e?HeightReference$1.RELATIVE_TO_GROUND:"absolute"===e?HeightReference$1.NONE:"clampToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),HeightReference$1.CLAMP_TO_GROUND):"relativeToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),HeightReference$1.RELATIVE_TO_GROUND):(defined(e)?oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown <kml:altitudeMode>:"+e+", using <kml:altitudeMode>:CLAMP_TO_GROUND."):oneTimeWarning("kml-gx:altitudeMode-unknown","KML - Unknown <gx:altitudeMode>:"+t+", using <kml:altitudeMode>:CLAMP_TO_GROUND."),HeightReference$1.CLAMP_TO_GROUND)}function createPositionPropertyFromAltitudeMode(e,t,n){return"relativeToSeaFloor"===n||"absolute"===t||"relativeToGround"===t?e:((defined(t)&&"clampToGround"!==t||defined(n)&&"clampToSeaFloor"!==n)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,n)),new ScaledPositionProperty(e))}function createPositionPropertyArrayFromAltitudeMode(e,t,n,i){if(!defined(e))return;if("relativeToSeaFloor"===n||"absolute"===t||"relativeToGround"===t)return e;(defined(t)&&"clampToGround"!==t||defined(n)&&"clampToSeaFloor"!==n)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,n));const r=e.length;for(let t=0;t<r;t++){const n=e[t];i.scaleToGeodeticSurface(n,n)}return e}function processPositionGraphics(e,t,n,i){let r=t.label;defined(r)||(r=defined(n.label)?n.label.clone():createDefaultLabel(),t.label=r),r.text=t.name;let o=t.billboard;defined(o)||(o=defined(n.billboard)?n.billboard.clone():createDefaultBillboard(),t.billboard=o),defined(o.image)?o.image.getValue()||(o.image=void 0):o.image=e._pinBuilder.fromColor(Color.YELLOW,64);let a=1;defined(o.scale)&&(a=o.scale.getValue(),0!==a?r.pixelOffset=new Cartesian2(16*a+1,0):(r.pixelOffset=void 0,r.horizontalOrigin=void 0)),defined(i)&&e._clampToGround&&(o.heightReference=i,r.heightReference=i)}function processPathGraphics(e,t){let n=e.path;defined(n)||(n=new PathGraphics,n.leadTime=0,e.path=n);const i=t.polyline;defined(i)&&(n.material=i.material,n.width=i.width)}function processPoint(e,t,n,i,r){const o=queryStringValue(n,"coordinates",namespaces.kml),a=queryStringValue(n,"altitudeMode",namespaces.kml),s=queryStringValue(n,"altitudeMode",namespaces.gx),c=queryBooleanValue(n,"extrude",namespaces.kml),l=readCoordinate(o,e._ellipsoid);return i.position=l,processPositionGraphics(e,i,r,heightReferenceFromAltitudeMode(a,s)),c&&isExtrudable(a,s)&&createDropLine(t,i,r),!0}function processLineStringOrLinearRing(e,t,n,i,r){const o=queryFirstNode(n,"coordinates",namespaces.kml),a=queryStringValue(n,"altitudeMode",namespaces.kml),s=queryStringValue(n,"altitudeMode",namespaces.gx),c=queryBooleanValue(n,"extrude",namespaces.kml),l=queryBooleanValue(n,"tessellate",namespaces.kml),u=isExtrudable(a,s),d=queryNumericValue(n,"drawOrder",namespaces.gx),h=e._ellipsoid,p=readCoordinates(o,h);let f=r.polyline;if(u&&c){const e=new WallGraphics;i.wall=e,e.positions=p;const t=r.polygon;defined(t)&&(e.fill=t.fill,e.material=t.material),e.outline=!0,defined(f)?(e.outlineColor=defined(f.material)?f.material.color:Color.WHITE,e.outlineWidth=f.width):defined(t)&&(e.outlineColor=defined(t.material)?t.material.color:Color.WHITE)}else if(e._clampToGround&&!u&&l){const e=new PolylineGraphics;e.clampToGround=!0,i.polyline=e,e.positions=p,defined(f)?(e.material=defined(f.material)?f.material.color.getValue(Iso8601.MINIMUM_VALUE):Color.WHITE,e.width=defaultValue(f.width,1)):(e.material=Color.WHITE,e.width=1),e.zIndex=d}else defined(d)&&oneTimeWarning("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),e._clampToGround&&!l&&oneTimeWarning("kml-line-tesselate","Ignoring clampToGround for KML lines without the tessellate flag."),f=defined(f)?f.clone():new PolylineGraphics,i.polyline=f,f.positions=createPositionPropertyArrayFromAltitudeMode(p,a,s,h),l&&!u||(f.arcType=ArcType$1.NONE);return!0}function processPolygon(e,t,n,i,r){const o=queryFirstNode(n,"outerBoundaryIs",namespaces.kml);let a=queryFirstNode(o,"LinearRing",namespaces.kml),s=queryFirstNode(a,"coordinates",namespaces.kml);const c=e._ellipsoid;let l=readCoordinates(s,c);const u=queryBooleanValue(n,"extrude",namespaces.kml),d=isExtrudable(queryStringValue(n,"altitudeMode",namespaces.kml),queryStringValue(n,"altitudeMode",namespaces.gx)),h=defined(r.polygon)?r.polygon.clone():createDefaultPolygon(),p=r.polyline;if(defined(p)&&(h.outlineColor=defined(p.material)?p.material.color:Color.WHITE,h.outlineWidth=p.width),i.polygon=h,d?(h.perPositionHeight=!0,h.extrudedHeight=u?0:void 0):e._clampToGround||(h.height=0),defined(l)){const e=new PolygonHierarchy(l),t=queryChildNodes(n,"innerBoundaryIs",namespaces.kml);for(let n=0;n<t.length;n++){a=queryChildNodes(t[n],"LinearRing",namespaces.kml);for(let t=0;t<a.length;t++)s=queryFirstNode(a[t],"coordinates",namespaces.kml),l=readCoordinates(s,c),defined(l)&&e.holes.push(new PolygonHierarchy(l))}h.hierarchy=e}return!0}function processTrack(e,t,n,i,r){const o=queryStringValue(n,"altitudeMode",namespaces.kml),a=queryStringValue(n,"altitudeMode",namespaces.gx),s=queryChildNodes(n,"coord",namespaces.gx),c=queryChildNodes(n,"angles",namespaces.gx),l=queryChildNodes(n,"when",namespaces.kml),u=queryBooleanValue(n,"extrude",namespaces.kml),d=isExtrudable(o,a),h=e._ellipsoid;c.length>0&&oneTimeWarning("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");const p=Math.min(s.length,l.length),f=[],m=[];for(let e=0;e<p;e++){const t=readCoordinate(s[e].textContent,h);f.push(t),m.push(JulianDate.fromIso8601(l[e].textContent))}const g=new SampledPositionProperty;return g.addSamples(m,f),i.position=g,processPositionGraphics(e,i,r,heightReferenceFromAltitudeMode(o,a)),processPathGraphics(i,r),i.availability=new TimeIntervalCollection,l.length>0&&i.availability.addInterval(new TimeInterval({start:m[0],stop:m[m.length-1]})),d&&u&&createDropLine(t,i,r),!0}function addToMultiTrack(e,t,n,i,r,o,a,s,c){const l=e[0],u=e[e.length-1],d=new SampledPositionProperty;d.addSamples(e,t),n.intervals.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c,data:createPositionPropertyFromAltitudeMode(d,a,s)})),i.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c})),r.intervals.addInterval(new TimeInterval({start:l,stop:u,isStartIncluded:c,isStopIncluded:c,data:o}))}function processMultiTrack(e,t,n,i,r){const o=queryBooleanValue(n,"interpolate",namespaces.gx),a=queryChildNodes(n,"Track",namespaces.gx);let s,c,l,u=!1;const d=new TimeIntervalCollectionProperty,h=new TimeIntervalCollection,p=new CompositePositionProperty,f=e._ellipsoid;for(let e=0,t=a.length;e<t;e++){const t=a[e],n=queryChildNodes(t,"when",namespaces.kml),i=queryChildNodes(t,"coord",namespaces.gx),r=queryStringValue(t,"altitudeMode",namespaces.kml),m=queryStringValue(t,"altitudeMode",namespaces.gx),g=isExtrudable(r,m),_=queryBooleanValue(t,"extrude",namespaces.kml),y=Math.min(i.length,n.length),C=[];s=[];for(let e=0;e<y;e++){const t=readCoordinate(i[e].textContent,f);C.push(t),s.push(JulianDate.fromIso8601(n[e].textContent))}o&&(defined(c)&&addToMultiTrack([c,s[0]],[l,C[0]],p,h,d,!1,"absolute",void 0,!1),c=s[y-1],l=C[C.length-1]),addToMultiTrack(s,C,p,h,d,g&&_,r,m,!0),u=u||g&&_}return i.availability=h,i.position=p,processPositionGraphics(e,i,r),processPathGraphics(i,r),u&&(createDropLine(t,i,r),i.polyline.show=d),!0}const geometryTypes={Point:processPoint,LineString:processLineStringOrLinearRing,LinearRing:processLineStringOrLinearRing,Polygon:processPolygon,Track:processTrack,MultiTrack:processMultiTrack,MultiGeometry:processMultiGeometry,Model:processUnsupportedGeometry};function processMultiGeometry(e,t,n,i,r,o){const a=n.childNodes;let s=!1;for(let n=0,c=a.length;n<c;n++){const c=a.item(n),l=geometryTypes[c.localName];if(defined(l)){const n=createEntity(c,t,o);n.parent=i,n.name=i.name,n.availability=i.availability,n.description=i.description,n.kml=i.kml,l(e,t,c,n,r)&&(s=!0)}}return s}function processUnsupportedGeometry(e,t,n,i,r){return oneTimeWarning("kml-unsupportedGeometry","KML - Unsupported geometry: "+n.localName),!1}function processExtendedData(e,t){const n=queryFirstNode(e,"ExtendedData",namespaces.kml);if(!defined(n))return;defined(queryFirstNode(n,"SchemaData",namespaces.kml))&&oneTimeWarning("kml-schemaData","KML - SchemaData is unsupported"),defined(queryStringAttribute(n,"xmlns:prefix"))&&oneTimeWarning("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");const i={},r=queryChildNodes(n,"Data",namespaces.kml);if(defined(r)){const e=r.length;for(let t=0;t<e;t++){const e=r[t],n=queryStringAttribute(e,"name");defined(n)&&(i[n]={displayName:queryStringValue(e,"displayName",namespaces.kml),value:queryStringValue(e,"value",namespaces.kml)})}}t.kml.extendedData=i}let scratchDiv;function processDescription(e,t,n,i,r){let o,a,s;const c=t.kml,l=c.extendedData,u=queryStringValue(e,"description",namespaces.kml),d=defaultValue(t.balloonStyle,n.balloonStyle);let h,p=Color.WHITE,f=Color.BLACK,m=u;if(defined(d)&&(p=defaultValue(d.bgColor,Color.WHITE),f=defaultValue(d.textColor,Color.BLACK),m=defaultValue(d.text,u)),defined(m)){if(m=m.replace("$[name]",defaultValue(t.name,"")),m=m.replace("$[description]",defaultValue(u,"")),m=m.replace("$[address]",defaultValue(c.address,"")),m=m.replace("$[Snippet]",defaultValue(c.snippet,"")),m=m.replace("$[id]",t.id),m=m.replace("$[geDirections]",""),defined(l)){const e=m.match(/\$\[.+?\]/g);if(null!==e)for(o=0;o<e.length;o++){const t=e[o];let n=t.substr(2,t.length-3);const i=/\/displayName$/.test(n);n=n.replace(/\/displayName$/,""),h=l[n],defined(h)&&(h=i?h.displayName:h.value),defined(h)&&(m=m.replace(t,defaultValue(h,"")))}}}else if(defined(l)&&(s=Object.keys(l),s.length>0)){for(m='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',o=0;o<s.length;o++)a=s[o],h=l[a],m+="<tr><th>"+defaultValue(h.displayName,a)+"</th><td>"+defaultValue(h.value,"")+"</td></tr>";m+="</tbody></table>"}if(!defined(m))return;m=autolinker.link(m),scratchDiv.innerHTML=m;const g=scratchDiv.querySelectorAll("a");for(o=0;o<g.length;o++)g[o].setAttribute("target","_blank");defined(i)&&i.keys.length>1&&(embedDataUris(scratchDiv,"a","href",i),embedDataUris(scratchDiv,"link","href",i),embedDataUris(scratchDiv,"area","href",i),embedDataUris(scratchDiv,"img","src",i),embedDataUris(scratchDiv,"iframe","src",i),embedDataUris(scratchDiv,"video","src",i),embedDataUris(scratchDiv,"audio","src",i),embedDataUris(scratchDiv,"source","src",i),embedDataUris(scratchDiv,"track","src",i),embedDataUris(scratchDiv,"input","src",i),embedDataUris(scratchDiv,"embed","src",i),embedDataUris(scratchDiv,"script","src",i),embedDataUris(scratchDiv,"video","poster",i)),applyBasePath(scratchDiv,"a","href",r),applyBasePath(scratchDiv,"link","href",r),applyBasePath(scratchDiv,"area","href",r),applyBasePath(scratchDiv,"img","src",r),applyBasePath(scratchDiv,"iframe","src",r),applyBasePath(scratchDiv,"video","src",r),applyBasePath(scratchDiv,"audio","src",r),applyBasePath(scratchDiv,"source","src",r),applyBasePath(scratchDiv,"track","src",r),applyBasePath(scratchDiv,"input","src",r),applyBasePath(scratchDiv,"embed","src",r),applyBasePath(scratchDiv,"script","src",r),applyBasePath(scratchDiv,"video","poster",r);let _='<div class="cesium-infoBox-description-lighter" style="';_+="overflow:auto;",_+="word-wrap:break-word;",_+="background-color:"+p.toCssColorString()+";",_+="color:"+f.toCssColorString()+";",_+='">',_+=scratchDiv.innerHTML+"</div>",scratchDiv.innerHTML="",t.description=_}function processFeature(e,t,n){const i=n.entityCollection,r=n.parentEntity,o=n.sourceResource,a=n.uriResolver,s=createEntity(t,i,n.context),c=s.kml,l=computeFinalStyle(e,t,n.styleCollection,o,a),u=queryStringValue(t,"name",namespaces.kml);s.name=u,s.parent=r;let d=processTimeSpan(t);defined(d)||(d=processTimeStamp(t)),s.availability=d,mergeAvailabilityWithParent(s);const h=queryBooleanValue(t,"visibility",namespaces.kml);s.show=function e(t){return!t||t.show&&e(t.parent)}(r)&&defaultValue(h,!0);const p=queryFirstNode(t,"author",namespaces.atom),f=c.author;f.name=queryStringValue(p,"name",namespaces.atom),f.uri=queryStringValue(p,"uri",namespaces.atom),f.email=queryStringValue(p,"email",namespaces.atom);const m=queryFirstNode(t,"link",namespaces.atom),g=c.link;g.href=queryStringAttribute(m,"href"),g.hreflang=queryStringAttribute(m,"hreflang"),g.rel=queryStringAttribute(m,"rel"),g.type=queryStringAttribute(m,"type"),g.title=queryStringAttribute(m,"title"),g.length=queryStringAttribute(m,"length"),c.address=queryStringValue(t,"address",namespaces.kml),c.phoneNumber=queryStringValue(t,"phoneNumber",namespaces.kml),c.snippet=queryStringValue(t,"Snippet",namespaces.kml),processExtendedData(t,s),processDescription(t,s,l,a,o);const _=e._ellipsoid;return processLookAt(t,s,_),processCamera(t,s,_),defined(queryFirstNode(t,"Region",namespaces.kml))&&oneTimeWarning("kml-region","KML - Placemark Regions are unsupported"),{entity:s,styleEntity:l}}function processDocument(e,t,n,i){i.addNodes(t.childNodes,n),i.process()}function processFolder(e,t,n,i){const r=processFeature(e,t,n),o=clone$1(n);o.parentEntity=r.entity,processDocument(e,t,o,i)}function processPlacemark(e,t,n,i){const r=processFeature(e,t,n),o=r.entity,a=r.styleEntity;let s=!1;const c=t.childNodes;for(let t=0,i=c.length;t<i&&!s;t++){const i=c.item(t),r=geometryTypes[i.localName];defined(r)&&(r(e,n.entityCollection,i,o,a,o.id),s=!0)}s||(o.merge(a),processPositionGraphics(e,o,a))}"undefined"!=typeof document&&(scratchDiv=document.createElement("div"));const playlistNodeProcessors={FlyTo:processTourFlyTo,Wait:processTourWait,SoundCue:processTourUnsupportedNode,AnimatedUpdate:processTourUnsupportedNode,TourControl:processTourUnsupportedNode};function processTour(e,t,n,i){const r=new KmlTour(queryStringValue(t,"name",namespaces.kml),queryStringAttribute(t,"id")),o=queryFirstNode(t,"Playlist",namespaces.gx);if(o){const t=e._ellipsoid,n=o.childNodes;for(let e=0;e<n.length;e++){const i=n[e];if(i.localName){const e=playlistNodeProcessors[i.localName];e?e(r,i,t):console.log("Unknown KML Tour playlist entry type "+i.localName)}}}e._kmlTours.push(r)}function processTourUnsupportedNode(e,t){oneTimeWarning("KML Tour unsupported node "+t.localName)}function processTourWait(e,t){const n=queryNumericValue(t,"duration",namespaces.gx);e.addPlaylistEntry(new KmlTourWait(n))}function processTourFlyTo(e,t,n){const i=queryNumericValue(t,"duration",namespaces.gx),r=queryStringValue(t,"flyToMode",namespaces.gx),o={kml:{}};processLookAt(t,o,n),processCamera(t,o,n);const a=new KmlTourFlyTo(i,r,o.kml.lookAt||o.kml.camera);e.addPlaylistEntry(a)}function processCamera(e,t,n){const i=queryFirstNode(e,"Camera",namespaces.kml);if(defined(i)){const e=defaultValue(queryNumericValue(i,"longitude",namespaces.kml),0),r=defaultValue(queryNumericValue(i,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(i,"altitude",namespaces.kml),0),a=defaultValue(queryNumericValue(i,"heading",namespaces.kml),0),s=defaultValue(queryNumericValue(i,"tilt",namespaces.kml),0),c=defaultValue(queryNumericValue(i,"roll",namespaces.kml),0),l=Cartesian3.fromDegrees(e,r,o,n),u=HeadingPitchRoll.fromDegrees(a,s-90,c);t.kml.camera=new KmlCamera(l,u)}}function processLookAt(e,t,n){const i=queryFirstNode(e,"LookAt",namespaces.kml);if(defined(i)){const e=defaultValue(queryNumericValue(i,"longitude",namespaces.kml),0),r=defaultValue(queryNumericValue(i,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(i,"altitude",namespaces.kml),0);let a=queryNumericValue(i,"heading",namespaces.kml),s=queryNumericValue(i,"tilt",namespaces.kml);const c=defaultValue(queryNumericValue(i,"range",namespaces.kml),0);s=CesiumMath.toRadians(defaultValue(s,0)),a=CesiumMath.toRadians(defaultValue(a,0));const l=new HeadingPitchRange(a,s-CesiumMath.PI_OVER_TWO,c),u=Cartesian3.fromDegrees(e,r,o,n);t.kml.lookAt=new KmlLookAt(u,l)}}function processScreenOverlay(e,t,n,i){const r=n.screenOverlayContainer;if(!defined(r))return;const o=n.sourceResource,a=n.uriResolver,s=getIconHref(queryFirstNode(t,"Icon",namespaces.kml),e,o,a,!1);if(!defined(s))return;const c=document.createElement("img");e._screenOverlays.push(c),c.src=s.url,c.onload=function(){const e=["position: absolute"],n=queryFirstNode(t,"screenXY",namespaces.kml),i=queryFirstNode(t,"overlayXY",namespaces.kml),r=queryFirstNode(t,"size",namespaces.kml);let o,a,s,l,u,d;defined(r)&&(o=queryNumericAttribute(r,"x"),a=queryNumericAttribute(r,"y"),s=queryStringAttribute(r,"xunits"),l=queryStringAttribute(r,"yunits"),defined(o)&&-1!==o&&0!==o&&("fraction"===s?u="width: "+Math.floor(100*o)+"%":"pixels"===s&&(u="width: "+o+"px"),e.push(u)),defined(a)&&-1!==a&&0!==a&&("fraction"===l?d="height: "+Math.floor(100*a)+"%":"pixels"===l&&(d="height: "+a+"px"),e.push(d))),c.style=e.join(";");let h=0,p=c.height;defined(i)&&(o=queryNumericAttribute(i,"x"),a=queryNumericAttribute(i,"y"),s=queryStringAttribute(i,"xunits"),l=queryStringAttribute(i,"yunits"),defined(o)&&("fraction"===s?h=o*c.width:("pixels"===s||"insetPixels"===s)&&(h=o)),defined(a)&&("fraction"===l?p=a*c.height:("pixels"===l||"insetPixels"===l)&&(p=a))),defined(n)&&(o=queryNumericAttribute(n,"x"),a=queryNumericAttribute(n,"y"),s=queryStringAttribute(n,"xunits"),l=queryStringAttribute(n,"yunits"),defined(o)&&("fraction"===s?u="left: calc("+Math.floor(100*o)+"% - "+h+"px)":"pixels"===s?u="left: "+(o-h)+"px":"insetPixels"===s&&(u="right: "+(o-h)+"px"),e.push(u)),defined(a)&&("fraction"===l?d="bottom: calc("+Math.floor(100*a)+"% - "+p+"px)":"pixels"===l?d="bottom: "+(a-p)+"px":"insetPixels"===l&&(d="top: "+(a-p)+"px"),e.push(d))),c.style=e.join(";")},r.appendChild(c)}function processGroundOverlay(e,t,n,i){const r=processFeature(e,t,n).entity;let o,a=!1;const s=e._ellipsoid,c=readCoordinates(queryFirstNode(t,"LatLonQuad",namespaces.gx),s),l=queryNumericValue(t,"drawOrder",namespaces.kml);if(defined(c))o=createDefaultPolygon(),o.hierarchy=new PolygonHierarchy(c),o.zIndex=l,r.polygon=o,a=!0;else{o=new RectangleGraphics,o.zIndex=l,r.rectangle=o;const e=queryFirstNode(t,"LatLonBox",namespaces.kml);if(defined(e)){let t=queryNumericValue(e,"west",namespaces.kml),n=queryNumericValue(e,"south",namespaces.kml),i=queryNumericValue(e,"east",namespaces.kml),r=queryNumericValue(e,"north",namespaces.kml);defined(t)&&(t=CesiumMath.negativePiToPi(CesiumMath.toRadians(t))),defined(n)&&(n=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(n))),defined(i)&&(i=CesiumMath.negativePiToPi(CesiumMath.toRadians(i))),defined(r)&&(r=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(r))),o.coordinates=new Rectangle(t,n,i,r);const a=queryNumericValue(e,"rotation",namespaces.kml);if(defined(a)){const e=CesiumMath.toRadians(a);o.rotation=e,o.stRotation=e}}}const u=queryFirstNode(t,"Icon",namespaces.kml),d=getIconHref(u,e,n.sourceResource,n.uriResolver,!0);if(defined(d)){a&&oneTimeWarning("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");const e=queryNumericValue(u,"x",namespaces.gx),n=queryNumericValue(u,"y",namespaces.gx),i=queryNumericValue(u,"w",namespaces.gx),r=queryNumericValue(u,"h",namespaces.gx);(defined(e)||defined(n)||defined(i)||defined(r))&&oneTimeWarning("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),o.material=d,o.material.color=queryColorValue(t,"color",namespaces.kml),o.material.transparent=!0}else o.material=queryColorValue(t,"color",namespaces.kml);let h=queryStringValue(t,"altitudeMode",namespaces.kml);defined(h)?"absolute"===h?(o.height=queryNumericValue(t,"altitude",namespaces.kml),o.zIndex=void 0):"clampToGround"!==h&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+h):(h=queryStringValue(t,"altitudeMode",namespaces.gx),"relativeToSeaFloor"===h?(oneTimeWarning("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),o.height=queryNumericValue(t,"altitude",namespaces.kml),o.zIndex=void 0):"clampToSeaFloor"===h?oneTimeWarning("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):defined(h)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+h))}function processUnsupportedFeature(e,t,n,i){e._unsupportedNode.raiseEvent(e,n.parentEntity,t,n.entityCollection,n.styleCollection,n.sourceResource,n.uriResolver),oneTimeWarning("kml-unsupportedFeature-"+t.nodeName,"KML - Unsupported feature: "+t.nodeName)}const RefreshMode={INTERVAL:0,EXPIRE:1,STOP:2};function cleanupString(e){if(!defined(e)||0===e.length)return"";const t=e[0];return"&"!==t&&"?"!==t||(e=e.substring(1)),e}const zeroRectangle=new Rectangle,scratchCartographic$6=new Cartographic,scratchCartesian2$2=new Cartesian2,scratchCartesian3$2=new Cartesian3;function processNetworkLinkQueryString(e,t,n,i,r,o){function a(e){return e<-CesiumMath.PI_OVER_TWO?-CesiumMath.PI_OVER_TWO:e>CesiumMath.PI_OVER_TWO?CesiumMath.PI_OVER_TWO:e}function s(e){return e>CesiumMath.PI?e-CesiumMath.TWO_PI:e<-CesiumMath.PI?e+CesiumMath.TWO_PI:e}let c=objectToQuery(e.queryParameters);if(c=c.replace(/%5B/g,"[").replace(/%5D/g,"]"),defined(t)&&t._mode!==SceneMode$1.MORPHING){let e,l;if(r=defaultValue(r,zeroRectangle),defined(n)&&(scratchCartesian2$2.x=.5*n.clientWidth,scratchCartesian2$2.y=.5*n.clientHeight,e=t.pickEllipsoid(scratchCartesian2$2,o,scratchCartesian3$2)),defined(e)?l=o.cartesianToCartographic(e,scratchCartographic$6):(l=Rectangle.center(r,scratchCartographic$6),e=o.cartographicToCartesian(l)),defined(i)&&!CesiumMath.equalsEpsilon(i,1,CesiumMath.EPSILON9)){const e=r.width*i*.5,t=r.height*i*.5;r=new Rectangle(s(l.longitude-e),a(l.latitude-t),s(l.longitude+e),a(l.latitude+t))}c=c.replace("[bboxWest]",CesiumMath.toDegrees(r.west).toString()),c=c.replace("[bboxSouth]",CesiumMath.toDegrees(r.south).toString()),c=c.replace("[bboxEast]",CesiumMath.toDegrees(r.east).toString()),c=c.replace("[bboxNorth]",CesiumMath.toDegrees(r.north).toString());const u=CesiumMath.toDegrees(l.longitude).toString(),d=CesiumMath.toDegrees(l.latitude).toString();c=c.replace("[lookatLon]",u),c=c.replace("[lookatLat]",d),c=c.replace("[lookatTilt]",CesiumMath.toDegrees(t.pitch).toString()),c=c.replace("[lookatHeading]",CesiumMath.toDegrees(t.heading).toString()),c=c.replace("[lookatRange]",Cartesian3.distance(t.positionWC,e)),c=c.replace("[lookatTerrainLon]",u),c=c.replace("[lookatTerrainLat]",d),c=c.replace("[lookatTerrainAlt]",l.height.toString()),o.cartesianToCartographic(t.positionWC,scratchCartographic$6),c=c.replace("[cameraLon]",CesiumMath.toDegrees(scratchCartographic$6.longitude).toString()),c=c.replace("[cameraLat]",CesiumMath.toDegrees(scratchCartographic$6.latitude).toString()),c=c.replace("[cameraAlt]",CesiumMath.toDegrees(scratchCartographic$6.height).toString());const h=t.frustum,p=h.aspectRatio;let f="",m="";if(defined(p)){const e=CesiumMath.toDegrees(h.fov);p>1?(f=e,m=e/p):(m=e,f=e*p)}c=c.replace("[horizFov]",f.toString()),c=c.replace("[vertFov]",m.toString())}else c=c.replace("[bboxWest]","-180"),c=c.replace("[bboxSouth]","-90"),c=c.replace("[bboxEast]","180"),c=c.replace("[bboxNorth]","90"),c=c.replace("[lookatLon]",""),c=c.replace("[lookatLat]",""),c=c.replace("[lookatRange]",""),c=c.replace("[lookatTilt]",""),c=c.replace("[lookatHeading]",""),c=c.replace("[lookatTerrainLon]",""),c=c.replace("[lookatTerrainLat]",""),c=c.replace("[lookatTerrainAlt]",""),c=c.replace("[cameraLon]",""),c=c.replace("[cameraLat]",""),c=c.replace("[cameraAlt]",""),c=c.replace("[horizFov]",""),c=c.replace("[vertFov]","");defined(n)?(c=c.replace("[horizPixels]",n.clientWidth),c=c.replace("[vertPixels]",n.clientHeight)):(c=c.replace("[horizPixels]",""),c=c.replace("[vertPixels]","")),c=c.replace("[terrainEnabled]","1"),c=c.replace("[clientVersion]","1"),c=c.replace("[kmlVersion]","2.2"),c=c.replace("[clientName]","Cesium"),c=c.replace("[language]","English"),e.setQueryParameters(queryToObject(c))}function processNetworkLink(e,t,n,i){const r=processFeature(e,t,n).entity,o=n.sourceResource,a=n.uriResolver;let s=queryFirstNode(t,"Link",namespaces.kml);if(defined(s)||(s=queryFirstNode(t,"Url",namespaces.kml)),defined(s)){let t,c,l=queryStringValue(s,"href",namespaces.kml);if(defined(l)){let u=l;if(l=resolveHref(l,o,n.uriResolver),/^data:/.test(l.getUrlComponent()))/\.kmz/i.test(o.getUrlComponent())||(u=o.getDerivedResource({url:u}));else{u=l.clone(),t=queryStringValue(s,"viewRefreshMode",namespaces.kml),c=defaultValue(queryStringValue(s,"viewBoundScale",namespaces.kml),1);const n="onStop"===t?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",i=defaultValue(queryStringValue(s,"viewFormat",namespaces.kml),n),r=queryStringValue(s,"httpQuery",namespaces.kml);defined(i)&&l.setQueryParameters(queryToObject(cleanupString(i))),defined(r)&&l.setQueryParameters(queryToObject(cleanupString(r)));const o=e._ellipsoid;processNetworkLinkQueryString(l,e._camera,e._canvas,c,e._lastCameraView.bbox,o)}const d={sourceUri:u,uriResolver:a,context:r.id,screenOverlayContainer:n.screenOverlayContainer},h=new EntityCollection,p=load(e,h,l,d).then((function(n){const i=e._entityCollection,o=h.values;i.suspendEvents();for(let e=0;e<o.length;e++){const t=o[e];defined(t.parent)||(t.parent=r,mergeAvailabilityWithParent(t)),i.add(t)}i.resumeEvents();const a=queryStringValue(s,"refreshMode",namespaces.kml);let u=defaultValue(queryNumericValue(s,"refreshInterval",namespaces.kml),0);if("onInterval"===a&&u>0||"onExpire"===a||"onStop"===t){const t=queryFirstNode(n,"NetworkLinkControl",namespaces.kml),i=defined(t),o=JulianDate.now(),d={id:createGuid(),href:l,cookie:{},lastUpdated:o,updating:!1,entity:r,viewBoundScale:c,needsUpdate:!1,cameraUpdateTime:o};let h=0;if(i&&(d.cookie=queryToObject(defaultValue(queryStringValue(t,"cookie",namespaces.kml),"")),h=defaultValue(queryNumericValue(t,"minRefreshPeriod",namespaces.kml),0)),"onInterval"===a)i&&(u=Math.max(h,u)),d.refreshMode=RefreshMode.INTERVAL,d.time=u;else if("onExpire"===a){let e;if(i&&(e=queryStringValue(t,"expires",namespaces.kml)),defined(e))try{const t=JulianDate.fromIso8601(e),n=JulianDate.secondsDifference(t,o);n>0&&n<h&&JulianDate.addSeconds(o,h,t),d.refreshMode=RefreshMode.EXPIRE,d.time=t}catch(e){oneTimeWarning("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else e._camera?(d.refreshMode=RefreshMode.STOP,d.time=defaultValue(queryNumericValue(s,"viewRefreshTime",namespaces.kml),0)):oneTimeWarning("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires a camera be passed in when creating the KmlDataSource");defined(d.refreshMode)&&e._networkLinks.set(d.id,d)}else"onRegion"===t&&oneTimeWarning("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion")})).otherwise((function(t){oneTimeWarning("An error occured during loading "+l.url),e._error.raiseEvent(e,t)}));i.addPromise(p)}}}function processFeatureNode(e,t,n,i){const r=featureTypes[t.localName];return defined(r)?r(e,t,n,i):processUnsupportedFeature(e,t,n)}function loadKml(e,t,n,i,r,o,a){t.removeAll();const s=n.documentElement;let c=queryStringValue("Document"===s.localName?s:queryFirstNode(s,"Document",namespaces.kml),"name",namespaces.kml);defined(c)||(c=getFilenameFromUri(i.getUrlComponent())),defined(e._name)||(e._name=c);const l=new KmlDataSource._DeferredLoading(e),u=new EntityCollection(e);return when.all(processStyles(e,n,u,i,!1,r)).then((function(){let s=n.documentElement;if("kml"===s.localName){const e=s.childNodes;for(let t=0;t<e.length;t++){const n=e[t];if(defined(featureTypes[n.localName])){s=n;break}}}const c={parentEntity:void 0,entityCollection:t,styleCollection:u,sourceResource:i,uriResolver:r,context:a,screenOverlayContainer:o};return t.suspendEvents(),processFeatureNode(e,s,c,l),t.resumeEvents(),l.wait().then((function(){return n.documentElement}))}))}function loadKmz(e,t,n,i,r){const o=buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");zipNoWorker.configure({workerScripts:{deflate:[o,"./pako_deflate.min.js"],inflate:[o,"./pako_inflate.min.js"]}});const a=new zipNoWorker.ZipReader(new zipNoWorker.BlobReader(n));return when(a.getEntries()).then((function(n){const o=[],s={};let c;for(let e=0;e<n.length;e++){const t=n[e];t.directory||(/\.kml$/i.test(t.filename)?defined(c)&&/\//i.test(t.filename)?o.push(loadDataUriFromZip(t,s)):(defined(c)&&o.push(loadDataUriFromZip(c,s)),c=t):o.push(loadDataUriFromZip(t,s)))}return defined(c)&&o.push(loadXmlFromZip(c,s)),when.all(o).then((function(){if(a.close(),!defined(s.kml))throw new RuntimeError("KMZ file does not contain a KML document.");return s.keys=Object.keys(s),loadKml(e,t,s.kml,i,s,r)}))}))}function load(e,t,n,i){let r=(i=defaultValue(i,defaultValue.EMPTY_OBJECT)).sourceUri;const o=i.uriResolver,a=i.context;let s=i.screenOverlayContainer,c=n;if("string"==typeof n||n instanceof Resource){c=(n=Resource.createIfNeeded(n)).fetchBlob(),r=defaultValue(r,n.clone());const t=e._resourceCredits,i=n.credits;if(defined(i)){const e=i.length;for(let n=0;n<e;n++)t.push(i[n])}}else r=defaultValue(r,Resource.DEFAULT.clone());return r=Resource.createIfNeeded(r),defined(s)&&(s=getElement(s)),when(c).then((function(n){return n instanceof Blob?isZipFile(n).then((function(i){return i?loadKmz(e,t,n,r,s):readBlobAsText(n).then((function(n){let i,c;n=removeDuplicateNamespaces(n=insertNamespaces(n));try{i=parser.parseFromString(n,"application/xml")}catch(e){c=e.toString()}if(defined(c)||i.body||"parsererror"===i.documentElement.tagName){let e=defined(c)?c:i.documentElement.firstChild.nodeValue;throw e||(e=i.body.innerText),new RuntimeError(e)}return loadKml(e,t,i,r,o,s,a)}))})):loadKml(e,t,n,r,o,s,a)})).otherwise((function(t){return e._error.raiseEvent(e,t),console.log(t),when.reject(t)}))}function KmlDataSource(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).camera,n=e.canvas;this._changed=new Event,this._error=new Event,this._loading=new Event,this._refresh=new Event,this._unsupportedNode=new Event,this._clock=void 0,this._entityCollection=new EntityCollection(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new PinBuilder,this._networkLinks=new AssociativeArray,this._entityCluster=new EntityCluster,this._canvas=n,this._camera=t,this._lastCameraView={position:defined(t)?Cartesian3.clone(t.positionWC):void 0,direction:defined(t)?Cartesian3.clone(t.directionWC):void 0,up:defined(t)?Cartesian3.clone(t.upWC):void 0,bbox:defined(t)?t.computeViewRectangle():Rectangle.clone(Rectangle.MAX_VALUE)},this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84);let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._resourceCredits=[],this._kmlTours=[],this._screenOverlays=[]}function mergeAvailabilityWithParent(e){const t=e.parent;if(defined(t)){const n=t.availability;if(defined(n)){const t=e.availability;defined(t)?t.intersect(n):e.availability=n}}}function getNetworkLinkUpdateCallback(e,t,n,i,r){return function(o){if(!i.contains(t.id))return;let a=!1;const s=queryFirstNode(o,"NetworkLinkControl",namespaces.kml);let c=0;if(defined(s)){if(defined(queryFirstNode(s,"Update",namespaces.kml)))return oneTimeWarning("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),t.updating=!1,void i.remove(t.id);t.cookie=queryToObject(defaultValue(queryStringValue(s,"cookie",namespaces.kml),"")),c=defaultValue(queryNumericValue(s,"minRefreshPeriod",namespaces.kml),0)}const l=JulianDate.now(),u=t.refreshMode;if(u===RefreshMode.INTERVAL)defined(s)&&(t.time=Math.max(c,t.time));else if(u===RefreshMode.EXPIRE){let e;if(defined(s)&&(e=queryStringValue(s,"expires",namespaces.kml)),defined(e))try{const n=JulianDate.fromIso8601(e),i=JulianDate.secondsDifference(n,l);i>0&&i<c&&JulianDate.addSeconds(l,c,n),t.time=n}catch(e){oneTimeWarning("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),a=!0}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"),a=!0}const d=t.entity,h=e._entityCollection,p=n.values;function f(e){h.remove(e);const t=e._children,n=t.length;for(let e=0;e<n;++e)f(t[e])}h.suspendEvents();const m=h.values.slice();let g;for(g=0;g<m.length;++g){const e=m[g];e.parent===d&&(e.parent=void 0,f(e))}for(h.resumeEvents(),h.suspendEvents(),g=0;g<p.length;g++){const e=p[g];defined(e.parent)||(e.parent=d,mergeAvailabilityWithParent(e)),h.add(e)}h.resumeEvents(),a?i.remove(t.id):t.lastUpdated=l;const _=h.computeAvailability(),y=_.start,C=_.stop,T=JulianDate.equals(y,Iso8601.MINIMUM_VALUE),S=JulianDate.equals(C,Iso8601.MAXIMUM_VALUE);if(!T||!S){const t=e._clock;t.startTime===y&&t.stopTime===C||(t.startTime=y,t.stopTime=C,e._changed.raiseEvent(e))}t.updating=!1,t.needsUpdate=!1,e._refresh.raiseEvent(e,r.getUrlComponent(!0))}}KmlDataSource.load=function(e,t){return new KmlDataSource(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).load(e,t)},Object.defineProperties(KmlDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},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}},refreshEvent:{get:function(){return this._refresh}},unsupportedNodeEvent:{get:function(){return this._unsupportedNode}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}},kmlTours:{get:function(){return this._kmlTours}}}),KmlDataSource.prototype.load=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT),DataSource.setLoading(this,!0);const n=this._name;this._name=void 0,this._clampToGround=defaultValue(t.clampToGround,!1);const i=this;return load(this,this._entityCollection,e,t).then((function(){let e;const t=i._entityCollection.computeAvailability();let r=t.start,o=t.stop;const a=JulianDate.equals(r,Iso8601.MINIMUM_VALUE),s=JulianDate.equals(o,Iso8601.MAXIMUM_VALUE);if(!a||!s){let t;a&&(t=new Date,t.setHours(0,0,0,0),r=JulianDate.fromDate(t)),s&&(t=new Date,t.setHours(24,0,0,0),o=JulianDate.fromDate(t)),e=new DataSourceClock,e.startTime=r,e.stopTime=o,e.currentTime=JulianDate.clone(r),e.clockRange=ClockRange$1.LOOP_STOP,e.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(o,r)/60,1),31556900))}let c=!1;return e!==i._clock&&(i._clock=e,c=!0),n!==i._name&&(c=!0),c&&i._changed.raiseEvent(i),DataSource.setLoading(i,!1),i})).otherwise((function(e){return DataSource.setLoading(i,!1),i._error.raiseEvent(i,e),console.log(e),when.reject(e)}))},KmlDataSource.prototype.destroy=function(){for(;this._screenOverlays.length>0;){this._screenOverlays.pop().remove()}};const entitiesToIgnore=new AssociativeArray;function KmlFeatureData(){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}function Visualizer(){DeveloperError.throwInstantiationError()}KmlDataSource.prototype.update=function(e){const t=this._networkLinks;if(0===t.length)return!0;const n=JulianDate.now(),i=this;function r(e){const t=e._children,n=t.length;for(let e=0;e<n;++e){const n=t[e];entitiesToIgnore.set(n.id,n),r(n)}}entitiesToIgnore.removeAll();let o=!1;const a=this._lastCameraView,s=this._camera;!defined(s)||s.positionWC.equalsEpsilon(a.position,CesiumMath.EPSILON7)&&s.directionWC.equalsEpsilon(a.direction,CesiumMath.EPSILON7)&&s.upWC.equalsEpsilon(a.up,CesiumMath.EPSILON7)||(a.position=Cartesian3.clone(s.positionWC),a.direction=Cartesian3.clone(s.directionWC),a.up=Cartesian3.clone(s.upWC),a.bbox=s.computeViewRectangle(),o=!0);const c=new AssociativeArray;let l=!1;return t.values.forEach((function(e){const t=e.entity;if(!entitiesToIgnore.contains(t.id)){if(!e.updating){let s=!1;if(e.refreshMode===RefreshMode.INTERVAL?JulianDate.secondsDifference(n,e.lastUpdated)>e.time&&(s=!0):e.refreshMode===RefreshMode.EXPIRE?JulianDate.greaterThan(n,e.time)&&(s=!0):e.refreshMode===RefreshMode.STOP&&(o&&(e.needsUpdate=!0,e.cameraUpdateTime=n),e.needsUpdate&&JulianDate.secondsDifference(n,e.cameraUpdateTime)>=e.time&&(s=!0)),s){r(t),e.updating=!0;const n=new EntityCollection,o=e.href.clone();o.setQueryParameters(e.cookie);const s=defaultValue(i._ellipsoid,Ellipsoid.WGS84);processNetworkLinkQueryString(o,i._camera,i._canvas,e.viewBoundScale,a.bbox,s),load(i,n,o,{context:t.id}).then(getNetworkLinkUpdateCallback(i,e,n,c,o)).otherwise((function(t){const n="NetworkLink "+e.href+" refresh failed: "+t;console.log(n),i._error.raiseEvent(i,n)})),l=!0}}c.set(e.id,e)}})),l&&(this._networkLinks=c,this._changed.raiseEvent(this)),!0},KmlDataSource._DeferredLoading=DeferredLoading,KmlDataSource._getTimestamp=getTimestamp$1,Visualizer.prototype.update=DeveloperError.throwInstantiationError,Visualizer.prototype.getBoundingSphere=DeveloperError.throwInstantiationError,Visualizer.prototype.isDestroyed=DeveloperError.throwInstantiationError,Visualizer.prototype.destroy=DeveloperError.throwInstantiationError;var ViewportQuadVS="attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n";function ComputeEngine(e){this._context=e}let renderStateScratch;const drawCommandScratch=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES}),clearCommandScratch=new ClearCommand({color:new Color(0,0,0,0)});function createFramebuffer$1(e,t){return new Framebuffer({context:e,colorTextures:[t],destroyAttachments:!1})}function createViewportQuadShader(e,t){return ShaderProgram.fromCache({context:e,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function createRenderState$1(e,t){return defined(renderStateScratch)&&renderStateScratch.viewport.width===e&&renderStateScratch.viewport.height===t||(renderStateScratch=RenderState.fromCache({viewport:new BoundingRectangle(0,0,e,t)})),renderStateScratch}function PassState(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function ShaderCache(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}function destroyShader(e,t){const n=t.derivedKeywords,i=n.length;for(let r=0;r<i;++r){const i=n[r]+t.keyword;destroyShader(e,e._shaders[i])}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}function TextureCache(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}function SunLight(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,2)}function UniformState(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new BoundingRectangle,this._viewportCartesian4=new Cartesian4,this._viewportDirty=!1,this._viewportOrthographicMatrix=Matrix4.clone(Matrix4.IDENTITY),this._viewportTransformation=Matrix4.clone(Matrix4.IDENTITY),this._model=Matrix4.clone(Matrix4.IDENTITY),this._view=Matrix4.clone(Matrix4.IDENTITY),this._inverseView=Matrix4.clone(Matrix4.IDENTITY),this._projection=Matrix4.clone(Matrix4.IDENTITY),this._infiniteProjection=Matrix4.clone(Matrix4.IDENTITY),this._entireFrustum=new Cartesian2,this._currentFrustum=new Cartesian2,this._frustumPlanes=new Cartesian4,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=Matrix3.clone(Matrix4.IDENTITY),this._view3DDirty=!0,this._view3D=new Matrix4,this._inverseView3DDirty=!0,this._inverseView3D=new Matrix4,this._inverseModelDirty=!0,this._inverseModel=new Matrix4,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new Matrix3,this._viewRotation=new Matrix3,this._inverseViewRotation=new Matrix3,this._viewRotation3D=new Matrix3,this._inverseViewRotation3D=new Matrix3,this._inverseProjectionDirty=!0,this._inverseProjection=new Matrix4,this._modelViewDirty=!0,this._modelView=new Matrix4,this._modelView3DDirty=!0,this._modelView3D=new Matrix4,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new Matrix4,this._inverseModelViewDirty=!0,this._inverseModelView=new Matrix4,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new Matrix4,this._viewProjectionDirty=!0,this._viewProjection=new Matrix4,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new Matrix4,this._modelViewProjectionDirty=!0,this._modelViewProjection=new Matrix4,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new Matrix4,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new Matrix4,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new Matrix4,this._normalDirty=!0,this._normal=new Matrix3,this._normal3DDirty=!0,this._normal3D=new Matrix3,this._inverseNormalDirty=!0,this._inverseNormal=new Matrix3,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new Matrix3,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new EncodedCartesian3,this._cameraPosition=new Cartesian3,this._sunPositionWC=new Cartesian3,this._sunPositionColumbusView=new Cartesian3,this._sunDirectionWC=new Cartesian3,this._sunDirectionEC=new Cartesian3,this._moonDirectionEC=new Cartesian3,this._lightDirectionWC=new Cartesian3,this._lightDirectionEC=new Cartesian3,this._lightColor=new Cartesian3,this._lightColorHdr=new Cartesian3,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new Cartesian3,this._cameraRight=new Cartesian3,this._cameraUp=new Cartesian3,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new Cartesian2,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new Color,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new Cartesian2,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._imagerySplitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}function setView(e,t){Matrix4.clone(t,e._view),Matrix4.getMatrix3(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._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function setInverseView(e,t){Matrix4.clone(t,e._inverseView),Matrix4.getMatrix3(t,e._inverseViewRotation)}function setProjection(e,t){Matrix4.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function setInfiniteProjection(e,t){Matrix4.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function setCamera(e,t){Cartesian3.clone(t.positionWC,e._cameraPosition),Cartesian3.clone(t.directionWC,e._cameraDirection),Cartesian3.clone(t.rightWC,e._cameraRight),Cartesian3.clone(t.upWC,e._cameraUp);const n=t.positionCartographic;defined(n)?e._eyeHeight=n.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}ComputeEngine.prototype.execute=function(e){defined(e.preExecute)&&e.preExecute(e);const t=e.outputTexture,n=t.width,i=t.height,r=this._context,o=defined(e.vertexArray)?e.vertexArray:r.getViewportQuadVertexArray(),a=defined(e.shaderProgram)?e.shaderProgram:createViewportQuadShader(r,e.fragmentShaderSource),s=createFramebuffer$1(r,t),c=createRenderState$1(n,i),l=e.uniformMap,u=clearCommandScratch;u.framebuffer=s,u.renderState=c,u.execute(r);const d=drawCommandScratch;d.vertexArray=o,d.renderState=c,d.shaderProgram=a,d.uniformMap=l,d.framebuffer=s,d.execute(r),s.destroy(),e.persists||(a.destroy(),defined(e.vertexArray)&&o.destroy()),defined(e.postExecute)&&e.postExecute(t)},ComputeEngine.prototype.isDestroyed=function(){return!1},ComputeEngine.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(ShaderCache.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),ShaderCache.prototype.replaceShaderProgram=function(e){return defined(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)},ShaderCache.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;"string"==typeof t&&(t=new ShaderSource({sources:[t]})),"string"==typeof n&&(n=new ShaderSource({sources:[n]}));const r=t.createCombinedVertexShader(this._context),o=n.createCombinedFragmentShader(this._context),a=r+o+JSON.stringify(i);let s;if(defined(this._shaders[a]))s=this._shaders[a],delete this._shadersToRelease[a];else{const e=this._context,c=new ShaderProgram({gl:e._gl,logShaderCompilation:e.logShaderCompilation,debugShaders:e.debugShaders,vertexShaderSource:t,vertexShaderText:r,fragmentShaderSource:n,fragmentShaderText:o,attributeLocations:i});s={cache:this,shaderProgram:c,keyword:a,derivedKeywords:[],count:0},c._cachedShader=s,this._shaders[a]=s,++this._numberOfShaders}return++s.count,s.shaderProgram},ShaderCache.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,r=t+i.keyword,o=this._shaders[r];if(defined(o)){destroyShader(this,o);const e=i.derivedKeywords.indexOf(t);e>-1&&i.derivedKeywords.splice(e,1)}return this.createDerivedShaderProgram(e,t,n)},ShaderCache.prototype.getDerivedShaderProgram=function(e,t){const n=t+e._cachedShader.keyword,i=this._shaders[n];if(defined(i))return i.shaderProgram},ShaderCache.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,r=t+i.keyword;let o=n.vertexShaderSource,a=n.fragmentShaderSource;const s=n.attributeLocations;"string"==typeof o&&(o=new ShaderSource({sources:[o]})),"string"==typeof a&&(a=new ShaderSource({sources:[a]}));const c=this._context,l=o.createCombinedVertexShader(c),u=a.createCombinedFragmentShader(c),d=new ShaderProgram({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:o,vertexShaderText:l,fragmentShaderSource:a,fragmentShaderText:u,attributeLocations:s}),h={cache:this,shaderProgram:d,keyword:r,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),d._cachedShader=h,this._shaders[r]=h,d},ShaderCache.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){destroyShader(this,e[t]),--this._numberOfShaders}this._shadersToRelease={}},ShaderCache.prototype.releaseShaderProgram=function(e){if(defined(e)){const t=e._cachedShader;t&&0==--t.count&&(this._shadersToRelease[t.keyword]=t)}},ShaderCache.prototype.isDestroyed=function(){return!1},ShaderCache.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return destroyObject(this)},Object.defineProperties(TextureCache.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}}),TextureCache.prototype.getTexture=function(e){const t=this._textures[e];if(defined(t))return delete this._texturesToRelease[e],++t.count,t.texture},TextureCache.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){0==--n.count&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures},TextureCache.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}},TextureCache.prototype.isDestroyed=function(){return!1},TextureCache.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return destroyObject(this)},Object.defineProperties(UniformState.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!BoundingRectangle.equals(e,this._viewport)){BoundingRectangle.clone(e,this._viewport);const t=this._viewport,n=this._viewportCartesian4;n.x=t.x,n.y=t.y,n.z=t.width,n.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return cleanViewport(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return cleanViewport(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){Matrix4.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!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,Matrix4.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,Matrix4.getMatrix3(this.inverseModel,e),Matrix3.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return updateView3D(this),this._view3D}},viewRotation:{get:function(){return updateView3D(this),this._viewRotation}},viewRotation3D:{get:function(){return updateView3D(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return updateInverseView3D(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return updateInverseView3D(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return cleanInverseProjection(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return cleanModelView(this),this._modelView}},modelView3D:{get:function(){return cleanModelView3D(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return cleanModelViewRelativeToEye(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return cleanInverseModelView(this),this._inverseModelView}},inverseModelView3D:{get:function(){return cleanInverseModelView3D(this),this._inverseModelView3D}},viewProjection:{get:function(){return cleanViewProjection(this),this._viewProjection}},inverseViewProjection:{get:function(){return cleanInverseViewProjection(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return cleanModelViewProjection(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return cleanInverseModelViewProjection(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return cleanModelViewProjectionRelativeToEye(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return cleanModelViewInfiniteProjection(this),this._modelViewInfiniteProjection}},normal:{get:function(){return cleanNormal(this),this._normal}},normal3D:{get:function(){return cleanNormal3D(this),this._normal3D}},inverseNormal:{get:function(){return cleanInverseNormal(this),this._inverseNormal}},inverseNormal3D:{get:function(){return cleanInverseNormal3D(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},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}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},imagerySplitPosition:{get:function(){return this._imagerySplitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return defaultValue(this._ellipsoid,Ellipsoid.WGS84)}}});let transformMatrix=new Matrix3;const sunCartographicScratch=new Cartographic;function setSunAndMoonDirections(e,t){defined(Transforms.computeIcrfToFixedMatrix(t.time,transformMatrix))||(transformMatrix=Transforms.computeTemeToPseudoFixedMatrix(t.time,transformMatrix));let n=Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);Matrix3.multiplyByVector(transformMatrix,n,n),Cartesian3.normalize(n,e._sunDirectionWC),n=Matrix3.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),Cartesian3.normalize(n,n),n=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),Matrix3.multiplyByVector(transformMatrix,n,n),Matrix3.multiplyByVector(e.viewRotation3D,n,n),Cartesian3.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,sunCartographicScratch);i.project(r,e._sunPositionColumbusView)}UniformState.prototype.updateCamera=function(e){setView(this,e.viewMatrix),setInverseView(this,e.inverseViewMatrix),setCamera(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==SceneMode$1.SCENE2D&&e.frustum instanceof OrthographicFrustum},UniformState.prototype.updateFrustum=function(e){setProjection(this,e.projectionMatrix),defined(e.infiniteProjectionMatrix)&&setInfiniteProjection(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=CesiumMath.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,defined(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},UniformState.prototype.updatePass=function(e){this._pass=e};const EMPTY_ARRAY=[],defaultLight=new SunLight;function cleanViewport(e){if(e._viewportDirty){const t=e._viewport;Matrix4.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),Matrix4.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function cleanInverseProjection(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode===SceneMode$1.SCENE2D||e._mode===SceneMode$1.MORPHING||e._orthographicIn3D?Matrix4.clone(Matrix4.ZERO,e._inverseProjection):Matrix4.inverse(e._projection,e._inverseProjection))}function cleanModelView(e){e._modelViewDirty&&(e._modelViewDirty=!1,Matrix4.multiplyTransformation(e._view,e._model,e._modelView))}function cleanModelView3D(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,Matrix4.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function cleanInverseModelView(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,Matrix4.inverse(e.modelView,e._inverseModelView))}function cleanInverseModelView3D(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,Matrix4.inverse(e.modelView3D,e._inverseModelView3D))}function cleanViewProjection(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,Matrix4.multiply(e._projection,e._view,e._viewProjection))}function cleanInverseViewProjection(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,Matrix4.inverse(e.viewProjection,e._inverseViewProjection))}function cleanModelViewProjection(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,Matrix4.multiply(e._projection,e.modelView,e._modelViewProjection))}function cleanModelViewRelativeToEye(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const t=e.modelView,n=e._modelViewRelativeToEye;n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=0,n[13]=0,n[14]=0,n[15]=t[15]}}function cleanInverseModelViewProjection(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,Matrix4.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function cleanModelViewProjectionRelativeToEye(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,Matrix4.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function cleanModelViewInfiniteProjection(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,Matrix4.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function cleanNormal(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;Matrix4.getMatrix3(e.inverseModelView,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanNormal3D(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;Matrix4.getMatrix3(e.inverseModelView3D,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanInverseNormal(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,Matrix4.getMatrix3(e.inverseModelView,e._inverseNormal),Matrix3.getRotation(e._inverseNormal,e._inverseNormal))}function cleanInverseNormal3D(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,Matrix4.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),Matrix3.getRotation(e._inverseNormal3D,e._inverseNormal3D))}UniformState.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===SceneMode$1.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.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),setSunAndMoonDirections(this,e);const n=defaultValue(e.light,defaultLight);n instanceof SunLight?(this._lightDirectionWC=Cartesian3.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=Cartesian3.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=Cartesian3.normalize(Cartesian3.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=Matrix3.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let r=Cartesian3.fromElements(i.red,i.green,i.blue,this._lightColorHdr);r=Cartesian3.multiplyByScalar(r,n.intensity,r);const o=Cartesian3.maximumComponent(r);o>1?Cartesian3.divideByScalar(r,o,this._lightColor):Cartesian3.clone(r,this._lightColor);const a=e.brdfLutGenerator,s=defined(a)?a.colorTexture:void 0;this._brdfLut=s,this._environmentMap=defaultValue(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=defaultValue(e.sphericalHarmonicCoefficients,EMPTY_ARRAY),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,defined(this._specularEnvironmentMaps)&&Cartesian2.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Transforms.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._imagerySplitPosition=e.imagerySplitPosition*e.context.drawingBufferWidth;const c=t.frustum.fov,l=this._viewport;let u;u=defined(c)?l.height>l.width?2*Math.tan(.5*c)/l.height:2*Math.tan(.5*c)/l.width:1/Math.max(l.width,l.height),this._geometricToleranceOverMeter=u*e.maximumScreenSpaceError,Color.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};const cameraPositionMC=new Cartesian3;function cleanEncodedCameraPositionMC(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,Matrix4.multiplyByPoint(e.inverseModel,e._cameraPosition,cameraPositionMC),EncodedCartesian3.fromCartesian(cameraPositionMC,e._encodedCameraPositionMC))}const view2Dto3DPScratch=new Cartesian3,view2Dto3DRScratch=new Cartesian3,view2Dto3DUScratch=new Cartesian3,view2Dto3DDScratch=new Cartesian3,view2Dto3DCartographicScratch=new Cartographic,view2Dto3DCartesian3Scratch=new Cartesian3,view2Dto3DMatrix4Scratch=new Matrix4;function view2Dto3D(e,t,n,i,r,o,a,s){const c=view2Dto3DPScratch;c.x=e.y,c.y=e.z,c.z=e.x;const l=view2Dto3DRScratch;l.x=n.y,l.y=n.z,l.z=n.x;const u=view2Dto3DUScratch;u.x=i.y,u.y=i.z,u.z=i.x;const d=view2Dto3DDScratch;d.x=t.y,d.y=t.z,d.z=t.x,o===SceneMode$1.SCENE2D&&(c.z=.5*r);const h=a.unproject(c,view2Dto3DCartographicScratch);h.longitude=CesiumMath.clamp(h.longitude,-Math.PI,Math.PI),h.latitude=CesiumMath.clamp(h.latitude,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO);const p=a.ellipsoid,f=p.cartographicToCartesian(h,view2Dto3DCartesian3Scratch),m=Transforms.eastNorthUpToFixedFrame(f,p,view2Dto3DMatrix4Scratch);return Matrix4.multiplyByPointAsVector(m,l,l),Matrix4.multiplyByPointAsVector(m,u,u),Matrix4.multiplyByPointAsVector(m,d,d),defined(s)||(s=new Matrix4),s[0]=l.x,s[1]=u.x,s[2]=-d.x,s[3]=0,s[4]=l.y,s[5]=u.y,s[6]=-d.y,s[7]=0,s[8]=l.z,s[9]=u.z,s[10]=-d.z,s[11]=0,s[12]=-Cartesian3.dot(l,f),s[13]=-Cartesian3.dot(u,f),s[14]=Cartesian3.dot(d,f),s[15]=1,s}function updateView3D(e){e._view3DDirty&&(e._mode===SceneMode$1.SCENE3D?Matrix4.clone(e._view,e._view3D):view2Dto3D(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),Matrix4.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function updateInverseView3D(e){e._inverseView3DDirty&&(Matrix4.inverseTransformation(e.view3D,e._inverseView3D),Matrix4.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function errorToString(e,t){let n="WebGL Error: ";switch(t){case e.INVALID_ENUM:n+="INVALID_ENUM";break;case e.INVALID_VALUE:n+="INVALID_VALUE";break;case e.INVALID_OPERATION:n+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:n+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n+="CONTEXT_LOST_WEBGL lost";break;default:n+="Unknown ("+t+")"}return n}function createErrorMessage(e,t,n,i){let r=errorToString(e,i)+": "+t.name+"(";for(let e=0;e<n.length;++e)0!==e&&(r+=", "),r+=n[e];return r+=");",r}function throwOnError(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new RuntimeError(createErrorMessage(e,t,n,i))}function makeGetterSetter(e,t,n){return{get:function(){const i=e[t];return n(e,"get: "+t,i),e[t]},set:function(i){e[t]=i,n(e,"set: "+t,i)}}}function wrapGL(e,t){if(!defined(t))return e;function n(n){return function(){const i=n.apply(e,arguments);return t(e,n,arguments),i}}const i={};for(const r in e){const o=e[r];o instanceof Function?i[r]=n(o):Object.defineProperty(i,r,makeGetterSetter(e,r,t))}return i}function getExtension(e,t){const n=t.length;for(let i=0;i<n;++i){const n=e.getExtension(t[i]);if(n)return n}}function Context(e,t){if("undefined"==typeof WebGLRenderingContext)throw new RuntimeError("The browser does not support WebGL. Visit http://get.webgl.org.");this._canvas=e,(t=defaultValue(t=clone$1(t,!0),{})).allowTextureFilterAnisotropic=defaultValue(t.allowTextureFilterAnisotropic,!0);const n=defaultValue(t.webgl,{});n.alpha=defaultValue(n.alpha,!1),n.stencil=defaultValue(n.stencil,!0);const i=defaultValue(t.requestWebgl2,!1)&&"undefined"!=typeof WebGL2RenderingContext;let r,o=!1;const a=t.getWebGLStub;if(defined(a))r=a(e,n);else if(i&&(r=e.getContext("webgl2",n)||e.getContext("experimental-webgl2",n)||void 0,defined(r)&&(o=!0)),defined(r)||(r=e.getContext("webgl",n)||e.getContext("experimental-webgl",n)||void 0),!defined(r))throw new RuntimeError("The browser supports WebGL, but initialization failed.");this._originalGLContext=r,this._gl=r,this._webgl2=o,this._id=createGuid(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new ShaderCache(this),this._textureCache=new TextureCache;const s=r;this._stencilBits=s.getParameter(s.STENCIL_BITS),ContextLimits._maximumCombinedTextureImageUnits=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ContextLimits._maximumCubeMapSize=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),ContextLimits._maximumFragmentUniformVectors=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),ContextLimits._maximumTextureImageUnits=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumRenderbufferSize=s.getParameter(s.MAX_RENDERBUFFER_SIZE),ContextLimits._maximumTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ContextLimits._maximumVaryingVectors=s.getParameter(s.MAX_VARYING_VECTORS),ContextLimits._maximumVertexAttributes=s.getParameter(s.MAX_VERTEX_ATTRIBS),ContextLimits._maximumVertexTextureImageUnits=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumVertexUniformVectors=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS);const c=s.getParameter(s.ALIASED_LINE_WIDTH_RANGE);ContextLimits._minimumAliasedLineWidth=c[0],ContextLimits._maximumAliasedLineWidth=c[1];const l=s.getParameter(s.ALIASED_POINT_SIZE_RANGE);ContextLimits._minimumAliasedPointSize=l[0],ContextLimits._maximumAliasedPointSize=l[1];const u=s.getParameter(s.MAX_VIEWPORT_DIMS);ContextLimits._maximumViewportWidth=u[0],ContextLimits._maximumViewportHeight=u[1];const d=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);ContextLimits._highpFloatSupported=0!==d.precision;const h=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_INT);ContextLimits._highpIntSupported=0!==h.rangeMax,this._antialias=s.getContextAttributes().antialias,this._standardDerivatives=!!getExtension(s,["OES_standard_derivatives"]),this._blendMinmax=!!getExtension(s,["EXT_blend_minmax"]),this._elementIndexUint=!!getExtension(s,["OES_element_index_uint"]),this._depthTexture=!!getExtension(s,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!getExtension(s,["EXT_frag_depth"]),this._debugShaders=getExtension(s,["WEBGL_debug_shaders"]),this._textureFloat=!!getExtension(s,["OES_texture_float"]),this._textureHalfFloat=!!getExtension(s,["OES_texture_half_float"]),this._textureFloatLinear=!!getExtension(s,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!getExtension(s,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!getExtension(s,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!getExtension(s,["EXT_float_blend"]),this._colorBufferHalfFloat=!!getExtension(s,["EXT_color_buffer_half_float"]),this._s3tc=!!getExtension(s,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!getExtension(s,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!getExtension(s,["WEBGL_compressed_texture_astc"]),this._etc=!!getExtension(s,["WEBG_compressed_texture_etc"]),this._etc1=!!getExtension(s,["WEBGL_compressed_texture_etc1"]),this._bc7=!!getExtension(s,["EXT_texture_compression_bptc"]),loadKTX2.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const p=t.allowTextureFilterAnisotropic?getExtension(s,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;let f,m,g,_,y,C,T,S,A,v;if(this._textureFilterAnisotropic=p,ContextLimits._maximumTextureFilterAnisotropy=defined(p)?s.getParameter(p.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,o){const e=this;f=function(){return e._gl.createVertexArray()},m=function(t){e._gl.bindVertexArray(t)},g=function(t){e._gl.deleteVertexArray(t)},_=function(e,t,n,i,r){s.drawElementsInstanced(e,t,n,i,r)},y=function(e,t,n,i){s.drawArraysInstanced(e,t,n,i)},C=function(e,t){s.vertexAttribDivisor(e,t)},T=function(e){s.drawBuffers(e)}}else S=getExtension(s,["OES_vertex_array_object"]),defined(S)&&(f=function(){return S.createVertexArrayOES()},m=function(e){S.bindVertexArrayOES(e)},g=function(e){S.deleteVertexArrayOES(e)}),A=getExtension(s,["ANGLE_instanced_arrays"]),defined(A)&&(_=function(e,t,n,i,r){A.drawElementsInstancedANGLE(e,t,n,i,r)},y=function(e,t,n,i){A.drawArraysInstancedANGLE(e,t,n,i)},C=function(e,t){A.vertexAttribDivisorANGLE(e,t)}),v=getExtension(s,["WEBGL_draw_buffers"]),defined(v)&&(T=function(e){v.drawBuffersWEBGL(e)});this.glCreateVertexArray=f,this.glBindVertexArray=m,this.glDeleteVertexArray=g,this.glDrawElementsInstanced=_,this.glDrawArraysInstanced=y,this.glVertexAttribDivisor=C,this.glDrawBuffers=T,this._vertexArrayObject=!!S,this._instancedArrays=!!A,this._drawBuffers=!!v,ContextLimits._maximumDrawBuffers=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_DRAW_BUFFERS):1,ContextLimits._maximumColorAttachments=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new Color(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const E=new UniformState,b=new PassState(this),x=RenderState.fromCache();this._defaultPassState=b,this._defaultRenderState=x,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=E,this._currentRenderState=x,this._currentPassState=b,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let e=0;e<ContextLimits._maximumVertexAttributes;e++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=t,this.cache={},RenderState.apply(s,x,b)}const defaultFramebufferMarker={};function applyRenderState(e,t,n,i){const r=e._currentRenderState,o=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,RenderState.partialApply(e._gl,r,t,o,n,i)}let scratchBackBufferArray;function bindFramebuffer(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=scratchBackBufferArray;if(defined(t))t._bind(),n=t._getActiveColorAttachments();else{const t=e._gl;t.bindFramebuffer(t.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}Object.defineProperties(Context.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}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},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=wrapGL(this._originalGLContext,e?throwOnError:void 0)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new Texture({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,0])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return void 0===this._defaultEmissiveTexture&&(this._defaultEmissiveTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return void 0===this._defaultNormalTexture&&(this._defaultNormalTexture=new Texture({context:this,pixelFormat:PixelFormat$1.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new CubeMap({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return defaultFramebufferMarker}}}),"undefined"!=typeof WebGLRenderingContext&&(scratchBackBufferArray=[WebGLConstants$1.BACK]);const defaultClearCommand=new ClearCommand;function beginDraw(e,t,n,i,r){bindFramebuffer(e,t),applyRenderState(e,r,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function continueDraw(e,t,n,i){const r=t._primitiveType,o=t._vertexArray;let a=t._offset,s=t._count;const c=t.instanceCount;e._us.model=defaultValue(t._modelMatrix,Matrix4.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),o._bind();const l=o.indexBuffer;defined(l)?(a*=l.bytesPerIndex,s=defaultValue(s,l.numberOfIndices),0===c?e._gl.drawElements(r,s,l.indexDatatype,a):e.glDrawElementsInstanced(r,s,l.indexDatatype,a,c)):(s=defaultValue(s,o.numberOfVertices),0===c?e._gl.drawArrays(r,a,s):e.glDrawArraysInstanced(r,a,s,c)),o._unBind()}Context.prototype.clear=function(e,t){e=defaultValue(e,defaultClearCommand),t=defaultValue(t,this._defaultPassState);const n=this._gl;let i=0;const r=e.color,o=e.depth,a=e.stencil;defined(r)&&(Color.equals(this._clearColor,r)||(Color.clone(r,this._clearColor),n.clearColor(r.red,r.green,r.blue,r.alpha)),i|=n.COLOR_BUFFER_BIT),defined(o)&&(o!==this._clearDepth&&(this._clearDepth=o,n.clearDepth(o)),i|=n.DEPTH_BUFFER_BIT),defined(a)&&(a!==this._clearStencil&&(this._clearStencil=a,n.clearStencil(a)),i|=n.STENCIL_BUFFER_BIT);applyRenderState(this,defaultValue(e.renderState,this._defaultRenderState),t,!0);bindFramebuffer(this,defaultValue(e.framebuffer,t.framebuffer)),n.clear(i)},Context.prototype.draw=function(e,t,n,i){t=defaultValue(t,this._defaultPassState);const r=defaultValue(e._framebuffer,t.framebuffer),o=defaultValue(e._renderState,this._defaultRenderState);n=defaultValue(n,e._shaderProgram),i=defaultValue(i,e._uniformMap),beginDraw(this,r,t,n,o),continueDraw(this,e,n,i)},Context.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=scratchBackBufferArray;this.drawBuffers&&this.glDrawBuffers(t);const n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let t=0;t<n;++t)e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},Context.prototype.readPixels=function(e){const t=this._gl;e=defaultValue(e,defaultValue.EMPTY_OBJECT);const n=Math.max(defaultValue(e.x,0),0),i=Math.max(defaultValue(e.y,0),0),r=defaultValue(e.width,t.drawingBufferWidth),o=defaultValue(e.height,t.drawingBufferHeight),a=e.framebuffer;let s=PixelDatatype$1.UNSIGNED_BYTE;defined(a)&&a.numberOfColorAttachments>0&&(s=a.getColorTexture(0).pixelDatatype);const c=PixelFormat$1.createTypedArray(PixelFormat$1.RGBA,s,r,o);return bindFramebuffer(this,a),t.readPixels(n,i,r,o,PixelFormat$1.RGBA,PixelDatatype$1.toWebGLConstant(s,this),c),c};const viewportQuadAttributeLocations={position:0,textureCoordinates:1};function PickId(e,t,n){this._pickObjects=e,this.key=t,this.color=n}function loadCubeMap(e,t,n){const i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},r=[Resource.createIfNeeded(t.positiveX).fetchImage(i),Resource.createIfNeeded(t.negativeX).fetchImage(i),Resource.createIfNeeded(t.positiveY).fetchImage(i),Resource.createIfNeeded(t.negativeY).fetchImage(i),Resource.createIfNeeded(t.positiveZ).fetchImage(i),Resource.createIfNeeded(t.negativeZ).fetchImage(i)];return when.all(r,(function(t){return new CubeMap({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})}))}function DiscardMissingTileImagePolicy(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Resource.createIfNeeded(e.missingImageUrl),n=this;t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then((function(t){defined(t.blob)&&(n._missingImageByteLength=t.blob.size);let i=getImagePixels(t);if(e.disableCheckIfAllPixelsAreTransparent){let n=!0;const r=t.width,o=e.pixelsToCheck;for(let e=0,t=o.length;n&&e<t;++e){const t=o[e];i[4*t.x+t.y*r+3]>0&&(n=!1)}n&&(i=void 0)}n._missingImagePixels=i,n._isReady=!0})).otherwise((function(){n._missingImagePixels=void 0,n._isReady=!0}))}function ImageryLayerFeatureInfo(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}function ImageryProvider(){this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,DeveloperError.throwInstantiationError()}Context.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!defined(e)){const t=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:PrimitiveType$1.TRIANGLES});e=VertexArray.fromGeometry({context:this,geometry:t,attributeLocations:viewportQuadAttributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},Context.prototype.createViewportQuadCommand=function(e,t){return t=defaultValue(t,defaultValue.EMPTY_OBJECT),new DrawCommand({vertexArray:this.getViewportQuadVertexArray(),primitiveType:PrimitiveType$1.TRIANGLES,renderState:t.renderState,shaderProgram:ShaderProgram.fromCache({context:this,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:e,attributeLocations:viewportQuadAttributeLocations}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})},Context.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},Object.defineProperties(PickId.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),PickId.prototype.destroy=function(){delete this._pickObjects[this.key]},Context.prototype.createPickId=function(e){++this._nextPickColor[0];const t=this._nextPickColor[0];if(0===t)throw new RuntimeError("Out of unique Pick IDs.");return this._pickObjects[t]=e,new PickId(this._pickObjects,t,Color.fromRgba(t))},Context.prototype.isDestroyed=function(){return!1},Context.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];defined(n.destroy)&&n.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),destroyObject(this)},DiscardMissingTileImagePolicy.prototype.isReady=function(){return this._isReady},DiscardMissingTileImagePolicy.prototype.shouldDiscardImage=function(e){const t=this._pixelsToCheck,n=this._missingImagePixels;if(!defined(n))return!1;if(defined(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=getImagePixels(e),r=e.width;for(let e=0,o=t.length;e<o;++e){const o=t[e],a=4*o.x+o.y*r;for(let e=0;e<4;++e){const t=a+e;if(i[t]!==n[t])return!1}}return!0},ImageryLayerFeatureInfo.prototype.configureNameFromProperties=function(e){let t,n=10;for(const i in e)if(e.hasOwnProperty(i)&&e[i]){const e=i.toLowerCase();n>1&&"name"===e?(n=1,t=i):n>2&&"title"===e?(n=2,t=i):n>3&&/name/i.test(i)?(n=3,t=i):n>4&&/title/i.test(i)&&(n=4,t=i)}defined(t)&&(this.name=e[t])},ImageryLayerFeatureInfo.prototype.configureDescriptionFromProperties=function(e){this.description=function e(t){let n='<table class="cesium-infoBox-defaultTable">';for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];defined(r)&&(n+="object"==typeof r?"<tr><td>"+i+"</td><td>"+e(r)+"</td></tr>":"<tr><td>"+i+"</td><td>"+r+"</td></tr>")}return n+="</table>",n}(e)},Object.defineProperties(ImageryProvider.prototype,{ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},tileWidth:{get:DeveloperError.throwInstantiationError},tileHeight:{get:DeveloperError.throwInstantiationError},maximumLevel:{get:DeveloperError.throwInstantiationError},minimumLevel:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},tileDiscardPolicy:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},proxy:{get:DeveloperError.throwInstantiationError},hasAlphaChannel:{get:DeveloperError.throwInstantiationError}}),ImageryProvider.prototype.getTileCredits=function(e,t,n){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.requestImage=function(e,t,n,i){DeveloperError.throwInstantiationError()},ImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){DeveloperError.throwInstantiationError()};const ktx2Regex=/\.ktx2$/i;function ArcGisMapServerImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url);t.appendForwardSlash(),defined(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),this._useTiles=defaultValue(e.usePreCachedTilesIfAvailable,!0),this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this.enablePickFeatures=defaultValue(e.enablePickFeatures,!0),this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();const i=this;let r;function o(t){const n=t.tileInfo;if(defined(n)){if(i._tileWidth=n.rows,i._tileHeight=n.cols,102100===n.spatialReference.wkid||102113===n.spatialReference.wkid)i._tilingScheme=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid});else{if(4326!==t.tileInfo.spatialReference.wkid){const e="Tile spatial reference WKID "+t.tileInfo.spatialReference.wkid+" is not supported.";return void(r=TileProviderError.handleError(r,i,i._errorEvent,e,void 0,void 0,void 0,s))}i._tilingScheme=new GeographicTilingScheme({ellipsoid:e.ellipsoid})}if(i._maximumLevel=t.tileInfo.lods.length-1,defined(t.fullExtent)){if(defined(t.fullExtent.spatialReference)&&defined(t.fullExtent.spatialReference.wkid))if(102100===t.fullExtent.spatialReference.wkid||102113===t.fullExtent.spatialReference.wkid){const e=new WebMercatorProjection,n=t.fullExtent,r=e.unproject(new Cartesian3(Math.max(n.xmin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(n.ymin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),o=e.unproject(new Cartesian3(Math.min(n.xmax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(n.ymax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));i._rectangle=new Rectangle(r.longitude,r.latitude,o.longitude,o.latitude)}else{if(4326!==t.fullExtent.spatialReference.wkid){const e="fullExtent.spatialReference WKID "+t.fullExtent.spatialReference.wkid+" is not supported.";return void(r=TileProviderError.handleError(r,i,i._errorEvent,e,void 0,void 0,void 0,s))}i._rectangle=Rectangle.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax)}}else i._rectangle=i._tilingScheme.rectangle;defined(i._tileDiscardPolicy)||(i._tileDiscardPolicy=new DiscardMissingTileImagePolicy({missingImageUrl:buildImageResource$3(i,0,0,i._maximumLevel).url,pixelsToCheck:[new Cartesian2(0,0),new Cartesian2(200,20),new Cartesian2(20,200),new Cartesian2(80,110),new Cartesian2(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),i._useTiles=!0}else i._useTiles=!1;defined(t.copyrightText)&&t.copyrightText.length>0&&(i._credit=new Credit(t.copyrightText)),i._ready=!0,i._readyPromise.resolve(!0),TileProviderError.handleSuccess(r)}function a(e){const t="An error occurred while accessing "+i._resource.url+".";r=TileProviderError.handleError(r,i,i._errorEvent,t,void 0,void 0,void 0,s),i._readyPromise.reject(new RuntimeError(t))}function s(){const e=i._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp();when(e,o,a)}this._useTiles?s():(this._ready=!0,this._readyPromise.resolve(!0))}function buildImageResource$3(e,t,n,i,r){let o;if(e._useTiles)o=e._resource.getDerivedResource({url:"tile/"+i+"/"+n+"/"+t,request:r});else{const a=e._tilingScheme.tileXYToNativeRectangle(t,n,i),s={bbox:a.west+","+a.south+","+a.east+","+a.north,size:e._tileWidth+","+e._tileHeight,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof GeographicProjection?(s.bboxSR=4326,s.imageSR=4326):(s.bboxSR=3857,s.imageSR=3857),e.layers&&(s.layers="show:"+e.layers),o=e._resource.getDerivedResource({url:"export",request:r,queryParameters:s})}return o}function AutoExposure(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new FramebufferManager,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new Cartesian2,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}function destroyFramebuffers$3(e){const t=e._framebuffers;if(!defined(t))return;const n=t.length;for(let e=0;e<n;++e)t[e].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function createFramebuffers$1(e,t){destroyFramebuffers$3(e);let n=e._width,i=e._height;const r=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT,o=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),a=new Array(o);for(let e=0;e<o;++e)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),a[e]=new FramebufferManager,a[e].update(t,n,i,r);const s=a[o-1].getColorTexture(0);e._previousLuminance.update(t,s.width,s.height,r),e._framebuffers=a}function destroyCommands(e){const t=e._commands;if(!defined(t))return;const n=t.length;for(let e=0;e<n;++e)t[e].shaderProgram.destroy();e._commands=void 0}function createUniformMap$1(e,t){let n;if(0===t)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function getShaderSource(e,t){let n="uniform sampler2D colorTexture; \nvarying vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";return n+=0===e?" vec4 color = texture2D(colorTexture, v_textureCoordinates + offset); \n return czm_luminance(color.rgb); \n":" return texture2D(colorTexture, v_textureCoordinates + offset).r; \n",n+="}\n\n",n+="uniform vec2 colorTextureDimensions; \nuniform vec2 minMaxLuminance; \nuniform sampler2D previousLuminance; \nvoid main() { \n float color = 0.0; \n float xStep = 1.0 / colorTextureDimensions.x; \n float yStep = 1.0 / colorTextureDimensions.y; \n int count = 0; \n for (int i = 0; i < 3; ++i) { \n for (int j = 0; j < 3; ++j) { \n vec2 offset; \n offset.x = -xStep + float(i) * xStep; \n offset.y = -yStep + float(j) * yStep; \n if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { \n continue; \n } \n color += sampleTexture(offset); \n ++count; \n } \n } \n if (count > 0) { \n color /= float(count); \n } \n",e===t-1&&(n+=" float previous = texture2D(previousLuminance, vec2(0.5)).r; \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n color = previous + (color - previous) / (60.0 * 1.5); \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n"),n+=" gl_FragColor = vec4(color); \n} \n",n}function createCommands(e,t){destroyCommands(e);const n=e._framebuffers,i=n.length,r=new Array(i);for(let o=0;o<i;++o)r[o]=t.createViewportQuadCommand(getShaderSource(o,i),{framebuffer:n[o].framebuffer,uniformMap:createUniformMap$1(e,o)});e._commands=r}ImageryProvider.loadImage=function(e,t){const n=Resource.createIfNeeded(t);return ktx2Regex.test(n.url)?loadKTX2(n):defined(e)&&defined(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})},Object.defineProperties(ArcGisMapServerImageryProvider.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.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}}}),ArcGisMapServerImageryProvider.prototype.getTileCredits=function(e,t,n){},ArcGisMapServerImageryProvider.prototype.requestImage=function(e,t,n,i){return ImageryProvider.loadImage(this,buildImageResource$3(this,e,t,n,i))},ArcGisMapServerImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){if(!this.enablePickFeatures)return;const o=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let a,s,c;if(this._tilingScheme.projection instanceof GeographicProjection)a=CesiumMath.toDegrees(i),s=CesiumMath.toDegrees(r),c="4326";else{const e=this._tilingScheme.projection.project(new Cartographic(i,r,0));a=e.x,s=e.y,c="3857"}let l="visible";defined(this._layers)&&(l+=":"+this._layers);const u={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:a+","+s,mapExtent:o.west+","+o.south+","+o.east+","+o.north,imageDisplay:this._tileWidth+","+this._tileHeight+",96",sr:c,layers:l};return this._resource.getDerivedResource({url:"identify",queryParameters:u}).fetchJson().then((function(e){const t=[],n=e.results;if(!defined(n))return t;for(let e=0;e<n.length;++e){const i=n[e],r=new ImageryLayerFeatureInfo;if(r.data=i,r.name=i.value,r.properties=i.attributes,r.configureDescriptionFromProperties(i.attributes),"esriGeometryPoint"===i.geometryType&&i.geometry){const e=i.geometry.spatialReference&&i.geometry.spatialReference.wkid?i.geometry.spatialReference.wkid:4326;if(4326===e||4283===e)r.position=Cartographic.fromDegrees(i.geometry.x,i.geometry.y,i.geometry.z);else if(102100===e||900913===e||3857===e){const e=new WebMercatorProjection;r.position=e.unproject(new Cartesian3(i.geometry.x,i.geometry.y,i.geometry.z))}}t.push(r)}return t}))},Object.defineProperties(AutoExposure.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(defined(e))return e[e.length-1].getColorTexture(0)}}}),AutoExposure.prototype.clear=function(e){const t=this._framebuffers;if(!defined(t))return;let n=this._clearCommand;defined(n)||(n=this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let r=0;r<i;++r)t[r].clear(e,n)},AutoExposure.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;t===this._width&&n===this._height||(this._width=t,this._height=n,createFramebuffers$1(this,e),createCommands(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const i=this._framebuffers,r=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=r},AutoExposure.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!defined(n))return;const i=n.length;for(let t=0;t<i;++t)n[t].execute(e)},AutoExposure.prototype.isDestroyed=function(){return!1},AutoExposure.prototype.destroy=function(){return destroyFramebuffers$3(this),destroyCommands(this),destroyObject(this)};const BingMapsStyle={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"};var BingMapsStyle$1=Object.freeze(BingMapsStyle);function DiscardEmptyTileImagePolicy(e){}let emptyImage;function BingMapsImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=Resource.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=defaultValue(e.mapStyle,BingMapsStyle$1.AERIAL),this._culture=defaultValue(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new DiscardEmptyTileImagePolicy),this._proxy=e.proxy,this._credit=new Credit('<a href="http://www.bing.com"><img src="'+BingMapsImageryProvider.logoUrl+'" title="Bing Imagery"/></a>'),this._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();let n=this._tileProtocol;if(defined(n))n.length>0&&":"===n[n.length-1]&&(n=n.substr(0,n.length-1));else{n="http:"===document.location.protocol?"http":"https"}const i=this._resource.getDerivedResource({url:"REST/v1/Imagery/Metadata/"+this._mapStyle,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:n}}),r=this;let o;function a(e){if(1!==e.resourceSets.length)return void s();const t=e.resourceSets[0].resources[0];r._tileWidth=t.imageWidth,r._tileHeight=t.imageHeight,r._maximumLevel=t.zoomMax-1,r._imageUrlSubdomains=t.imageUrlSubdomains,r._imageUrlTemplate=t.imageUrl;let n=r._attributionList=t.imageryProviders;n||(n=r._attributionList=[]);for(let e=0,t=n.length;e<t;++e){const t=n[e];if(t.credit instanceof Credit)break;t.credit=new Credit(t.attribution);const i=t.coverageAreas;for(let e=0,n=t.coverageAreas.length;e<n;++e){const t=i[e],n=t.bbox;t.bbox=new Rectangle(CesiumMath.toRadians(n[1]),CesiumMath.toRadians(n[0]),CesiumMath.toRadians(n[3]),CesiumMath.toRadians(n[2]))}}r._ready=!0,r._readyPromise.resolve(!0),TileProviderError.handleSuccess(o)}function s(e){const t="An error occurred while accessing "+i.url+".";o=TileProviderError.handleError(o,r,r._errorEvent,t,void 0,void 0,void 0,l),r._readyPromise.reject(new RuntimeError(t))}const c=i.url;function l(){const e=i.fetchJsonp("jsonp");BingMapsImageryProvider._metadataCache[c]=e,e.then(a).otherwise(s)}const u=BingMapsImageryProvider._metadataCache[c];defined(u)?u.then(a).otherwise(s):l()}DiscardEmptyTileImagePolicy.prototype.isReady=function(){return!0},DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage=function(e){return DiscardEmptyTileImagePolicy.EMPTY_IMAGE===e},Object.defineProperties(DiscardEmptyTileImagePolicy,{EMPTY_IMAGE:{get:function(){return defined(emptyImage)||(emptyImage=new Image,emptyImage.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),emptyImage}}}),Object.defineProperties(BingMapsImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.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}}});const rectangleScratch$1=new Rectangle;function buildImageResource$2(e,t,n,i,r){const o=e._imageUrlTemplate,a=e._imageUrlSubdomains,s=(t+n+i)%a.length;return e._resource.getDerivedResource({url:o,request:r,templateValues:{quadkey:BingMapsImageryProvider.tileXYToQuadKey(t,n,i),subdomain:a[s],culture:e._culture},queryParameters:{n:"z"}})}BingMapsImageryProvider.prototype.getTileCredits=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(e,t,n,rectangleScratch$1);return getRectangleAttribution(this._attributionList,n,i)},BingMapsImageryProvider.prototype.requestImage=function(e,t,n,i){const r=ImageryProvider.loadImage(this,buildImageResource$2(this,e,t,n,i));if(defined(r))return r.otherwise((function(e){return defined(e.blob)&&0===e.blob.size?DiscardEmptyTileImagePolicy.EMPTY_IMAGE:when.reject(e)}))},BingMapsImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){},BingMapsImageryProvider.tileXYToQuadKey=function(e,t,n){let i="";for(let r=n;r>=0;--r){const n=1<<r;let o=0;0!=(e&n)&&(o|=1),0!=(t&n)&&(o|=2),i+=o}return i},BingMapsImageryProvider.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let r=i;r>=0;--r){const o=1<<r,a=+e[i-r];0!=(1&a)&&(t|=o),0!=(2&a)&&(n|=o)}return{x:t,y:n,level:i}},BingMapsImageryProvider._logoUrl=void 0,Object.defineProperties(BingMapsImageryProvider,{logoUrl:{get:function(){return defined(BingMapsImageryProvider._logoUrl)||(BingMapsImageryProvider._logoUrl=buildModuleUrl("Assets/Images/bing_maps_credit.png")),BingMapsImageryProvider._logoUrl},set:function(e){BingMapsImageryProvider._logoUrl=e}}});const intersectionScratch=new Rectangle;function getRectangleAttribution(e,t,n){++t;const i=[];for(let r=0,o=e.length;r<o;++r){const o=e[r],a=o.coverageAreas;let s=!1;for(let e=0,i=o.coverageAreas.length;!s&&e<i;++e){const i=a[e];if(t>=i.zoomMin&&t<=i.zoomMax){defined(Rectangle.intersection(n,i.bbox,intersectionScratch))&&(s=!0)}}s&&i.push(o.credit)}return i}BingMapsImageryProvider._metadataCache={};const defaultDimensions=new Cartesian3(1,1,1);function BoxEmitter(e){e=defaultValue(e,defaultDimensions),this._dimensions=Cartesian3.clone(e)}Object.defineProperties(BoxEmitter.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){Cartesian3.clone(e,this._dimensions)}}});const scratchHalfDim=new Cartesian3;BoxEmitter.prototype.emit=function(e){const t=this._dimensions,n=Cartesian3.multiplyByScalar(t,.5,scratchHalfDim),i=CesiumMath.randomBetween(-n.x,n.x),r=CesiumMath.randomBetween(-n.y,n.y),o=CesiumMath.randomBetween(-n.z,n.z);e.position=Cartesian3.fromElements(i,r,o,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)};var BrdfLutGeneratorFS="varying vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\nfloat vdcRadicalInverse(int i)\n{\nfloat r;\nfloat base = 2.0;\nfloat value = 0.0;\nfloat invBase = 1.0 / base;\nfloat invBi = invBase;\nfor (int x = 0; x < 100; x++)\n{\nif (i <= 0)\n{\nbreak;\n}\nr = mod(float(i), base);\nvalue += r * invBi;\ninvBi *= invBase;\ni = int(float(i) * invBase);\n}\nreturn value;\n}\nvec2 hammersley2D(int i, int N)\n{\nreturn vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\nfloat a = roughness * roughness;\nfloat phi = 2.0 * M_PI * xi.x;\nfloat cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\nfloat sinTheta = sqrt(1.0 - cosTheta * cosTheta);\nvec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\nvec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\nvec3 tangentX = normalize(cross(upVector, N));\nvec3 tangentY = cross(N, tangentX);\nreturn tangentX * H.x + tangentY * H.y + N * H.z;\n}\nfloat G1_Smith(float NdotV, float k)\n{\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\nfloat k = roughness * roughness / 2.0;\nreturn G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\nvec2 integrateBrdf(float roughness, float NdotV)\n{\nvec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\nfloat A = 0.0;\nfloat B = 0.0;\nconst int NumSamples = 1024;\nfor (int i = 0; i < NumSamples; i++)\n{\nvec2 xi = hammersley2D(i, NumSamples);\nvec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\nvec3 L = 2.0 * dot(V, H) * H - V;\nfloat NdotL = clamp(L.z, 0.0, 1.0);\nfloat NdotH = clamp(H.z, 0.0, 1.0);\nfloat VdotH = clamp(dot(V, H), 0.0, 1.0);\nif (NdotL > 0.0)\n{\nfloat G = G_Smith(roughness, NdotV, NdotL);\nfloat G_Vis = G * VdotH / (NdotH * NdotV);\nfloat Fc = pow(1.0 - VdotH, 5.0);\nA += (1.0 - Fc) * G_Vis;\nB += Fc * G_Vis;\n}\n}\nreturn vec2(A, B) / float(NumSamples);\n}\nvoid main()\n{\ngl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n";function BrdfLutGenerator(){this._colorTexture=void 0,this._drawCommand=void 0}function createCommand$1(e,t,n){const i=t.createViewportQuadCommand(BrdfLutGeneratorFS,{framebuffer:n,renderState:RenderState.fromCache({viewport:new BoundingRectangle(0,0,256,256)})});e._drawCommand=i}Object.defineProperties(BrdfLutGenerator.prototype,{colorTexture:{get:function(){return this._colorTexture}}}),BrdfLutGenerator.prototype.update=function(e){if(!defined(this._colorTexture)){const t=e.context,n=new Texture({context:t,width:256,height:256,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST});this._colorTexture=n;const i=new Framebuffer({context:t,colorTextures:[n],destroyAttachments:!1});createCommand$1(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}},BrdfLutGenerator.prototype.isDestroyed=function(){return!1},BrdfLutGenerator.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),destroyObject(this)};const CameraFlightPath={};function getAltitude(e,t,n){let i,r,o;if(e instanceof PerspectiveFrustum){const a=Math.tan(.5*e.fovy);return i=e.near,r=e.near*a,o=e.aspectRatio*r,Math.max(t*i/o,n*i/r)}return e instanceof PerspectiveOffCenterFrustum?(i=e.near,r=e.top,o=e.right,Math.max(t*i/o,n*i/r)):Math.max(t,n)}const scratchCart=new Cartesian3,scratchCart2=new Cartesian3;function createPitchFunction(e,t,n,i){if(defined(i)&&n(.5)>i){const i=n(0),r=n(1),o=n(.5),a=o-i,s=o-r;return function(o){const c=n(o);if(o<=.5){const t=(c-i)/a;return CesiumMath.lerp(e,-CesiumMath.PI_OVER_TWO,t)}const l=(c-r)/s;return CesiumMath.lerp(-CesiumMath.PI_OVER_TWO,t,1-l)}}return function(n){return CesiumMath.lerp(e,t,n)}}function createHeightFunction(e,t,n,i,r){let o=r;const a=Math.max(n,i);if(!defined(o)){const n=e.position,i=t,r=e.up,a=e.right,s=e.frustum,c=Cartesian3.subtract(n,i,scratchCart),l=Cartesian3.magnitude(Cartesian3.multiplyByScalar(r,Cartesian3.dot(c,r),scratchCart2)),u=Cartesian3.magnitude(Cartesian3.multiplyByScalar(a,Cartesian3.dot(c,a),scratchCart2));o=Math.min(.2*getAltitude(s,l,u),1e9)}if(a<o){const e=8,t=1e6,r=-Math.pow((o-n)*t,1/e),a=Math.pow((o-i)*t,1/e);return function(n){const i=n*(a-r)+r;return-Math.pow(i,e)/t+o}}return function(e){return CesiumMath.lerp(n,i,e)}}function adjustAngleForLERP(e,t){return CesiumMath.equalsEpsilon(e,CesiumMath.TWO_PI,CesiumMath.EPSILON11)&&(e=0),t>e+Math.PI?e+=CesiumMath.TWO_PI:t<e-Math.PI&&(e-=CesiumMath.TWO_PI),e}const scratchStart=new Cartesian3;function createUpdateCV(e,t,n,i,r,o,a,s){const c=e.camera,l=Cartesian3.clone(c.position,scratchStart),u=c.pitch,d=adjustAngleForLERP(c.heading,i),h=adjustAngleForLERP(c.roll,o),p=createHeightFunction(c,n,l.z,n.z,a),f=createPitchFunction(u,r,p,s);return function(e){const r=e.time/t;c.setView({orientation:{heading:CesiumMath.lerp(d,i,r),pitch:f(r),roll:CesiumMath.lerp(h,o,r)}}),Cartesian2.lerp(l,n,r,c.position),c.position.z=p(r)}}function useLongestFlight(e,t){e.longitude<t.longitude?e.longitude+=CesiumMath.TWO_PI:t.longitude+=CesiumMath.TWO_PI}function useShortestFlight(e,t){const n=e.longitude-t.longitude;n<-CesiumMath.PI?e.longitude+=CesiumMath.TWO_PI:n>CesiumMath.PI&&(t.longitude+=CesiumMath.TWO_PI)}const scratchStartCart=new Cartographic,scratchEndCart=new Cartographic;function createUpdate3D(e,t,n,i,r,o,a,s,c,l){const u=e.camera,d=e.mapProjection.ellipsoid,h=Cartographic.clone(u.positionCartographic,scratchStartCart),p=u.pitch,f=adjustAngleForLERP(u.heading,i),m=adjustAngleForLERP(u.roll,o),g=d.cartesianToCartographic(n,scratchEndCart);h.longitude=CesiumMath.zeroToTwoPi(h.longitude),g.longitude=CesiumMath.zeroToTwoPi(g.longitude);let _=!1;if(defined(s)){const e=CesiumMath.zeroToTwoPi(s),t=Math.min(h.longitude,g.longitude),n=Math.max(h.longitude,g.longitude),i=e>=t&&e<=n;if(defined(c)){const e=Math.abs(h.longitude-g.longitude),t=CesiumMath.TWO_PI-e;(i?e:t)<(i?t:e)*c&&!i&&(_=!0)}else i||(_=!0)}_?useLongestFlight(h,g):useShortestFlight(h,g);const y=createHeightFunction(u,n,h.height,g.height,a),C=createPitchFunction(p,r,y,l);return function(){const e=h.longitude,n=g.longitude,r=h.latitude,a=g.latitude;return function(s){const c=s.time/t,l=Cartesian3.fromRadians(CesiumMath.lerp(e,n,c),CesiumMath.lerp(r,a,c),y(c),d);u.setView({destination:l,orientation:{heading:CesiumMath.lerp(f,i,c),pitch:C(c),roll:CesiumMath.lerp(m,o,c)}})}}()}function createUpdate2D(e,t,n,i,r,o,a){const s=e.camera,c=Cartesian3.clone(s.position,scratchStart),l=adjustAngleForLERP(s.heading,i),u=s.frustum.right-s.frustum.left,d=createHeightFunction(s,n,u,n.z,a);return function(e){const r=e.time/t;s.setView({orientation:{heading:CesiumMath.lerp(l,i,r)}}),Cartesian2.lerp(c,n,r,s.position);const o=d(r),a=s.frustum,u=a.top/a.right,h=.5*(o-(a.right-a.left));a.right+=h,a.left-=h,a.top=u*a.right,a.bottom=-a.top}}const scratchCartographic$5=new Cartographic,scratchDestination=new Cartesian3;function emptyFlight(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function wrapCallback(e,t){return function(){"function"==typeof t&&t(),e.enableInputs=!0}}CameraFlightPath.createTween=function(e,t){let n=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).destination;const i=e.mode;if(i===SceneMode$1.MORPHING)return emptyFlight();const r=defaultValue(t.convert,!0),o=e.mapProjection,a=o.ellipsoid,s=t.maximumHeight,c=t.flyOverLongitude,l=t.flyOverLongitudeWeight,u=t.pitchAdjustHeight;let d=t.easingFunction;r&&i!==SceneMode$1.SCENE3D&&(a.cartesianToCartographic(n,scratchCartographic$5),n=o.project(scratchCartographic$5,scratchDestination));const h=e.camera,p=t.endTransform;defined(p)&&h._setTransform(p);let f=t.duration;defined(f)||(f=Math.ceil(Cartesian3.distance(h.position,n)/1e6)+2,f=Math.min(f,3));const m=defaultValue(t.heading,0),g=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),_=defaultValue(t.roll,0),y=e.screenSpaceCameraController;y.enableInputs=!1;const C=wrapCallback(y,t.complete),T=wrapCallback(y,t.cancel),S=h.frustum;let A=e.mode===SceneMode$1.SCENE2D;if(A=A&&Cartesian2.equalsEpsilon(h.position,n,CesiumMath.EPSILON6),A=A&&CesiumMath.equalsEpsilon(Math.max(S.right-S.left,S.top-S.bottom),n.z,CesiumMath.EPSILON6),A=A||e.mode!==SceneMode$1.SCENE2D&&Cartesian3.equalsEpsilon(n,h.position,CesiumMath.EPSILON10),A=A&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(m),CesiumMath.negativePiToPi(h.heading),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(g),CesiumMath.negativePiToPi(h.pitch),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(_),CesiumMath.negativePiToPi(h.roll),CesiumMath.EPSILON10),A)return emptyFlight(C,T);const v=new Array(4);if(v[SceneMode$1.SCENE2D]=createUpdate2D,v[SceneMode$1.SCENE3D]=createUpdate3D,v[SceneMode$1.COLUMBUS_VIEW]=createUpdateCV,f<=0){return emptyFlight((function(){v[i](e,1,n,m,g,_,s,c,l,u)({time:1}),"function"==typeof C&&C()}),T)}const E=v[i](e,f,n,m,g,_,s,c,l,u);if(!defined(d)){const e=h.positionCartographic.height;d=e>(i===SceneMode$1.SCENE3D?a.cartesianToCartographic(n).height:n.z)&&e>11500?EasingFunction$1.CUBIC_OUT:EasingFunction$1.QUINTIC_IN_OUT}return{duration:f,easingFunction:d,startObject:{time:0},stopObject:{time:f},update:E,complete:C,cancel:T}};const MapMode2D={ROTATE:0,INFINITE_SCROLL:1};var MapMode2D$1=Object.freeze(MapMode2D);function Camera(e){this._scene=e,this._transform=Matrix4.clone(Matrix4.IDENTITY),this._invTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualInvTransform=Matrix4.clone(Matrix4.IDENTITY),this._transformChanged=!1,this.position=new Cartesian3,this._position=new Cartesian3,this._positionWC=new Cartesian3,this._positionCartographic=new Cartographic,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new Cartesian3,this._direction=new Cartesian3,this._directionWC=new Cartesian3,this.up=new Cartesian3,this._up=new Cartesian3,this._upWC=new Cartesian3,this.right=new Cartesian3,this._right=new Cartesian3,this._rightWC=new Cartesian3,this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new Event,this._moveEnd=new Event,this._changed=new Event,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this.percentageChanged=.5,this._viewMatrix=new Matrix4,this._invViewMatrix=new Matrix4,updateViewMatrix(this),this._mode=SceneMode$1.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._max2Dfrustum=void 0,rectangleCameraPosition3D(this,Camera.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=Cartesian3.magnitude(this.position);n+=n*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(this.position,this.position),Cartesian3.multiplyByScalar(this.position,n,this.position)}function updateViewMatrix(e){Matrix4.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),Matrix4.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),Matrix4.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function updateCameraDeltas(e){if(defined(e._oldPositionWC)){e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=Cartesian3.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=Cartesian3.magnitude(t),e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=getTimestamp$1()):e.timeSinceMoved=Math.max(getTimestamp$1()-e._lastMovedTimestamp,0)/1e3}else e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC)}function convertTransformForColumbusView(e){Transforms.basisTo2D(e._projection,e._transform,e._actualTransform)}Camera.TRANSFORM_2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Camera.TRANSFORM_2D_INVERSE=Matrix4.inverseTransformation(Camera.TRANSFORM_2D,new Matrix4),Camera.DEFAULT_VIEW_RECTANGLE=Rectangle.fromDegrees(-95,-20,-70,90),Camera.DEFAULT_VIEW_FACTOR=.5,Camera.DEFAULT_OFFSET=new HeadingPitchRange(0,-CesiumMath.PI_OVER_FOUR,0),Camera.prototype.canPreloadFlight=function(){return defined(this._currentFlight)&&this._mode!==SceneMode$1.SCENE2D},Camera.prototype._updateCameraChanged=function(){const e=this;if(updateCameraDeltas(e),0===e._changed.numberOfListeners)return;const t=e.percentageChanged,n=e.heading;defined(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%CesiumMath.TWO_PI;i=i>CesiumMath.PI?CesiumMath.TWO_PI-i:i;const r=i/Math.PI;if(r>t&&(e._changed.raiseEvent(r),e._changedHeading=n),e._mode===SceneMode$1.SCENE2D){if(!defined(e._changedFrustum))return e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),void(e._changedFrustum=e.frustum.clone());const n=e.position,i=e._changedPosition,r=e.frustum,o=e._changedFrustum,a=n.x+r.left,s=n.x+r.right,c=i.x+o.left,l=i.x+o.right,u=n.y+r.bottom,d=n.y+r.top,h=i.y+o.bottom,p=i.y+o.top,f=Math.max(a,c),m=Math.min(s,l),g=Math.max(u,h),_=Math.min(d,p);let y;if(f>=m||g>=d)y=1;else{let e=o;a<c&&s>l&&u<h&&d>p&&(e=r),y=1-(m-f)*(_-g)/((e.right-e.left)*(e.top-e.bottom))}return void(y>t&&(e._changed.raiseEvent(y),e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum)))}if(!defined(e._changedDirection))return e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),void(e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection));const o=CesiumMath.acosClamped(Cartesian3.dot(e.directionWC,e._changedDirection));let a;a=defined(e.frustum.fovy)?o/(.5*e.frustum.fovy):o;const s=Cartesian3.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(a>t||s>t)&&(e._changed.raiseEvent(Math.max(a,s)),e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection))};const scratchCartographic$4=new Cartographic,scratchCartesian3Projection=new Cartesian3,scratchCartesian3$1=new Cartesian3,scratchCartesian4Origin=new Cartesian4,scratchCartesian4NewOrigin=new Cartesian4,scratchCartesian4NewXAxis=new Cartesian4,scratchCartesian4NewYAxis=new Cartesian4,scratchCartesian4NewZAxis=new Cartesian4;function convertTransformFor2D(e){const t=e._projection,n=t.ellipsoid,i=Matrix4.getColumn(e._transform,3,scratchCartesian4Origin),r=n.cartesianToCartographic(i,scratchCartographic$4),o=t.project(r,scratchCartesian3Projection),a=scratchCartesian4NewOrigin;a.x=o.z,a.y=o.x,a.z=o.y,a.w=1;const s=Cartesian4.clone(Cartesian4.UNIT_X,scratchCartesian4NewZAxis),c=Cartesian4.add(Matrix4.getColumn(e._transform,0,scratchCartesian3$1),i,scratchCartesian3$1);n.cartesianToCartographic(c,r),t.project(r,o);const l=scratchCartesian4NewXAxis;l.x=o.z,l.y=o.x,l.z=o.y,l.w=0,Cartesian3.subtract(l,a,l),l.x=0;const u=scratchCartesian4NewYAxis;if(Cartesian3.magnitudeSquared(l)>CesiumMath.EPSILON10)Cartesian3.cross(s,l,u);else{const s=Cartesian4.add(Matrix4.getColumn(e._transform,1,scratchCartesian3$1),i,scratchCartesian3$1);n.cartesianToCartographic(s,r),t.project(r,o),u.x=o.z,u.y=o.x,u.z=o.y,u.w=0,Cartesian3.subtract(u,a,u),u.x=0,Cartesian3.magnitudeSquared(u)<CesiumMath.EPSILON10&&(Cartesian4.clone(Cartesian4.UNIT_Y,l),Cartesian4.clone(Cartesian4.UNIT_Z,u))}Cartesian3.cross(u,s,l),Cartesian3.normalize(l,l),Cartesian3.cross(s,l,u),Cartesian3.normalize(u,u),Matrix4.setColumn(e._actualTransform,0,l,e._actualTransform),Matrix4.setColumn(e._actualTransform,1,u,e._actualTransform),Matrix4.setColumn(e._actualTransform,2,s,e._actualTransform),Matrix4.setColumn(e._actualTransform,3,a,e._actualTransform)}const scratchCartesian$1=new Cartesian3;function updateMembers(e){const t=e._mode;let n=!1,i=0;t===SceneMode$1.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let r=e._position;const o=!Cartesian3.equals(r,e.position)||n;o&&(r=Cartesian3.clone(e.position,e._position));let a=e._direction;const s=!Cartesian3.equals(a,e.direction);s&&(Cartesian3.normalize(e.direction,e.direction),a=Cartesian3.clone(e.direction,e._direction));let c=e._up;const l=!Cartesian3.equals(c,e.up);l&&(Cartesian3.normalize(e.up,e.up),c=Cartesian3.clone(e.up,e._up));let u=e._right;const d=!Cartesian3.equals(u,e.right);d&&(Cartesian3.normalize(e.right,e.right),u=Cartesian3.clone(e.right,e._right));const h=e._transformChanged||e._modeChanged;e._transformChanged=!1,h&&(Matrix4.inverseTransformation(e._transform,e._invTransform),e._mode===SceneMode$1.COLUMBUS_VIEW||e._mode===SceneMode$1.SCENE2D?Matrix4.equals(Matrix4.IDENTITY,e._transform)?Matrix4.clone(Camera.TRANSFORM_2D,e._actualTransform):e._mode===SceneMode$1.COLUMBUS_VIEW?convertTransformForColumbusView(e):convertTransformFor2D(e):Matrix4.clone(e._transform,e._actualTransform),Matrix4.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const p=e._actualTransform;if(o||h)if(e._positionWC=Matrix4.multiplyByPoint(p,r,e._positionWC),t===SceneMode$1.SCENE3D||t===SceneMode$1.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const n=scratchCartesian$1;n.x=e._positionWC.y,n.y=e._positionWC.z,n.z=e._positionWC.x,t===SceneMode$1.SCENE2D&&(n.z=i),e._projection.unproject(n,e._positionCartographic)}if(s||l||d){const t=Cartesian3.dot(a,Cartesian3.cross(c,u,scratchCartesian$1));if(Math.abs(1-t)>CesiumMath.EPSILON2){const t=1/Cartesian3.magnitudeSquared(c),n=Cartesian3.dot(c,a)*t,i=Cartesian3.multiplyByScalar(a,n,scratchCartesian$1);c=Cartesian3.normalize(Cartesian3.subtract(c,i,e._up),e._up),Cartesian3.clone(c,e.up),u=Cartesian3.cross(a,c,e._right),Cartesian3.clone(u,e.right)}}(s||h)&&(e._directionWC=Matrix4.multiplyByPointAsVector(p,a,e._directionWC),Cartesian3.normalize(e._directionWC,e._directionWC)),(l||h)&&(e._upWC=Matrix4.multiplyByPointAsVector(p,c,e._upWC),Cartesian3.normalize(e._upWC,e._upWC)),(d||h)&&(e._rightWC=Matrix4.multiplyByPointAsVector(p,u,e._rightWC),Cartesian3.normalize(e._rightWC,e._rightWC)),(o||s||l||d||h)&&updateViewMatrix(e)}function getHeading(e,t){let n;return n=CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)?Math.atan2(t.y,t.x)-CesiumMath.PI_OVER_TWO:Math.atan2(e.y,e.x)-CesiumMath.PI_OVER_TWO,CesiumMath.TWO_PI-CesiumMath.zeroToTwoPi(n)}function getPitch(e){return CesiumMath.PI_OVER_TWO-CesiumMath.acosClamped(e.z)}function getRoll(e,t,n){let i=0;return CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=CesiumMath.zeroToTwoPi(i+CesiumMath.TWO_PI)),i}const scratchHPRMatrix1=new Matrix4,scratchHPRMatrix2=new Matrix4;Object.defineProperties(Camera.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return updateMembers(this),this._invTransform}},viewMatrix:{get:function(){return updateMembers(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return updateMembers(this),this._invViewMatrix}},positionCartographic:{get:function(){return updateMembers(this),this._positionCartographic}},positionWC:{get:function(){return updateMembers(this),this._positionWC}},directionWC:{get:function(){return updateMembers(this),this._directionWC}},upWC:{get:function(){return updateMembers(this),this._upWC}},rightWC:{get:function(){return updateMembers(this),this._rightWC}},heading:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),n=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(n);const i=getHeading(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),n=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(n);const i=getPitch(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==SceneMode$1.MORPHING){const e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),n=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(n);const i=getRoll(this.direction,this.up,this.right);return this._setTransform(t),i}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}}),Camera.prototype.update=function(e){let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==SceneMode$1.MORPHING,t=this._mode===SceneMode$1.SCENE2D),t){const e=this._max2Dfrustum=this.frustum.clone(),t=2,n=e.top/e.right;e.right=this._maxCoord.x*t,e.left=-e.right,e.top=n*e.right,e.bottom=-e.top}this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,this.position)};const setTransformPosition=new Cartesian3,setTransformUp=new Cartesian3,setTransformDirection=new Cartesian3;Camera.prototype._setTransform=function(e){const t=Cartesian3.clone(this.positionWC,setTransformPosition),n=Cartesian3.clone(this.upWC,setTransformUp),i=Cartesian3.clone(this.directionWC,setTransformDirection);Matrix4.clone(e,this._transform),this._transformChanged=!0,updateMembers(this);const r=this._actualInvTransform;Matrix4.multiplyByPoint(r,t,this.position),Matrix4.multiplyByPointAsVector(r,i,this.direction),Matrix4.multiplyByPointAsVector(r,n,this.up),Cartesian3.cross(this.direction,this.up,this.right),updateMembers(this)};const scratchAdjustOrthographicFrustumMousePosition=new Cartesian2,scratchPickRay$1=new Ray,scratchRayIntersection$1=new Cartesian3,scratchDepthIntersection$1=new Cartesian3;function calculateOrthographicFrustumWidth(e){if(!Matrix4.equals(Matrix4.IDENTITY,e.transform))return Cartesian3.magnitude(e.position);const t=e._scene,n=t.globe,i=scratchAdjustOrthographicFrustumMousePosition;let r,o,a;if(i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2,defined(n)){const o=e.getPickRay(i,scratchPickRay$1);r=n.pickWorldCoordinates(o,t,!0,scratchRayIntersection$1)}if(t.pickPositionSupported&&(o=t.pickPositionWorldCoordinates(i,scratchDepthIntersection$1)),defined(r)||defined(o)){const t=defined(o)?Cartesian3.distance(o,e.positionWC):Number.POSITIVE_INFINITY,n=defined(r)?Cartesian3.distance(r,e.positionWC):Number.POSITIVE_INFINITY;a=Math.min(t,n)}else a=Math.max(e.positionCartographic.height,0);return a}Camera.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof OrthographicFrustum&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=calculateOrthographicFrustumWidth(this)))};const scratchSetViewCartesian=new Cartesian3,scratchSetViewTransform1=new Matrix4,scratchSetViewTransform2=new Matrix4,scratchSetViewQuaternion=new Quaternion,scratchSetViewMatrix3=new Matrix3,scratchSetViewCartographic=new Cartographic;function setView3D(e,t,n){const i=Matrix4.clone(e.transform,scratchSetViewTransform1),r=Transforms.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,scratchSetViewTransform2);e._setTransform(r),Cartesian3.clone(Cartesian3.ZERO,e.position),n.heading=n.heading-CesiumMath.PI_OVER_TWO;const o=Quaternion.fromHeadingPitchRoll(n,scratchSetViewQuaternion),a=Matrix3.fromQuaternion(o,scratchSetViewMatrix3);Matrix3.getColumn(a,0,e.direction),Matrix3.getColumn(a,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function setViewCV(e,t,n,i){const r=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(i){const n=e._projection,i=n.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=n.project(i,scratchSetViewCartesian)}Cartesian3.clone(t,e.position)}n.heading=n.heading-CesiumMath.PI_OVER_TWO;const o=Quaternion.fromHeadingPitchRoll(n,scratchSetViewQuaternion),a=Matrix3.fromQuaternion(o,scratchSetViewMatrix3);Matrix3.getColumn(a,0,e.direction),Matrix3.getColumn(a,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(r),e._adjustOrthographicFrustum(!0)}function setView2D(e,t,n,i){const r=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(i){const n=e._projection,i=n.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=n.project(i,scratchSetViewCartesian)}Cartesian2.clone(t,e.position);const n=.5*-t.z,r=-n,o=e.frustum;if(r>n){const e=o.top/o.right;o.right=r,o.left=n,o.top=o.right*e,o.bottom=-o.top}}if(e._scene.mapMode2D===MapMode2D$1.ROTATE){n.heading=n.heading-CesiumMath.PI_OVER_TWO,n.pitch=-CesiumMath.PI_OVER_TWO,n.roll=0;const t=Quaternion.fromHeadingPitchRoll(n,scratchSetViewQuaternion),i=Matrix3.fromQuaternion(t,scratchSetViewMatrix3);Matrix3.getColumn(i,2,e.up),Cartesian3.cross(e.direction,e.up,e.right)}e._setTransform(r)}const scratchToHPRDirection=new Cartesian3,scratchToHPRUp=new Cartesian3,scratchToHPRRight=new Cartesian3;function directionUpToHeadingPitchRoll(e,t,n,i){const r=Cartesian3.clone(n.direction,scratchToHPRDirection),o=Cartesian3.clone(n.up,scratchToHPRUp);if(e._scene.mode===SceneMode$1.SCENE3D){const n=e._projection.ellipsoid,i=Transforms.eastNorthUpToFixedFrame(t,n,scratchHPRMatrix1),a=Matrix4.inverseTransformation(i,scratchHPRMatrix2);Matrix4.multiplyByPointAsVector(a,r,r),Matrix4.multiplyByPointAsVector(a,o,o)}const a=Cartesian3.cross(r,o,scratchToHPRRight);return i.heading=getHeading(r,o),i.pitch=getPitch(r),i.roll=getRoll(r,o,a),i}const scratchSetViewOptions={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},scratchHpr=new HeadingPitchRoll;Camera.prototype.setView=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);let t=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);const n=this._mode;if(n===SceneMode$1.MORPHING)return;defined(e.endTransform)&&this._setTransform(e.endTransform);let i=defaultValue(e.convert,!0),r=defaultValue(e.destination,Cartesian3.clone(this.positionWC,scratchSetViewCartesian));defined(r)&&defined(r.west)&&(r=this.getRectangleCameraCoordinates(r,scratchSetViewCartesian),i=!1),defined(t.direction)&&(t=directionUpToHeadingPitchRoll(this,r,t,scratchSetViewOptions.orientation)),scratchHpr.heading=defaultValue(t.heading,0),scratchHpr.pitch=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),scratchHpr.roll=defaultValue(t.roll,0),n===SceneMode$1.SCENE3D?setView3D(this,r,scratchHpr):n===SceneMode$1.SCENE2D?setView2D(this,r,scratchHpr,i):setViewCV(this,r,scratchHpr,i)};const pitchScratch=new Cartesian3;function clampMove2D(e,t){const n=e._scene.mapMode2D===MapMode2D$1.ROTATE,i=e._maxCoord.x,r=e._maxCoord.y;let o,a;n?(a=i,o=-a):(a=t.x-2*i,o=t.x+2*i),t.x>i&&(t.x=a),t.x<-i&&(t.x=o),t.y>r&&(t.y=r),t.y<-r&&(t.y=-r)}Camera.prototype.flyHome=function(e){const t=this._mode;if(t===SceneMode$1.MORPHING&&this._scene.completeMorph(),t===SceneMode$1.SCENE2D)this.flyTo({destination:Camera.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:Matrix4.IDENTITY});else if(t===SceneMode$1.SCENE3D){const t=this.getRectangleCameraCoordinates(Camera.DEFAULT_VIEW_RECTANGLE);let n=Cartesian3.magnitude(t);n+=n*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(t,t),Cartesian3.multiplyByScalar(t,n,t),this.flyTo({destination:t,duration:e,endTransform:Matrix4.IDENTITY})}else if(t===SceneMode$1.COLUMBUS_VIEW){const t=this._projection.ellipsoid.maximumRadius;let n=new Cartesian3(0,-1,1);n=Cartesian3.multiplyByScalar(Cartesian3.normalize(n,n),5*t,n),this.flyTo({destination:n,duration:e,orientation:{heading:0,pitch:-Math.acos(Cartesian3.normalize(n,pitchScratch).z),roll:0},endTransform:Matrix4.IDENTITY,convert:!1})}},Camera.prototype.worldToCameraCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualInvTransform,e,t)},Camera.prototype.cameraToWorldCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualTransform,e,t)};const moveScratch=new Cartesian3;Camera.prototype.move=function(e,t){const n=this.position;Cartesian3.multiplyByScalar(e,t,moveScratch),Cartesian3.add(n,moveScratch,n),this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,n),this._adjustOrthographicFrustum(!0)},Camera.prototype.moveForward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):this.move(this.direction,e)},Camera.prototype.moveBackward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):this.move(this.direction,-e)},Camera.prototype.moveUp=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,e)},Camera.prototype.moveDown=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,-e)},Camera.prototype.moveRight=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,e)},Camera.prototype.moveLeft=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,-e)},Camera.prototype.lookLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,-e)},Camera.prototype.lookRight=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,e)},Camera.prototype.lookUp=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,-e)},Camera.prototype.lookDown=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,e)};const lookScratchQuaternion=new Quaternion,lookScratchMatrix=new Matrix3;Camera.prototype.look=function(e,t){const n=defaultValue(t,this.defaultLookAmount),i=Quaternion.fromAxisAngle(e,-n,lookScratchQuaternion),r=Matrix3.fromQuaternion(i,lookScratchMatrix),o=this.direction,a=this.up,s=this.right;Matrix3.multiplyByVector(r,o,o),Matrix3.multiplyByVector(r,a,a),Matrix3.multiplyByVector(r,s,s)},Camera.prototype.twistLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,e)},Camera.prototype.twistRight=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,-e)};const rotateScratchQuaternion=new Quaternion,rotateScratchMatrix=new Matrix3;Camera.prototype.rotate=function(e,t){const n=defaultValue(t,this.defaultRotateAmount),i=Quaternion.fromAxisAngle(e,-n,rotateScratchQuaternion),r=Matrix3.fromQuaternion(i,rotateScratchMatrix);Matrix3.multiplyByVector(r,this.position,this.position),Matrix3.multiplyByVector(r,this.direction,this.direction),Matrix3.multiplyByVector(r,this.up,this.up),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)},Camera.prototype.rotateDown=function(e){rotateVertical(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.rotateUp=function(e){rotateVertical(this,-(e=defaultValue(e,this.defaultRotateAmount)))};const rotateVertScratchP=new Cartesian3,rotateVertScratchA=new Cartesian3,rotateVertScratchTan=new Cartesian3,rotateVertScratchNegate=new Cartesian3;function rotateVertical(e,t){const n=e.position;if(defined(e.constrainedAxis)&&!Cartesian3.equalsEpsilon(e.position,Cartesian3.ZERO,CesiumMath.EPSILON2)){const i=Cartesian3.normalize(n,rotateVertScratchP),r=Cartesian3.equalsEpsilon(i,e.constrainedAxis,CesiumMath.EPSILON2),o=Cartesian3.equalsEpsilon(i,Cartesian3.negate(e.constrainedAxis,rotateVertScratchNegate),CesiumMath.EPSILON2);if(r||o)(r&&t<0||o&&t>0)&&e.rotate(e.right,t);else{const n=Cartesian3.normalize(e.constrainedAxis,rotateVertScratchA);let r=Cartesian3.dot(i,n),o=CesiumMath.acosClamped(r);t>0&&t>o&&(t=o-CesiumMath.EPSILON4),r=Cartesian3.dot(i,Cartesian3.negate(n,rotateVertScratchNegate)),o=CesiumMath.acosClamped(r),t<0&&-t>o&&(t=-o+CesiumMath.EPSILON4);const a=Cartesian3.cross(n,i,rotateVertScratchTan);e.rotate(a,t)}}else e.rotate(e.right,t)}function rotateHorizontal(e,t){defined(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function zoom2D$1(e,t){const n=e.frustum;let i;if(t*=.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let r=n.top-t,o=n.bottom+t,a=e._maxCoord.y;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(a*=e.maximumZoomFactor),o>a&&(o=a,r=-a),r<=o&&(r=1,o=-1),i=n.right/n.top,n.top=r,n.bottom=o,n.right=n.top*i,n.left=-n.right}else{let r=n.right-t,o=n.left+t,a=e._maxCoord.x;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(a*=e.maximumZoomFactor),r>a&&(r=a,o=-a),r<=o&&(r=1,o=-1),i=n.top/n.right,n.right=r,n.left=o,n.top=n.right*i,n.bottom=-n.top}}function zoom3D$1(e,t){e.move(e.direction,t)}Camera.prototype.rotateRight=function(e){rotateHorizontal(this,-(e=defaultValue(e,this.defaultRotateAmount)))},Camera.prototype.rotateLeft=function(e){rotateHorizontal(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.zoomIn=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,e):zoom3D$1(this,e)},Camera.prototype.zoomOut=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D$1(this,-e):zoom3D$1(this,-e)},Camera.prototype.getMagnitude=function(){return this._mode===SceneMode$1.SCENE3D?Cartesian3.magnitude(this.position):this._mode===SceneMode$1.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===SceneMode$1.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};const scratchLookAtMatrix4=new Matrix4;Camera.prototype.lookAt=function(e,t){const n=Transforms.eastNorthUpToFixedFrame(e,Ellipsoid.WGS84,scratchLookAtMatrix4);this.lookAtTransform(n,t)};const scratchLookAtHeadingPitchRangeOffset=new Cartesian3,scratchLookAtHeadingPitchRangeQuaternion1=new Quaternion,scratchLookAtHeadingPitchRangeQuaternion2=new Quaternion,scratchHeadingPitchRangeMatrix3=new Matrix3;function offsetFromHeadingPitchRange(e,t,n){t=CesiumMath.clamp(t,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO),e=CesiumMath.zeroToTwoPi(e)-CesiumMath.PI_OVER_TWO;const i=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-t,scratchLookAtHeadingPitchRangeQuaternion1),r=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e,scratchLookAtHeadingPitchRangeQuaternion2),o=Quaternion.multiply(r,i,r),a=Matrix3.fromQuaternion(o,scratchHeadingPitchRangeMatrix3),s=Cartesian3.clone(Cartesian3.UNIT_X,scratchLookAtHeadingPitchRangeOffset);return Matrix3.multiplyByVector(a,s,s),Cartesian3.negate(s,s),Cartesian3.multiplyByScalar(s,n,s),s}Camera.prototype.lookAtTransform=function(e,t){if(this._setTransform(e),!defined(t))return;let n;if(n=defined(t.heading)?offsetFromHeadingPitchRange(t.heading,t.pitch,t.range):t,this._mode===SceneMode$1.SCENE2D){Cartesian2.clone(Cartesian2.ZERO,this.position),Cartesian3.negate(n,this.up),this.up.z=0,Cartesian3.magnitudeSquared(this.up)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_Y,this.up),Cartesian3.normalize(this.up,this.up),this._setTransform(Matrix4.IDENTITY),Cartesian3.negate(Cartesian3.UNIT_Z,this.direction),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.normalize(this.right,this.right);const t=this.frustum,i=t.top/t.right;return t.right=.5*Cartesian3.magnitude(n),t.left=-t.right,t.top=i*t.right,t.bottom=-t.top,void this._setTransform(e)}Cartesian3.clone(n,this.position),Cartesian3.negate(this.position,this.direction),Cartesian3.normalize(this.direction,this.direction),Cartesian3.cross(this.direction,Cartesian3.UNIT_Z,this.right),Cartesian3.magnitudeSquared(this.right)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_X,this.right),Cartesian3.normalize(this.right,this.right),Cartesian3.cross(this.right,this.direction,this.up),Cartesian3.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const viewRectangle3DCartographic1=new Cartographic,viewRectangle3DCartographic2=new Cartographic,viewRectangle3DNorthEast=new Cartesian3,viewRectangle3DSouthWest=new Cartesian3,viewRectangle3DNorthWest=new Cartesian3,viewRectangle3DSouthEast=new Cartesian3,viewRectangle3DNorthCenter=new Cartesian3,viewRectangle3DSouthCenter=new Cartesian3,viewRectangle3DCenter=new Cartesian3,viewRectangle3DEquator=new Cartesian3,defaultRF={direction:new Cartesian3,right:new Cartesian3,up:new Cartesian3};let viewRectangle3DEllipsoidGeodesic;function computeD(e,t,n,i){return Math.abs(Cartesian3.dot(t,n))/i-Cartesian3.dot(e,n)}function rectangleCameraPosition3D(e,t,n,i){const r=e._projection.ellipsoid,o=i?e:defaultRF,a=t.north,s=t.south;let c=t.east;const l=t.west;l>c&&(c+=CesiumMath.TWO_PI);const u=.5*(l+c);let d;if(s<-CesiumMath.PI_OVER_TWO+CesiumMath.RADIANS_PER_DEGREE&&a>CesiumMath.PI_OVER_TWO-CesiumMath.RADIANS_PER_DEGREE)d=0;else{const e=viewRectangle3DCartographic1;e.longitude=u,e.latitude=a,e.height=0;const t=viewRectangle3DCartographic2;t.longitude=u,t.latitude=s,t.height=0;let n=viewRectangle3DEllipsoidGeodesic;defined(n)&&n.ellipsoid===r||(viewRectangle3DEllipsoidGeodesic=n=new EllipsoidGeodesic(void 0,void 0,r)),n.setEndPoints(e,t),d=n.interpolateUsingFraction(.5,viewRectangle3DCartographic1).latitude}const h=viewRectangle3DCartographic1;h.longitude=u,h.latitude=d,h.height=0;const p=r.cartographicToCartesian(h,viewRectangle3DCenter),f=viewRectangle3DCartographic1;f.longitude=c,f.latitude=a;const m=r.cartographicToCartesian(f,viewRectangle3DNorthEast);f.longitude=l;const g=r.cartographicToCartesian(f,viewRectangle3DNorthWest);f.longitude=u;const _=r.cartographicToCartesian(f,viewRectangle3DNorthCenter);f.latitude=s;const y=r.cartographicToCartesian(f,viewRectangle3DSouthCenter);f.longitude=c;const C=r.cartographicToCartesian(f,viewRectangle3DSouthEast);f.longitude=l;const T=r.cartographicToCartesian(f,viewRectangle3DSouthWest);Cartesian3.subtract(g,p,g),Cartesian3.subtract(C,p,C),Cartesian3.subtract(m,p,m),Cartesian3.subtract(T,p,T),Cartesian3.subtract(_,p,_),Cartesian3.subtract(y,p,y);const S=r.geodeticSurfaceNormal(p,o.direction);Cartesian3.negate(S,S);const A=Cartesian3.cross(S,Cartesian3.UNIT_Z,o.right);Cartesian3.normalize(A,A);const v=Cartesian3.cross(A,S,o.up);let E;if(e.frustum instanceof OrthographicFrustum){const t=Math.max(Cartesian3.distance(m,g),Cartesian3.distance(C,T)),n=Math.max(Cartesian3.distance(m,C),Cartesian3.distance(g,T));let i,r;const o=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,a=n*o;t>a?(i=t,r=i/o):(r=n,i=a),E=Math.max(i,r)}else{const t=Math.tan(.5*e.frustum.fovy),n=e.frustum.aspectRatio*t;if(E=Math.max(computeD(S,v,g,t),computeD(S,v,C,t),computeD(S,v,m,t),computeD(S,v,T,t),computeD(S,v,_,t),computeD(S,v,y,t),computeD(S,A,g,n),computeD(S,A,C,n),computeD(S,A,m,n),computeD(S,A,T,n),computeD(S,A,_,n),computeD(S,A,y,n)),s<0&&a>0){const e=viewRectangle3DCartographic1;e.longitude=l,e.latitude=0,e.height=0;let i=r.cartographicToCartesian(e,viewRectangle3DEquator);Cartesian3.subtract(i,p,i),E=Math.max(E,computeD(S,v,i,t),computeD(S,A,i,n)),e.longitude=c,i=r.cartographicToCartesian(e,viewRectangle3DEquator),Cartesian3.subtract(i,p,i),E=Math.max(E,computeD(S,v,i,t),computeD(S,A,i,n))}}return Cartesian3.add(p,Cartesian3.multiplyByScalar(S,-E,viewRectangle3DEquator),n)}const viewRectangleCVCartographic=new Cartographic,viewRectangleCVNorthEast=new Cartesian3,viewRectangleCVSouthWest=new Cartesian3;function rectangleCameraPositionColumbusView(e,t,n){const i=e._projection;t.west>t.east&&(t=Rectangle.MAX_VALUE);const r=e._actualTransform,o=e._actualInvTransform,a=viewRectangleCVCartographic;a.longitude=t.east,a.latitude=t.north;const s=i.project(a,viewRectangleCVNorthEast);Matrix4.multiplyByPoint(r,s,s),Matrix4.multiplyByPoint(o,s,s),a.longitude=t.west,a.latitude=t.south;const c=i.project(a,viewRectangleCVSouthWest);if(Matrix4.multiplyByPoint(r,c,c),Matrix4.multiplyByPoint(o,c,c),n.x=.5*(s.x-c.x)+c.x,n.y=.5*(s.y-c.y)+c.y,defined(e.frustum.fovy)){const t=Math.tan(.5*e.frustum.fovy),i=e.frustum.aspectRatio*t;n.z=.5*Math.max((s.x-c.x)/i,(s.y-c.y)/t)}else{const e=s.x-c.x,t=s.y-c.y;n.z=Math.max(e,t)}return n}const viewRectangle2DCartographic=new Cartographic,viewRectangle2DNorthEast=new Cartesian3,viewRectangle2DSouthWest=new Cartesian3;function rectangleCameraPosition2D(e,t,n){const i=e._projection;let r=t.east;t.west>t.east&&(e._scene.mapMode2D===MapMode2D$1.INFINITE_SCROLL?r+=CesiumMath.TWO_PI:r=(t=Rectangle.MAX_VALUE).east);let o=viewRectangle2DCartographic;o.longitude=r,o.latitude=t.north;const a=i.project(o,viewRectangle2DNorthEast);o.longitude=t.west,o.latitude=t.south;const s=i.project(o,viewRectangle2DSouthWest),c=.5*Math.abs(a.x-s.x);let l,u,d=.5*Math.abs(a.y-s.y);const h=e.frustum.right/e.frustum.top,p=d*h;return c>p?(l=c,u=l/h):(u=d,l=p),d=Math.max(2*l,2*u),n.x=.5*(a.x-s.x)+s.x,n.y=.5*(a.y-s.y)+s.y,o=i.unproject(n,o),o.height=d,n=i.project(o,n)}Camera.prototype.getRectangleCameraCoordinates=function(e,t){const n=this._mode;return defined(t)||(t=new Cartesian3),n===SceneMode$1.SCENE3D?rectangleCameraPosition3D(this,e,t):n===SceneMode$1.COLUMBUS_VIEW?rectangleCameraPositionColumbusView(this,e,t):n===SceneMode$1.SCENE2D?rectangleCameraPosition2D(this,e,t):void 0};const pickEllipsoid3DRay=new Ray;function pickEllipsoid3D(e,t,n,i){n=defaultValue(n,Ellipsoid.WGS84);const r=e.getPickRay(t,pickEllipsoid3DRay),o=IntersectionTests.rayEllipsoid(r,n);if(!o)return;const a=o.start>0?o.start:o.stop;return Ray.getPoint(r,a,i)}const pickEllipsoid2DRay=new Ray;function pickMap2D(e,t,n,i){let r=e.getPickRay(t,pickEllipsoid2DRay).origin;r=Cartesian3.fromElements(r.y,r.z,0,r);const o=n.unproject(r);if(!(o.latitude<-CesiumMath.PI_OVER_TWO||o.latitude>CesiumMath.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(o,i)}const pickEllipsoidCVRay=new Ray;function pickMapColumbusView(e,t,n,i){const r=e.getPickRay(t,pickEllipsoidCVRay),o=-r.origin.x/r.direction.x;Ray.getPoint(r,o,i);const a=n.unproject(new Cartesian3(i.y,i.z,0));if(!(a.latitude<-CesiumMath.PI_OVER_TWO||a.latitude>CesiumMath.PI_OVER_TWO||a.longitude<-Math.PI||a.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(a,i)}Camera.prototype.pickEllipsoid=function(e,t,n){const i=this._scene.canvas;if(0!==i.clientWidth&&0!==i.clientHeight){if(defined(n)||(n=new Cartesian3),t=defaultValue(t,Ellipsoid.WGS84),this._mode===SceneMode$1.SCENE3D)n=pickEllipsoid3D(this,e,t,n);else if(this._mode===SceneMode$1.SCENE2D)n=pickMap2D(this,e,this._projection,n);else{if(this._mode!==SceneMode$1.COLUMBUS_VIEW)return;n=pickMapColumbusView(this,e,this._projection,n)}return n}};const pickPerspCenter=new Cartesian3,pickPerspXDir=new Cartesian3,pickPerspYDir=new Cartesian3;function getPickRayPerspective(e,t,n){const i=e._scene.canvas,r=i.clientWidth,o=i.clientHeight,a=Math.tan(.5*e.frustum.fovy),s=e.frustum.aspectRatio*a,c=e.frustum.near,l=2/r*t.x-1,u=2/o*(o-t.y)-1,d=e.positionWC;Cartesian3.clone(d,n.origin);const h=Cartesian3.multiplyByScalar(e.directionWC,c,pickPerspCenter);Cartesian3.add(d,h,h);const p=Cartesian3.multiplyByScalar(e.rightWC,l*c*s,pickPerspXDir),f=Cartesian3.multiplyByScalar(e.upWC,u*c*a,pickPerspYDir),m=Cartesian3.add(h,p,n.direction);return Cartesian3.add(m,f,m),Cartesian3.subtract(m,d,m),Cartesian3.normalize(m,m),n}const scratchDirection=new Cartesian3;function getPickRayOrthographic(e,t,n){const i=e._scene.canvas,r=i.clientWidth,o=i.clientHeight;let a=e.frustum;defined(a._offCenterFrustum)&&(a=a._offCenterFrustum);let s=2/r*t.x-1;s*=.5*(a.right-a.left);let c=2/o*(o-t.y)-1;c*=.5*(a.top-a.bottom);const l=n.origin;return Cartesian3.clone(e.position,l),Cartesian3.multiplyByScalar(e.right,s,scratchDirection),Cartesian3.add(scratchDirection,l,l),Cartesian3.multiplyByScalar(e.up,c,scratchDirection),Cartesian3.add(scratchDirection,l,l),Cartesian3.clone(e.directionWC,n.direction),e._mode!==SceneMode$1.COLUMBUS_VIEW&&e._mode!==SceneMode$1.SCENE2D||Cartesian3.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}Camera.prototype.getPickRay=function(e,t){defined(t)||(t=new Ray);const n=this.frustum;return defined(n.aspectRatio)&&defined(n.fov)&&defined(n.near)?getPickRayPerspective(this,e,t):getPickRayOrthographic(this,e,t)};const scratchToCenter=new Cartesian3,scratchProj=new Cartesian3;Camera.prototype.distanceToBoundingSphere=function(e){const t=Cartesian3.subtract(this.positionWC,e.center,scratchToCenter),n=Cartesian3.multiplyByScalar(this.directionWC,Cartesian3.dot(t,this.directionWC),scratchProj);return Math.max(0,Cartesian3.magnitude(n)-e.radius)};const scratchPixelSize=new Cartesian2;function createAnimationTemplateCV(e,t,n,i,r,o){const a=Cartesian3.clone(t);return n.y>i?a.y-=n.y-i:n.y<-i&&(a.y+=-i-n.y),n.z>r?a.z-=n.z-r:n.z<-r&&(a.z+=-r-n.z),{easingFunction:EasingFunction$1.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:o,update:function(n){const i=Cartesian3.lerp(t,a,n.time,new Cartesian3);e.worldToCameraCoordinatesPoint(i,e.position)}}}Camera.prototype.getPixelSize=function(e,t,n){const i=this.distanceToBoundingSphere(e),r=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,scratchPixelSize);return Math.max(r.x,r.y)};const normalScratch$1=new Cartesian3,centerScratch$1=new Cartesian3,posScratch=new Cartesian3,scratchCartesian3Subtract=new Cartesian3;function createAnimationCV(e,t){let n=e.position;const i=e.direction,r=e.worldToCameraCoordinatesVector(Cartesian3.UNIT_X,normalScratch$1),o=-Cartesian3.dot(r,n)/Cartesian3.dot(r,i),a=Cartesian3.add(n,Cartesian3.multiplyByScalar(i,o,centerScratch$1),centerScratch$1);e.cameraToWorldCoordinatesPoint(a,a),n=e.cameraToWorldCoordinatesPoint(e.position,posScratch);const s=Math.tan(.5*e.frustum.fovy),c=e.frustum.aspectRatio*s,l=Cartesian3.magnitude(Cartesian3.subtract(n,a,scratchCartesian3Subtract)),u=c*l,d=s*l,h=e._maxCoord.x,p=e._maxCoord.y,f=Math.max(u-h,h),m=Math.max(d-p,p);if(n.z<-f||n.z>f||n.y<-m||n.y>m){const i=a.y<-f||a.y>f,r=a.z<-m||a.z>m;if(i||r)return createAnimationTemplateCV(e,n,a,f,m,t)}}Camera.prototype.createCorrectPositionTween=function(e){if(this._mode===SceneMode$1.COLUMBUS_VIEW)return createAnimationCV(this,e)};const scratchFlyToDestination=new Cartesian3,newOptions={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};function distanceToBoundingSphere3D(e,t){const n=e.frustum,i=Math.tan(.5*n.fovy),r=n.aspectRatio*i;return Math.max(t/r,t/i)}function distanceToBoundingSphere2D(e,t){let n,i,r=e.frustum;defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);const o=r.right/r.top,a=t*o;return t>a?(n=t,i=n/o):(i=t,n=a),1.5*Math.max(n,i)}Camera.prototype.cancelFlight=function(){defined(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)},Camera.prototype.completeFlight=function(){if(defined(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=newOptions.destination,e.orientation.heading=newOptions.heading,e.orientation.pitch=newOptions.pitch,e.orientation.roll=newOptions.roll,this.setView(e),defined(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}},Camera.prototype.flyTo=function(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).destination;if(this._mode===SceneMode$1.MORPHING)return;this.cancelFlight();let n=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);if(defined(n.direction)&&(n=directionUpToHeadingPitchRoll(this,t,n,scratchSetViewOptions.orientation)),defined(e.duration)&&e.duration<=0){const t=scratchSetViewOptions;return t.destination=e.destination,t.orientation.heading=n.heading,t.orientation.pitch=n.pitch,t.orientation.roll=n.roll,t.convert=e.convert,t.endTransform=e.endTransform,this.setView(t),void("function"==typeof e.complete&&e.complete())}const i=defined(t.west);i&&(t=this.getRectangleCameraCoordinates(t,scratchFlyToDestination));const r=this;let o;newOptions.destination=t,newOptions.heading=n.heading,newOptions.pitch=n.pitch,newOptions.roll=n.roll,newOptions.duration=e.duration,newOptions.complete=function(){o===r._currentFlight&&(r._currentFlight=void 0),defined(e.complete)&&e.complete()},newOptions.cancel=e.cancel,newOptions.endTransform=e.endTransform,newOptions.convert=!i&&e.convert,newOptions.maximumHeight=e.maximumHeight,newOptions.pitchAdjustHeight=e.pitchAdjustHeight,newOptions.flyOverLongitude=e.flyOverLongitude,newOptions.flyOverLongitudeWeight=e.flyOverLongitudeWeight,newOptions.easingFunction=e.easingFunction;const a=this._scene,s=CameraFlightPath.createTween(a,newOptions);if(0===s.duration)return void("function"==typeof s.complete&&s.complete());o=a.tweens.add(s),this._currentFlight=o;let c=this._scene.preloadFlightCamera;this._mode!==SceneMode$1.SCENE2D&&(defined(c)||(c=Camera.clone(this)),c.setView({destination:t,orientation:n}),this._scene.preloadFlightCullingVolume=c.frustum.computeCullingVolume(c.positionWC,c.directionWC,c.upWC))};const MINIMUM_ZOOM=100;function adjustBoundingSphereOffset(e,t,n){n=HeadingPitchRange.clone(defined(n)?n:Camera.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,r=e._scene.screenSpaceCameraController.maximumZoomDistance,o=n.range;if(!defined(o)||0===o){const o=t.radius;0===o?n.range=MINIMUM_ZOOM:e.frustum instanceof OrthographicFrustum||e._mode===SceneMode$1.SCENE2D?n.range=distanceToBoundingSphere2D(e,o):n.range=distanceToBoundingSphere3D(e,o),n.range=CesiumMath.clamp(n.range,i,r)}return n}Camera.prototype.viewBoundingSphere=function(e,t){t=adjustBoundingSphereOffset(this,e,t),this.lookAt(e.center,t)};const scratchflyToBoundingSphereTransform=new Matrix4,scratchflyToBoundingSphereDestination=new Cartesian3,scratchflyToBoundingSphereDirection=new Cartesian3,scratchflyToBoundingSphereUp=new Cartesian3,scratchflyToBoundingSphereRight=new Cartesian3,scratchFlyToBoundingSphereCart4=new Cartesian4,scratchFlyToBoundingSphereQuaternion=new Quaternion,scratchFlyToBoundingSphereMatrix3=new Matrix3;Camera.prototype.flyToBoundingSphere=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);const n=this._mode===SceneMode$1.SCENE2D||this._mode===SceneMode$1.COLUMBUS_VIEW;this._setTransform(Matrix4.IDENTITY);const i=adjustBoundingSphereOffset(this,e,t.offset);let r;r=n?Cartesian3.multiplyByScalar(Cartesian3.UNIT_Z,i.range,scratchflyToBoundingSphereDestination):offsetFromHeadingPitchRange(i.heading,i.pitch,i.range);const o=Transforms.eastNorthUpToFixedFrame(e.center,Ellipsoid.WGS84,scratchflyToBoundingSphereTransform);let a,s;if(Matrix4.multiplyByPoint(o,r,r),!n){if(a=Cartesian3.subtract(e.center,r,scratchflyToBoundingSphereDirection),Cartesian3.normalize(a,a),s=Matrix4.multiplyByPointAsVector(o,Cartesian3.UNIT_Z,scratchflyToBoundingSphereUp),1-Math.abs(Cartesian3.dot(a,s))<CesiumMath.EPSILON6){const e=Quaternion.fromAxisAngle(a,i.heading,scratchFlyToBoundingSphereQuaternion),t=Matrix3.fromQuaternion(e,scratchFlyToBoundingSphereMatrix3);Cartesian3.fromCartesian4(Matrix4.getColumn(o,1,scratchFlyToBoundingSphereCart4),s),Matrix3.multiplyByVector(t,s,s)}const t=Cartesian3.cross(a,s,scratchflyToBoundingSphereRight);Cartesian3.cross(t,a,s),Cartesian3.normalize(s,s)}this.flyTo({destination:r,orientation:{direction:a,up:s},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};const scratchCartesian3_1=new Cartesian3,scratchCartesian3_2=new Cartesian3,scratchCartesian3_3=new Cartesian3,scratchCartesian3_4=new Cartesian3,horizonPoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeHorizonQuad(e,t){const n=t.radii,i=e.positionWC,r=Cartesian3.multiplyComponents(t.oneOverRadii,i,scratchCartesian3_1),o=Cartesian3.magnitude(r),a=Cartesian3.normalize(r,scratchCartesian3_2);let s,c;Cartesian3.equalsEpsilon(a,Cartesian3.UNIT_Z,CesiumMath.EPSILON10)?(s=new Cartesian3(0,1,0),c=new Cartesian3(0,0,1)):(s=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,a,scratchCartesian3_3),scratchCartesian3_3),c=Cartesian3.normalize(Cartesian3.cross(a,s,scratchCartesian3_4),scratchCartesian3_4));const l=Math.sqrt(Cartesian3.magnitudeSquared(r)-1),u=Cartesian3.multiplyByScalar(a,1/o,scratchCartesian3_1),d=l/o,h=Cartesian3.multiplyByScalar(s,d,scratchCartesian3_2),p=Cartesian3.multiplyByScalar(c,d,scratchCartesian3_3),f=Cartesian3.add(u,p,horizonPoints[0]);Cartesian3.subtract(f,h,f),Cartesian3.multiplyComponents(n,f,f);const m=Cartesian3.subtract(u,p,horizonPoints[1]);Cartesian3.subtract(m,h,m),Cartesian3.multiplyComponents(n,m,m);const g=Cartesian3.subtract(u,p,horizonPoints[2]);Cartesian3.add(g,h,g),Cartesian3.multiplyComponents(n,g,g);const _=Cartesian3.add(u,p,horizonPoints[3]);return Cartesian3.add(_,h,_),Cartesian3.multiplyComponents(n,_,_),horizonPoints}const scratchPickCartesian2=new Cartesian2,scratchRectCartesian=new Cartesian3,cartoArray=[new Cartographic,new Cartographic,new Cartographic,new Cartographic];function addToResult(e,t,n,i,r,o){scratchPickCartesian2.x=e,scratchPickCartesian2.y=t;const a=i.pickEllipsoid(scratchPickCartesian2,r,scratchRectCartesian);return defined(a)?(cartoArray[n]=r.cartesianToCartographic(a,cartoArray[n]),1):(cartoArray[n]=r.cartesianToCartographic(o[n],cartoArray[n]),0)}Camera.prototype.computeViewRectangle=function(e,t){e=defaultValue(e,Ellipsoid.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new BoundingSphere(Cartesian3.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Intersect$1.OUTSIDE)return;const r=this._scene.canvas,o=r.clientWidth,a=r.clientHeight;let s=0;const c=computeHorizonQuad(this,e);if(s+=addToResult(0,0,0,this,e,c),s+=addToResult(0,a,1,this,e,c),s+=addToResult(o,a,2,this,e,c),s+=addToResult(o,0,3,this,e,c),s<2)return Rectangle.MAX_VALUE;t=Rectangle.fromCartographicArray(cartoArray,t);let l=0,u=cartoArray[3].longitude;for(let e=0;e<4;++e){const t=cartoArray[e].longitude,n=Math.abs(t-u);n>CesiumMath.PI?l+=CesiumMath.TWO_PI-n:l+=n,u=t}return CesiumMath.equalsEpsilon(Math.abs(l),CesiumMath.TWO_PI,CesiumMath.EPSILON9)&&(t.west=-CesiumMath.PI,t.east=CesiumMath.PI,cartoArray[0].latitude>=0?t.north=CesiumMath.PI_OVER_TWO:t.south=-CesiumMath.PI_OVER_TWO),t},Camera.prototype.switchToPerspectiveFrustum=function(){if(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof PerspectiveFrustum)return;const e=this._scene;this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60)},Camera.prototype.switchToOrthographicFrustum=function(){if(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof OrthographicFrustum)return;const e=calculateOrthographicFrustumWidth(this),t=this._scene;this.frustum=new OrthographicFrustum,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e},Camera.clone=function(e,t){return defined(t)||(t=new Camera(e._scene)),Cartesian3.clone(e.position,t.position),Cartesian3.clone(e.direction,t.direction),Cartesian3.clone(e.up,t.up),Cartesian3.clone(e.right,t.right),Matrix4.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};const CameraEventType={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4};var CameraEventType$1=Object.freeze(CameraEventType);function getKey$1(e,t){let n=e;return defined(t)&&(n+="+"+t),n}function clonePinchMovement(e,t){Cartesian2.clone(e.distance.startPosition,t.distance.startPosition),Cartesian2.clone(e.distance.endPosition,t.distance.endPosition),Cartesian2.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),Cartesian2.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function listenToPinch(e,t,n){const i=getKey$1(CameraEventType$1.PINCH,t),r=e._update,o=e._isDown,a=e._eventStartPosition,s=e._pressTime,c=e._releaseTime;r[i]=!0,o[i]=!1,a[i]=new Cartesian2;let l=e._movement[i];defined(l)||(l=e._movement[i]={}),l.distance={startPosition:new Cartesian2,endPosition:new Cartesian2},l.angleAndHeight={startPosition:new Cartesian2,endPosition:new Cartesian2},l.prevAngle=0,e._eventHandler.setInputAction((function(t){e._buttonsDown++,o[i]=!0,s[i]=new Date,Cartesian2.lerp(t.position1,t.position2,.5,a[i])}),ScreenSpaceEventType$1.PINCH_START,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,c[i]=new Date}),ScreenSpaceEventType$1.PINCH_END,t),e._eventHandler.setInputAction((function(e){if(o[i]){r[i]?(clonePinchMovement(e,l),r[i]=!1,l.prevAngle=l.angleAndHeight.startPosition.x):(Cartesian2.clone(e.distance.endPosition,l.distance.endPosition),Cartesian2.clone(e.angleAndHeight.endPosition,l.angleAndHeight.endPosition));let t=l.angleAndHeight.endPosition.x;const o=l.prevAngle,a=2*Math.PI;for(;t>=o+Math.PI;)t-=a;for(;t<o-Math.PI;)t+=a;l.angleAndHeight.endPosition.x=-t*n.clientWidth/12,l.angleAndHeight.startPosition.x=-o*n.clientWidth/12}}),ScreenSpaceEventType$1.PINCH_MOVE,t)}function listenToWheel(e,t){const n=getKey$1(CameraEventType$1.WHEEL,t),i=e._update;i[n]=!0;let r=e._movement[n];defined(r)||(r=e._movement[n]={}),r.startPosition=new Cartesian2,r.endPosition=new Cartesian2,e._eventHandler.setInputAction((function(e){const t=15*CesiumMath.toRadians(e);i[n]?(Cartesian2.clone(Cartesian2.ZERO,r.startPosition),r.endPosition.x=0,r.endPosition.y=t,i[n]=!1):r.endPosition.y=r.endPosition.y+t}),ScreenSpaceEventType$1.WHEEL,t)}function listenMouseButtonDownUp(e,t,n){const i=getKey$1(n,t),r=e._isDown,o=e._eventStartPosition,a=e._pressTime,s=e._releaseTime;r[i]=!1,o[i]=new Cartesian2;let c,l,u=e._lastMovement[i];defined(u)||(u=e._lastMovement[i]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),n===CameraEventType$1.LEFT_DRAG?(c=ScreenSpaceEventType$1.LEFT_DOWN,l=ScreenSpaceEventType$1.LEFT_UP):n===CameraEventType$1.RIGHT_DRAG?(c=ScreenSpaceEventType$1.RIGHT_DOWN,l=ScreenSpaceEventType$1.RIGHT_UP):n===CameraEventType$1.MIDDLE_DRAG&&(c=ScreenSpaceEventType$1.MIDDLE_DOWN,l=ScreenSpaceEventType$1.MIDDLE_UP),e._eventHandler.setInputAction((function(t){e._buttonsDown++,u.valid=!1,r[i]=!0,a[i]=new Date,Cartesian2.clone(t.position,o[i])}),c,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,s[i]=new Date}),l,t)}function cloneMouseMovement(e,t){Cartesian2.clone(e.startPosition,t.startPosition),Cartesian2.clone(e.endPosition,t.endPosition)}function listenMouseMove(e,t){const n=e._update,i=e._movement,r=e._lastMovement,o=e._isDown;for(const i in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(i)){const r=CameraEventType$1[i];if(defined(r)){const i=getKey$1(r,t);n[i]=!0,defined(e._lastMovement[i])||(e._lastMovement[i]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),defined(e._movement[i])||(e._movement[i]={startPosition:new Cartesian2,endPosition:new Cartesian2})}}e._eventHandler.setInputAction((function(a){for(const e in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(e)){const s=CameraEventType$1[e];if(defined(s)){const e=getKey$1(s,t);o[e]&&(n[e]?(cloneMouseMovement(i[e],r[e]),r[e].valid=!0,cloneMouseMovement(a,i[e]),n[e]=!1):Cartesian2.clone(a.endPosition,i[e].endPosition))}}Cartesian2.clone(a.endPosition,e._currentMousePosition)}),ScreenSpaceEventType$1.MOUSE_MOVE,t)}function CameraEventAggregator(e){this._eventHandler=new ScreenSpaceEventHandler(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new Cartesian2,listenToWheel(this,void 0),listenToPinch(this,void 0,e),listenMouseButtonDownUp(this,void 0,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,void 0);for(const t in KeyboardEventModifier$1)if(KeyboardEventModifier$1.hasOwnProperty(t)){const n=KeyboardEventModifier$1[t];defined(n)&&(listenToWheel(this,n),listenToPinch(this,n,e),listenMouseButtonDownUp(this,n,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,n,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,n,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,n))}}function Cesium3DTileContent(){this.featurePropertiesDirty=!1}function Cesium3DTilePassState(e){this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function ConditionsExpression(e,t){this._conditionsExpression=clone$1(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,setRuntime(this,t)}function Statement(e,t){this.condition=e,this.expression=t}function setRuntime(e,t){const n=[],i=e._conditions;if(!defined(i))return;const r=i.length;for(let e=0;e<r;++e){const r=i[e],o=String(r[0]),a=String(r[1]);n.push(new Statement(new Expression(o,t),new Expression(a,t)))}e._runtimeConditions=n}function Cesium3DTileStyle(e){let t;if(this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,"string"==typeof e||e instanceof Resource){t=Resource.createIfNeeded(e).fetchJson(e)}else t=when.resolve(e);const n=this;this._readyPromise=t.then((function(e){return setup(n,e),n}))}function setup(e,t){t=defaultValue(clone$1(t,!0),e._style),e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;const n={};if(defined(t.meta)){const e=t.defines,i=defaultValue(t.meta,defaultValue.EMPTY_OBJECT);for(const t in i)i.hasOwnProperty(t)&&(n[t]=new Expression(i[t],e))}e._meta=n,e._ready=!0}function getExpression(e,t){const n=defaultValue(e._style,defaultValue.EMPTY_OBJECT).defines;if(defined(t))return"boolean"==typeof t||"number"==typeof t?new Expression(String(t)):"string"==typeof t?new Expression(t,n):defined(t.conditions)?new ConditionsExpression(t,n):t}function getJsonFromExpression(e){if(defined(e))return defined(e.expression)?e.expression:defined(e.conditionsExpression)?clone$1(e.conditionsExpression,!0):e}function CircleEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}Object.defineProperties(CameraEventAggregator.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!(this._update[getKey$1(CameraEventType$1.WHEEL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.SHIFT)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.CTRL)]&&this._update[getKey$1(CameraEventType$1.WHEEL,KeyboardEventModifier$1.ALT)]);return this._buttonsDown>0||e}}}),CameraEventAggregator.prototype.isMoving=function(e,t){const n=getKey$1(e,t);return!this._update[n]},CameraEventAggregator.prototype.getMovement=function(e,t){const n=getKey$1(e,t);return this._movement[n]},CameraEventAggregator.prototype.getLastMovement=function(e,t){const n=getKey$1(e,t),i=this._lastMovement[n];if(i.valid)return i},CameraEventAggregator.prototype.isButtonDown=function(e,t){const n=getKey$1(e,t);return this._isDown[n]},CameraEventAggregator.prototype.getStartMousePosition=function(e,t){if(e===CameraEventType$1.WHEEL)return this._currentMousePosition;const n=getKey$1(e,t);return this._eventStartPosition[n]},CameraEventAggregator.prototype.getButtonPressTime=function(e,t){const n=getKey$1(e,t);return this._pressTime[n]},CameraEventAggregator.prototype.getButtonReleaseTime=function(e,t){const n=getKey$1(e,t);return this._releaseTime[n]},CameraEventAggregator.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},CameraEventAggregator.prototype.isDestroyed=function(){return!1},CameraEventAggregator.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),destroyObject(this)},Object.defineProperties(Cesium3DTileContent.prototype,{featuresLength:{get:function(){DeveloperError.throwInstantiationError()}},pointsLength:{get:function(){DeveloperError.throwInstantiationError()}},trianglesLength:{get:function(){DeveloperError.throwInstantiationError()}},geometryByteLength:{get:function(){DeveloperError.throwInstantiationError()}},texturesByteLength:{get:function(){DeveloperError.throwInstantiationError()}},batchTableByteLength:{get:function(){DeveloperError.throwInstantiationError()}},innerContents:{get:function(){DeveloperError.throwInstantiationError()}},readyPromise:{get:function(){DeveloperError.throwInstantiationError()}},tileset:{get:function(){DeveloperError.throwInstantiationError()}},tile:{get:function(){DeveloperError.throwInstantiationError()}},url:{get:function(){DeveloperError.throwInstantiationError()}},batchTable:{get:function(){DeveloperError.throwInstantiationError()}},groupMetadata:{get:function(){DeveloperError.throwInstantiationError()},set:function(e){DeveloperError.throwInstantiationError()}}}),Cesium3DTileContent.prototype.hasProperty=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.getFeature=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyDebugSettings=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyStyle=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.update=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.isDestroyed=function(){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.destroy=function(){DeveloperError.throwInstantiationError()},Object.defineProperties(ConditionsExpression.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}}),ConditionsExpression.prototype.evaluate=function(e,t){const n=this._runtimeConditions;if(!defined(n))return;const i=n.length;for(let r=0;r<i;++r){const i=n[r];if(i.condition.evaluate(e))return i.expression.evaluate(e,t)}},ConditionsExpression.prototype.evaluateColor=function(e,t){const n=this._runtimeConditions;if(!defined(n))return;const i=n.length;for(let r=0;r<i;++r){const i=n[r];if(i.condition.evaluate(e))return i.expression.evaluateColor(e,t)}},ConditionsExpression.prototype.getShaderFunction=function(e,t,n,i){const r=this._runtimeConditions;if(!defined(r)||0===r.length)return;let o="";const a=r.length;for(let e=0;e<a;++e){const i=r[e];o+=" "+(0===e?"if":"else if")+" ("+i.condition.getShaderExpression(t,n)+")\n {\n return "+i.expression.getShaderExpression(t,n)+";\n }\n"}return o=i+" "+e+"\n{\n"+o+" return "+i+"(1.0);\n}\n",o},ConditionsExpression.prototype.getVariables=function(){let e=[];const t=this._runtimeConditions;if(!defined(t)||0===t.length)return e;const n=t.length;for(let i=0;i<n;++i){const n=t[i];e.push.apply(e,n.condition.getVariables()),e.push.apply(e,n.expression.getVariables())}return e=e.filter((function(e,t,n){return n.indexOf(e)===t})),e},Object.defineProperties(Cesium3DTileStyle.prototype,{style:{get:function(){return this._style}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},show:{get:function(){return this._show},set:function(e){this._show=getExpression(this,e),this._style.show=getJsonFromExpression(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=getExpression(this,e),this._style.color=getJsonFromExpression(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=getExpression(this,e),this._style.pointSize=getJsonFromExpression(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=getExpression(this,e),this._style.pointOutlineColor=getJsonFromExpression(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=getExpression(this,e),this._style.pointOutlineWidth=getJsonFromExpression(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=getExpression(this,e),this._style.labelColor=getJsonFromExpression(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=getExpression(this,e),this._style.labelOutlineColor=getJsonFromExpression(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=getExpression(this,e),this._style.labelOutlineWidth=getJsonFromExpression(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=getExpression(this,e),this._style.font=getJsonFromExpression(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=getExpression(this,e),this._style.labelStyle=getJsonFromExpression(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=getExpression(this,e),this._style.labelText=getJsonFromExpression(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=getExpression(this,e),this._style.backgroundColor=getJsonFromExpression(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=getExpression(this,e),this._style.backgroundPadding=getJsonFromExpression(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=getExpression(this,e),this._style.backgroundEnabled=getJsonFromExpression(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=getExpression(this,e),this._style.scaleByDistance=getJsonFromExpression(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=getExpression(this,e),this._style.translucencyByDistance=getJsonFromExpression(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=getExpression(this,e),this._style.distanceDisplayCondition=getJsonFromExpression(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=getExpression(this,e),this._style.heightOffset=getJsonFromExpression(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=getExpression(this,e),this._style.anchorLineEnabled=getJsonFromExpression(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=getExpression(this,e),this._style.anchorLineColor=getJsonFromExpression(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=getExpression(this,e),this._style.image=getJsonFromExpression(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=getExpression(this,e),this._style.disableDepthTestDistance=getJsonFromExpression(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=getExpression(this,e),this._style.horizontalOrigin=getJsonFromExpression(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=getExpression(this,e),this._style.verticalOrigin=getJsonFromExpression(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=getExpression(this,e),this._style.labelHorizontalOrigin=getJsonFromExpression(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=getExpression(this,e),this._style.labelVerticalOrigin=getJsonFromExpression(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}}),Cesium3DTileStyle.prototype.getColorShaderFunction=function(e,t,n){return this._colorShaderFunctionReady?(n.translucent=this._colorShaderTranslucent,this._colorShaderFunction):(this._colorShaderFunctionReady=!0,defined(this.color)&&defined(this.color.getShaderFunction)?this._colorShaderFunction=this.color.getShaderFunction(e,t,n,"vec4"):this._colorShaderFunction=void 0,this._colorShaderTranslucent=n.translucent,this._colorShaderFunction)},Cesium3DTileStyle.prototype.getShowShaderFunction=function(e,t,n){return this._showShaderFunctionReady||(this._showShaderFunctionReady=!0,defined(this.show)&&defined(this.show.getShaderFunction)?this._showShaderFunction=this.show.getShaderFunction(e,t,n,"bool"):this._showShaderFunction=void 0),this._showShaderFunction},Cesium3DTileStyle.prototype.getPointSizeShaderFunction=function(e,t,n){return this._pointSizeShaderFunctionReady||(this._pointSizeShaderFunctionReady=!0,defined(this.pointSize)&&defined(this.pointSize.getShaderFunction)?this._pointSizeShaderFunction=this.pointSize.getShaderFunction(e,t,n,"float"):this._pointSizeShaderFunction=void 0),this._pointSizeShaderFunction},Cesium3DTileStyle.prototype.getVariables=function(){let e=[];return defined(this.color)&&defined(this.color.getVariables)&&e.push.apply(e,this.color.getVariables()),defined(this.show)&&defined(this.show.getVariables)&&e.push.apply(e,this.show.getVariables()),defined(this.pointSize)&&defined(this.pointSize.getVariables)&&e.push.apply(e,this.pointSize.getVariables()),e=e.filter((function(e,t,n){return n.indexOf(e)===t})),e},Object.defineProperties(CircleEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),CircleEmitter.prototype.emit=function(e){const t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),n=CesiumMath.randomBetween(0,this._radius),i=n*Math.cos(t),r=n*Math.sin(t);e.position=Cartesian3.fromElements(i,r,0,e.position),e.velocity=Cartesian3.clone(Cartesian3.UNIT_Z,e.velocity)};const CloudType={CUMULUS:0,validate:function(e){return e===CloudType.CUMULUS}};var CloudType$1=Object.freeze(CloudType),CloudCollectionFS="uniform sampler2D u_noiseTexture;\nuniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;\nvec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,\ninverseNoiseTextureRows / textureSliceWidth);\nvec2 voxelToUV(vec3 voxelIndex) {\nvec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);\nfloat column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);\nfloat row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);\nfloat xPixelCoord = wrappedIndex.x + column * textureSliceWidth;\nfloat yPixelCoord = wrappedIndex.y + row * textureSliceWidth;\nreturn vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;\n}\nvec4 lerpSamplesX(vec3 voxelIndex, float x) {\nvec2 uv0 = voxelToUV(voxelIndex);\nvec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));\nvec4 sample0 = texture2D(u_noiseTexture, uv0);\nvec4 sample1 = texture2D(u_noiseTexture, uv1);\nreturn mix(sample0, sample1, x);\n}\nvec4 sampleNoiseTexture(vec3 position) {\nvec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);\nvec3 lerpValue = fract(recenteredPos);\nvec3 voxelIndex = floor(recenteredPos);\nvec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);\nvec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);\nvec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);\nvec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);\nvec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);\nvec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);\nreturn mix(yLerp0, yLerp1, lerpValue.z);\n}\nbool intersectSphere(vec3 origin, vec3 dir, float slice,\nout vec3 point, out vec3 normal) {\nfloat A = dot(dir, dir);\nfloat B = dot(origin, dir);\nfloat C = dot(origin, origin) - 0.25;\nfloat discriminant = (B * B) - (A * C);\nif(discriminant < 0.0) {\nreturn false;\n}\nfloat root = sqrt(discriminant);\nfloat t = (-B - root) / A;\nif(t < 0.0) {\nt = (-B + root) / A;\n}\npoint = origin + t * dir;\nif(slice >= 0.0) {\npoint.z = (slice / 2.0) - 0.5;\nif(length(point) > 0.5) {\nreturn false;\n}\n}\nnormal = normalize(point);\npoint -= czm_epsilon2 * normal;\nreturn true;\n}\nbool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,\nout vec3 point, out vec3 normal) {\nif(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {\nreturn false;\n}\nvec3 o = (origin - center) / scale;\nvec3 d = dir / scale;\nvec3 p, n;\nbool intersected = intersectSphere(o, d, slice, p, n);\nif(intersected) {\npoint = (p * scale) + center;\nnormal = n;\n}\nreturn intersected;\n}\nvec2 phaseShift2D(vec2 p, vec2 freq) {\nreturn (czm_pi / 2.0) * sin(freq.yx * p.yx);\n}\nvec2 phaseShift3D(vec3 p, vec2 freq) {\nreturn phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));\n}\nconst float T0 = 0.6;\nconst float k = 0.1;\nconst float C0 = 0.8;\nconst float FX0 = 0.6;\nconst float FY0 = 0.6;\nconst int octaves = 5;\nfloat T(vec3 point) {\nvec2 sum = vec2(0.0);\nfloat Ci = C0;\nvec2 FXY = vec2(FX0, FY0);\nvec2 PXY = vec2(0.0);\nfor(int i = 1; i <= octaves; i++) {\nPXY = phaseShift3D(point, FXY);\nCi *= 0.707;\nFXY *= 2.0;\nvec2 sinTerm = sin(FXY * point.xy + PXY);\nsum += Ci * sinTerm + vec2(T0);\n}\nreturn k * sum.x * sum.y;\n}\nconst float a = 0.5;\nconst float t = 0.4;\nconst float s = 0.25;\nfloat I(float Id, float Is, float It) {\nreturn (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;\n}\nconst vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));\nvec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,\nfloat brightness) {\nvec3 cloudPoint, cloudNormal;\nif(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,\ncloudPoint, cloudNormal)) {\nreturn vec4(0.0);\n}\nfloat Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0);\nfloat Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);\nfloat It = T(cloudPoint);\nfloat intensity = I(Id, Is, It);\nvec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));\nvec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);\nfloat W = noise.x;\nfloat W2 = noise.y;\nfloat W3 = noise.z;\nfloat ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);\nfloat TR = pow(ndDot, 3.0) - W;\nTR *= 1.3;\nfloat minusDot = 0.5 - ndDot;\nTR -= min(minusDot * W2, 0.0);\nTR -= 0.8 * (minusDot + 0.25) * W3;\nfloat shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);\nshading = clamp(shading + 0.2, 0.3, 1.0);\nvec3 finalColor = mix(vec3(0.5), shading * color, 1.15);\nreturn vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;\n}\nvoid main() {\n#ifdef DEBUG_BILLBOARDS\ngl_FragColor = vec4(0.0, 0.5, 0.5, 1.0);\n#endif\nvec2 coordinate = v_maximumSize.xy * v_offset;\nvec3 ellipsoidScale = 0.82 * v_maximumSize;\nvec3 ellipsoidCenter = vec3(0.0);\nfloat zOffset = max(ellipsoidScale.z - 10.0, 0.0);\nvec3 eye = vec3(0, 0, -10.0 - zOffset);\nvec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);\nvec3 rayOrigin = eye;\n#ifdef DEBUG_ELLIPSOIDS\nvec3 point, normal;\nif(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,\npoint, normal)) {\ngl_FragColor = v_brightness * v_color;\n}\n#else\n#ifndef DEBUG_BILLBOARDS\nvec4 cloud = drawCloud(rayOrigin, rayDir,\nellipsoidCenter, ellipsoidScale, v_slice, v_brightness);\nif(cloud.w < 0.01) {\ndiscard;\n}\ngl_FragColor = cloud;\n#endif\n#endif\n}\n",CloudCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScaleX;\nattribute vec4 positionLowAndScaleY;\nattribute vec4 packedAttribute0;\nattribute vec4 packedAttribute1;\nattribute vec4 color;\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\nvoid main() {\nvec3 positionHigh = positionHighAndScaleX.xyz;\nvec3 positionLow = positionLowAndScaleY.xyz;\nvec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);\nfloat show = packedAttribute0.x;\nfloat brightness = packedAttribute0.y;\nvec2 coordinates = packedAttribute0.wz;\nvec3 maximumSize = packedAttribute1.xyz;\nfloat slice = packedAttribute1.w;\n#ifdef INSTANCED\nvec2 dir = direction;\n#else\nvec2 dir = coordinates;\n#endif\nvec2 offset = dir - vec2(0.5, 0.5);\nvec2 scaledOffset = scale * offset;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xy += scaledOffset;\npositionEC.xyz *= show;\ngl_Position = czm_projection * positionEC;\nv_offset = offset;\nv_maximumSize = maximumSize;\nv_color = color;\nv_slice = slice;\nv_brightness = brightness;\n}\n",CloudNoiseFS="uniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nuniform vec3 u_noiseOffset;\nvarying vec2 v_position;\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nfloat wrap(float value, float rangeLength) {\nif(value < 0.0) {\nfloat absValue = abs(value);\nfloat modValue = mod(absValue, rangeLength);\nreturn mod(rangeLength - modValue, rangeLength);\n}\nreturn mod(value, rangeLength);\n}\nvec3 wrapVec(vec3 value, float rangeLength) {\nreturn vec3(wrap(value.x, rangeLength),\nwrap(value.y, rangeLength),\nwrap(value.z, rangeLength));\n}\nvec3 random3(vec3 p) {\nfloat dot1 = dot(p, vec3(127.1, 311.7, 932.8));\nfloat dot2 = dot(p, vec3(269.5, 183.3, 421.4));\nreturn fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));\n}\nvec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {\nvec3 cell = centerCell + offset;\ncell = wrapVec(cell, textureSliceWidth / u_noiseDetail);\ncell += floor(u_noiseOffset / u_noiseDetail);\nvec3 p = offset + random3(cell);\nreturn p;\n}\nfloat worleyNoise(vec3 p, float freq) {\nvec3 centerCell = floor(p * freq);\nvec3 pointInCell = fract(p * freq);\nfloat shortestDistance = 1000.0;\nfor(float z = -1.0; z <= 1.0; z++) {\nfor(float y = -1.0; y <= 1.0; y++) {\nfor(float x = -1.0; x <= 1.0; x++) {\nvec3 offset = vec3(x, y, z);\nvec3 point = getWorleyCellPoint(centerCell, offset, freq);\nfloat distance = length(pointInCell - point);\nif(distance < shortestDistance) {\nshortestDistance = distance;\n}\n}\n}\n}\nreturn shortestDistance;\n}\nconst float MAX_FBM_ITERATIONS = 10.0;\nfloat worleyFBMNoise(vec3 p, float octaves, float scale) {\nfloat noise = 0.0;\nfloat freq = 1.0;\nfloat persistence = 0.625;\nfor(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {\nif(i >= octaves) {\nbreak;\n}\nnoise += worleyNoise(p * scale, freq * scale) * persistence;\npersistence *= 0.5;\nfreq *= 2.0;\n}\nreturn noise;\n}\nvoid main() {\nfloat x = mod(v_position.x, textureSliceWidth);\nfloat y = mod(v_position.y, textureSliceWidth);\nfloat sliceRow = floor(v_position.y / textureSliceWidth);\nfloat z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;\nvec3 position = vec3(x, y, z);\nposition /= u_noiseDetail;\nfloat worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);\nfloat worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);\nfloat worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);\ngl_FragColor = vec4(worley0, worley1, worley2, 1.0);\n}\n",CloudNoiseVS="uniform vec3 u_noiseTextureDimensions;\nattribute vec2 position;\nvarying vec2 v_position;\nvoid main()\n{\ngl_Position = vec4(position, 0.1, 1.0);\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat noiseTextureRows = u_noiseTextureDimensions.y;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\nvec2 transformedPos = (position * 0.5) + vec2(0.5);\ntransformedPos *= textureSliceWidth;\ntransformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;\ntransformedPos.y *= noiseTextureRows;\nv_position = transformedPos;\n}\n";function CumulusCloud(e,t){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),!defined(e.scale)&&defined(e.maximumSize))this._maximumSize=Cartesian3.clone(e.maximumSize),this._scale=new Cartesian2(this._maximumSize.x,this._maximumSize.y);else{this._scale=Cartesian2.clone(defaultValue(e.scale,new Cartesian2(20,12)));const t=new Cartesian3(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=Cartesian3.clone(defaultValue(e.maximumSize,t))}this._slice=defaultValue(e.slice,-1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._brightness=defaultValue(e.brightness,1),this._cloudCollection=t,this._index=-1}const SHOW_INDEX$1=CumulusCloud.SHOW_INDEX=0,POSITION_INDEX$1=CumulusCloud.POSITION_INDEX=1,SCALE_INDEX$1=CumulusCloud.SCALE_INDEX=2,MAXIMUM_SIZE_INDEX$1=CumulusCloud.MAXIMUM_SIZE_INDEX=3,SLICE_INDEX$1=CumulusCloud.SLICE_INDEX=4,BRIGHTNESS_INDEX$1=CumulusCloud.BRIGHTNESS_INDEX=5,COLOR_INDEX$1=CumulusCloud.COLOR_INDEX=6;function makeDirty(e,t){const n=e._cloudCollection;defined(n)&&(n._updateCloud(e,t),e._dirty=!0)}let attributeLocations$1;CumulusCloud.NUMBER_OF_PROPERTIES=7,Object.defineProperties(CumulusCloud.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty(this,SHOW_INDEX$1))}},position:{get:function(){return this._position},set:function(e){const t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,POSITION_INDEX$1))}},scale:{get:function(){return this._scale},set:function(e){const t=this._scale;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty(this,SCALE_INDEX$1))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){const t=this._maximumSize;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,MAXIMUM_SIZE_INDEX$1))}},color:{get:function(){return this._color},set:function(e){const t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty(this,COLOR_INDEX$1))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,makeDirty(this,SLICE_INDEX$1))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,makeDirty(this,BRIGHTNESS_INDEX$1))}}}),CumulusCloud.prototype._destroy=function(){this._cloudCollection=void 0};const scratchTextureDimensions=new Cartesian3,attributeLocationsBatched={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},attributeLocationsInstanced={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},SHOW_INDEX=CumulusCloud.SHOW_INDEX,POSITION_INDEX=CumulusCloud.POSITION_INDEX,SCALE_INDEX=CumulusCloud.SCALE_INDEX,MAXIMUM_SIZE_INDEX=CumulusCloud.MAXIMUM_SIZE_INDEX,SLICE_INDEX=CumulusCloud.SLICE_INDEX,BRIGHTNESS_INDEX=CumulusCloud.BRIGHTNESS_INDEX,NUMBER_OF_PROPERTIES=CumulusCloud.NUMBER_OF_PROPERTIES,COLOR_INDEX=CumulusCloud.COLOR_INDEX;function CloudCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=defaultValue(e.noiseDetail,16),this.noiseOffset=Cartesian3.clone(defaultValue(e.noiseOffset,Cartesian3.ZERO)),this._loading=!1,this._ready=!1;const t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:getNoiseTextureDimensions(t),u_noiseDetail:function(){return t.noiseDetail}},this._vaNoise=void 0,this._spNoise=void 0,this._spCreated=!1,this._sp=void 0,this._rs=void 0,this.show=defaultValue(e.show,!0),this._colorCommands=[],this.debugBillboards=defaultValue(e.debugBillboards,!1),this._compiledDebugBillboards=!1,this.debugEllipsoids=defaultValue(e.debugEllipsoids,!1),this._compiledDebugEllipsoids=!1}function getNoiseTextureDimensions(e){return function(){return scratchTextureDimensions.x=e._textureSliceWidth,scratchTextureDimensions.y=e._noiseTextureRows,scratchTextureDimensions.z=1/e._noiseTextureRows,scratchTextureDimensions}}function destroyClouds(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}function removeClouds(e){if(e._cloudsRemoved){e._cloudsRemoved=!1;const t=[],n=e._clouds,i=n.length;for(let e=0,r=0;e<i;++e){const i=n[e];defined(i)&&(n._index=r++,t.push(i))}e._clouds=t}}Object.defineProperties(CloudCollection.prototype,{length:{get:function(){return removeClouds(this),this._clouds.length}}}),CloudCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);let t;return defaultValue(e.cloudType,CloudType$1.CUMULUS)===CloudType$1.CUMULUS&&(t=new CumulusCloud(e,this),t._index=this._clouds.length,this._clouds.push(t),this._createVertexArray=!0),t},CloudCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},CloudCollection.prototype.removeAll=function(){destroyClouds(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0},CloudCollection.prototype._updateCloud=function(e,t){e._dirty||(this._cloudsToUpdate[this._cloudsToUpdateIndex++]=e),++this._propertiesChanged[t]},CloudCollection.prototype.contains=function(e){return defined(e)&&e._cloudCollection===this},CloudCollection.prototype.get=function(e){return removeClouds(this),this._clouds[e]};const texturePositions=new Float32Array([-1,-1,1,-1,1,1,-1,1]),textureIndices=new Uint16Array([0,1,2,0,2,3]);function createTextureVA(e){const t=Buffer$1.createVertexBuffer({context:e,typedArray:texturePositions,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createIndexBuffer({context:e,typedArray:textureIndices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:n})}let getIndexBuffer;function getIndexBufferBatched(e){let t=e.cache.cloudCollection_indexBufferBatched;if(defined(t))return t;const n=new Uint16Array(98298);for(let e=0,t=0;e<98298;e+=6,t+=4)n[e]=t,n[e+1]=t+1,n[e+2]=t+2,n[e+3]=t,n[e+4]=t+2,n[e+5]=t+3;return t=Buffer$1.createIndexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferBatched=t,t}function getIndexBufferInstanced(e){let t=e.cache.cloudCollection_indexBufferInstanced;return defined(t)||(t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferInstanced=t),t}function getVertexBufferInstanced(e){let t=e.cache.cloudCollection_vertexBufferInstanced;return defined(t)||(t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_vertexBufferInstanced=t),t}function createVAF(e,t,n){const i=[{index:attributeLocations$1.positionHighAndScaleX,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.positionLowAndScaleY,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.packedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:BufferUsage$1.STATIC_DRAW},{index:attributeLocations$1.color,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,usage:BufferUsage$1.STATIC_DRAW}];n&&i.push({index:attributeLocations$1.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced(e)});return new VertexArrayFacade(e,i,n?t:4*t,n)}const writePositionScratch=new EncodedCartesian3;function writePositionAndScale(e,t,n,i){let r;const o=n[attributeLocations$1.positionHighAndScaleX],a=n[attributeLocations$1.positionLowAndScaleY],s=i.position;EncodedCartesian3.fromCartesian(s,writePositionScratch);const c=i.scale,l=writePositionScratch.high,u=writePositionScratch.low;e._instanced?(r=i._index,o(r,l.x,l.y,l.z,c.x),a(r,u.x,u.y,u.z,c.y)):(r=4*i._index,o(r+0,l.x,l.y,l.z,c.x),o(r+1,l.x,l.y,l.z,c.x),o(r+2,l.x,l.y,l.z,c.x),o(r+3,l.x,l.y,l.z,c.x),a(r+0,u.x,u.y,u.z,c.y),a(r+1,u.x,u.y,u.z,c.y),a(r+2,u.x,u.y,u.z,c.y),a(r+3,u.x,u.y,u.z,c.y))}function writePackedAttribute0(e,t,n,i){let r;const o=n[attributeLocations$1.packedAttribute0],a=i.show,s=i.brightness;e._instanced?(r=i._index,o(r,a,s,0,0)):(r=4*i._index,o(r+0,a,s,0,0),o(r+1,a,s,1,0),o(r+2,a,s,1,1),o(r+3,a,s,0,1))}function writePackedAttribute1(e,t,n,i){let r;const o=n[attributeLocations$1.packedAttribute1],a=i.maximumSize,s=i.slice;e._instanced?(r=i._index,o(r,a.x,a.y,a.z,s)):(r=4*i._index,o(r+0,a.x,a.y,a.z,s),o(r+1,a.x,a.y,a.z,s),o(r+2,a.x,a.y,a.z,s),o(r+3,a.x,a.y,a.z,s))}function writeColor(e,t,n,i){let r;const o=n[attributeLocations$1.color],a=i.color,s=Color.floatToByte(a.red),c=Color.floatToByte(a.green),l=Color.floatToByte(a.blue),u=Color.floatToByte(a.alpha);e._instanced?(r=i._index,o(r,s,c,l,u)):(r=4*i._index,o(r+0,s,c,l,u),o(r+1,s,c,l,u),o(r+2,s,c,l,u),o(r+3,s,c,l,u))}function writeCloud(e,t,n,i){writePositionAndScale(e,t,n,i),writePackedAttribute0(e,t,n,i),writePackedAttribute1(e,t,n,i),writeColor(e,t,n,i)}function createNoiseTexture(e,t,n,i){const r=e,o=r._textureSliceWidth,a=r._noiseTextureRows,s=t.context;r._vaNoise=createTextureVA(s),r._spNoise=ShaderProgram.fromCache({context:s,vertexShaderSource:n,fragmentShaderSource:i,attributeLocations:{position:0}});const c=r.noiseDetail,l=r.noiseOffset;r._noiseTexture=new Texture({context:s,width:o*o/a,height:o*a,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,pixelFormat:PixelFormat$1.RGBA,sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})});const u=new ComputeCommand({vertexArray:r._vaNoise,shaderProgram:r._spNoise,outputTexture:r._noiseTexture,uniformMap:{u_noiseTextureDimensions:getNoiseTextureDimensions(r),u_noiseDetail:function(){return c},u_noiseOffset:function(){return l}},persists:!1,owner:e,postExecute:function(e){r._ready=!0,r._loading=!1}});t.commandList.push(u),r._loading=!0}function createVertexArray(e,t){const n=e,i=t.context;n._createVertexArray=!1,n._vaf=n._vaf&&n._vaf.destroy();const r=e._clouds,o=r.length;if(o>0){n._vaf=createVAF(i,o,n._instanced);const a=n._vaf.writers;let s;for(s=0;s<o;++s){writeCloud(e,t,a,r[s])}n._vaf.commit(getIndexBuffer(i))}}const scratchWriterArray=[];function updateClouds(e,t){const n=t.context,i=e,r=i._clouds.length,o=i._cloudsToUpdate,a=i._cloudsToUpdateIndex,s=i._propertiesChanged,c=scratchWriterArray;c.length=0,(s[POSITION_INDEX]||s[SCALE_INDEX])&&c.push(writePositionAndScale),(s[SHOW_INDEX]||s[BRIGHTNESS_INDEX])&&c.push(writePackedAttribute0),(s[MAXIMUM_SIZE_INDEX]||s[SLICE_INDEX])&&c.push(writePackedAttribute1),s[COLOR_INDEX]&&c.push(writeColor);const l=c.length,u=i._vaf.writers;let d,h,p;if(a/r>.1){for(d=0;d<a;++d)for(h=o[d],h._dirty=!1,p=0;p<l;++p)c[p](e,t,u,h);i._vaf.commit(getIndexBuffer(n))}else{for(d=0;d<a;++d){for(h=o[d],h._dirty=!1,p=0;p<l;++p)c[p](e,t,u,h);i._instanced?i._vaf.subCommit(h._index,1):i._vaf.subCommit(4*h._index,4)}i._vaf.endSubCommits()}i._cloudsToUpdateIndex=0}function createShaderProgram(e,t,n,i){const r=t.context,o=e,a=new ShaderSource({defines:[],sources:[n]});o._instanced&&a.defines.push("INSTANCED");const s=new ShaderSource({defines:[],sources:[i]});o.debugBillboards&&s.defines.push("DEBUG_BILLBOARDS"),o.debugEllipsoids&&s.defines.push("DEBUG_ELLIPSOIDS"),o._sp=ShaderProgram.replaceCache({context:r,shaderProgram:o._sp,vertexShaderSource:a,fragmentShaderSource:s,attributeLocations:attributeLocations$1}),o._rs=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}),o._spCreated=!0,o._compiledDebugBillboards=o.debugBillboards,o._compiledDebugEllipsoids=o.debugEllipsoids}function createDrawCommands(e,t){const n=e,i=t.passes,r=n._uniforms,o=t.commandList;if(i.render){const t=n._colorCommands,i=n._vaf.va,a=i.length;t.length=a;for(let s=0;s<a;s++){let a=t[s];defined(a)||(a=t[s]=new DrawCommand),a.pass=Pass$1.TRANSLUCENT,a.owner=e,a.uniformMap=r,a.count=i[s].indicesCount,a.vertexArray=i[s].va,a.shaderProgram=n._sp,a.renderState=n._rs,n._instanced&&(a.count=6,a.instanceCount=n._clouds.length),o.push(a)}}}function computeFlyToLocationForRectangle(e,t){const n=t.terrainProvider,i=t.mapProjection,r=i.ellipsoid;let o;const a=t.camera.getRectangleCameraCoordinates(e);return o=t.mode===SceneMode$1.SCENE3D?r.cartesianToCartographic(a):i.unproject(a),defined(n)?n.readyPromise.then((function(){if(!defined(n.availability)||t.mode===SceneMode$1.SCENE2D)return o;const i=[Rectangle.center(e),Rectangle.southeast(e),Rectangle.southwest(e),Rectangle.northeast(e),Rectangle.northwest(e)];return computeFlyToLocationForRectangle._sampleTerrainMostDetailed(n,i).then((function(e){const t=e.reduce((function(e,t){return Math.max(t.height,e)}),-Number.MAX_VALUE),n=o;return n.height+=t,n}))})):when.resolve(o)}CloudCollection.prototype.update=function(e){if(removeClouds(this),!this.show)return;const t=this.debugBillboards||this.debugEllipsoids;this._ready=!!t||defined(this._noiseTexture),this._ready||this._loading||t||createNoiseTexture(this,e,CloudNoiseVS,CloudNoiseFS),this._instanced=e.context.instancedArrays,attributeLocations$1=this._instanced?attributeLocationsInstanced:attributeLocationsBatched,getIndexBuffer=this._instanced?getIndexBufferInstanced:getIndexBufferBatched;const n=this._clouds.length,i=this._cloudsToUpdate,r=this._cloudsToUpdateIndex;this._createVertexArray?createVertexArray(this,e):r>0&&updateClouds(this,e),r>1.5*n&&(i.length=n),!defined(this._vaf)||!defined(this._vaf.va)||!this._ready&!t||(this._spCreated&&this.debugBillboards===this._compiledDebugBillboards&&this.debugEllipsoids===this._compiledDebugEllipsoids||createShaderProgram(this,e,CloudCollectionVS,CloudCollectionFS),createDrawCommands(this,e))},CloudCollection.prototype.isDestroyed=function(){return!1},CloudCollection.prototype.destroy=function(){return this._noiseTexture=this._noiseTexture&&this._noiseTexture.destroy(),this._sp=this._sp&&this._sp.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),destroyClouds(this._clouds),destroyObject(this)},computeFlyToLocationForRectangle._sampleTerrainMostDetailed=sampleTerrainMostDetailed;const defaultAngle=CesiumMath.toRadians(30);function ConeEmitter(e){this._angle=defaultValue(e,defaultAngle)}Object.defineProperties(ConeEmitter.prototype,{angle:{get:function(){return this._angle},set:function(e){this._angle=e}}}),ConeEmitter.prototype.emit=function(e){const t=Math.tan(this._angle),n=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),i=CesiumMath.randomBetween(0,t),r=i*Math.cos(n),o=i*Math.sin(n);e.velocity=Cartesian3.fromElements(r,o,1,e.velocity),Cartesian3.normalize(e.velocity,e.velocity),e.position=Cartesian3.clone(Cartesian3.ZERO,e.position)};const scratchColor$2=new Color,scratchColorAbove=new Color,scratchColorBelow=new Color,scratchColorBlend=new Color,scratchPackedFloat=new Cartesian4,scratchColorBytes=new Uint8Array(4);function lerpEntryColor(e,t,n,i){const r=t.height===n.height?0:(e-t.height)/(n.height-t.height);return Color.lerp(t.color,n.color,r,i)}function createNewEntry(e,t){return{height:e,color:Color.clone(t)}}function removeDuplicates(e){return e=e.filter((function(e,t,n){const i=t>0,r=t<n.length-1,o=!i||e.height===n[t-1].height,a=!r||e.height===n[t+1].height;return!o||!a})),e=e.filter((function(e,t,n){const i=t>0,r=t<n.length-1,o=!!i&&Color.equals(e.color,n[t-1].color),a=!!r&&Color.equals(e.color,n[t+1].color);return!o||!a})),e=e.filter((function(e,t,n){const i=t>0,r=!!i&&Color.equals(e.color,n[t-1].color),o=!i||e.height===n[t-1].height;return!r||!o})),e}function preprocess(e){let t,n;const i=[],r=e.length;for(t=0;t<r;t++){const r=e[t],o=r.entries,a=o.length;let s=[];for(n=0;n<a;n++){const e=o[n],t=CesiumMath.clamp(e.height,createElevationBandMaterial._minimumHeight,createElevationBandMaterial._maximumHeight),i=Color.clone(e.color,scratchColor$2);i.red*=i.alpha,i.green*=i.alpha,i.blue*=i.alpha,s.push(createNewEntry(t,i))}let c=!0,l=!0;for(n=0;n<a-1;n++){const e=s[n+0],t=s[n+1];c=c&&e.height<=t.height,l=l&&e.height>=t.height}l?s=s.reverse():c||mergeSort(s,(function(e,t){return CesiumMath.sign(e.height-t.height)}));let u=defaultValue(r.extendDownwards,!1),d=defaultValue(r.extendUpwards,!1);1!==s.length||u||d||(u=!0,d=!0),u&&s.splice(0,0,createNewEntry(createElevationBandMaterial._minimumHeight,s[0].color)),d&&s.splice(s.length,0,createNewEntry(createElevationBandMaterial._maximumHeight,s[s.length-1].color)),s=removeDuplicates(s),i.push(s)}return i}function createLayeredEntries(e){const t=preprocess(e);let n,i=[],r=[];function o(e,t){i.push(createNewEntry(e,t))}function a(e,t,n){let i=Color.multiplyByScalar(n,1-t.alpha,scratchColorBlend);i=Color.add(i,t,i),o(e,i)}const s=t.length;for(n=0;n<s;n++){const e=t[n];let s=0,c=0;r=i,i=[];const l=e.length,u=r.length;for(;s<l||c<u;){const t=s<l?e[s]:void 0,n=s>0?e[s-1]:void 0,i=s<l-1?e[s+1]:void 0,d=c<u?r[c]:void 0,h=c>0?r[c-1]:void 0,p=c<u-1?r[c+1]:void 0;if(defined(t)&&defined(d)&&t.height===d.height){const e=defined(p)&&d.height===p.height,r=!defined(h),l=!defined(p),u=defined(i)&&t.height===i.height,f=!defined(n),m=!defined(i);e?u?(a(t.height,t.color,d.color),a(t.height,i.color,p.color)):f?(o(t.height,d.color),a(t.height,t.color,p.color)):m?(a(t.height,t.color,d.color),o(t.height,p.color)):(a(t.height,t.color,d.color),a(t.height,t.color,p.color)):r?u?(o(t.height,t.color),a(t.height,i.color,d.color)):m?(o(t.height,t.color),o(t.height,d.color)):(f||o(t.height,t.color),a(t.height,t.color,d.color)):l?u?(a(t.height,t.color,d.color),o(t.height,i.color)):f?(o(t.height,d.color),o(t.height,t.color)):m?a(t.height,t.color,d.color):(a(t.height,t.color,d.color),o(t.height,t.color)):u?(a(t.height,t.color,d.color),a(t.height,i.color,d.color)):f?(o(t.height,d.color),a(t.height,t.color,d.color)):m?(a(t.height,t.color,d.color),o(t.height,d.color)):a(t.height,t.color,d.color),s+=u?2:1,c+=e?2:1}else if(defined(t)&&defined(d)&&defined(h)&&t.height<d.height){const e=lerpEntryColor(t.height,h,d,scratchColorBelow);defined(n)?defined(i)?a(t.height,t.color,e):(a(t.height,t.color,e),o(t.height,e)):(o(t.height,e),a(t.height,t.color,e)),s++}else if(defined(d)&&defined(t)&&defined(n)&&d.height<t.height){const e=lerpEntryColor(d.height,n,t,scratchColorAbove);defined(h)?defined(p)?a(d.height,e,d.color):(a(d.height,e,d.color),o(d.height,e)):(o(d.height,e),a(d.height,e,d.color)),c++}else defined(t)&&(!defined(d)||t.height<d.height)?(!defined(d)||defined(h)||defined(i)?(defined(d)||!defined(h)||defined(n)||(o(h.height,createElevationBandMaterial._emptyColor),o(t.height,createElevationBandMaterial._emptyColor)),o(t.height,t.color)):(o(t.height,t.color),o(t.height,createElevationBandMaterial._emptyColor),o(d.height,createElevationBandMaterial._emptyColor)),s++):defined(d)&&(!defined(t)||d.height<t.height)&&(o(d.height,d.color),c++)}}return removeDuplicates(i)}function createElevationBandMaterial(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).scene,n=createLayeredEntries(e.layers),i=n.length;let r,o,a,s;if(!createElevationBandMaterial._useFloatTexture(t.context))for(a=PixelDatatype$1.UNSIGNED_BYTE,s=PixelFormat$1.RGBA,o=new Uint8Array(4*i),r=0;r<i;r++)Cartesian4.packFloat(n[r].height,scratchPackedFloat),Cartesian4.pack(scratchPackedFloat,o,4*r);else for(a=PixelDatatype$1.FLOAT,s=PixelFormat$1.LUMINANCE,o=new Float32Array(i),r=0;r<i;r++)o[r]=n[r].height;const c=Texture.create({context:t.context,pixelFormat:s,pixelDatatype:a,source:{arrayBufferView:o,width:i,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),l=new Uint8Array(4*i);for(r=0;r<i;r++){n[r].color.toBytes(scratchColorBytes),l[4*r+0]=scratchColorBytes[0],l[4*r+1]=scratchColorBytes[1],l[4*r+2]=scratchColorBytes[2],l[4*r+3]=scratchColorBytes[3]}const u=Texture.create({context:t.context,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:i,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})});return Material$4.fromType("ElevationBand",{heights:c,colors:u})}function createOsmBuildings(e){const t=new Cesium3DTileset(e=combine$2(e,{url:IonResource.fromAssetId(96188)}));let n=e.style;if(!defined(n)){n=new Cesium3DTileStyle({color:"Boolean(${feature['cesium#color']}) ? color(${feature['cesium#color']}) : "+defaultValue(e.defaultColor,Color.WHITE).toCssColorString()})}return t.style=n,t}function createTangentSpaceDebugPrimitive(e){const t=[];let n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometry;defined(n.attributes)&&defined(n.primitiveType)||(n=n.constructor.createGeometry(n));const i=n.attributes,r=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),o=defaultValue(e.length,1e4);if(defined(i.normal)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(n,"normal",o),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)},modelMatrix:r})),defined(i.tangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(n,"tangent",o),attributes:{color:new ColorGeometryInstanceAttribute(0,1,0,1)},modelMatrix:r})),defined(i.bitangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(n,"bitangent",o),attributes:{color:new ColorGeometryInstanceAttribute(0,0,1,1)},modelMatrix:r})),t.length>0)return new Primitive$3({asynchronous:!1,geometryInstances:t,appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1})})}createElevationBandMaterial._useFloatTexture=function(e){return e.floatingPointTexture},createElevationBandMaterial._maximumHeight=5906376425472,createElevationBandMaterial._minimumHeight=-5906376425472,createElevationBandMaterial._emptyColor=new Color(0,0,0,0);const templateRegex=/{[^}]+}/g,tags={x:xTag,y:yTag,z:zTag,s:sTag,reverseX:reverseXTag,reverseY:reverseYTag,reverseZ:reverseZTag,westDegrees:westDegreesTag,southDegrees:southDegreesTag,eastDegrees:eastDegreesTag,northDegrees:northDegreesTag,westProjected:westProjectedTag,southProjected:southProjectedTag,eastProjected:eastProjectedTag,northProjected:northProjectedTag,width:widthTag,height:heightTag},pickFeaturesTags=combine$2(tags,{i:iTag,j:jTag,reverseI:reverseITag,reverseJ:reverseJTag,longitudeDegrees:longitudeDegreesTag,latitudeDegrees:latitudeDegreesTag,longitudeProjected:longitudeProjectedTag,latitudeProjected:latitudeProjectedTag,format:formatTag});function UrlTemplateImageryProvider(e){this._errorEvent=new Event,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=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._tags=void 0,this._pickFeaturesTags=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this.enablePickFeatures=!0,this.reinitialize(e)}Object.defineProperties(UrlTemplateImageryProvider.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.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 defined(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),UrlTemplateImageryProvider.prototype.reinitialize=function(e){const t=this;t._readyPromise=when(e).then((function(e){const n=e.customTags,i=combine$2(tags,n),r=combine$2(pickFeaturesTags,n),o=Resource.createIfNeeded(e.url),a=Resource.createIfNeeded(e.pickFeaturesUrl);t.enablePickFeatures=defaultValue(e.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=defaultValue(e.urlSchemeZeroPadding,t.urlSchemeZeroPadding),t._tileDiscardPolicy=e.tileDiscardPolicy,t._getFeatureInfoFormats=e.getFeatureInfoFormats,t._subdomains=e.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():defined(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=defaultValue(e.tileWidth,256),t._tileHeight=defaultValue(e.tileHeight,256),t._minimumLevel=defaultValue(e.minimumLevel,0),t._maximumLevel=e.maximumLevel,t._tilingScheme=defaultValue(e.tilingScheme,new WebMercatorTilingScheme({ellipsoid:e.ellipsoid})),t._rectangle=defaultValue(e.rectangle,t._tilingScheme.rectangle),t._rectangle=Rectangle.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=defaultValue(e.hasAlphaChannel,!0);let s=e.credit;return"string"==typeof s&&(s=new Credit(s)),t._credit=s,t._resource=o,t._tags=i,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0}))},UrlTemplateImageryProvider.prototype.getTileCredits=function(e,t,n){},UrlTemplateImageryProvider.prototype.requestImage=function(e,t,n,i){return ImageryProvider.loadImage(this,buildImageResource$1(this,e,t,n,i))},UrlTemplateImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){if(!this.enablePickFeatures||!defined(this._pickFeaturesResource)||0===this._getFeatureInfoFormats.length)return;let o=0;const a=this;function s(e,t){return e.callback(t)}return function c(){if(o>=a._getFeatureInfoFormats.length)return when([]);const l=a._getFeatureInfoFormats[o],u=buildPickFeaturesResource(a,e,t,n,i,r,l.format);return++o,"json"===l.type?u.fetchJson().then(l.callback).otherwise(c):"xml"===l.type?u.fetchXML().then(l.callback).otherwise(c):"text"===l.type||"html"===l.type?u.fetchText().then(l.callback).otherwise(c):u.fetch({responseType:l.format}).then(s.bind(void 0,l)).otherwise(c)}()};let degreesScratchComputed=!1;const degreesScratch=new Rectangle;let projectedScratchComputed=!1;const projectedScratch=new Rectangle;function buildImageResource$1(e,t,n,i,r){degreesScratchComputed=!1,projectedScratchComputed=!1;const o=e._resource,a=o.getUrlComponent(!0),s=e._tags,c={},l=a.match(templateRegex);return defined(l)&&l.forEach((function(r){const o=r.substring(1,r.length-1);defined(s[o])&&(c[o]=s[o](e,t,n,i))})),o.getDerivedResource({request:r,templateValues:c})}let ijScratchComputed=!1;const ijScratch=new Cartesian2;let longitudeLatitudeProjectedScratchComputed=!1;function buildPickFeaturesResource(e,t,n,i,r,o,a){degreesScratchComputed=!1,projectedScratchComputed=!1,ijScratchComputed=!1,longitudeLatitudeProjectedScratchComputed=!1;const s=e._pickFeaturesResource,c=s.getUrlComponent(!0),l=e._pickFeaturesTags,u={},d=c.match(templateRegex);return defined(d)&&d.forEach((function(s){const c=s.substring(1,s.length-1);defined(l[c])&&(u[c]=l[c](e,t,n,i,r,o,a))})),s.getDerivedResource({templateValues:u})}function padWithZerosIfNecessary(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if("string"==typeof i){const e=i.length;e>1&&(n=n.length>=e?n:new Array(e-n.toString().length+1).join("0")+n)}}return n}function xTag(e,t,n,i){return padWithZerosIfNecessary(e,"{x}",t)}function reverseXTag(e,t,n,i){const r=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return padWithZerosIfNecessary(e,"{reverseX}",r)}function yTag(e,t,n,i){return padWithZerosIfNecessary(e,"{y}",n)}function reverseYTag(e,t,n,i){const r=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return padWithZerosIfNecessary(e,"{reverseY}",r)}function reverseZTag(e,t,n,i){const r=e.maximumLevel;return padWithZerosIfNecessary(e,"{reverseZ}",defined(r)&&i<r?r-i-1:i)}function zTag(e,t,n,i){return padWithZerosIfNecessary(e,"{z}",i)}function sTag(e,t,n,i){const r=(t+n+i)%e._subdomains.length;return e._subdomains[r]}function computeDegrees(e,t,n,i){degreesScratchComputed||(e.tilingScheme.tileXYToRectangle(t,n,i,degreesScratch),degreesScratch.west=CesiumMath.toDegrees(degreesScratch.west),degreesScratch.south=CesiumMath.toDegrees(degreesScratch.south),degreesScratch.east=CesiumMath.toDegrees(degreesScratch.east),degreesScratch.north=CesiumMath.toDegrees(degreesScratch.north),degreesScratchComputed=!0)}function westDegreesTag(e,t,n,i){return computeDegrees(e,t,n,i),degreesScratch.west}function southDegreesTag(e,t,n,i){return computeDegrees(e,t,n,i),degreesScratch.south}function eastDegreesTag(e,t,n,i){return computeDegrees(e,t,n,i),degreesScratch.east}function northDegreesTag(e,t,n,i){return computeDegrees(e,t,n,i),degreesScratch.north}function computeProjected(e,t,n,i){projectedScratchComputed||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,projectedScratch),projectedScratchComputed=!0)}function westProjectedTag(e,t,n,i){return computeProjected(e,t,n,i),projectedScratch.west}function southProjectedTag(e,t,n,i){return computeProjected(e,t,n,i),projectedScratch.south}function eastProjectedTag(e,t,n,i){return computeProjected(e,t,n,i),projectedScratch.east}function northProjectedTag(e,t,n,i){return computeProjected(e,t,n,i),projectedScratch.north}function widthTag(e,t,n,i){return e.tileWidth}function heightTag(e,t,n,i){return e.tileHeight}function iTag(e,t,n,i,r,o,a){return computeIJ(e,t,n,i,r,o),ijScratch.x}function jTag(e,t,n,i,r,o,a){return computeIJ(e,t,n,i,r,o),ijScratch.y}function reverseITag(e,t,n,i,r,o,a){return computeIJ(e,t,n,i,r,o),e.tileWidth-ijScratch.x-1}function reverseJTag(e,t,n,i,r,o,a){return computeIJ(e,t,n,i,r,o),e.tileHeight-ijScratch.y-1}const rectangleScratch=new Rectangle,longitudeLatitudeProjectedScratch=new Cartesian3;function computeIJ(e,t,n,i,r,o,a){if(ijScratchComputed)return;computeLongitudeLatitudeProjected(e,t,n,i,r,o);const s=longitudeLatitudeProjectedScratch,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,rectangleScratch);ijScratch.x=e.tileWidth*(s.x-c.west)/c.width|0,ijScratch.y=e.tileHeight*(c.north-s.y)/c.height|0,ijScratchComputed=!0}function longitudeDegreesTag(e,t,n,i,r,o,a){return CesiumMath.toDegrees(r)}function latitudeDegreesTag(e,t,n,i,r,o,a){return CesiumMath.toDegrees(o)}function longitudeProjectedTag(e,t,n,i,r,o,a){return computeLongitudeLatitudeProjected(e,t,n,i,r,o),longitudeLatitudeProjectedScratch.x}function latitudeProjectedTag(e,t,n,i,r,o,a){return computeLongitudeLatitudeProjected(e,t,n,i,r,o),longitudeLatitudeProjectedScratch.y}const cartographicScratch$1=new Cartographic;function computeLongitudeLatitudeProjected(e,t,n,i,r,o,a){if(!longitudeLatitudeProjectedScratchComputed){if(e.tilingScheme.projection instanceof GeographicProjection)longitudeLatitudeProjectedScratch.x=CesiumMath.toDegrees(r),longitudeLatitudeProjectedScratch.y=CesiumMath.toDegrees(o);else{const t=cartographicScratch$1;t.longitude=r,t.latitude=o,e.tilingScheme.projection.project(t,longitudeLatitudeProjectedScratch)}longitudeLatitudeProjectedScratchComputed=!0}}function formatTag(e,t,n,i,r,o,a){return a}function TileMapServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=when.defer();let n;UrlTemplateImageryProvider.call(this,t.promise),this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._deferred=t,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);const i=this;when(e.url).then((function(e){n=Resource.createIfNeeded(e),n.appendForwardSlash(),i._tmsResource=n,i._xmlResource=n.getDerivedResource({url:"tilemapresource.xml"}),i._requestMetadata()})).otherwise((function(e){t.reject(e)}))}function confineRectangleToTilingScheme(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function calculateSafeMinimumDetailLevel(e,t,n){const i=e.positionToTileXY(Rectangle.southwest(t),n),r=e.positionToTileXY(Rectangle.northeast(t),n);return(Math.abs(r.x-i.x)+1)*(Math.abs(r.y-i.y)+1)>4?0:n}function GoogleEarthEnterpriseMapsProvider(e){e=defaultValue(e,{}),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1.9,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=e.url,n=defaultValue(e.path,"/default_map"),i=Resource.createIfNeeded(t).getDerivedResource({url:"/"===n[0]?n.substring(1):n});i.appendForwardSlash(),this._resource=i,this._url=t,this._path=n,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Credit('<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="'+GoogleEarthEnterpriseMapsProvider.logoUrl+'" title="Google Imagery"/></a>'),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();const r=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),o=this;let a;function s(t){let n,i,r;try{n=JSON.parse(t)}catch(e){n=JSON.parse(t.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(let e=0;e<n.layers.length;e++)if(n.layers[e].id===o._channel){i=n.layers[e];break}if(!defined(i))throw r="Could not find layer with channel (id) of "+o._channel+".",a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,l),new RuntimeError(r);if(!defined(i.version))throw r="Could not find a version in channel (id) "+o._channel+".",a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,l),new RuntimeError(r);if(o._version=i.version,defined(n.projection)&&"flat"===n.projection)o._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else{if(defined(n.projection)&&"mercator"!==n.projection)throw r="Unsupported projection "+n.projection+".",a=TileProviderError.handleError(a,o,o._errorEvent,r,void 0,void 0,void 0,l),new RuntimeError(r);o._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid})}o._ready=!0,o._readyPromise.resolve(!0),TileProviderError.handleSuccess(a)}function c(e){const t="An error occurred while accessing "+r.url+".";a=TileProviderError.handleError(a,o,o._errorEvent,t,void 0,void 0,void 0,l),o._readyPromise.reject(new RuntimeError(t))}function l(){const e=r.fetchText();when(e,s,c)}l()}defined(Object.create)&&(TileMapServiceImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),TileMapServiceImageryProvider.prototype.constructor=TileMapServiceImageryProvider),TileMapServiceImageryProvider.prototype._requestMetadata=function(){this._xmlResource.fetchXML().then(this._metadataSuccess).otherwise(this._metadataFailure)},TileMapServiceImageryProvider.prototype._metadataSuccess=function(e){const t=/tileformat/i,n=/tileset/i,i=/tilesets/i,r=/boundingbox/i;let o,a,s;const c=[],l=this._xmlResource;let u=this._metadataError;const d=this._deferred,h=this._requestMetadata,p=e.childNodes[0].childNodes;for(let e=0;e<p.length;e++)if(t.test(p.item(e).nodeName))o=p.item(e);else if(i.test(p.item(e).nodeName)){s=p.item(e);const t=p.item(e).childNodes;for(let e=0;e<t.length;e++)n.test(t.item(e).nodeName)&&c.push(t.item(e))}else r.test(p.item(e).nodeName)&&(a=p.item(e));let f;if(!defined(s)||!defined(a))return f="Unable to find expected tilesets or bbox attributes in "+l.url+".",u=TileProviderError.handleError(u,this,this.errorEvent,f,void 0,void 0,void 0,h),u.retry||d.reject(new RuntimeError(f)),void(this._metadataError=u);const m=this._options,g=defaultValue(m.fileExtension,o.getAttribute("extension")),_=defaultValue(m.tileWidth,parseInt(o.getAttribute("width"),10)),y=defaultValue(m.tileHeight,parseInt(o.getAttribute("height"),10));let C=defaultValue(m.minimumLevel,parseInt(c[0].getAttribute("order"),10));const T=defaultValue(m.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),S=s.getAttribute("profile");let A=m.tilingScheme;if(!defined(A))if("geodetic"===S||"global-geodetic"===S)A=new GeographicTilingScheme({ellipsoid:m.ellipsoid});else{if("mercator"!==S&&"global-mercator"!==S)return f=l.url+"specifies an unsupported profile attribute, "+S+".",u=TileProviderError.handleError(u,this,this.errorEvent,f,void 0,void 0,void 0,h),u.retry||d.reject(new RuntimeError(f)),void(this._metadataError=u);A=new WebMercatorTilingScheme({ellipsoid:m.ellipsoid})}let v=Rectangle.clone(m.rectangle);if(!defined(v)){let e,t,n,i;defaultValue(m.flipXY,!1)?(n=new Cartesian2(parseFloat(a.getAttribute("miny")),parseFloat(a.getAttribute("minx"))),i=new Cartesian2(parseFloat(a.getAttribute("maxy")),parseFloat(a.getAttribute("maxx")))):(n=new Cartesian2(parseFloat(a.getAttribute("minx")),parseFloat(a.getAttribute("miny"))),i=new Cartesian2(parseFloat(a.getAttribute("maxx")),parseFloat(a.getAttribute("maxy"))));const r="geodetic"===S||"mercator"===S;if(A.projection instanceof GeographicProjection||r)e=Cartographic.fromDegrees(n.x,n.y),t=Cartographic.fromDegrees(i.x,i.y);else{const r=A.projection;e=r.unproject(n),t=r.unproject(i)}v=new Rectangle(e.longitude,e.latitude,t.longitude,t.latitude)}v=confineRectangleToTilingScheme(v,A),C=calculateSafeMinimumDetailLevel(A,v,C);const E=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+g});d.resolve({url:E,tilingScheme:A,rectangle:v,tileWidth:_,tileHeight:y,minimumLevel:C,maximumLevel:T,tileDiscardPolicy:m.tileDiscardPolicy,credit:m.credit})},TileMapServiceImageryProvider.prototype._metadataFailure=function(e){const t=this._options,n=defaultValue(t.fileExtension,"png"),i=defaultValue(t.tileWidth,256),r=defaultValue(t.tileHeight,256),o=t.maximumLevel,a=defined(t.tilingScheme)?t.tilingScheme:new WebMercatorTilingScheme({ellipsoid:t.ellipsoid});let s=defaultValue(t.rectangle,a.rectangle);s=confineRectangleToTilingScheme(s,a);const c=calculateSafeMinimumDetailLevel(a,s,t.maximumLevel),l=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+n});this._deferred.resolve({url:l,tilingScheme:a,rectangle:s,tileWidth:i,tileHeight:r,minimumLevel:c,maximumLevel:o,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit})},Object.defineProperties(GoogleEarthEnterpriseMapsProvider.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.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}}}),GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits=function(e,t,n){},GoogleEarthEnterpriseMapsProvider.prototype.requestImage=function(e,t,n,i){const r=this._resource.getDerivedResource({url:"query",request:i,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:n+1}});return ImageryProvider.loadImage(this,r)},GoogleEarthEnterpriseMapsProvider.prototype.pickFeatures=function(e,t,n,i,r){},GoogleEarthEnterpriseMapsProvider._logoUrl=void 0,Object.defineProperties(GoogleEarthEnterpriseMapsProvider,{logoUrl:{get:function(){return defined(GoogleEarthEnterpriseMapsProvider._logoUrl)||(GoogleEarthEnterpriseMapsProvider._logoUrl=buildModuleUrl("Assets/Images/google_earth_credit.png")),GoogleEarthEnterpriseMapsProvider._logoUrl},set:function(e){GoogleEarthEnterpriseMapsProvider._logoUrl=e}}});const trailingSlashRegex$1=/\/$/,defaultCredit$3=new Credit('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).mapId,n=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const i=Resource.createIfNeeded(defaultValue(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let r=defaultValue(e.format,"png");/\./.test(r)||(r="."+r),this._format=r;let o,a=i.getUrlComponent();trailingSlashRegex$1.test(a)||(a+="/"),a+=t+"/{z}/{x}/{y}"+this._format,i.url=a,i.setQueryParameters({access_token:n}),defined(e.credit)?(o=e.credit,"string"==typeof o&&(o=new Credit(o))):o=defaultCredit$3,this._resource=i,this._imageryProvider=new UrlTemplateImageryProvider({url:i,credit:o,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function SingleTileImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url),n=new GeographicTilingScheme({rectangle:defaultValue(e.rectangle,Rectangle.MAX_VALUE),numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=n,this._resource=t,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();let i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i;const r=this;let o;function a(e){r._image=e,r._tileWidth=e.width,r._tileHeight=e.height,r._ready=!0,r._readyPromise.resolve(!0),TileProviderError.handleSuccess(r._errorEvent)}function s(e){const n="Failed to load image "+t.url+".";o=TileProviderError.handleError(o,r,r._errorEvent,n,0,0,0,c,e),r._readyPromise.reject(new RuntimeError(n))}function c(){ImageryProvider.loadImage(null,t).then(a).otherwise(s)}c()}function GetFeatureInfoFormat(e,t,n){this.type=e,defined(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,defined(n)||("json"===e?n=geoJsonToFeatureInfo:"xml"===e?n=xmlToFeatureInfo:("html"===e||"text"===e)&&(n=textToFeatureInfo)),this.callback=n}function geoJsonToFeatureInfo(e){const t=[],n=e.features;for(let e=0;e<n.length;++e){const i=n[e],r=new ImageryLayerFeatureInfo;if(r.data=i,r.properties=i.properties,r.configureNameFromProperties(i.properties),r.configureDescriptionFromProperties(i.properties),defined(i.geometry)&&"Point"===i.geometry.type){const e=i.geometry.coordinates[0],t=i.geometry.coordinates[1];r.position=Cartographic.fromDegrees(e,t)}t.push(r)}return t}Object.defineProperties(MapboxImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.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}}}),MapboxImageryProvider.prototype.getTileCredits=function(e,t,n){},MapboxImageryProvider.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)},MapboxImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){return this._imageryProvider.pickFeatures(e,t,n,i,r)},MapboxImageryProvider._defaultCredit=defaultCredit$3,Object.defineProperties(SingleTileImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},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 this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),SingleTileImageryProvider.prototype.getTileCredits=function(e,t,n){},SingleTileImageryProvider.prototype.requestImage=function(e,t,n,i){return this._image},SingleTileImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){};const mapInfoMxpNamespace="http://www.mapinfo.com/mxp",esriWmsNamespace="http://www.esri.com/wms",wfsNamespace="http://www.opengis.net/wfs",gmlNamespace="http://www.opengis.net/gml";function xmlToFeatureInfo(e){const t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===mapInfoMxpNamespace)return mapInfoXmlToFeatureInfo(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===esriWmsNamespace)return esriXmlToFeatureInfo(e);if("FeatureCollection"===t.localName&&t.namespaceURI===wfsNamespace)return gmlToFeatureInfo(e);if("ServiceExceptionReport"===t.localName)throw new RuntimeError((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?msGmlToFeatureInfo(e):unknownXmlToFeatureInfo(e)}function mapInfoXmlToFeatureInfo(e){const t=[],n=e.documentElement.getElementsByTagNameNS(mapInfoMxpNamespace,"Feature");for(let e=0;e<n.length;++e){const i=n[e],r={},o=i.getElementsByTagNameNS(mapInfoMxpNamespace,"Val");for(let e=0;e<o.length;++e){const t=o[e];if(t.hasAttribute("ref")){const e=t.getAttribute("ref"),n=t.textContent.trim();r[e]=n}}const a=new ImageryLayerFeatureInfo;a.data=i,a.properties=r,a.configureNameFromProperties(r),a.configureDescriptionFromProperties(r),t.push(a)}return t}function esriXmlToFeatureInfo(e){const t=e.documentElement,n=[];let i;const r=t.getElementsByTagNameNS("*","FIELDS");if(r.length>0)for(let e=0;e<r.length;++e){const t=r[e];i={};const o=t.attributes;for(let e=0;e<o.length;++e){const t=o[e];i[t.name]=t.value}n.push(imageryLayerFeatureInfoFromDataAndProperties(t,i))}else{const e=t.getElementsByTagNameNS("*","FeatureInfo");for(let t=0;t<e.length;++t){const r=e[t];i={};const o=r.childNodes;for(let e=0;e<o.length;++e){const t=o[e];t.nodeType===Node.ELEMENT_NODE&&(i[t.localName]=t.textContent)}n.push(imageryLayerFeatureInfoFromDataAndProperties(r,i))}}return n}function gmlToFeatureInfo(e){const t=[],n=e.documentElement.getElementsByTagNameNS(gmlNamespace,"featureMember");for(let e=0;e<n.length;++e){const i=n[e],r={};getGmlPropertiesRecursively(i,r),t.push(imageryLayerFeatureInfoFromDataAndProperties(i,r))}return t}function msGmlToFeatureInfo(e){const t=[];let n;const i=e.documentElement.childNodes;for(let e=0;e<i.length;e++)if(i[e].nodeType===Node.ELEMENT_NODE){n=i[e];break}if(!defined(n))throw new RuntimeError("Unable to find first child of the feature info xml document");const r=n.childNodes;for(let e=0;e<r.length;++e){const n=r[e];if(n.nodeType===Node.ELEMENT_NODE){const e={};getGmlPropertiesRecursively(n,e),t.push(imageryLayerFeatureInfoFromDataAndProperties(n,e))}}return t}function getGmlPropertiesRecursively(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){const r=e.childNodes[i];r.nodeType===Node.ELEMENT_NODE&&(n=!1),"Point"!==r.localName&&"LineString"!==r.localName&&"Polygon"!==r.localName&&"boundedBy"!==r.localName&&(r.hasChildNodes()&&getGmlPropertiesRecursively(r,t)&&(t[r.localName]=r.textContent))}return n}function imageryLayerFeatureInfoFromDataAndProperties(e,t){const n=new ImageryLayerFeatureInfo;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function unknownXmlToFeatureInfo(e){const t=(new XMLSerializer).serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const r=new ImageryLayerFeatureInfo;return r.data=e,r.description=n.innerHTML,[r]}const emptyBodyRegex=/<body>\s*<\/body>/im,wmsServiceExceptionReportRegex=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,titleRegex=/<title>([\s\S]*)<\/title>/im;function textToFeatureInfo(e){if(emptyBodyRegex.test(e))return;if(wmsServiceExceptionReportRegex.test(e))return;let t;const n=titleRegex.exec(e);n&&n.length>1&&(t=n[1]);const i=new ImageryLayerFeatureInfo;return i.name=t,i.description=e,i.data=e,[i]}function TimeDynamicImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tileCache={},this._tilesRequestedForInterval=[];const t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}function getKey(e,t,n){return e+"-"+t+"-"+n}function getKeyElements(e){const t=e.split("-");if(3===t.length)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function getApproachingInterval(e){const t=e._times;if(!defined(t))return;const n=e._clock,i=n.currentTime,r=n.canAnimate&&n.shouldAnimate,o=n.multiplier;if(!r&&0!==o)return;let a,s=t.indexOf(i);if(s<0)return;const c=t.get(s);return o>0?(a=JulianDate.secondsDifference(c.stop,i),++s):(a=JulianDate.secondsDifference(c.start,i),--s),a/=o,s>=0&&a<=5?t.get(s):void 0}function addToCache(e,t,n){const i=e._times.indexOf(n.start),r=e._tileCache;let o=r[i];defined(o)||(o=r[i]={});const a=t.key;if(defined(o[a]))return!0;const s=getKeyElements(a),c=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY,priorityFunction:t.priorityFunction}),l=e._requestImageFunction(s.x,s.y,s.level,c,n);return!!defined(l)&&(o[a]={promise:l,request:c},!0)}Object.defineProperties(TimeDynamicImagery.prototype,{clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}}),TimeDynamicImagery.prototype.getFromCache=function(e,t,n,i){const r=getKey(e,t,n);let o;const a=this._tileCache[this._currentIntervalIndex];if(defined(a)&&defined(a[r])){const e=a[r];o=e.promise.otherwise((function(t){throw i.state=e.request.state,t})),delete a[r]}return o},TimeDynamicImagery.prototype.checkApproachingInterval=function(e,t,n,i){const r=getKey(e,t,n),o=this._tilesRequestedForInterval,a=getApproachingInterval(this),s={key:r,priorityFunction:i.priorityFunction};defined(a)&&addToCache(this,s,a)||o.push(s),o.length>=512&&o.splice(0,256)},TimeDynamicImagery.prototype._clockOnTick=function(e){const t=e.currentTime,n=this._times.indexOf(t),i=this._currentIntervalIndex;if(n!==i){const e=this._tileCache[i];for(const t in e)e.hasOwnProperty(t)&&e[t].request.cancel();return delete this._tileCache[i],this._tilesRequestedForInterval=[],this._currentIntervalIndex=n,void this._reloadFunction()}const r=getApproachingInterval(this);if(defined(r)){const e=this._tilesRequestedForInterval;let t=!0;for(;t&&0!==e.length;){const n=e.pop();t=addToCache(this,n,r),t||e.push(n)}}};const includesReverseAxis=[3034,3035,3042,3043,3044],excludesReverseAxis=[4471,4559];function WebMapServiceImageryProvider(e){if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times)&&!defined(e.clock))throw new DeveloperError("options.times was specified, so options.clock is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=defaultValue(e.getFeatureInfoUrl,e.url);const t=Resource.createIfNeeded(e.url),n=Resource.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(WebMapServiceImageryProvider.DefaultParameters,!0),n.setQueryParameters(WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters,!0),defined(e.parameters)&&t.setQueryParameters(objectToLowercase(e.parameters)),defined(e.getFeatureInfoParameters)&&n.setQueryParameters(objectToLowercase(e.getFeatureInfoParameters));const i=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,n,r,o){return requestImage$1(i,e,t,n,r,o)},reloadFunction:function(){defined(i._reload)&&i._reload()}}));const r={};if(r.layers=e.layers,r.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",r.width="{width}",r.height="{height}",parseFloat(t.queryParameters.version)>=1.3){r.crs=defaultValue(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"CRS:84");const t=r.crs.split(":");if("EPSG"===t[0]&&2===t.length){const e=Number(t[1]);(e>=4e3&&e<5e3&&!excludesReverseAxis.includes(e)||includesReverseAxis.includes(e))&&(r.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else r.srs=defaultValue(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"EPSG:4326");t.setQueryParameters(r,!0),n.setQueryParameters(r,!0);const o={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(o.i="{i}",o.j="{j}"):(o.x="{i}",o.y="{j}"),n.setQueryParameters(o,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new UrlTemplateImageryProvider({url:t,pickFeaturesUrl:n,tilingScheme:defaultValue(e.tilingScheme,new GeographicTilingScheme({ellipsoid:e.ellipsoid})),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:defaultValue(e.getFeatureInfoFormats,WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function requestImage$1(e,t,n,i,r,o){const a=defined(o)?o.data:void 0,s=e._tileProvider;return defined(a)&&s._resource.setQueryParameters(a),s.requestImage(t,n,i,r)}function pickFeatures(e,t,n,i,r,o,a){const s=defined(a)?a.data:void 0,c=e._tileProvider;return defined(s)&&c._pickFeaturesResource.setQueryParameters(s),c.pickFeatures(t,n,i,r,o)}function objectToLowercase(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}Object.defineProperties(WebMapServiceImageryProvider.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}}),WebMapServiceImageryProvider.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)},WebMapServiceImageryProvider.prototype.requestImage=function(e,t,n,i){let r;const o=this._timeDynamicImagery;let a;return defined(o)&&(a=o.currentInterval,r=o.getFromCache(e,t,n,i)),defined(r)||(r=requestImage$1(this,e,t,n,i,a)),defined(r)&&defined(o)&&o.checkApproachingInterval(e,t,n,i),r},WebMapServiceImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){const o=this._timeDynamicImagery;return pickFeatures(this,e,t,n,i,r,defined(o)?o.currentInterval:void 0)},WebMapServiceImageryProvider.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new GetFeatureInfoFormat("json","application/json")),Object.freeze(new GetFeatureInfoFormat("xml","text/xml")),Object.freeze(new GetFeatureInfoFormat("text","text/html"))]);const defaultParameters=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function WebMapTileServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=Resource.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,r=t.url,o=r.match(/{/g);if(!defined(o)||1===o.length&&/{s}/.test(r))t.setQueryParameters(defaultParameters),this._useKvp=!0;else{const e={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(e),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=defaultValue(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._minimumLevel=defaultValue(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const a=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,n,i,r){return requestImage(a,e,t,n,i,r)},reloadFunction:function(){defined(a._reload)&&a._reload()}})),this._readyPromise=when.resolve(!0);const s=this._tilingScheme.positionToTileXY(Rectangle.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(Rectangle.northeast(this._rectangle),this._minimumLevel);Math.abs(c.x-s.x),Math.abs(c.y-s.y),this._errorEvent=new Event;const l=e.credit;this._credit="string"==typeof l?new Credit(l):l,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():defined(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function requestImage(e,t,n,i,r,o){const a=e._tileMatrixLabels,s=defined(a)?a[i]:i.toString(),c=e._subdomains,l=e._dimensions,u=defined(o)?o.data:void 0;let d,h;if(e._useKvp){let o={};o.tilematrix=s,o.layer=e._layer,o.style=e._style,o.tilerow=n,o.tilecol=t,o.tilematrixset=e._tileMatrixSetID,o.format=e._format,defined(l)&&(o=combine$2(o,l)),defined(u)&&(o=combine$2(o,u)),h={s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({queryParameters:o,request:r}),d.setTemplateValues(h)}else h={TileMatrix:s,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({request:r}),d.setTemplateValues(h),defined(l)&&d.setTemplateValues(l),defined(u)&&d.setTemplateValues(u);return ImageryProvider.loadImage(e,d)}function createFactory(e){return function(t){return new e(t)}}Object.defineProperties(WebMapTileServiceImageryProvider.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.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}},format:{get:function(){return this._format}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,defined(this._reload)&&this._reload())}}}),WebMapTileServiceImageryProvider.prototype.getTileCredits=function(e,t,n){},WebMapTileServiceImageryProvider.prototype.requestImage=function(e,t,n,i){let r;const o=this._timeDynamicImagery;let a;return defined(o)&&(a=o.currentInterval,r=o.getFromCache(e,t,n,i)),defined(r)||(r=requestImage(this,e,t,n,i,a)),defined(r)&&defined(o)&&o.checkApproachingInterval(e,t,n,i),r},WebMapTileServiceImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){};const ImageryProviderMapping={ARCGIS_MAPSERVER:createFactory(ArcGisMapServerImageryProvider),BING:createFactory(BingMapsImageryProvider),GOOGLE_EARTH:createFactory(GoogleEarthEnterpriseMapsProvider),MAPBOX:createFactory(MapboxImageryProvider),SINGLE_TILE:createFactory(SingleTileImageryProvider),TMS:createFactory(TileMapServiceImageryProvider),URL_TEMPLATE:createFactory(UrlTemplateImageryProvider),WMS:createFactory(WebMapServiceImageryProvider),WMTS:createFactory(WebMapTileServiceImageryProvider)};function IonImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).assetId;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._ready=!1,this._tileCredits=void 0,this._errorEvent=new Event;const n=this,i=IonResource._createEndpointResource(t,e),r=e.assetId.toString()+e.accessToken+e.server;let o=IonImageryProvider._endpointCache[r];defined(o)||(o=i.fetchJson(),IonImageryProvider._endpointCache[r]=o),this._readyPromise=o.then((function(e){if("IMAGERY"!==e.type)return when.reject(new RuntimeError("Cesium ion asset "+t+" is not an imagery asset."));let r;const o=e.externalType;if(defined(o)){const t=ImageryProviderMapping[o];if(!defined(t))return when.reject(new RuntimeError("Unrecognized Cesium ion imagery type: "+o));r=t(e.options)}else r=new TileMapServiceImageryProvider({url:new IonResource(e,i)});return n._tileCredits=IonResource.getCreditsFromEndpoint(e,i),r.errorEvent.addEventListener((function(e){e.provider=n,n._errorEvent.raiseEvent(e)})),n._imageryProvider=r,r.readyPromise.then((function(){return n._ready=!0,!0}))}))}Object.defineProperties(IonImageryProvider.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._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._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel},proxy:{get:function(){}}}}),IonImageryProvider.prototype.getTileCredits=function(e,t,n){const i=this._imageryProvider.getTileCredits(e,t,n);return defined(i)?this._tileCredits.concat(i):this._tileCredits},IonImageryProvider.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)},IonImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){return this._imageryProvider.pickFeatures(e,t,n,i,r)},IonImageryProvider._endpointCache={};const IonWorldImageryStyle={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4};var IonWorldImageryStyle$1=Object.freeze(IonWorldImageryStyle);function createWorldImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);return new IonImageryProvider({assetId:defaultValue(e.style,IonWorldImageryStyle$1.AERIAL)})}const mobileWidth=576,lightboxHeight=100,textColor="#ffffff",highlightColor$1="#48b";function contains(e,t){const n=e.length;for(let i=0;i<n;i++){const n=e[i];if(Credit.equals(n,t))return!0}return!1}function swapCesiumCredit(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;Credit.equals(n,t)||(defined(t)&&e._cesiumCreditContainer.removeChild(t.element),defined(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const delimiterClassName="cesium-credit-delimiter";function createDelimiterElement(e){const t=document.createElement("span");return t.textContent=e,t.className=delimiterClassName,t}function createCreditElement(e,t){if(defined(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function displayCredits(e,t,n,i){const r=e.childNodes;let o=-1;for(let a=0;a<t.length;++a){const s=t[a];if(defined(s)){if(o=a,defined(n)&&(o*=2,a>0)){const t=o-1;if(r.length<=t)e.appendChild(createDelimiterElement(n));else{const i=r[t];i.className!==delimiterClassName&&e.replaceChild(createDelimiterElement(n),i)}}const t=s.element;if(r.length<=o)e.appendChild(createCreditElement(t,i));else{const n=r[o];n._creditId!==s._id&&e.replaceChild(createCreditElement(t,i),n)}}}for(++o;o<r.length;)e.removeChild(r[o])}function styleLightboxContainer(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<mobileWidth?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=Math.floor(.5*(i-t.clientHeight))+"px"),e._lastViewportWidth=n),n>=mobileWidth&&i!==e._lastViewportHeight&&(t.style.marginTop=Math.floor(.5*(i-t.clientHeight))+"px",e._lastViewportHeight=i)}function addStyle(e,t){let n=e+" {";for(const e in t)t.hasOwnProperty(e)&&(n+=e+": "+t[e]+"; ");return n+=" }\n",n}function appendCss(){let e="";e+=addStyle(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),e+=addStyle(".cesium-credit-lightbox",{"background-color":"#303336",color:textColor,position:"relative","min-height":lightboxHeight+"px",margin:"auto"}),e+=addStyle(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:textColor}),e+=addStyle(".cesium-credit-lightbox > ul > li a:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=addStyle(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=addStyle(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:textColor}),e+=addStyle(".cesium-credit-lightbox-close:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=addStyle(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=addStyle(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=addStyle(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:textColor}),e+=addStyle(".cesium-credit-expand-link:hover",{color:highlightColor$1}),e+=addStyle(".cesium-credit-text",{color:textColor}),e+=addStyle(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});const t=document.head,n=document.createElement("style");n.innerHTML=e,t.insertBefore(n,t.firstChild)}function CreditDisplay(e,t,n){const i=this;n=defaultValue(n,document.body);const r=document.createElement("div");r.className="cesium-credit-lightbox-overlay",n.appendChild(r);const o=document.createElement("div");function a(e){o.contains(e.target)||i.hideLightbox()}o.className="cesium-credit-lightbox",r.appendChild(o),r.addEventListener("click",a,!1);const s=document.createElement("div");s.className="cesium-credit-lightbox-title",s.textContent="Data provided by:",o.appendChild(s);const c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="&times;",c.className="cesium-credit-lightbox-close",o.appendChild(c);const l=document.createElement("ul");o.appendChild(l);const u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);const d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);const h=document.createElement("a");h.className="cesium-credit-expand-link",h.onclick=this.showLightbox.bind(this),h.textContent="Data attribution",e.appendChild(h),appendCss();const p=Credit.clone(CreditDisplay.cesiumCredit);this._delimiter=defaultValue(t," • "),this._screenContainer=d,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=o,this._creditList=l,this._lightbox=r,this._hideLightbox=a,this._expandLink=h,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=p,this._previousCesiumCredit=void 0,this._currentCesiumCredit=p,this._currentFrameCredits={screenCredits:new AssociativeArray,lightboxCredits:new AssociativeArray},this._defaultCredit=void 0,this.viewport=n,this.container=e}let defaultCredit$2;function getDefaultCredit(){if(!defined(defaultCredit$2)){let e=buildModuleUrl("Assets/Images/ion-credit.png");if(0!==e.indexOf("http://")&&0!==e.indexOf("https://")&&0!==e.indexOf("data:")){e=new URI(e).path()}defaultCredit$2=new Credit('<a href="https://cesium.com/" target="_blank"><img src="'+e+'" title="Cesium ion"/></a>',!0)}return CreditDisplay._cesiumCreditInitialized||(CreditDisplay._cesiumCredit=defaultCredit$2,CreditDisplay._cesiumCreditInitialized=!0),defaultCredit$2}function DebugAppearance(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).attributeName;let n=e.perInstanceAttribute;defined(n)||(n=!1);let i=defaultValue(e.glslDatatype,"vec3");const r="v_"+t;let o;if("normal"===t||"tangent"===t||"bitangent"===t)o="vec4 getColor() { return vec4(("+r+" + vec3(1.0)) * 0.5, 1.0); }\n";else switch("st"===t&&(i="vec2"),i){case"float":o="vec4 getColor() { return vec4(vec3("+r+"), 1.0); }\n";break;case"vec2":o="vec4 getColor() { return vec4("+r+", 0.0, 1.0); }\n";break;case"vec3":o="vec4 getColor() { return vec4("+r+", 1.0); }\n";break;case"vec4":o="vec4 getColor() { return "+r+"; }\n"}const a="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n"+(n?"":"attribute "+i+" "+t+";\n")+"varying "+i+" "+r+";\nvoid main()\n{\nvec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n"+(n?r+" = czm_batchTable_"+t+"(batchId);\n":r+" = "+t+";\n")+"gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}",s="varying "+i+" "+r+";\n"+o+"\nvoid main()\n{\ngl_FragColor = getColor();\n}";this.material=void 0,this.translucent=defaultValue(e.translucent,!1),this._vertexShaderSource=defaultValue(e.vertexShaderSource,a),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,s),this._renderState=Appearance.getDefaultRenderState(!1,!1,e.renderState),this._closed=defaultValue(e.closed,!1),this._attributeName=t,this._glslDatatype=i}function DebugCameraPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=defaultValue(e.color,Color.CYAN),this._updateOnChange=defaultValue(e.updateOnChange,!0),this.show=defaultValue(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}CreditDisplay.prototype.addCredit=function(e){if(e._isIon)return defined(this._defaultCredit)||(this._defaultCredit=Credit.clone(getDefaultCredit())),void(this._currentCesiumCredit=this._defaultCredit);e.showOnScreen?this._currentFrameCredits.screenCredits.set(e.id,e):this._currentFrameCredits.lightboxCredits.set(e.id,e)},CreditDisplay.prototype.addDefaultCredit=function(e){const t=this._defaultCredits;contains(t,e)||t.push(e)},CreditDisplay.prototype.removeDefaultCredit=function(e){const t=this._defaultCredits,n=t.indexOf(e);-1!==n&&t.splice(n,1)},CreditDisplay.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0},CreditDisplay.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1},CreditDisplay.prototype.update=function(){this._expanded&&styleLightboxContainer(this)},CreditDisplay.prototype.beginFrame=function(){const e=this._currentFrameCredits,t=e.screenCredits;t.removeAll();const n=this._defaultCredits;for(let e=0;e<n.length;++e){const i=n[e];t.set(i.id,i)}e.lightboxCredits.removeAll(),Credit.equals(CreditDisplay.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Credit.clone(CreditDisplay.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit},CreditDisplay.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;displayCredits(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",displayCredits(this._creditList,t,void 0,"li"),swapCesiumCredit(this)},CreditDisplay.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),destroyObject(this)},CreditDisplay.prototype.isDestroyed=function(){return!1},CreditDisplay._cesiumCredit=void 0,CreditDisplay._cesiumCreditInitialized=!1,Object.defineProperties(CreditDisplay,{cesiumCredit:{get:function(){return getDefaultCredit(),CreditDisplay._cesiumCredit},set:function(e){CreditDisplay._cesiumCredit=e,CreditDisplay._cesiumCreditInitialized=!0}}}),Object.defineProperties(DebugAppearance.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}}}),DebugAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,DebugAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,DebugAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;const scratchRight$2=new Cartesian3,scratchRotation=new Matrix3,scratchOrientation=new Quaternion,scratchPerspective=new PerspectiveFrustum,scratchPerspectiveOffCenter=new PerspectiveOffCenterFrustum,scratchOrthographic=new OrthographicFrustum,scratchOrthographicOffCenter=new OrthographicOffCenterFrustum,scratchColor$1=new Color,scratchSplits$1=[1,1e5];function DebugInspector(){this._cachedShowFrustumsShaders={}}function getAttributeLocations(e){const t={},n=e.vertexAttributes;for(const e in n)n.hasOwnProperty(e)&&(t[e]=n[e].index);return t}function createDebugShowFrustumsShaderProgram(e,t){const n=e.context,i=t,r=i.fragmentShaderSource.clone(),o=[];r.sources=r.sources.map((function(e){e=ShaderSource.replaceMain(e,"czm_Debug_main");const t=/gl_FragData\[(\d+)\]/g;let n;for(;null!==(n=t.exec(e));)-1===o.indexOf(n[1])&&o.push(n[1]);return e}));const a=o.length;let s,c="";if(c+="uniform vec3 debugShowCommandsColor;\n",c+="uniform vec3 debugShowFrustumsColor;\n",c+="void main() \n{ \n czm_Debug_main(); \n",a>0)for(s=0;s<a;++s)c+=" gl_FragData["+o[s]+"].rgb *= debugShowCommandsColor;\n",c+=" gl_FragData["+o[s]+"].rgb *= debugShowFrustumsColor;\n";else c+=" gl_FragColor.rgb *= debugShowCommandsColor;\n",c+=" gl_FragColor.rgb *= debugShowFrustumsColor;\n";c+="}",r.sources.push(c);const l=getAttributeLocations(i);return ShaderProgram.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:r,attributeLocations:l})}DebugCameraPrimitive.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let i,r;if(this._updateOnChange){for(r=t.length,i=0;i<r;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(0===t.length){const e=this._camera,r=e.frustum;let o,a;o=r instanceof PerspectiveFrustum?scratchPerspective:r instanceof PerspectiveOffCenterFrustum?scratchPerspectiveOffCenter:r instanceof OrthographicFrustum?scratchOrthographic:scratchOrthographicOffCenter,o=r.clone(o);let s=this._frustumSplits;!defined(s)||s.length<=1?(s=scratchSplits$1,s[0]=this._camera.frustum.near,s[1]=this._camera.frustum.far,a=1):a=s.length-1;const c=e.positionWC,l=e.directionWC,u=e.upWC;let d=e.rightWC;d=Cartesian3.negate(d,scratchRight$2);const h=scratchRotation;Matrix3.setColumn(h,0,d,h),Matrix3.setColumn(h,1,u,h),Matrix3.setColumn(h,2,l,h);const p=Quaternion.fromRotationMatrix(h,scratchOrientation);for(t.length=n.length=a,i=0;i<a;++i)o.near=s[i],o.far=s[i+1],t[i]=new Primitive$3({geometryInstances:new GeometryInstance({geometry:new FrustumGeometry({origin:c,orientation:p,frustum:o,_drawNearPlane:0===i}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(Color.fromAlpha(this._color,.1,scratchColor$1))},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Primitive$3({geometryInstances:new GeometryInstance({geometry:new FrustumOutlineGeometry({origin:c,orientation:p,frustum:o,_drawNearPlane:0===i}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}for(r=t.length,i=0;i<r;++i)n[i].update(e),t[i].update(e)},DebugCameraPrimitive.prototype.isDestroyed=function(){return!1},DebugCameraPrimitive.prototype.destroy=function(){const e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return destroyObject(this)};const scratchFrustumColor=new Color;function createDebugShowFrustumsUniformMap(e,t){let n;return n=defined(t.uniformMap)?t.uniformMap:{},defined(n.debugShowCommandsColor)||defined(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(defined(t._debugColor)||(t._debugColor=Color.fromRandom()),t._debugColor):Color.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(scratchFrustumColor.red=1&t.debugOverlappingFrustums?1:0,scratchFrustumColor.green=2&t.debugOverlappingFrustums?1:0,scratchFrustumColor.blue=4&t.debugOverlappingFrustums?1:0,scratchFrustumColor.alpha=1,scratchFrustumColor):Color.WHITE}),n}const scratchShowFrustumCommand=new DrawCommand;function DebugModelMatrixPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.length=defaultValue(e.length,1e7),this._length=void 0,this.width=defaultValue(e.width,2),this._width=void 0,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.id=e.id,this._id=void 0,this._primitive=void 0}DebugInspector.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let r=this._cachedShowFrustumsShaders[i];defined(r)||(r=createDebugShowFrustumsShaderProgram(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=r);const o=DrawCommand.shallowClone(t,scratchShowFrustumCommand);o.shaderProgram=r,o.uniformMap=createDebugShowFrustumsUniformMap(e,t),o.execute(e.context,n)},DebugModelMatrixPrimitive.prototype.update=function(e){if(this.show){if(!defined(this._primitive)||!Matrix4.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=Matrix4.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,defined(this._primitive)&&this._primitive.destroy(),0===this.modelMatrix[12]&&0===this.modelMatrix[13]&&0===this.modelMatrix[14]&&(this.modelMatrix[14]=.01);const e=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_X],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.RED,Color.RED],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),t=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Y],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.GREEN,Color.GREEN],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),n=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Z],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.BLUE,Color.BLUE],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this});this._primitive=new Primitive$3({geometryInstances:[e,t,n],appearance:new PolylineColorAppearance,asynchronous:!1})}this._primitive.update(e)}},DebugModelMatrixPrimitive.prototype.isDestroyed=function(){return!1},DebugModelMatrixPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var DepthPlaneFS="varying vec4 positionEC;\nvoid main()\n{\nvec3 position;\nvec3 direction;\nif (czm_orthographicIn3D == 1.0)\n{\nvec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\nvec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y);\nvec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x);\nposition = vec3(mix(minPlane, maxPlane, uv), 0.0);\ndirection = vec3(0.0, 0.0, -1.0);\n}\nelse\n{\nposition = vec3(0.0);\ndirection = normalize(positionEC.xyz);\n}\nczm_ray ray = czm_ray(position, direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\nczm_writeLogDepth();\n}\n",DepthPlaneVS="attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n}\n";function DepthPlane(){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1}const depthQuadScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(12):[],scratchCartesian1$1=new Cartesian3,scratchCartesian2$1=new Cartesian3,scratchCartesian3=new Cartesian3,scratchCartesian4$1=new Cartesian3,scratchCartesian5=new Cartesian3;function computeDepthQuad(e,t){const n=e.radii,i=t.camera;let r,o,a;if(i.frustum instanceof OrthographicFrustum)r=Cartesian3.ZERO,o=i.rightWC,a=i.upWC;else{const t=i.positionWC,n=Cartesian3.multiplyComponents(e.oneOverRadii,t,scratchCartesian1$1),s=Cartesian3.normalize(n,scratchCartesian2$1),c=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,n,scratchCartesian3),scratchCartesian3),l=Cartesian3.normalize(Cartesian3.cross(s,c,scratchCartesian4$1),scratchCartesian4$1),u=Cartesian3.magnitude(n),d=Math.sqrt(u*u-1);r=Cartesian3.multiplyByScalar(s,1/u,scratchCartesian1$1);const h=d/u;o=Cartesian3.multiplyByScalar(c,h,scratchCartesian2$1),a=Cartesian3.multiplyByScalar(l,h,scratchCartesian3)}const s=Cartesian3.add(r,a,scratchCartesian5);Cartesian3.subtract(s,o,s),Cartesian3.multiplyComponents(n,s,s),Cartesian3.pack(s,depthQuadScratch,0);const c=Cartesian3.subtract(r,a,scratchCartesian5);Cartesian3.subtract(c,o,c),Cartesian3.multiplyComponents(n,c,c),Cartesian3.pack(c,depthQuadScratch,3);const l=Cartesian3.add(r,a,scratchCartesian5);Cartesian3.add(l,o,l),Cartesian3.multiplyComponents(n,l,l),Cartesian3.pack(l,depthQuadScratch,6);const u=Cartesian3.subtract(r,a,scratchCartesian5);return Cartesian3.add(u,o,u),Cartesian3.multiplyComponents(n,u,u),Cartesian3.pack(u,depthQuadScratch,9),depthQuadScratch}function DerivedCommand(){}DepthPlane.prototype.update=function(e){if(this._mode=e.mode,e.mode!==SceneMode$1.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid,i=e.useLogDepth;if(defined(this._command)||(this._rs=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new DrawCommand({renderState:this._rs,boundingVolume:new BoundingSphere(Cartesian3.ZERO,n.maximumRadius),pass:Pass$1.OPAQUE,owner:this})),!defined(this._sp)||this._useLogDepth!==i){this._useLogDepth=i;const e=new ShaderSource({sources:[DepthPlaneVS]}),n=new ShaderSource({sources:[DepthPlaneFS]});if(i){const t="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";n.sources.push(t),n.defines.push("LOG_DEPTH"),e.defines.push("LOG_DEPTH")}this._sp=ShaderProgram.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:e,fragmentShaderSource:n,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=computeDepthQuad(n,e);if(defined(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const e=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:PrimitiveType$1.TRIANGLES});this._va=VertexArray.fromGeometry({context:t,geometry:e,attributeLocations:{position:0},bufferUsage:BufferUsage$1.DYNAMIC_DRAW}),this._command.vertexArray=this._va}},DepthPlane.prototype.execute=function(e,t){this._mode===SceneMode$1.SCENE3D&&this._command.execute(e,t)},DepthPlane.prototype.isDestroyed=function(){return!1},DepthPlane.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};const fragDepthRegex=/\bgl_FragDepthEXT\b/,discardRegex=/\bdiscard\b/;function getDepthOnlyShaderProgram$1(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!defined(n)){const i=t._attributeLocations;let r,o=t.fragmentShaderSource,a=!1;const s=o.sources;let c=s.length;for(r=0;r<c;++r)if(fragDepthRegex.test(s[r])||discardRegex.test(s[r])){a=!0;break}let l=!1;const u=o.defines;for(c=u.length,r=0;r<c;++r)if("LOG_DEPTH"===u[r]){l=!0;break}let d;a||l?!a&&l&&(d="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeLogDepth(); \n} \n",o=new ShaderSource({defines:["LOG_DEPTH"],sources:[d]})):(d="void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n",o=new ShaderSource({sources:[d]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function getDepthOnlyRenderState(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!defined(i)){const e=RenderState.getState(t);e.depthMask=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=RenderState.fromCache(e),n[t.id]=i}return i}DerivedCommand.createDepthOnlyDerivedCommand=function(e,t,n,i){let r,o;return defined(i)||(i={}),defined(i.depthOnlyCommand)&&(r=i.depthOnlyCommand.shaderProgram,o=i.depthOnlyCommand.renderState),i.depthOnlyCommand=DrawCommand.shallowClone(t,i.depthOnlyCommand),defined(r)&&i.shaderProgramId===t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=r,i.depthOnlyCommand.renderState=o):(i.depthOnlyCommand.shaderProgram=getDepthOnlyShaderProgram$1(n,t.shaderProgram),i.depthOnlyCommand.renderState=getDepthOnlyRenderState(e,t.renderState),i.shaderProgramId=t.shaderProgram.id),i};const writeLogDepthRegex=/\s+czm_writeLogDepth\(/,vertexlogDepthRegex=/\s+czm_vertexLogDepth\(/,extensionRegex=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function getLogDepthShaderProgram(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!defined(n)){const i=t._attributeLocations,r=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();let a,s;r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH");let c=!1,l=r.sources,u=l.length;for(a=0;a<u;++a)if(vertexlogDepthRegex.test(l[a])){c=!0;break}if(!c){for(a=0;a<u;++a)l[a]=ShaderSource.replaceMain(l[a],"czm_log_depth_main");s="\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n",l.push(s)}for(l=o.sources,u=l.length,c=!1,a=0;a<u;++a)writeLogDepthRegex.test(l[a])&&(c=!0);-1!==o.defines.indexOf("LOG_DEPTH_WRITE")&&(c=!0);let d=!0;for(a=0;a<u;++a)extensionRegex.test(l[a])&&(d=!1);let h="";if(d&&(h+="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),!c){for(a=0;a<u;a++)l[a]=ShaderSource.replaceMain(l[a],"czm_log_depth_main");h+="\nvoid main() \n{ \n czm_log_depth_main(); \n czm_writeLogDepth(); \n} \n"}l.push(h),n=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:o,attributeLocations:i})}return n}function getPickShaderProgram$1(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!defined(i)){const r=t._attributeLocations;let o=t.fragmentShaderSource;const a=o.sources,s=a.length,c="void main() \n{ \n czm_non_pick_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = "+n+"; \n} \n",l=new Array(s+1);for(let e=0;e<s;++e)l[e]=ShaderSource.replaceMain(a[e],"czm_non_pick_main");l[s]=c,o=new ShaderSource({sources:l,defines:o.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:r})}return i}function getPickRenderState(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!defined(i)){const e=RenderState.getState(t);e.blending.enabled=!1,e.depthMask=!0,i=RenderState.fromCache(e),n[t.id]=i}return i}function getHdrShaderProgram(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!defined(n)){const i=t._attributeLocations,r=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:r,fragmentShaderSource:o,attributeLocations:i})}return n}function DeviceOrientationCameraController(e){this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function n(e){const n=e.alpha;if(!defined(n))return t._alpha=void 0,t._beta=void 0,void(t._gamma=void 0);t._alpha=CesiumMath.toRadians(n),t._beta=CesiumMath.toRadians(e.beta),t._gamma=CesiumMath.toRadians(e.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}DerivedCommand.createLogDepthCommand=function(e,t,n){let i;return defined(n)||(n={}),defined(n.command)&&(i=n.command.shaderProgram),n.command=DrawCommand.shallowClone(e,n.command),defined(i)&&n.shaderProgramId===e.shaderProgram.id?n.command.shaderProgram=i:(n.command.shaderProgram=getLogDepthShaderProgram(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id),n},DerivedCommand.createPickDerivedCommand=function(e,t,n,i){let r,o;return defined(i)||(i={}),defined(i.pickCommand)&&(r=i.pickCommand.shaderProgram,o=i.pickCommand.renderState),i.pickCommand=DrawCommand.shallowClone(t,i.pickCommand),defined(r)&&i.shaderProgramId===t.shaderProgram.id?(i.pickCommand.shaderProgram=r,i.pickCommand.renderState=o):(i.pickCommand.shaderProgram=getPickShaderProgram$1(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=getPickRenderState(e,t.renderState),i.shaderProgramId=t.shaderProgram.id),i},DerivedCommand.createHdrCommand=function(e,t,n){let i;return defined(n)||(n={}),defined(n.command)&&(i=n.command.shaderProgram),n.command=DrawCommand.shallowClone(e,n.command),defined(i)&&n.shaderProgramId===e.shaderProgram.id?n.command.shaderProgram=i:(n.command.shaderProgram=getHdrShaderProgram(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id),n};const scratchQuaternion1=new Quaternion,scratchQuaternion2=new Quaternion,scratchMatrix3=new Matrix3;function rotate(e,t,n,i){const r=e.direction,o=e.right,a=e.up,s=Quaternion.fromAxisAngle(r,n,scratchQuaternion2),c=Quaternion.fromAxisAngle(o,i,scratchQuaternion1),l=Quaternion.multiply(c,s,c),u=Quaternion.fromAxisAngle(a,t,scratchQuaternion2);Quaternion.multiply(u,l,l);const d=Matrix3.fromQuaternion(l,scratchMatrix3);Matrix3.multiplyByVector(d,o,o),Matrix3.multiplyByVector(d,a,a),Matrix3.multiplyByVector(d,r,r)}function DirectionalLight(e){this.direction=Cartesian3.clone(e.direction),this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this.intensity=defaultValue(e.intensity,1)}DeviceOrientationCameraController.prototype.update=function(){if(!defined(this._alpha))return;defined(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;rotate(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma},DeviceOrientationCameraController.prototype.isDestroyed=function(){return!1},DeviceOrientationCameraController.prototype.destroy=function(){return this._removeListener(),destroyObject(this)};var EllipsoidFS="#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, czm_sunDirectionEC);\n#else\nreturn czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\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_ray ray = czm_ray(t * direction, direction);\nvec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\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);\n#ifdef LOG_DEPTH\nczm_writeLogDepth(1.0 + positionCC.w);\n#else\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#endif\n}\n",EllipsoidVS="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);\nczm_vertexLogDepth();\n}\n";const attributeLocations={position:0};function EllipsoidPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.center=Cartesian3.clone(defaultValue(e.center,Cartesian3.ZERO)),this._center=new Cartesian3,this.radii=Cartesian3.clone(e.radii),this._radii=new Cartesian3,this._oneOverEllipsoidRadiiSquared=new Cartesian3,this._boundingSphere=new BoundingSphere,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this._computedModelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this.material=defaultValue(e.material,Material$4.fromType(Material$4.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.onlySunLighting=defaultValue(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=defaultValue(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new DrawCommand({owner:defaultValue(e._owner,this)}),this._pickCommand=new DrawCommand({owner:defaultValue(e._owner,this),pickOnly:!0});const t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function getVertexArray(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(defined(t))return t;const n=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY}));return t=VertexArray.fromGeometry({context:e,geometry:n,attributeLocations:attributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}const logDepthExtension="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";EllipsoidPrimitive.prototype.update=function(e){if(!this.show||e.mode!==SceneMode$1.SCENE3D||!defined(this.center)||!defined(this.radii))return;const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;defined(this._rs)&&!i||(this._translucent=n,this._rs=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?BlendingState$1.ALPHA_BLEND:void 0})),defined(this._va)||(this._va=getVertexArray(t));let r=!1;const o=this.radii;if(!Cartesian3.equals(this._radii,o)){Cartesian3.clone(o,this._radii);const e=this._oneOverEllipsoidRadiiSquared;e.x=1/(o.x*o.x),e.y=1/(o.y*o.y),e.z=1/(o.z*o.z),r=!0}Matrix4.equals(this.modelMatrix,this._modelMatrix)&&Cartesian3.equals(this.center,this._center)||(Matrix4.clone(this.modelMatrix,this._modelMatrix),Cartesian3.clone(this.center,this._center),Matrix4.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),r=!0),r&&(Cartesian3.clone(Cartesian3.ZERO,this._boundingSphere.center),this._boundingSphere.radius=Cartesian3.maximumComponent(o),BoundingSphere.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const a=this._material!==this.material;this._material=this.material,this._material.update(t);const s=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const c=e.useLogDepth,l=this._useLogDepth!==c;this._useLogDepth=c;const u=this._colorCommand;let d,h;(a||s||i||l)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS]}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._sp=ShaderProgram.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),u.vertexArray=this._va,u.renderState=this._rs,u.shaderProgram=this._sp,u.uniformMap=combine$2(this._uniforms,this.material._uniforms),u.executeInClosestFrustum=n);const p=e.commandList,f=e.passes;if(f.render&&(u.boundingVolume=this._boundingSphere,u.debugShowBoundingVolume=this.debugShowBoundingVolume,u.modelMatrix=this._computedModelMatrix,u.pass=n?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,p.push(u)),f.pick){const e=this._pickCommand;defined(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(a||s||!defined(this._pickSP)||l)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS],pickColorQualifier:"uniform"}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._pickSP=ShaderProgram.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations}),e.vertexArray=this._va,e.renderState=this._rs,e.shaderProgram=this._pickSP,e.uniformMap=combine$2(combine$2(this._uniforms,this._pickUniforms),this.material._uniforms),e.executeInClosestFrustum=n),e.boundingVolume=this._boundingSphere,e.modelMatrix=this._computedModelMatrix,e.pass=n?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,p.push(e)}},EllipsoidPrimitive.prototype.isDestroyed=function(){return!1},EllipsoidPrimitive.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(),destroyObject(this)};var EllipsoidSurfaceAppearanceFS="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, czm_lightDirectionEC);\n#endif\n}\n",EllipsoidSurfaceAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\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";function EllipsoidSurfaceAppearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.translucent,!0),n=defaultValue(e.aboveGround,!1);this.material=defined(e.material)?e.material:Material$4.fromType(Material$4.ColorType),this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=defaultValue(e.vertexShaderSource,EllipsoidSurfaceAppearanceVS),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,EllipsoidSurfaceAppearanceFS),this._renderState=Appearance.getDefaultRenderState(t,!n,e.renderState),this._closed=!1,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,n),this._aboveGround=n}function Fog(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}Object.defineProperties(EllipsoidSurfaceAppearance.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 EllipsoidSurfaceAppearance.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),EllipsoidSurfaceAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,EllipsoidSurfaceAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,EllipsoidSurfaceAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,EllipsoidSurfaceAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;const heightsTable=[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],densityTable=[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];for(let e=0;e<densityTable.length;++e)densityTable[e]*=1e6;const tableStartDensity=densityTable[1],tableEndDensity=densityTable[densityTable.length-1];for(let e=0;e<densityTable.length;++e)densityTable[e]=(densityTable[e]-tableEndDensity)/(tableStartDensity-tableEndDensity);let tableLastIndex=0;function findInterval(e){const t=heightsTable,n=t.length;if(e<t[0])return tableLastIndex=0,tableLastIndex;if(e>t[n-1])return tableLastIndex=n-2,tableLastIndex;if(e>=t[tableLastIndex]){if(tableLastIndex+1<n&&e<t[tableLastIndex+1])return tableLastIndex;if(tableLastIndex+2<n&&e<t[tableLastIndex+2])return++tableLastIndex,tableLastIndex}else if(tableLastIndex-1>=0&&e>=t[tableLastIndex-1])return--tableLastIndex,tableLastIndex;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return tableLastIndex=i,tableLastIndex}const scratchPositionNormal$1=new Cartesian3;function FrameRateMonitor(e){this._scene=e.scene,this.samplingWindow=defaultValue(e.samplingWindow,FrameRateMonitor.defaultSettings.samplingWindow),this.quietPeriod=defaultValue(e.quietPeriod,FrameRateMonitor.defaultSettings.quietPeriod),this.warmupPeriod=defaultValue(e.warmupPeriod,FrameRateMonitor.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=defaultValue(e.minimumFrameRateDuringWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=defaultValue(e.minimumFrameRateAfterWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new Event,this._nominalFrameRate=new Event,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;const t=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener((function(e,n){update(t)})),this._hiddenPropertyName=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":void 0;const n=void 0!==document.hidden?"visibilitychange":void 0!==document.mozHidden?"mozvisibilitychange":void 0!==document.msHidden?"msvisibilitychange":void 0!==document.webkitHidden?"webkitvisibilitychange":void 0;function i(){visibilityChanged(t)}this._visibilityChangeRemoveListener=void 0,defined(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}function update(e,t){if(e._pauseCount>0)return;const n=getTimestamp$1();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=n+e.quietPeriod/TimeConstants$1.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/TimeConstants$1.SECONDS_PER_MILLISECOND;else if(n>=e._quietPeriodEndTime){e._frameTimes.push(n);const t=n-e.samplingWindow/TimeConstants$1.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=t){for(;e._frameTimes.length>=2&&e._frameTimes[1]<t;)e._frameTimes.shift();const i=(n-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/i;i>1e3/(n>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup)?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 visibilityChanged(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}function FrameState(e,t,n){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=SceneMode$1.SCENE3D,this.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=n,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.imagerySplitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}function FrustumCommands(e,t){this.near=defaultValue(e,0),this.far=defaultValue(t,0);const n=Pass$1.NUMBER_OF_PASSES,i=new Array(n),r=new Array(n);for(let e=0;e<n;++e)i[e]=[],r[e]=0;this.commands=i,this.indices=r}Fog.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;const t=e.camera,n=t.positionCartographic;if(!defined(n)||n.height>8e5||e.mode!==SceneMode$1.SCENE3D)return void(e.fog.enabled=!1);const i=n.height,r=findInterval(i),o=CesiumMath.clamp((i-heightsTable[r])/(heightsTable[r+1]-heightsTable[r]),0,1);let a=CesiumMath.lerp(densityTable[r],densityTable[r+1],o);const s=1e6*this.density;a=a*(s-s/tableStartDensity*tableEndDensity)*1e-6;const c=Cartesian3.normalize(t.positionWC,scratchPositionNormal$1);a*=1-Math.abs(Cartesian3.dot(t.directionWC,c)),e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness},FrameRateMonitor.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},FrameRateMonitor.fromScene=function(e){return defined(e._frameRateMonitor)&&!e._frameRateMonitor.isDestroyed()||(e._frameRateMonitor=new FrameRateMonitor({scene:e})),e._frameRateMonitor},Object.defineProperties(FrameRateMonitor.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}}}),FrameRateMonitor.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},FrameRateMonitor.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},FrameRateMonitor.prototype.isDestroyed=function(){return!1},FrameRateMonitor.prototype.destroy=function(){return this._preUpdateRemoveListener(),defined(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),destroyObject(this)};var GlobeFS="uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_DAY_NIGHT_ALPHA\nuniform float u_dayTextureNightAlpha[TEXTURE_UNITS];\nuniform float u_dayTextureDayAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SPLIT\nuniform float u_dayTextureSplit[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\n#ifdef APPLY_IMAGERY_CUTOUT\nuniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_COLOR_TO_ALPHA\nuniform vec4 u_colorsToAlpha[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#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nuniform vec2 u_lightingFadeDistance;\n#endif\n#ifdef TILE_LIMIT_RECTANGLE\nuniform vec4 u_cartographicLimitRectangle;\n#endif\n#ifdef GROUND_ATMOSPHERE\nuniform vec2 u_nightFadeDistance;\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nuniform highp sampler2D u_clippingPlanes;\nuniform mat4 u_clippingPlanesMatrix;\nuniform vec4 u_clippingPlanesEdgeStyle;\n#endif\n#if defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nuniform float u_minimumBrightness;\n#endif\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nuniform vec4 u_fillHighlightColor;\n#endif\n#ifdef TRANSLUCENT\nuniform vec4 u_frontFaceAlphaByDistance;\nuniform vec4 u_backFaceAlphaByDistance;\nuniform vec4 u_translucencyRectangle;\n#endif\n#ifdef UNDERGROUND_COLOR\nuniform vec4 u_undergroundColor;\nuniform vec4 u_undergroundColorAlphaByDistance;\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nuniform float u_lambertDiffuseMultiplier;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_height;\nvarying float v_slope;\nvarying float v_aspect;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogRayleighColor;\nvarying vec3 v_fogMieColor;\n#endif\n#ifdef GROUND_ATMOSPHERE\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nfloat interpolateByDistance(vec4 nearFarScalar, float distance)\n{\nfloat startDistance = nearFarScalar.x;\nfloat startValue = nearFarScalar.y;\nfloat endDistance = nearFarScalar.z;\nfloat endValue = nearFarScalar.w;\nfloat t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\nreturn mix(startValue, endValue, t);\n}\n#endif\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)\n{\nreturn sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\n#endif\n#ifdef TRANSLUCENT\nbool inTranslucencyRectangle()\n{\nreturn\nv_textureCoordinates.x > u_translucencyRectangle.x &&\nv_textureCoordinates.x < u_translucencyRectangle.z &&\nv_textureCoordinates.y > u_translucencyRectangle.y &&\nv_textureCoordinates.y < u_translucencyRectangle.w;\n}\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D textureToSample,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureNightAlpha,\nfloat textureDayAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma,\nfloat split,\nvec4 colorToAlpha,\nfloat nightBlend)\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;\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\ntextureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);\n#endif\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(textureToSample, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_COLOR_TO_ALPHA\nvec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);\ncolorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);\nalpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);\n#endif\n#if !defined(APPLY_GAMMA)\nvec4 tempColor = czm_gammaCorrect(vec4(color, alpha));\ncolor = tempColor.rgb;\nalpha = tempColor.a;\n#else\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\n#ifdef APPLY_SPLIT\nfloat splitPosition = czm_imagerySplitPosition;\nif (split < 0.0 && gl_FragCoord.x > splitPosition) {\nalpha = 0.0;\n}\nelse if (split > 0.0 && gl_FragCoord.x < splitPosition) {\nalpha = 0.0;\n}\n#endif\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\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\noutAlpha += sign(outAlpha) - 1.0;\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, max(outAlpha, 0.0));\n}\nvec3 colorCorrect(vec3 rgb) {\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nreturn rgb;\n}\nvec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist);\n#endif\nconst float fExposure = 2.0;\nvoid main()\n{\n#ifdef TILE_LIMIT_RECTANGLE\nif (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||\nv_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)\n{\ndiscard;\n}\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)\nvec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\nvec3 normalEC = czm_normal3D * normalMC;\n#endif\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\nfloat nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);\n#else\nfloat nightBlend = 0.0;\n#endif\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);\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(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nfloat cameraDist;\nif (czm_sceneMode == czm_sceneMode2D)\n{\ncameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;\n}\nelse if (czm_sceneMode == czm_sceneModeColumbusView)\n{\ncameraDist = -czm_view[3].z;\n}\nelse\n{\ncameraDist = length(czm_view[3]);\n}\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nif (czm_sceneMode != czm_sceneMode3D) {\nvec3 radii = czm_ellipsoidRadii;\nfloat maxRadii = max(radii.x, max(radii.y, radii.z));\nfadeOutDist -= maxRadii;\nfadeInDist -= maxRadii;\n}\nfloat fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#else\nfloat fade = 0.0;\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\nwaterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\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, fade);\n}\n#endif\n#ifdef APPLY_MATERIAL\nczm_materialInput materialInput;\nmaterialInput.st = v_textureCoordinates.st;\nmaterialInput.normalEC = normalize(v_normalEC);\nmaterialInput.positionToEyeEC = -v_positionEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));\nmaterialInput.slope = v_slope;\nmaterialInput.height = v_height;\nmaterialInput.aspect = v_aspect;\nczm_material material = czm_getMaterial(materialInput);\nvec4 materialColor = vec4(material.diffuse, material.alpha);\ncolor = alphaBlend(materialColor, color);\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, fade);\nvec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nvec4 clippingPlanesEdgeColor = vec4(1.0);\nclippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\nfloat clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\nif (clipDistance < clippingPlanesEdgeWidth)\n{\nfinalColor = clippingPlanesEdgeColor;\n}\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nfinalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvec3 fogColor = colorCorrect(v_fogMieColor) + finalColor.rgb * colorCorrect(v_fogRayleighColor);\n#ifndef HDR\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\n#endif\n#endif\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\nvec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\nvec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n#ifdef FOG\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nfloat darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);\nfogColor *= darken;\n#endif\n#ifdef HDR\nconst float modifier = 0.15;\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor, modifier), finalColor.a);\n#else\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#endif\n#endif\n#ifdef GROUND_ATMOSPHERE\nif (!czm_backFacing())\n{\nvec3 groundAtmosphereColor = computeGroundAtmosphereColor(fogColor, finalColor, atmosphereLightDirection, cameraDist);\nfinalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a);\n}\n#endif\n#ifdef UNDERGROUND_COLOR\nif (czm_backFacing())\n{\nfloat distanceFromEllipsoid = max(czm_eyeHeight, 0.0);\nfloat distance = max(v_distance - distanceFromEllipsoid, 0.0);\nfloat blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);\nvec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);\nfinalColor = alphaBlend(undergroundColor, finalColor);\n}\n#endif\n#ifdef TRANSLUCENT\nif (inTranslucencyRectangle())\n{\nvec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;\nfinalColor.a *= interpolateByDistance(alphaByDistance, v_distance);\n}\n#endif\ngl_FragColor = finalColor;\n}\n#ifdef GROUND_ATMOSPHERE\nvec3 computeGroundAtmosphereColor(vec3 fogColor, vec4 finalColor, vec3 atmosphereLightDirection, float cameraDist)\n{\n#if defined(PER_FRAGMENT_GROUND_ATMOSPHERE) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\nfloat mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);\nvec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);\nxy *= czm_viewport.zw * mpp * 0.5;\nvec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));\nczm_ray ray = czm_ray(vec3(0.0), direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nvec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);\nellipsoidPosition = (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(ellipsoidPosition, true, atmosphereLightDirection);\nvec3 groundAtmosphereColor = colorCorrect(atmosColor.mie) + finalColor.rgb * colorCorrect(atmosColor.rayleigh);\n#ifndef HDR\ngroundAtmosphereColor = vec3(1.0) - exp(-fExposure * groundAtmosphereColor);\n#endif\nfloat fadeInDist = u_nightFadeDistance.x;\nfloat fadeOutDist = u_nightFadeDistance.y;\nfloat sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#ifdef HDR\nsunlitAtmosphereIntensity = max(sunlitAtmosphereIntensity * sunlitAtmosphereIntensity, 0.03);\n#endif\ngroundAtmosphereColor = mix(groundAtmosphereColor, fogColor, sunlitAtmosphereIntensity);\n#else\nvec3 groundAtmosphereColor = fogColor;\n#endif\n#ifdef HDR\ngroundAtmosphereColor = czm_saturation(groundAtmosphereColor, 1.6);\n#endif\nreturn groundAtmosphereColor;\n}\n#endif\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, float fade)\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_lightDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);\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_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\n#ifdef HDR\nspecular *= 1.4;\nfloat e = 0.2;\nfloat d = 3.3;\nfloat c = 1.7;\nvec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));\n#else\nvec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;\n#endif\nreturn vec4(color, imageryColor.a);\n}\n#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n",GlobeVS="#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed0;\nattribute float compressed1;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec4 textureCoordAndEncodedNormals;\n#endif\n#ifdef GEODETIC_SURFACE_NORMALS\nattribute vec3 geodeticSurfaceNormal;\n#endif\n#ifdef EXAGGERATION\nuniform vec2 u_terrainExaggerationAndRelativeHeight;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_slope;\nvarying float v_aspect;\nvarying float v_height;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_fogMieColor;\nvarying vec3 v_fogRayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn u_modifiedModelViewProjection * 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 u_modifiedModelViewProjection * 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(height, 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(compressed0.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed0.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = compressed0.w;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = 0.0;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#endif\nvec3 position3DWC = position + u_center3D;\n#ifdef GEODETIC_SURFACE_NORMALS\nvec3 ellipsoidNormal = geodeticSurfaceNormal;\n#else\nvec3 ellipsoidNormal = normalize(position3DWC);\n#endif\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nfloat exaggeration = u_terrainExaggerationAndRelativeHeight.x;\nfloat relativeHeight = u_terrainExaggerationAndRelativeHeight.y;\nfloat newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\nfloat minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\nnewHeight = max(newHeight, -minRadius);\nvec3 offset = ellipsoidNormal * (newHeight - height);\nposition += offset;\nposition3DWC += offset;\nheight = newHeight;\n#endif\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\nvec3 normalMC = czm_octDecode(encodedNormal);\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\nvec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\nvec3 rejection = normalMC - projection;\nnormalMC = normalize(projection + rejection * exaggeration);\n#endif\nv_normalMC = normalMC;\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION) || defined(HDR)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nAtmosphereColor atmosFogColor = computeGroundAtmosphereFromSpace(position3DWC, false, vec3(0.0));\nv_fogMieColor = atmosFogColor.mie;\nv_fogRayleighColor = atmosFogColor.rayleigh;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n#ifdef APPLY_MATERIAL\nfloat northPoleZ = czm_ellipsoidRadii.z;\nvec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\nvec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\nfloat dotProd = abs(dot(ellipsoidNormal, v_normalMC));\nv_slope = acos(dotProd);\nvec3 normalRejected = ellipsoidNormal * dotProd;\nvec3 normalProjected = v_normalMC - normalRejected;\nvec3 aspectVector = normalize(normalProjected);\nv_aspect = acos(dot(aspectVector, vectorEastMC));\nfloat determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\nv_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\nv_height = height;\n#endif\n}\n",GroundAtmosphere="const 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 vec3 v3InvWavelength = vec3(5.60204474633241, 9.473284437923038, 19.64380261047721);\nconst float fScaleDepth = 0.25;\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, bool dynamicLighting, vec3 lightDirectionWC)\n{\nfloat fInnerRadius = czm_ellipsoidRadii.x;\nfloat fOuterRadius = czm_ellipsoidRadii.x * 1.025;\nfloat fOuterRadius2 = fOuterRadius * fOuterRadius;\nfloat fScale = 1.0 / (fOuterRadius - fInnerRadius);\nfloat fScaleOverScaleDepth = fScale / fScaleDepth;\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 = czm_branchFreeTernary(dynamicLighting, dot(lightDirectionWC, v3Pos) / length(v3Pos), 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";function GlobeSurfaceShader(e,t,n,i,r){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=r}function GlobeSurfaceShaderSet(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function getPositionMode(e){let t;switch(e){case SceneMode$1.SCENE3D:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";break;case SceneMode$1.SCENE2D:case SceneMode$1.COLUMBUS_VIEW:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";break;case SceneMode$1.MORPHING:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"}return t}function get2DYPositionFraction(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}GlobeSurfaceShaderSet.prototype.getShaderProgram=function(e){const t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,r=e.applyBrightness,o=e.applyContrast,a=e.applyHue,s=e.applySaturation,c=e.applyGamma,l=e.applyAlpha,u=e.applyDayNightAlpha,d=e.applySplit,h=e.showReflectiveOcean,p=e.showOceanWaves,f=e.enableLighting,m=e.dynamicAtmosphereLighting,g=e.dynamicAtmosphereLightingFromSun,_=e.showGroundAtmosphere,y=e.perFragmentGroundAtmosphere,C=e.hasVertexNormals,T=e.useWebMercatorProjection,S=e.enableFog,A=e.enableClippingPlanes,v=e.clippingPlanes,E=e.clippedByBoundaries,b=e.hasImageryLayerCutout,x=e.colorCorrect,P=e.highlightFillTile,D=e.colorToAlpha,w=e.hasGeodeticSurfaceNormals,M=e.hasExaggeration,I=e.showUndergroundColor,R=e.translucent;let O=0,B="";const L=n.renderedMesh.encoding;L.quantization===TerrainQuantization$1.BITS12&&(O=1,B="QUANTIZATION_BITS12");let F=0,N="";E&&(F=1,N="TILE_LIMIT_RECTANGLE");let V=0,k="";b&&(V=1,k="APPLY_IMAGERY_CUTOUT");const U=t.mode,G=U|r<<2|o<<3|a<<4|s<<5|c<<6|l<<7|h<<8|p<<9|f<<10|m<<11|g<<12|_<<13|y<<14|C<<15|T<<16|S<<17|O<<18|d<<19|A<<20|F<<21|V<<22|x<<23|P<<24|D<<25|w<<26|M<<27|I<<28|R<<29|u<<30;let $=0;defined(v)&&v.length>0&&($=A?v.clippingPlanesState:0);let z=n.surfaceShader;if(defined(z)&&z.numberOfDayTextures===i&&z.flags===G&&z.material===this.material&&z.clippingShaderState===$)return z.shaderProgram;let H=this._shadersByTexturesFlags[i];if(defined(H)||(H=this._shadersByTexturesFlags[i]=[]),z=H[G],!defined(z)||z.material!==this.material||z.clippingShaderState!==$){const e=this.baseVertexShaderSource.clone(),n=this.baseFragmentShaderSource.clone();0!==$&&n.sources.unshift(getClippingFunction(v,t.context)),e.defines.push(B),n.defines.push("TEXTURE_UNITS "+i,N,k),r&&n.defines.push("APPLY_BRIGHTNESS"),o&&n.defines.push("APPLY_CONTRAST"),a&&n.defines.push("APPLY_HUE"),s&&n.defines.push("APPLY_SATURATION"),c&&n.defines.push("APPLY_GAMMA"),l&&n.defines.push("APPLY_ALPHA"),u&&n.defines.push("APPLY_DAY_NIGHT_ALPHA"),h&&(n.defines.push("SHOW_REFLECTIVE_OCEAN"),e.defines.push("SHOW_REFLECTIVE_OCEAN")),p&&n.defines.push("SHOW_OCEAN_WAVES"),D&&n.defines.push("APPLY_COLOR_TO_ALPHA"),I&&(e.defines.push("UNDERGROUND_COLOR"),n.defines.push("UNDERGROUND_COLOR")),R&&(e.defines.push("TRANSLUCENT"),n.defines.push("TRANSLUCENT")),f&&(C?(e.defines.push("ENABLE_VERTEX_LIGHTING"),n.defines.push("ENABLE_VERTEX_LIGHTING")):(e.defines.push("ENABLE_DAYNIGHT_SHADING"),n.defines.push("ENABLE_DAYNIGHT_SHADING"))),m&&(n.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),g&&n.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN")),_&&(e.defines.push("GROUND_ATMOSPHERE"),n.defines.push("GROUND_ATMOSPHERE"),y&&n.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE")),e.defines.push("INCLUDE_WEB_MERCATOR_Y"),n.defines.push("INCLUDE_WEB_MERCATOR_Y"),S&&(e.defines.push("FOG"),n.defines.push("FOG")),d&&n.defines.push("APPLY_SPLIT"),A&&n.defines.push("ENABLE_CLIPPING_PLANES"),x&&n.defines.push("COLOR_CORRECT"),P&&n.defines.push("HIGHLIGHT_FILL_TILE"),w&&e.defines.push("GEODETIC_SURFACE_NORMALS"),M&&e.defines.push("EXAGGERATION");let E=" vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n {\n vec4 color = initialColor;\n";b&&(E+=" vec4 cutoutAndColorResult;\n bool texelUnclipped;\n");for(let e=0;e<i;++e)E+=b?" cutoutAndColorResult = u_dayTextureCutoutRectangles["+e+"];\n texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;\n cutoutAndColorResult = sampleAndBlend(\n":" color = sampleAndBlend(\n",E+=" color,\n u_dayTextures["+e+"],\n u_dayTextureUseWebMercatorT["+e+"] ? textureCoordinates.xz : textureCoordinates.xy,\n u_dayTextureTexCoordsRectangle["+e+"],\n u_dayTextureTranslationAndScale["+e+"],\n "+(l?"u_dayTextureAlpha["+e+"]":"1.0")+",\n "+(u?"u_dayTextureNightAlpha["+e+"]":"1.0")+",\n"+(u?"u_dayTextureDayAlpha["+e+"]":"1.0")+",\n"+(r?"u_dayTextureBrightness["+e+"]":"0.0")+",\n "+(o?"u_dayTextureContrast["+e+"]":"0.0")+",\n "+(a?"u_dayTextureHue["+e+"]":"0.0")+",\n "+(s?"u_dayTextureSaturation["+e+"]":"0.0")+",\n "+(c?"u_dayTextureOneOverGamma["+e+"]":"0.0")+",\n "+(d?"u_dayTextureSplit["+e+"]":"0.0")+",\n "+(D?"u_colorsToAlpha["+e+"]":"vec4(0.0)")+",\n nightBlend );\n",b&&(E+=" color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n");E+=" return color;\n }",n.sources.push(E),e.sources.push(getPositionMode(U)),e.sources.push(get2DYPositionFraction(T));const O=ShaderProgram.fromCache({context:t.context,vertexShaderSource:e,fragmentShaderSource:n,attributeLocations:L.getAttributeLocations()});z=H[G]=new GlobeSurfaceShader(i,G,this.material,O,$)}return n.surfaceShader=z,z.shaderProgram},GlobeSurfaceShaderSet.prototype.destroy=function(){let e,t;const n=this._shadersByTexturesFlags;for(const i in n)if(n.hasOwnProperty(i)){const r=n[i];if(!defined(r))continue;for(e in r)r.hasOwnProperty(e)&&(t=r[e],defined(t)&&t.shaderProgram.destroy())}return destroyObject(this)};const ImageryState={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};var ImageryState$1=Object.freeze(ImageryState);const QuadtreeTileLoadState={START:0,LOADING:1,DONE:2,FAILED:3};var QuadtreeTileLoadState$1=Object.freeze(QuadtreeTileLoadState);const TerrainState={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};var TerrainState$1=Object.freeze(TerrainState);function GlobeSurfaceTile(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new Cartesian3,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new BoundingSphere,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(GlobeSurfaceTile.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let t=!(e===TerrainState$1.RECEIVING||e===TerrainState$1.TRANSFORMING);const n=this.imagery;for(let e=0,i=n.length;t&&e<i;++e){const i=n[e];t=!defined(i.loadingImagery)||i.loadingImagery.state!==ImageryState$1.TRANSITIONING}return t}},renderedMesh:{get:function(){return defined(this.vertexArray)?this.mesh:defined(this.fill)?this.fill.mesh:void 0}}});const scratchCartographic$3=new Cartographic;function getPosition(e,t,n,i,r,o){let a=e.getExaggeratedPosition(i,r,o);if(defined(t)&&t!==SceneMode$1.SCENE3D){const e=n.ellipsoid.cartesianToCartographic(a,scratchCartographic$3);a=n.project(e,o),a=Cartesian3.fromElements(a.z,a.x,a.y,o)}return a}const scratchV0=new Cartesian3,scratchV1=new Cartesian3,scratchV2=new Cartesian3;function toggleGeodeticSurfaceNormals(e,t,n,i){const r=e.renderedMesh,o=r.vertices,a=r.encoding,s=o.length/a.stride;let c=TerrainEncoding.clone(a);c.hasGeodeticSurfaceNormals=t,c=TerrainEncoding.clone(c);const l=c.stride,u=new Float32Array(s*l);t?a.addGeodeticSurfaceNormals(o,u,n):a.removeGeodeticSurfaceNormals(o,u),r.vertices=u,r.stride=l;r!==e.mesh?(GlobeSurfaceTile._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(i.context,r)):(GlobeSurfaceTile._freeVertexArray(e.vertexArray),e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(i.context,r)),GlobeSurfaceTile._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}function prepareNewTile(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!defined(i)&&defined(e.parent)){const t=e.parent,n=t.data;defined(n)&&defined(n.terrainData)&&(i=n.terrainData.isChildAvailable(t.x,t.y,e.x,e.y))}!1===i&&(e.data.terrainState=TerrainState$1.FAILED);for(let i=0,r=n.length;i<r;++i){const r=n.get(i);r.show&&r._createTileImagerySkeletons(e,t)}}function processTerrainStateMachine(e,t,n,i,r,o){const a=e.data,s=e.parent;if(a.terrainState===TerrainState$1.FAILED&&void 0!==s){void 0!==s.data&&void 0!==s.data.terrainData&&!1!==s.data.terrainData.canUpsample||GlobeSurfaceTile.processStateMachine(s,t,n,i,r,o,!0)}if(a.terrainState===TerrainState$1.FAILED&&upsample(a,e,t,n,e.x,e.y,e.level),a.terrainState===TerrainState$1.UNLOADED&&requestTileGeometry(a,n,e.x,e.y,e.level),a.terrainState===TerrainState$1.RECEIVED&&transform(a,t,n,e.x,e.y,e.level),a.terrainState===TerrainState$1.TRANSFORMED&&(createResources$1(a,t.context,n,e.x,e.y,e.level,o),a.updateExaggeration(e,t,r)),a.terrainState>=TerrainState$1.RECEIVED&&void 0===a.waterMaskTexture&&n.hasWaterMask){if(void 0!==a.terrainData.waterMask)createWaterMaskTextureIfNeeded(t.context,a);else{const t=a._findAncestorTileWithTerrainData(e);defined(t)&&defined(t.data.waterMaskTexture)&&(a.waterMaskTexture=t.data.waterMaskTexture,++a.waterMaskTexture.referenceCount,a._computeWaterMaskTranslationAndScale(e,t,a.waterMaskTranslationAndScale))}}}function upsample(e,t,n,i,r,o,a){const s=t.parent;if(!s)return void(t.state=QuadtreeTileLoadState$1.FAILED);const c=s.data.terrainData,l=s.x,u=s.y,d=s.level;if(!defined(c))return;const h=c.upsample(i.tilingScheme,l,u,d,r,o,a);defined(h)&&(e.terrainState=TerrainState$1.RECEIVING,when(h,(function(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED}),(function(){e.terrainState=TerrainState$1.FAILED})))}function requestTileGeometry(e,t,n,i,r){function o(t){e.terrainData=t,e.terrainState=TerrainState$1.RECEIVED,e.request=void 0}function a(o){if(e.request.state===RequestState$1.CANCELLED)return e.terrainData=void 0,e.terrainState=TerrainState$1.UNLOADED,void(e.request=void 0);e.terrainState=TerrainState$1.FAILED,e.request=void 0;const a="Failed to obtain terrain tile X: "+n+" Y: "+i+" Level: "+r+'. Error message: "'+o+'"';t._requestError=TileProviderError.handleError(t._requestError,t,t.errorEvent,a,n,i,r,s)}function s(){const s=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});e.request=s;const c=t.requestTileGeometry(n,i,r,s);defined(c)?(e.terrainState=TerrainState$1.RECEIVING,when(c,o,a)):(e.terrainState=TerrainState$1.UNLOADED,e.request=void 0)}s()}GlobeSurfaceTile.prototype.pick=function(e,t,n,i,r){const o=this.renderedMesh;if(!defined(o))return;const a=o.vertices,s=o.indices,c=o.encoding,l=s.length;let u=Number.MAX_VALUE;for(let r=0;r<l;r+=3){const o=s[r],l=s[r+1],d=s[r+2],h=getPosition(c,t,n,a,o,scratchV0),p=getPosition(c,t,n,a,l,scratchV1),f=getPosition(c,t,n,a,d,scratchV2),m=IntersectionTests.rayTriangleParametric(e,h,p,f,i);defined(m)&&m<u&&m>=0&&(u=m)}return u!==Number.MAX_VALUE?Ray.getPoint(e,u,r):void 0},GlobeSurfaceTile.prototype.freeResources=function(){defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=TerrainState$1.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()},GlobeSurfaceTile.prototype.freeVertexArray=function(){GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0,GlobeSurfaceTile._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0},GlobeSurfaceTile.initialize=function(e,t,n){let i=e.data;defined(i)||(i=e.data=new GlobeSurfaceTile),e.state===QuadtreeTileLoadState$1.START&&(prepareNewTile(e,t,n),e.state=QuadtreeTileLoadState$1.LOADING)},GlobeSurfaceTile.processStateMachine=function(e,t,n,i,r,o,a){GlobeSurfaceTile.initialize(e,n,i);const s=e.data;if(e.state===QuadtreeTileLoadState$1.LOADING&&processTerrainStateMachine(e,t,n,i,r,o),a)return;const c=e.renderable;e.renderable=defined(s.vertexArray);const l=s.terrainState===TerrainState$1.READY;e.upsampledFromParent=defined(s.terrainData)&&s.terrainData.wasCreatedByUpsampling();const u=s.processImagery(e,n,t);if(l&&u){const t=e._loadedCallbacks,n={};for(const i in t)t.hasOwnProperty(i)&&(t[i](e)||(n[i]=t[i]));e._loadedCallbacks=n,e.state=QuadtreeTileLoadState$1.DONE}c&&(e.renderable=!0)},GlobeSurfaceTile.prototype.processImagery=function(e,t,n,i){const r=e.data;let o=e.upsampledFromParent,a=!1,s=!0;const c=r.imagery;let l,u;for(l=0,u=c.length;l<u;++l){const r=c[l];if(!defined(r.loadingImagery)){o=!1;continue}if(r.loadingImagery.state===ImageryState$1.PLACEHOLDER){const n=r.loadingImagery.imageryLayer;if(n.imageryProvider.ready){r.freeResources(),c.splice(l,1),n._createTileImagerySkeletons(e,t,l),--l,u=c.length;continue}o=!1}const d=r.processStateMachine(e,n,i);s=s&&d,a=a||d||defined(r.readyImagery),o=o&&defined(r.loadingImagery)&&(r.loadingImagery.state===ImageryState$1.FAILED||r.loadingImagery.state===ImageryState$1.INVALID)}return e.upsampledFromParent=o,e.renderable=e.renderable&&(a||s),s},GlobeSurfaceTile.prototype.addGeodeticSurfaceNormals=function(e,t){toggleGeodeticSurfaceNormals(this,!0,e,t)},GlobeSurfaceTile.prototype.removeGeodeticSurfaceNormals=function(e){toggleGeodeticSurfaceNormals(this,!1,void 0,e)},GlobeSurfaceTile.prototype.updateExaggeration=function(e,t,n){const i=this,r=i.renderedMesh;if(void 0===r)return;const o=t.terrainExaggeration,a=t.terrainExaggerationRelativeHeight,s=1!==o,c=r.encoding,l=c.exaggeration!==o,u=c.exaggerationRelativeHeight!==a;if(l||u){if(l)if(s&&!c.hasGeodeticSurfaceNormals){const n=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(n,t)}else!s&&c.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(c.exaggeration=o,c.exaggerationRelativeHeight=a,void 0!==n){n._tileToUpdateHeights.push(e);const t=e.customData,i=t.length;for(let e=0;e<i;e++){t[e].level=-1}}}};const scratchCreateMeshOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function transform(e,t,n,i,r,o){const a=n.tilingScheme,s=scratchCreateMeshOptions;s.tilingScheme=a,s.x=i,s.y=r,s.level=o,s.exaggeration=t.terrainExaggeration,s.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,s.throttle=!0;const c=e.terrainData.createMesh(s);defined(c)&&(e.terrainState=TerrainState$1.TRANSFORMING,when(c,(function(t){e.mesh=t,e.terrainState=TerrainState$1.TRANSFORMED}),(function(){e.terrainState=TerrainState$1.FAILED})))}function createResources$1(e,t,n,i,r,o,a){e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(t,e.mesh),e.terrainState=TerrainState$1.READY,e.fill=e.fill&&e.fill.destroy(a)}function getContextWaterMaskData(e){let t=e.cache.tile_waterMaskData;if(!defined(t)){const n=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;t={allWaterTexture:n,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR}),destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function createWaterMaskTextureIfNeeded(e,t){const n=t.terrainData.waterMask,i=getContextWaterMaskData(e);let r;const o=n.length;if(1===o){if(0===n[0])return;r=i.allWaterTexture}else{const t=Math.sqrt(o);r=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:t,height:t,arrayBufferView:n},sampler:i.sampler,flipY:!1}),r.referenceCount=0}++r.referenceCount,t.waterMaskTexture=r,Cartesian4.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}GlobeSurfaceTile._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=Buffer$1.createVertexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW}),r=t.encoding.getAttributes(i),o=t.indices.indexBuffers||{};let a=o[e.id];if(!defined(a)||a.isDestroyed()){const n=t.indices;a=Buffer$1.createIndexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(n.BYTES_PER_ELEMENT)}),a.vertexArrayDestroyable=!1,a.referenceCount=1,o[e.id]=a,t.indices.indexBuffers=o}else++a.referenceCount;return new VertexArray({context:e,attributes:r,indexBuffer:a})},GlobeSurfaceTile._freeVertexArray=function(e){if(defined(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),defined(t)&&!t.isDestroyed()&&defined(t.referenceCount)&&(--t.referenceCount,0===t.referenceCount&&t.destroy())}},GlobeSurfaceTile.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;defined(t)&&(!defined(t.data)||!defined(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t},GlobeSurfaceTile.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const i=t.rectangle,r=e.rectangle,o=r.width,a=r.height,s=o/i.width,c=a/i.height;return n.x=s*(r.west-i.west)/o,n.y=c*(r.south-i.south)/a,n.z=s,n.w=c,n};var ReprojectWebMercatorFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n",ReprojectWebMercatorVS="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";function Imagery(e,t,n,i,r){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,0!==i){const r=t/2|0,o=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,o,a)}if(this.state=ImageryState$1.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!defined(r)&&e.imageryProvider.ready){r=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)}this.rectangle=r}Imagery.createPlaceholder=function(e){const t=new Imagery(e,0,0,0);return t.addReference(),t.state=ImageryState$1.PLACEHOLDER,t},Imagery.prototype.addReference=function(){++this.referenceCount},Imagery.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),defined(this.parent)&&this.parent.releaseReference(),defined(this.image)&&defined(this.image.destroy)&&this.image.destroy(),defined(this.texture)&&this.texture.destroy(),defined(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),destroyObject(this),0):this.referenceCount},Imagery.prototype.processStateMachine=function(e,t,n){this.state!==ImageryState$1.UNLOADED||n||(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ImageryState$1.RECEIVED&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===ImageryState$1.READY&&t&&!this.texture;(this.state===ImageryState$1.TEXTURE_LOADED||i)&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};const ImagerySplitDirection={LEFT:-1,NONE:0,RIGHT:1};var ImagerySplitDirection$1=Object.freeze(ImagerySplitDirection);function TileImagery(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}function ImageryLayer(e,t){this._imageryProvider=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this.alpha=defaultValue(t.alpha,defaultValue(e.defaultAlpha,1)),this.nightAlpha=defaultValue(t.nightAlpha,defaultValue(e.defaultNightAlpha,1)),this.dayAlpha=defaultValue(t.dayAlpha,defaultValue(e.defaultDayAlpha,1)),this.brightness=defaultValue(t.brightness,defaultValue(e.defaultBrightness,ImageryLayer.DEFAULT_BRIGHTNESS)),this.contrast=defaultValue(t.contrast,defaultValue(e.defaultContrast,ImageryLayer.DEFAULT_CONTRAST)),this.hue=defaultValue(t.hue,defaultValue(e.defaultHue,ImageryLayer.DEFAULT_HUE)),this.saturation=defaultValue(t.saturation,defaultValue(e.defaultSaturation,ImageryLayer.DEFAULT_SATURATION)),this.gamma=defaultValue(t.gamma,defaultValue(e.defaultGamma,ImageryLayer.DEFAULT_GAMMA)),this.splitDirection=defaultValue(t.splitDirection,defaultValue(e.defaultSplit,ImageryLayer.DEFAULT_SPLIT)),this.minificationFilter=defaultValue(t.minificationFilter,defaultValue(e.defaultMinificationFilter,ImageryLayer.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=defaultValue(t.magnificationFilter,defaultValue(e.defaultMagnificationFilter,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER)),this.show=defaultValue(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=defaultValue(t.rectangle,Rectangle.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new TileImagery(Imagery.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=defaultValue(t.colorToAlphaThreshold,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}TileImagery.prototype.freeResources=function(){defined(this.readyImagery)&&this.readyImagery.releaseReference(),defined(this.loadingImagery)&&this.loadingImagery.releaseReference()},TileImagery.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,r=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===ImageryState$1.READY)return defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=r._calculateTextureTranslationAndScale(e,this),!0;let o,a=i.parent;for(;defined(a)&&(a.state!==ImageryState$1.READY||!this.useWebMercatorT&&!defined(a.texture));)a.state!==ImageryState$1.FAILED&&a.state!==ImageryState$1.INVALID&&(o=o||a),a=a.parent;return this.readyImagery!==a&&(defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=a,defined(a)&&(a.addReference(),this.textureTranslationAndScale=r._calculateTextureTranslationAndScale(e,this))),(i.state===ImageryState$1.FAILED||i.state===ImageryState$1.INVALID)&&(!defined(o)||(o.processStateMachine(t,!this.useWebMercatorT,n),!1))},Object.defineProperties(ImageryLayer.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),ImageryLayer.DEFAULT_BRIGHTNESS=1,ImageryLayer.DEFAULT_CONTRAST=1,ImageryLayer.DEFAULT_HUE=0,ImageryLayer.DEFAULT_SATURATION=1,ImageryLayer.DEFAULT_GAMMA=1,ImageryLayer.DEFAULT_SPLIT=ImagerySplitDirection$1.NONE,ImageryLayer.DEFAULT_MINIFICATION_FILTER=TextureMinificationFilter$1.LINEAR,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER=TextureMagnificationFilter$1.LINEAR,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004,ImageryLayer.prototype.isBaseLayer=function(){return this._isBaseLayer},ImageryLayer.prototype.isDestroyed=function(){return!1},ImageryLayer.prototype.destroy=function(){return destroyObject(this)};const imageryBoundsScratch=new Rectangle,tileImageryBoundsScratch=new Rectangle,clippedRectangleScratch=new Rectangle,terrainRectangleScratch=new Rectangle;function getSamplerKey(e,t,n){return e+":"+t+":"+n}function getImageryCacheKey(e,t,n){return JSON.stringify([e,t,n])}ImageryLayer.prototype.getViewableRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then((function(){return Rectangle.intersection(e.rectangle,t)}))},ImageryLayer.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(defined(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(defined(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;const r=this._imageryProvider;if(defined(n)||(n=i.imagery.length),!r.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const o=r.tilingScheme.projection instanceof WebMercatorProjection&&e.rectangle.north<WebMercatorProjection.MaximumLatitude&&e.rectangle.south>-WebMercatorProjection.MaximumLatitude,a=Rectangle.intersection(r.rectangle,this._rectangle,imageryBoundsScratch);let s=Rectangle.intersection(e.rectangle,a,tileImageryBoundsScratch);if(!defined(s)){if(!this.isBaseLayer())return!1;const t=a,n=e.rectangle;s=tileImageryBoundsScratch,n.south>=t.north?s.north=s.south=t.north:n.north<=t.south?s.north=s.south=t.south:(s.south=Math.max(n.south,t.south),s.north=Math.min(n.north,t.north)),n.west>=t.east?s.west=s.east=t.east:n.east<=t.west?s.west=s.east=t.west:(s.west=Math.max(n.west,t.west),s.east=Math.min(n.east,t.east))}let c=0;s.south>0?c=s.south:s.north<0&&(c=s.north);let l=getLevelWithMaximumTexelSpacing(this,1*t.getLevelMaximumGeometricError(e.level),c);l=Math.max(0,l);const u=r.maximumLevel;if(l>u&&(l=u),defined(r.minimumLevel)){const e=r.minimumLevel;l<e&&(l=e)}const d=r.tilingScheme,h=d.positionToTileXY(Rectangle.northwest(s),l),p=d.positionToTileXY(Rectangle.southeast(s),l);let f=e.rectangle.width/512,m=e.rectangle.height/512;const g=d.tileXYToRectangle(h.x,h.y,l);Math.abs(g.south-e.rectangle.north)<m&&h.y<p.y&&++h.y,Math.abs(g.east-e.rectangle.west)<f&&h.x<p.x&&++h.x;const _=d.tileXYToRectangle(p.x,p.y,l);Math.abs(_.north-e.rectangle.south)<m&&p.y>h.y&&--p.y,Math.abs(_.west-e.rectangle.east)<f&&p.x>h.x&&--p.x;const y=Rectangle.clone(e.rectangle,terrainRectangleScratch);let C,T,S=d.tileXYToRectangle(h.x,h.y,l),A=Rectangle.intersection(S,a,clippedRectangleScratch);o?(d.rectangleToNativeRectangle(y,y),d.rectangleToNativeRectangle(S,S),d.rectangleToNativeRectangle(A,A),d.rectangleToNativeRectangle(a,a),C=d.tileXYToNativeRectangle.bind(d),f=y.width/512,m=y.height/512):C=d.tileXYToRectangle.bind(d);let v,E=0,b=1;!this.isBaseLayer()&&Math.abs(A.west-y.west)>=f&&(E=Math.min(1,(A.west-y.west)/y.width)),!this.isBaseLayer()&&Math.abs(A.north-y.north)>=m&&(b=Math.max(0,(A.north-y.south)/y.height));const x=b;for(let e=h.x;e<=p.x;e++)if(T=E,S=C(e,h.y,l),A=Rectangle.simpleIntersection(S,a,clippedRectangleScratch),defined(A)){E=Math.min(1,(A.east-y.west)/y.width),e===p.x&&(this.isBaseLayer()||Math.abs(A.east-y.east)<f)&&(E=1),b=x;for(let t=h.y;t<=p.y;t++){if(v=b,S=C(e,t,l),A=Rectangle.simpleIntersection(S,a,clippedRectangleScratch),!defined(A))continue;b=Math.max(0,(A.south-y.south)/y.height),t===p.y&&(this.isBaseLayer()||Math.abs(A.south-y.south)<m)&&(b=0);const r=new Cartesian4(T,b,E,v),s=this.getImageryFromCache(e,t,l);i.imagery.splice(n,0,new TileImagery(s,r,o)),++n}}return!0},ImageryLayer.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const e=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=e.rectangleToNativeRectangle(n,imageryBoundsScratch),i=e.rectangleToNativeRectangle(i,terrainRectangleScratch)}const r=i.width,o=i.height,a=r/n.width,s=o/n.height;return new Cartesian4(a*(i.west-n.west)/r,s*(i.south-n.south)/o,a,s)},ImageryLayer.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(t){if(!defined(t))return r();e.image=t,e.state=ImageryState$1.RECEIVED,e.request=void 0,TileProviderError.handleSuccess(n._requestImageError)}function r(i){if(e.request.state===RequestState$1.CANCELLED)return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);e.state=ImageryState$1.FAILED,e.request=void 0;const r="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";n._requestImageError=TileProviderError.handleError(n._requestImageError,t,t.errorEvent,r,e.x,e.y,e.level,o,i)}function o(){const n=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY});e.request=n,e.state=ImageryState$1.TRANSITIONING;const o=t.requestImage(e.x,e.y,e.level,n);if(!defined(o))return e.state=ImageryState$1.UNLOADED,void(e.request=void 0);defined(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),when(o,i,r)}o()},ImageryLayer.prototype._createTextureWebGL=function(e,t){const n=new Sampler({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return defined(i.internalFormat)?new Texture({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new Texture({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?PixelFormat$1.RGBA:PixelFormat$1.RGB,sampler:n})},ImageryLayer.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(defined(n.tileDiscardPolicy)){const e=n.tileDiscardPolicy;if(defined(e)){if(!e.isReady())return void(t.state=ImageryState$1.RECEIVED);if(e.shouldDiscardImage(i))return void(t.state=ImageryState$1.INVALID)}}const r=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof WebMercatorProjection?t.textureWebMercator=r:t.texture=r,t.image=void 0,t.state=ImageryState$1.TEXTURE_LOADED},ImageryLayer.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===TextureMinificationFilter$1.LINEAR&&i===TextureMagnificationFilter$1.LINEAR&&!PixelFormat$1.isCompressedFormat(t.pixelFormat)&&CesiumMath.isPowerOfTwo(t.width)&&CesiumMath.isPowerOfTwo(t.height)){n=TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR;const r=ContextLimits.maximumTextureFilterAnisotropy,o=Math.min(r,defaultValue(this._maximumAnisotropy,r)),a=getSamplerKey(n,i,o);let s=e.cache.imageryLayerMipmapSamplers;defined(s)||(s={},e.cache.imageryLayerMipmapSamplers=s);let c=s[a];defined(c)||(c=s[a]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:o})),t.generateMipmap(MipmapHint$1.NICEST),t.sampler=c}else{const r=getSamplerKey(n,i,0);let o=e.cache.imageryLayerNonMipmapSamplers;defined(o)||(o={},e.cache.imageryLayerNonMipmapSamplers=o);let a=o[r];defined(a)||(a=o[r]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}},ImageryLayer.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,r=t.rectangle,o=e.context;if((n=defaultValue(n,!0))&&!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection)&&r.width/i.width>1e-5){const e=this;t.addReference();const n=new ComputeCommand({persists:!0,owner:this,preExecute:function(e){reprojectToGeographic(e,o,i,t.rectangle)},postExecute:function(n){t.texture=n,e._finalizeReprojectTexture(o,n),t.state=ImageryState$1.READY,t.releaseReference()},canceled:function(){t.state=ImageryState$1.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(n)}else n&&(t.texture=i),this._finalizeReprojectTexture(o,i),t.state=ImageryState$1.READY},ImageryLayer.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0},ImageryLayer.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach((function(e){defined(e.canceled)&&e.canceled()})),this._reprojectComputeCommands.length=0},ImageryLayer.prototype.getImageryFromCache=function(e,t,n,i){const r=getImageryCacheKey(e,t,n);let o=this._imageryCache[r];return defined(o)||(o=new Imagery(this,e,t,n,i),this._imageryCache[r]=o),o.addReference(),o},ImageryLayer.prototype.removeImageryFromCache=function(e){const t=getImageryCacheKey(e.x,e.y,e.level);delete this._imageryCache[t]};const uniformMap={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new Cartesian2,texture:void 0},float32ArrayScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(128):void 0;function reprojectToGeographic(e,t,n,i){let r=t.cache.imageryLayer_reproject;if(!defined(r)){r=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){defined(this.framebuffer)&&this.framebuffer.destroy(),defined(this.vertexArray)&&this.vertexArray.destroy(),defined(this.shaderProgram)&&this.shaderProgram.destroy()}};const e=new Float32Array(256);let n=0;for(let t=0;t<64;++t){const i=t/63;e[n++]=0,e[n++]=i,e[n++]=1,e[n++]=i}const i={position:0,webMercatorT:1},o=TerrainProvider.getRegularGridIndices(2,64),a=Buffer$1.createIndexBuffer({context:t,typedArray:o,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});r.vertexArray=new VertexArray({context:t,attributes:[{index:i.position,vertexBuffer:Buffer$1.createVertexBuffer({context:t,typedArray:e,usage:BufferUsage$1.STATIC_DRAW}),componentsPerAttribute:2},{index:i.webMercatorT,vertexBuffer:Buffer$1.createVertexBuffer({context:t,sizeInBytes:512,usage:BufferUsage$1.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:a});const s=new ShaderSource({sources:[ReprojectWebMercatorVS]});r.shaderProgram=ShaderProgram.fromCache({context:t,vertexShaderSource:s,fragmentShaderSource:ReprojectWebMercatorFS,attributeLocations:i}),r.sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}n.sampler=r.sampler;const o=n.width,a=n.height;uniformMap.textureDimensions.x=o,uniformMap.textureDimensions.y=a,uniformMap.texture=n;let s=Math.sin(i.south);const c=.5*Math.log((1+s)/(1-s));s=Math.sin(i.north);const l=1/(.5*Math.log((1+s)/(1-s))-c),u=new Texture({context:t,width:o,height:a,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});CesiumMath.isPowerOfTwo(o)&&CesiumMath.isPowerOfTwo(a)&&u.generateMipmap(MipmapHint$1.NICEST);const d=i.south,h=i.north,p=float32ArrayScratch;let f=0;for(let e=0;e<64;++e){const t=e/63,n=CesiumMath.lerp(d,h,t);s=Math.sin(n);const i=(.5*Math.log((1+s)/(1-s))-c)*l;p[f++]=i,p[f++]=i}r.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=r.shaderProgram,e.outputTexture=u,e.uniformMap=uniformMap,e.vertexArray=r.vertexArray}function getLevelWithMaximumTexelSpacing(e,t,n){const i=e._imageryProvider,r=i.tilingScheme,o=r.ellipsoid,a=e._imageryProvider.tilingScheme.projection instanceof GeographicProjection?1:Math.cos(n),s=r.rectangle,c=o.maximumRadius*s.width*a/(i.tileWidth*r.getNumberOfXTilesAtLevel(0))/t,l=Math.log(c)/Math.log(2);return 0|Math.round(l)}const TileSelectionResult={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=TileSelectionResult.RENDERED_AND_KICKED},originalResult:function(e){return 3&e},kick:function(e){return 4|e}};function TerrainFillMesh(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4}TerrainFillMesh.prototype.update=function(e,t,n){this.changedThisFrame&&(createFillMesh(e,t,this.tile,n),this.changedThisFrame=!1)},TerrainFillMesh.prototype.destroy=function(e){this._destroyVertexArray(e),defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)},TerrainFillMesh.prototype._destroyVertexArray=function(e){defined(this.vertexArray)&&(defined(e)?e.push(this.vertexArray):GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const traversalQueueScratch=new Queue;function visitRenderedTiles(e,t,n,i,r,o,a,s,c){if(void 0===i)return;let l=i;for(;l&&(l._lastSelectionResultFrame!==r||TileSelectionResult.wasKicked(l._lastSelectionResult)||TileSelectionResult.originalResult(l._lastSelectionResult)===TileSelectionResult.CULLED);){if(a)return;const e=l.parent;if(o>=TileEdge.NORTHWEST&&void 0!==e)switch(o){case TileEdge.NORTHWEST:l=l===e.northwestChild?e:void 0;break;case TileEdge.NORTHEAST:l=l===e.northeastChild?e:void 0;break;case TileEdge.SOUTHWEST:l=l===e.southwestChild?e:void 0;break;case TileEdge.SOUTHEAST:l=l===e.southeastChild?e:void 0}else l=e}if(void 0!==l)if(l._lastSelectionResult!==TileSelectionResult.RENDERED){if(TileSelectionResult.originalResult(i._lastSelectionResult)!==TileSelectionResult.CULLED)switch(o){case TileEdge.WEST:visitRenderedTiles(e,t,n,i.northwestChild,r,o,!0,s,c),visitRenderedTiles(e,t,n,i.southwestChild,r,o,!0,s,c);break;case TileEdge.EAST:visitRenderedTiles(e,t,n,i.southeastChild,r,o,!0,s,c),visitRenderedTiles(e,t,n,i.northeastChild,r,o,!0,s,c);break;case TileEdge.SOUTH:visitRenderedTiles(e,t,n,i.southwestChild,r,o,!0,s,c),visitRenderedTiles(e,t,n,i.southeastChild,r,o,!0,s,c);break;case TileEdge.NORTH:visitRenderedTiles(e,t,n,i.northeastChild,r,o,!0,s,c),visitRenderedTiles(e,t,n,i.northwestChild,r,o,!0,s,c);break;case TileEdge.NORTHWEST:visitRenderedTiles(e,t,n,i.northwestChild,r,o,!0,s,c);break;case TileEdge.NORTHEAST:visitRenderedTiles(e,t,n,i.northeastChild,r,o,!0,s,c);break;case TileEdge.SOUTHWEST:visitRenderedTiles(e,t,n,i.southwestChild,r,o,!0,s,c);break;case TileEdge.SOUTHEAST:visitRenderedTiles(e,t,n,i.southeastChild,r,o,!0,s,c);break;default:throw new DeveloperError("Invalid edge")}}else{if(defined(l.data.vertexArray))return;visitTile$1(e,t,n,l,o,r,s,c)}}function visitTile$1(e,t,n,i,r,o,a,s){const c=i.data;if(void 0===c.fill)c.fill=new TerrainFillMesh(i);else if(c.fill.visitedFrame===o)return;c.fill.enqueuedFrame!==o&&(c.fill.enqueuedFrame=o,c.fill.changedThisFrame=!1,a.enqueue(i)),propagateEdge(e,t,n,i,r,s)}function propagateEdge(e,t,n,i,r,o){const a=i.data.fill;let s;const c=n.data.fill;let l,u,d,h,p,f;switch(defined(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(createFillMesh(e,t,n,o),c.changedThisFrame=!1),s=n.data.fill.mesh):s=n.data.mesh,r){case TileEdge.WEST:l=a.westMeshes,u=a.westTiles;break;case TileEdge.SOUTH:l=a.southMeshes,u=a.southTiles;break;case TileEdge.EAST:l=a.eastMeshes,u=a.eastTiles;break;case TileEdge.NORTH:l=a.northMeshes,u=a.northTiles;break;case TileEdge.NORTHWEST:return a.changedThisFrame=a.changedThisFrame||a.northwestMesh!==s,a.northwestMesh=s,void(a.northwestTile=n);case TileEdge.NORTHEAST:return a.changedThisFrame=a.changedThisFrame||a.northeastMesh!==s,a.northeastMesh=s,void(a.northeastTile=n);case TileEdge.SOUTHWEST:return a.changedThisFrame=a.changedThisFrame||a.southwestMesh!==s,a.southwestMesh=s,void(a.southwestTile=n);case TileEdge.SOUTHEAST:return a.changedThisFrame=a.changedThisFrame||a.southeastMesh!==s,a.southeastMesh=s,void(a.southeastTile=n)}if(n.level<=i.level)return a.changedThisFrame=a.changedThisFrame||l[0]!==s||1!==l.length,l[0]=s,u[0]=n,l.length=1,void(u.length=1);const m=n.rectangle;let g;const _=i.rectangle;switch(r){case TileEdge.WEST:for(g=(_.north-_.south)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.greaterThan(m.north,f.south,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.greaterThanOrEquals(m.south,f.north,g));++h);break;case TileEdge.SOUTH:for(g=(_.east-_.west)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.lessThan(m.west,f.east,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.lessThanOrEquals(m.east,f.west,g));++h);break;case TileEdge.EAST:for(g=(_.north-_.south)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.lessThan(m.south,f.north,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.lessThanOrEquals(m.north,f.south,g));++h);break;case TileEdge.NORTH:for(g=(_.east-_.west)*CesiumMath.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!CesiumMath.greaterThan(m.east,f.west,g));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!CesiumMath.greaterThanOrEquals(m.west,f.east,g));++h);}h-d==1?(a.changedThisFrame=a.changedThisFrame||l[d]!==s,l[d]=s,u[d]=n):(a.changedThisFrame=!0,l.splice(d,h-d,s),u.splice(d,h-d,n))}TerrainFillMesh.updateFillTiles=function(e,t,n,i){const r=e._quadtree,o=r._levelZeroTiles,a=r._lastSelectionFrameNumber,s=traversalQueueScratch;s.clear();for(let e=0;e<t.length;++e){defined(t[e].data.vertexArray)&&s.enqueue(t[e])}let c=s.dequeue();for(;void 0!==c;){const t=c.findTileToWest(o),r=c.findTileToSouth(o),l=c.findTileToEast(o),u=c.findTileToNorth(o);visitRenderedTiles(e,n,c,t,a,TileEdge.EAST,!1,s,i),visitRenderedTiles(e,n,c,r,a,TileEdge.NORTH,!1,s,i),visitRenderedTiles(e,n,c,l,a,TileEdge.WEST,!1,s,i),visitRenderedTiles(e,n,c,u,a,TileEdge.SOUTH,!1,s,i);const d=t.findTileToNorth(o),h=t.findTileToSouth(o),p=l.findTileToNorth(o),f=l.findTileToSouth(o);visitRenderedTiles(e,n,c,d,a,TileEdge.SOUTHEAST,!1,s,i),visitRenderedTiles(e,n,c,p,a,TileEdge.SOUTHWEST,!1,s,i),visitRenderedTiles(e,n,c,h,a,TileEdge.NORTHEAST,!1,s,i),visitRenderedTiles(e,n,c,f,a,TileEdge.NORTHWEST,!1,s,i),c=s.dequeue()}};const cartographicScratch=new Cartographic,centerCartographicScratch=new Cartographic,cartesianScratch=new Cartesian3,normalScratch=new Cartesian3,octEncodedNormalScratch=new Cartesian2,uvScratch2=new Cartesian2,uvScratch=new Cartesian2;function HeightAndNormal(){this.height=0,this.encodedNormal=new Cartesian2}function fillMissingCorner(e,t,n,i,r,o,a,s,c){if(defined(r))return r;let l;if(defined(o)&&defined(a))l=.5*(o.height+a.height);else if(defined(o))l=o.height;else if(defined(a))l=a.height;else if(defined(s))l=s.height;else{const t=e.tile.data.tileBoundingRegion;let n=0,i=0;defined(t)&&(n=t.minimumHeight,i=t.maximumHeight),l=.5*(n+i)}return getVertexWithHeightAtCorner(e,t,n,i,l,c),c}const heightRangeScratch={minimumHeight:0,maximumHeight:0},scratchCenter$2=new Cartesian3,swVertexScratch=new HeightAndNormal,seVertexScratch=new HeightAndNormal,nwVertexScratch=new HeightAndNormal,neVertexScratch=new HeightAndNormal,heightmapBuffer="undefined"!=typeof Uint8Array?new Uint8Array(81):void 0,scratchCreateMeshSyncOptions={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function createFillMesh(e,t,n,i){GlobeSurfaceTile.initialize(n,e.terrainProvider,e._imageryLayers);const r=n.data,o=r.fill,a=n.rectangle,s=t.terrainExaggeration,c=t.terrainExaggerationRelativeHeight,l=1!==s,u=n.tilingScheme.ellipsoid;let d=getCorner(o,u,0,1,o.northwestTile,o.northwestMesh,o.northTiles,o.northMeshes,o.westTiles,o.westMeshes,nwVertexScratch),h=getCorner(o,u,0,0,o.southwestTile,o.southwestMesh,o.westTiles,o.westMeshes,o.southTiles,o.southMeshes,swVertexScratch),p=getCorner(o,u,1,0,o.southeastTile,o.southeastMesh,o.southTiles,o.southMeshes,o.eastTiles,o.eastMeshes,seVertexScratch),f=getCorner(o,u,1,1,o.northeastTile,o.northeastMesh,o.eastTiles,o.eastMeshes,o.northTiles,o.northMeshes,neVertexScratch);d=fillMissingCorner(o,u,0,1,d,h,f,p,nwVertexScratch),h=fillMissingCorner(o,u,0,0,h,d,p,f,swVertexScratch),p=fillMissingCorner(o,u,1,1,p,h,f,d,seVertexScratch),f=fillMissingCorner(o,u,1,1,f,p,d,h,neVertexScratch);const m=h.height,g=p.height,_=d.height,y=f.height;let C=Math.min(m,g,_,y),T=Math.max(m,g,_,y);const S=.5*(C+T);let A,v;const E=e.getLevelMaximumGeometricError(n.level),b=u.maximumRadius-E;let x=4*Math.acos(b/u.maximumRadius);if(x*=1.5,a.width>x&&T-C<=E){const e=new HeightmapTerrainData({width:9,height:9,buffer:heightmapBuffer,structure:{heightOffset:T}}),t=scratchCreateMeshSyncOptions;t.tilingScheme=n.tilingScheme,t.x=n.x,t.y=n.y,t.level=n.level,t.exaggeration=s,t.exaggerationRelativeHeight=c,o.mesh=e._createMeshSync(t)}else{const t=l,i=Rectangle.center(a,centerCartographicScratch);i.height=S;const r=new TerrainEncoding(u.cartographicToCartesian(i,scratchCenter$2),void 0,void 0,void 0,void 0,!0,!0,t,s,c);let m,g=5;for(m=o.westMeshes,A=0,v=m.length;A<v;++A)g+=m[A].eastIndicesNorthToSouth.length;for(m=o.southMeshes,A=0,v=m.length;A<v;++A)g+=m[A].northIndicesWestToEast.length;for(m=o.eastMeshes,A=0,v=m.length;A<v;++A)g+=m[A].westIndicesSouthToNorth.length;for(m=o.northMeshes,A=0,v=m.length;A<v;++A)g+=m[A].southIndicesEastToWest.length;const _=heightRangeScratch;_.minimumHeight=C,_.maximumHeight=T;const y=r.stride;let E=new Float32Array(g*y),b=0;const x=b;b=addVertexWithComputedPosition(u,a,r,E,b,0,1,d.height,d.encodedNormal,1,_),b=addEdge(o,u,r,E,b,o.westTiles,o.westMeshes,TileEdge.EAST,_);const P=b;b=addVertexWithComputedPosition(u,a,r,E,b,0,0,h.height,h.encodedNormal,0,_),b=addEdge(o,u,r,E,b,o.southTiles,o.southMeshes,TileEdge.NORTH,_);const D=b;b=addVertexWithComputedPosition(u,a,r,E,b,1,0,p.height,p.encodedNormal,0,_),b=addEdge(o,u,r,E,b,o.eastTiles,o.eastMeshes,TileEdge.WEST,_);const w=b;b=addVertexWithComputedPosition(u,a,r,E,b,1,1,f.height,f.encodedNormal,1,_),b=addEdge(o,u,r,E,b,o.northTiles,o.northMeshes,TileEdge.SOUTH,_),C=_.minimumHeight,T=_.maximumHeight;const M=OrientedBoundingBox.fromRectangle(a,C,T,n.tilingScheme.ellipsoid),I=WebMercatorProjection.geodeticLatitudeToMercatorAngle(a.south),R=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(a.north)-I),O=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(i.latitude)-I)*R,B=u.geodeticSurfaceNormalCartographic(cartographicScratch,normalScratch),L=AttributeCompression.octEncode(B,octEncodedNormalScratch),F=b;r.encode(E,b*y,M.center,Cartesian2.fromElements(.5,.5,uvScratch),S,L,O,B),++b;const N=b,V=3*(N-1),k=V*(N<256?1:2);let U;if((E.length-N*y)*Float32Array.BYTES_PER_ELEMENT>=k){const e=N*y*Float32Array.BYTES_PER_ELEMENT;U=N<256?new Uint8Array(E.buffer,e,V):new Uint16Array(E.buffer,e,V)}else U=N<256?new Uint8Array(V):new Uint16Array(V);E=new Float32Array(E.buffer,0,N*y);let G=0;for(A=0;A<N-2;++A)U[G++]=F,U[G++]=A,U[G++]=A+1;U[G++]=F,U[G++]=A,U[G++]=0;const $=[];for(A=P;A>=x;--A)$.push(A);const z=[];for(A=D;A>=P;--A)z.push(A);const H=[];for(A=w;A>=D;--A)H.push(A);const W=[];for(W.push(0),A=F-1;A>=w;--A)W.push(A);o.mesh=new TerrainMesh(r.center,E,U,V,N,C,T,BoundingSphere.fromOrientedBoundingBox(M),computeOccludeePoint$1(e,M.center,a,C,T),r.stride,M,r,$,z,H,W)}const P=t.context;o._destroyVertexArray(i),o.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(P,o.mesh),r.processImagery(n,e.terrainProvider,t,!0);const D=o.waterMaskTexture;if(o.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const e=r._findAncestorTileWithTerrainData(n);defined(e)&&defined(e.data.waterMaskTexture)&&(o.waterMaskTexture=e.data.waterMaskTexture,++o.waterMaskTexture.referenceCount,r._computeWaterMaskTranslationAndScale(n,e,o.waterMaskTranslationAndScale))}defined(D)&&(--D.referenceCount,0===D.referenceCount&&D.destroy())}function addVertexWithComputedPosition(e,t,n,i,r,o,a,s,c,l,u){const d=cartographicScratch;d.longitude=CesiumMath.lerp(t.west,t.east,o),d.latitude=CesiumMath.lerp(t.south,t.north,a),d.height=s;const h=e.cartographicToCartesian(d,cartesianScratch);let p;n.hasGeodeticSurfaceNormals&&(p=e.geodeticSurfaceNormal(h,normalScratch));const f=uvScratch2;return f.x=o,f.y=a,n.encode(i,r*n.stride,h,f,s,c,l,p),u.minimumHeight=Math.min(u.minimumHeight,s),u.maximumHeight=Math.max(u.maximumHeight,s),r+1}const sourceRectangleScratch=new Rectangle;function transformTextureCoordinates(e,t,n,i){let r=e.rectangle;const o=t.rectangle;0===t.x&&1===n.x&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(r=Rectangle.clone(e.rectangle,sourceRectangleScratch),r.west-=CesiumMath.TWO_PI,r.east-=CesiumMath.TWO_PI):0===e.x&&0===n.x&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(r=Rectangle.clone(e.rectangle,sourceRectangleScratch),r.west+=CesiumMath.TWO_PI,r.east+=CesiumMath.TWO_PI);const a=r.east-r.west,s=(o.west-r.west)/a,c=(o.east-r.west)/a,l=r.north-r.south,u=(o.south-r.south)/l,d=(o.north-r.south)/l;let h=(n.x-s)/(c-s),p=(n.y-u)/(d-u);return Math.abs(h)<Math.EPSILON5?h=0:Math.abs(h-1)<Math.EPSILON5&&(h=1),Math.abs(p)<Math.EPSILON5?p=0:Math.abs(p-1)<Math.EPSILON5&&(p=1),i.x=h,i.y=p,i}const encodedNormalScratch=new Cartesian2;function getVertexFromTileAtCorner(e,t,n,i,r){const o=e.encoding,a=e.vertices;if(r.height=o.decodeHeight(a,t),o.hasVertexNormals)o.getOctEncodedNormal(a,t,r.encodedNormal);else{const e=r.encodedNormal;e.x=0,e.y=0}}const encodedNormalScratch2=new Cartesian2,cartesianScratch2=new Cartesian3;function getInterpolatedVertexAtCorner(e,t,n,i,r,o,a,s,c,l){const u=i.encoding,d=i.vertices,h=transformTextureCoordinates(t,n,u.decodeTextureCoordinates(d,r,uvScratch),uvScratch),p=transformTextureCoordinates(t,n,u.decodeTextureCoordinates(d,o,uvScratch2),uvScratch2);let f;f=c?(a-h.x)/(p.x-h.x):(s-h.y)/(p.y-h.y);const m=u.decodeHeight(d,r),g=u.decodeHeight(d,o),_=n.rectangle;let y;if(cartographicScratch.longitude=CesiumMath.lerp(_.west,_.east,a),cartographicScratch.latitude=CesiumMath.lerp(_.south,_.north,s),l.height=cartographicScratch.height=CesiumMath.lerp(m,g,f),u.hasVertexNormals){const e=u.getOctEncodedNormal(d,r,encodedNormalScratch),t=u.getOctEncodedNormal(d,o,encodedNormalScratch2),n=AttributeCompression.octDecode(e.x,e.y,cartesianScratch),i=AttributeCompression.octDecode(t.x,t.y,cartesianScratch2);y=Cartesian3.lerp(n,i,f,cartesianScratch),Cartesian3.normalize(y,y),AttributeCompression.octEncode(y,l.encodedNormal)}else y=e.geodeticSurfaceNormalCartographic(cartographicScratch,cartesianScratch),AttributeCompression.octEncode(y,l.encodedNormal)}function getVertexWithHeightAtCorner(e,t,n,i,r,o){o.height=r;const a=t.geodeticSurfaceNormalCartographic(cartographicScratch,cartesianScratch);AttributeCompression.octEncode(a,o.encodedNormal)}function getCorner(e,t,n,i,r,o,a,s,c,l,u){if(getCornerFromEdge(e,t,s,a,!1,n,i,u)||getCornerFromEdge(e,t,l,c,!0,n,i,u))return u;let d,h;return meshIsUsable(r,o)?(d=0===n?0===i?o.eastIndicesNorthToSouth[0]:o.southIndicesEastToWest[0]:0===i?o.northIndicesWestToEast[0]:o.westIndicesSouthToNorth[0],getVertexFromTileAtCorner(o,d,n,i,u),u):(h=0===n?0===i?getClosestHeightToCorner(e.westMeshes,e.westTiles,TileEdge.EAST,e.southMeshes,e.southTiles,TileEdge.NORTH):getClosestHeightToCorner(e.northMeshes,e.northTiles,TileEdge.SOUTH,e.westMeshes,e.westTiles,TileEdge.EAST):0===i?getClosestHeightToCorner(e.southMeshes,e.southTiles,TileEdge.NORTH,e.eastMeshes,e.eastTiles,TileEdge.WEST):getClosestHeightToCorner(e.eastMeshes,e.eastTiles,TileEdge.WEST,e.northMeshes,e.northTiles,TileEdge.SOUTH),defined(h)?(getVertexWithHeightAtCorner(e,t,n,i,h,u),u):void 0)}function getClosestHeightToCorner(e,t,n,i,r,o,a,s){const c=getNearestHeightOnEdge(e,t,!1,n),l=getNearestHeightOnEdge(i,r,!0,o);return defined(c)&&defined(l)?.5*(c+l):defined(c)?c:l}function addEdge(e,t,n,i,r,o,a,s,c){for(let l=0;l<o.length;++l)r=addEdgeMesh(e,t,n,i,r,o[l],a[l],s,c);return r}function addEdgeMesh(e,t,n,i,r,o,a,s,c){let l=o.rectangle;s===TileEdge.EAST&&0===e.tile.x?(l=Rectangle.clone(o.rectangle,sourceRectangleScratch),l.west-=CesiumMath.TWO_PI,l.east-=CesiumMath.TWO_PI):s===TileEdge.WEST&&0===o.x&&(l=Rectangle.clone(o.rectangle,sourceRectangleScratch),l.west+=CesiumMath.TWO_PI,l.east+=CesiumMath.TWO_PI);const u=e.tile.rectangle;let d,h,p,f;switch(r>0&&(n.decodeTextureCoordinates(i,r-1,uvScratch),d=uvScratch.x,h=uvScratch.y),s){case TileEdge.WEST:p=a.westIndicesSouthToNorth,f=!1;break;case TileEdge.NORTH:p=a.northIndicesWestToEast,f=!0;break;case TileEdge.EAST:p=a.eastIndicesNorthToSouth,f=!1;break;case TileEdge.SOUTH:p=a.southIndicesEastToWest,f=!0}const m=o,g=e.tile,_=a.encoding,y=a.vertices,C=n.stride;let T,S;_.hasWebMercatorT&&(T=WebMercatorProjection.geodeticLatitudeToMercatorAngle(u.south),S=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(u.north)-T));for(let e=0;e<p.length;++e){const o=p[e],a=_.decodeTextureCoordinates(y,o,uvScratch);transformTextureCoordinates(m,g,a,a);const s=a.x,l=a.y,A=f?s:l;if(A<0||A>1)continue;if(Math.abs(s-d)<CesiumMath.EPSILON5&&Math.abs(l-h)<CesiumMath.EPSILON5)continue;const v=Math.abs(s)<CesiumMath.EPSILON5||Math.abs(s-1)<CesiumMath.EPSILON5,E=Math.abs(l)<CesiumMath.EPSILON5||Math.abs(l-1)<CesiumMath.EPSILON5;if(v&&E)continue;const b=_.decodePosition(y,o,cartesianScratch),x=_.decodeHeight(y,o);let P;_.hasVertexNormals?P=_.getOctEncodedNormal(y,o,octEncodedNormalScratch):(P=octEncodedNormalScratch,P.x=0,P.y=0);let D,w=l;if(_.hasWebMercatorT){const e=CesiumMath.lerp(u.south,u.north,l);w=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(e)-T)*S}n.hasGeodeticSurfaceNormals&&(D=t.geodeticSurfaceNormal(b,normalScratch)),n.encode(i,r*C,b,a,x,P,w,D),c.minimumHeight=Math.min(c.minimumHeight,x),c.maximumHeight=Math.max(c.maximumHeight,x),++r}return r}function getNearestHeightOnEdge(e,t,n,i,r,o){let a,s,c;n?(a=0,s=e.length,c=1):(a=e.length-1,s=-1,c=-1);for(let r=a;r!==s;r+=c){const o=e[r];if(!meshIsUsable(t[r],o))continue;let a;switch(i){case TileEdge.WEST:a=o.westIndicesSouthToNorth;break;case TileEdge.SOUTH:a=o.southIndicesEastToWest;break;case TileEdge.EAST:a=o.eastIndicesNorthToSouth;break;case TileEdge.NORTH:a=o.northIndicesWestToEast}const s=a[n?0:a.length-1];if(defined(s))return o.encoding.decodeHeight(o.vertices,s)}}function meshIsUsable(e,t){return defined(t)&&(!defined(e.data.fill)||!e.data.fill.changedThisFrame)}function getCornerFromEdge(e,t,n,i,r,o,a,s){let c,l,u,d,h;const p=i[r?0:n.length-1],f=n[r?0:n.length-1];if(meshIsUsable(p,f)&&(0===o?0===a?(c=r?f.northIndicesWestToEast:f.eastIndicesNorthToSouth,l=r,u=r):(c=r?f.eastIndicesNorthToSouth:f.southIndicesEastToWest,l=!r,u=!1):0===a?(c=r?f.westIndicesSouthToNorth:f.northIndicesWestToEast,l=!r,u=!0):(c=r?f.southIndicesEastToWest:f.westIndicesSouthToNorth,l=r,u=!r),c.length>0)){d=r?0:c.length-1,h=c[d],f.encoding.decodeTextureCoordinates(f.vertices,h,uvScratch);const n=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);if(n.x===o&&n.y===a)return getVertexFromTileAtCorner(f,h,o,a,s),!0;if(d=binarySearch(c,l?o:a,(function(t,n){f.encoding.decodeTextureCoordinates(f.vertices,t,uvScratch);const i=transformTextureCoordinates(p,e.tile,uvScratch,uvScratch);return u?l?i.x-o:i.y-a:l?o-i.x:a-i.y})),!(d<0))return getVertexFromTileAtCorner(f,c[d],o,a,s),!0;if(d=~d,d>0&&d<c.length)return getInterpolatedVertexAtCorner(t,p,e.tile,f,c[d-1],c[d],o,a,l,s),!0}return!1}const cornerPositionsScratch$1=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint$1(e,t,n,i,r,o){const a=e.quadtree._occluders.ellipsoid,s=a.ellipsoid,c=cornerPositionsScratch$1;return Cartesian3.fromRadians(n.west,n.south,r,s,c[0]),Cartesian3.fromRadians(n.east,n.south,r,s,c[1]),Cartesian3.fromRadians(n.west,n.north,r,s,c[2]),Cartesian3.fromRadians(n.east,n.north,r,s,c[3]),a.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,o)}function GlobeSurfaceTileProvider(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,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._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new Event,this._imageryLayers.layerAdded.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Event,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new Color(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}function sortTileImageryByLayerIndex(e,t){let n=e.loadingImagery;defined(n)||(n=e.readyImagery);let i=t.loadingImagery;return defined(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}function updateCredits(e,t){const n=t.creditDisplay;e._terrainProvider.ready&&defined(e._terrainProvider.credit)&&n.addCredit(e._terrainProvider.credit);const i=e._imageryLayers;for(let e=0,t=i.length;e<t;++e){const t=i.get(e).imageryProvider;t.ready&&defined(t.credit)&&n.addCredit(t.credit)}}function pushCommand(e,t){const n=t.globeTranslucencyState;if(n.translucent){const i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}Object.defineProperties(GlobeSurfaceTileProvider.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=Cartesian4.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}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,defined(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}}}),GlobeSurfaceTileProvider.prototype.update=function(e){this._imageryLayers._update()},GlobeSurfaceTileProvider.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile((function(e){e.data.imagery.sort(sortTileImageryByLayerIndex)}))),updateCredits(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let e=0;e<n;++e)GlobeSurfaceTile._freeVertexArray(t[e]);t.length=0},GlobeSurfaceTileProvider.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let e=0,n=t.length;e<n;++e){const n=t[e];defined(n)&&(n.length=0)}const n=this._clippingPlanes;defined(n)&&n.enabled&&n.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1},GlobeSurfaceTileProvider.prototype.endUpdate=function(e){if(!defined(this._renderState)){this._renderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS}}),this._blendRenderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.ALPHA_BLEND});let e=clone$1(this._renderState,!0);e.cull.enabled=!1,this._disableCullingRenderState=RenderState.fromCache(e),e=clone$1(this._blendRenderState,!0),e.cull.enabled=!1,this._disableCullingBlendRenderState=RenderState.fromCache(e)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&TerrainFillMesh.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,n=e.terrainExaggeration,i=e.terrainExaggerationRelativeHeight,r=this._oldTerrainExaggeration!==n||this._oldTerrainExaggerationRelativeHeight!==i;this._oldTerrainExaggeration=n,this._oldTerrainExaggerationRelativeHeight=i,r&&t.forEachLoadedTile((function(n){n.data.updateExaggeration(n,e,t)}));const o=this._tilesToRenderByTextureCount;for(let t=0,n=o.length;t<n;++t){const n=o[t];if(defined(n))for(let t=0,i=n.length;t<i;++t){const i=n[t],r=i.data.tileBoundingRegion;addDrawCommandsForTile(this,i,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,r.minimumHeight)}}},GlobeSurfaceTileProvider.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)pushCommand(t[n],e)},GlobeSurfaceTileProvider.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()},GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},GlobeSurfaceTileProvider.prototype.loadTile=function(e,t){let n,i=t.data,r=!0;defined(i)&&(r=i.boundingVolumeSourceTile!==t||t._lastSelectionResult===TileSelectionResult.CULLED_BUT_NEEDED,n=i.terrainState),GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,r),i=t.data,r&&n!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==Visibility$1.NONE&&i.boundingVolumeSourceTile===t&&(r=!1,GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,r))};const boundingSphereScratch$1=new BoundingSphere,rectangleIntersectionScratch=new Rectangle,splitCartographicLimitRectangleScratch=new Rectangle,rectangleCenterScratch=new Cartographic;function clipRectangleAntimeridian(e,t){if(t.west<t.east)return t;const n=Rectangle.clone(t,splitCartographicLimitRectangleScratch);return Rectangle.center(e,rectangleCenterScratch).longitude>0?n.east=CesiumMath.PI:n.west=-CesiumMath.PI,n}function isUndergroundVisible(e,t){if(t.cameraUnderground)return!0;if(t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;return!(!defined(n)||!n.enabled)||!Rectangle.equals(e.cartographicLimitRectangle,Rectangle.MAX_VALUE)}GlobeSurfaceTileProvider.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const r=isUndergroundVisible(this,t);if(t.fog.enabled&&!r&&CesiumMath.fog(i,t.fog.density)>=1)return Visibility$1.NONE;const o=e.data,a=o.tileBoundingRegion;if(void 0===o.boundingVolumeSourceTile)return Visibility$1.PARTIAL;const s=t.cullingVolume;let c=a.boundingVolume;defined(c)||(c=a.boundingSphere),o.clippedByBoundaries=!1;const l=clipRectangleAntimeridian(e.rectangle,this.cartographicLimitRectangle),u=Rectangle.simpleIntersection(l,e.rectangle,rectangleIntersectionScratch);if(!defined(u))return Visibility$1.NONE;if(Rectangle.equals(u,e.rectangle)||(o.clippedByBoundaries=!0),t.mode!==SceneMode$1.SCENE3D&&(c=boundingSphereScratch$1,BoundingSphere.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,a.minimumHeight,a.maximumHeight,c),Cartesian3.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===SceneMode$1.MORPHING&&defined(o.renderedMesh)&&(c=BoundingSphere.union(a.boundingSphere,c,c))),!defined(c))return Visibility$1.PARTIAL;const d=this._clippingPlanes;if(defined(d)&&d.enabled){const t=d.computeIntersectionWithBoundingVolume(c);if(e.isClipped=t!==Intersect$1.INSIDE,t===Intersect$1.OUTSIDE)return Visibility$1.NONE}let h;const p=s.computeVisibility(c);if(p===Intersect$1.OUTSIDE?h=Visibility$1.NONE:p===Intersect$1.INTERSECTING?h=Visibility$1.PARTIAL:p===Intersect$1.INSIDE&&(h=Visibility$1.FULL),h===Visibility$1.NONE)return h;const f=t.mode===SceneMode$1.SCENE3D&&t.camera.frustum instanceof OrthographicFrustum;if(t.mode===SceneMode$1.SCENE3D&&!f&&defined(n)&&!r){const e=o.occludeePointInScaledSpace;return defined(e)?n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(e,a.minimumHeight)?h:Visibility$1.NONE:h}return h},GlobeSurfaceTileProvider.prototype.canRefine=function(e){if(defined(e.data.terrainData))return!0;return void 0!==this.terrainProvider.getTileDataAvailable(2*e.x,2*e.y,e.level+1)};const readyImageryScratch=[],canRenderTraversalStack=[];GlobeSurfaceTileProvider.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=readyImageryScratch;i.length=this._imageryLayers.length;let r,o,a,s=!1,c=!1;for(defined(n)&&(s=n.terrainState===TerrainState$1.READY,c=!0,r=n.imagery),o=0,a=i.length;o<a;++o)i[o]=c;if(defined(r))for(o=0,a=r.length;o<a;++o){const e=r[o],t=e.loadingImagery,n=!defined(t)||t.state===ImageryState$1.FAILED||t.state===ImageryState$1.INVALID,a=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;i[a]=n&&i[a]}const l=this.quadtree._lastSelectionFrameNumber,u=canRenderTraversalStack;for(u.length=0,u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);u.length>0;){const e=u.pop(),t=e._lastSelectionResultFrame===l?e._lastSelectionResult:TileSelectionResult.NONE;if(t===TileSelectionResult.RENDERED){if(!defined(e.data))continue;if(!s&&e.data.terrainState===TerrainState$1.READY)return!1;const t=e.data.imagery;for(o=0,a=t.length;o<a;++o){const e=t[o],n=e.loadingImagery,r=!defined(n)||n.state===ImageryState$1.FAILED||n.state===ImageryState$1.INVALID,a=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;if(r&&!i[a])return!1}}else t===TileSelectionResult.REFINED&&u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild)}return!0};const tileDirectionScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(void 0===n)return 0;const i=n.tileBoundingRegion.boundingVolume;if(void 0===i)return 0;const r=t.camera.positionWC,o=t.camera.directionWC,a=Cartesian3.subtract(i.center,r,tileDirectionScratch),s=Cartesian3.magnitude(a);return s<CesiumMath.EPSILON5?0:(Cartesian3.divideByScalar(a,s,a),(1-Cartesian3.dot(a,o))*e._distance)};const modifiedModelViewScratch=new Matrix4,modifiedModelViewProjectionScratch=new Matrix4,tileRectangleScratch=new Cartesian4,localizedCartographicLimitRectangleScratch=new Cartesian4,localizedTranslucencyRectangleScratch=new Cartesian4,rtcScratch=new Cartesian3,centerEyeScratch=new Cartesian3,southwestScratch=new Cartesian3,northeastScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let e=0,t=i.length;e<t;++e){const t=i[e];defined(t.readyImagery)&&0!==t.readyImagery.imageryLayer.alpha&&++n}let r=this._tilesToRenderByTextureCount[n];defined(r)||(r=[],this._tilesToRenderByTextureCount[n]=r),r.push(e);defined(e.data.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const o=this._debug;++o.tilesRendered,o.texturesRendered+=n};const cornerPositionsScratch=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint(e,t,n,i,r,o){const a=e.quadtree._occluders.ellipsoid,s=a.ellipsoid,c=cornerPositionsScratch;return Cartesian3.fromRadians(n.west,n.south,r,s,c[0]),Cartesian3.fromRadians(n.east,n.south,r,s,c[1]),Cartesian3.fromRadians(n.west,n.north,r,s,c[2]),Cartesian3.fromRadians(n.east,n.north,r,s,c[3]),a.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,o)}function updateTileBoundingRegion(e,t,n){let i=e.data;void 0===i&&(i=e.data=new GlobeSurfaceTile);const r=e.tilingScheme.ellipsoid;void 0===i.tileBoundingRegion&&(i.tileBoundingRegion=new TileBoundingRegion({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:r,minimumHeight:0,maximumHeight:0}));const o=i.tileBoundingRegion,a=o.minimumHeight,s=o.maximumHeight;let c=!1,l=e;const u=i.mesh,d=i.terrainData;if(void 0!==u&&void 0!==u.minimumHeight&&void 0!==u.maximumHeight)o.minimumHeight=u.minimumHeight,o.maximumHeight=u.maximumHeight,c=!0;else if(void 0!==d&&void 0!==d._minimumHeight&&void 0!==d._maximumHeight)o.minimumHeight=d._minimumHeight,o.maximumHeight=d._maximumHeight;else{o.minimumHeight=Number.NaN,o.maximumHeight=Number.NaN;let t=e.parent;for(;void 0!==t;){const e=t.data;if(void 0!==e){const t=e.mesh,n=e.terrainData;if(void 0!==t&&void 0!==t.minimumHeight&&void 0!==t.maximumHeight){o.minimumHeight=t.minimumHeight,o.maximumHeight=t.maximumHeight;break}if(void 0!==n&&void 0!==n._minimumHeight&&void 0!==n._maximumHeight){o.minimumHeight=n._minimumHeight,o.maximumHeight=n._maximumHeight;break}}t=t.parent}l=t}if(void 0!==l){const d=n.terrainExaggeration,h=n.terrainExaggerationRelativeHeight;if(1!==d&&(c=!1,o.minimumHeight=TerrainExaggeration.getHeight(o.minimumHeight,d,h),o.maximumHeight=TerrainExaggeration.getHeight(o.maximumHeight,d,h)),c)i.boundingVolumeIsFromMesh||(o._orientedBoundingBox=OrientedBoundingBox.clone(u.orientedBoundingBox,o._orientedBoundingBox),o._boundingSphere=BoundingSphere.clone(u.boundingSphere3D,o._boundingSphere),i.occludeePointInScaledSpace=Cartesian3.clone(u.occludeePointInScaledSpace,i.occludeePointInScaledSpace),defined(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=computeOccludeePoint(t,o._orientedBoundingBox.center,e.rectangle,o.minimumHeight,o.maximumHeight,i.occludeePointInScaledSpace)));else{const n=void 0===o._orientedBoundingBox||void 0===o._boundingSphere;(o.minimumHeight!==a||o.maximumHeight!==s||n)&&(o.computeBoundingVolumes(r),i.occludeePointInScaledSpace=computeOccludeePoint(t,o._orientedBoundingBox.center,e.rectangle,o.minimumHeight,o.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=l,i.boundingVolumeIsFromMesh=c}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}function getTileReadyCallback(e,t,n){return function(i){let r,o,a=-1;const s=i.data.imagery,c=s.length;let l;for(l=0;l<c;++l)if(r=s[l],o=defaultValue(r.readyImagery,r.loadingImagery),o.imageryLayer===t){a=l;break}if(-1!==a){const c=a+e;if(r=s[c],o=defined(r)?defaultValue(r.readyImagery,r.loadingImagery):void 0,!defined(o)||o.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,c);for(l=a;l<c;++l)s[l].freeResources();s.splice(a,e)}return!0}}GlobeSurfaceTileProvider.prototype.computeDistanceToTile=function(e,t){updateTileBoundingRegion(e,this,t);const n=e.data;if(void 0===n.boundingVolumeSourceTile)return 9999999999;const i=n.tileBoundingRegion,r=i.minimumHeight,o=i.maximumHeight;if(n.boundingVolumeSourceTile!==e){const e=t.camera.positionCartographic.height;Math.abs(e-r)>Math.abs(e-o)?(i.minimumHeight=r,i.maximumHeight=r):(i.minimumHeight=o,i.maximumHeight=o)}const a=i.distanceToCamera(t);return i.minimumHeight=r,i.maximumHeight=o,a},GlobeSurfaceTileProvider.prototype.isDestroyed=function(){return!1},GlobeSurfaceTileProvider.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),destroyObject(this)},GlobeSurfaceTileProvider.prototype._onLayerAdded=function(e,t){if(e.show){const t=this._terrainProvider,n=this,i=e.imageryProvider,r=this._imageryLayersUpdatedEvent;i._reload=function(){e._imageryCache={},n._quadtree.forEachLoadedTile((function(n){if(defined(n._loadedCallbacks[e._layerIndex]))return;let i;const r=n.data.imagery,o=r.length;let a=-1,s=0;for(i=0;i<o;++i){const t=r[i];if(defaultValue(t.readyImagery,t.loadingImagery).imageryLayer===e)-1===a&&(a=i),++s;else if(-1!==a)break}if(-1===a)return;const c=a+s;e._createTileImagerySkeletons(n,t,c)&&(n._loadedCallbacks[e._layerIndex]=getTileReadyCallback(s,e,t),n.state=QuadtreeTileLoadState$1.LOADING)}))},this._quadtree.forEachLoadedTile((function(i){e._createTileImagerySkeletons(i,t)&&(i.state=QuadtreeTileLoadState$1.LOADING,0===i.level||i._lastSelectionResultFrame===n.quadtree._lastSelectionFrameNumber&&i._lastSelectionResult===TileSelectionResult.RENDERED||(i.renderable=!1))})),this._layerOrderChanged=!0,r.raiseEvent()}},GlobeSurfaceTileProvider.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile((function(t){const n=t.data.imagery;let i=-1,r=0;for(let t=0,o=n.length;t<o;++t){const o=n[t];let a=o.loadingImagery;if(defined(a)||(a=o.readyImagery),a.imageryLayer===e)-1===i&&(i=t),o.freeResources(),++r;else if(-1!==i)break}-1!==i&&n.splice(i,r)})),defined(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const scratchClippingPlanesMatrix=new Matrix4,scratchInverseTransposeClippingPlanesMatrix=new Matrix4;function createTileUniformMap(e,t){const n={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_terrainExaggerationAndRelativeHeight:function(){return this.properties.terrainExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const t=e.context.uniformState.view,n=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,n,modifiedModelViewScratch),modifiedModelViewScratch},u_modifiedModelViewProjection:function(){const t=e.context.uniformState.view,n=e.context.uniformState.projection,i=Matrix4.multiplyByPoint(t,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(t,i,modifiedModelViewProjectionScratch),Matrix4.multiply(n,modifiedModelViewProjectionScratch,modifiedModelViewProjectionScratch),modifiedModelViewProjectionScratch},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_clippingPlanes:function(){const n=t._clippingPlanes;return defined(n)&&defined(n.texture)?n.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const n=t._clippingPlanes,i=defined(n)?Matrix4.multiply(e.context.uniformState.view,n.modelMatrix,scratchClippingPlanesMatrix):Matrix4.IDENTITY;return Matrix4.inverseTranspose(i,scratchInverseTransposeClippingPlanesMatrix)},u_clippingPlanesEdgeStyle:function(){const e=this.properties.clippingPlanesEdgeColor;return e.alpha=this.properties.clippingPlanesEdgeWidth,e},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},properties:{initialColor:new Cartesian4(0,0,.5,1),fillHighlightColor:new Color(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new Cartesian2(65e5,9e6),nightFadeDistance:new Cartesian2(1e7,4e7),hsbShift:new Cartesian3,center3D:void 0,rtc:new Cartesian3,modifiedModelView:new Matrix4,tileRectangle:new Cartesian4,terrainExaggerationAndRelativeHeight:new Cartesian2(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new Cartesian2,southMercatorYAndOneOverHeight:new Cartesian2,waterMask:void 0,waterMaskTranslationAndScale:new Cartesian4,minMaxHeight:new Cartesian2,scaleAndBias:new Matrix4,clippingPlanesEdgeColor:Color.clone(Color.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new Cartesian4,frontFaceAlphaByDistance:new Cartesian4,backFaceAlphaByDistance:new Cartesian4,localizedTranslucencyRectangle:new Cartesian4,undergroundColor:Color.clone(Color.TRANSPARENT),undergroundColorAlphaByDistance:new Cartesian4,lambertDiffuseMultiplier:0}};return defined(t.materialUniformMap)?combine$2(n,t.materialUniformMap):n}function createWireframeVertexArrayIfNecessary(e,t,n){const i=n.data;let r,o;if(defined(i.vertexArray)?(r=i.mesh,o=i.vertexArray):defined(i.fill)&&defined(i.fill.vertexArray)&&(r=i.fill.mesh,o=i.fill.vertexArray),defined(r)&&defined(o)){if(defined(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===r)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=createWireframeVertexArray(e,o,r),i.wireframeVertexArray.mesh=r}}function createWireframeVertexArray(e,t,n){const i={indices:n.indices,primitiveType:PrimitiveType$1.TRIANGLES};GeometryPipeline.toWireframe(i);const r=i.indices,o=Buffer$1.createIndexBuffer({context:e,typedArray:r,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new VertexArray({context:e,attributes:t._attributes,indexBuffer:o})}let getDebugOrientedBoundingBox,getDebugBoundingSphere,debugDestroyPrimitive;!function(){const e=new GeometryInstance({geometry:BoxOutlineGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2)})}),t=new GeometryInstance({geometry:new SphereOutlineGeometry({radius:1})});let n,i,r=new Matrix4;function o(e){return new Primitive$3({geometryInstances:e,appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}getDebugOrientedBoundingBox=function(t,a){return t===n||(debugDestroyPrimitive(),n=t,r=Matrix4.fromRotationTranslation(t.halfAxes,t.center,r),e.modelMatrix=r,e.attributes.color=ColorGeometryInstanceAttribute.fromColor(a),i=o(e)),i},getDebugBoundingSphere=function(e,a){return e===n||(debugDestroyPrimitive(),n=e,r=Matrix4.fromTranslation(e.center,r),r=Matrix4.multiplyByUniformScale(r,e.radius,r),t.modelMatrix=r,t.attributes.color=ColorGeometryInstanceAttribute.fromColor(a),i=o(t)),i},debugDestroyPrimitive=function(){defined(i)&&(i.destroy(),i=void 0,n=void 0)}}();const otherPassesInitialColor=new Cartesian4(0,0,0,0),surfaceShaderSetOptionsScratch={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},defaultUndergroundColor=Color.TRANSPARENT,defaultUndergroundColorAlphaByDistance=new NearFarScalar;function addDrawCommandsForTile(e,t,n){const i=t.data;defined(i.vertexArray)||(void 0===i.fill&&(i.fill=new TerrainFillMesh(t)),i.fill.update(e,n));const r=n.creditDisplay,o=i.terrainData;if(defined(o)&&defined(o.credits)){const e=o.credits;for(let t=0,n=e.length;t<n;++t)r.addCredit(e[t])}let a=ContextLimits.maximumTextureImageUnits,s=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!defined(s)&&defined(i.fill)&&(s=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);const l=n.cameraUnderground,u=n.globeTranslucencyState,d=u.translucent,h=u.frontFaceAlphaByDistance,p=u.backFaceAlphaByDistance,f=u.rectangle,m=defaultValue(e.undergroundColor,defaultUndergroundColor),g=defaultValue(e.undergroundColorAlphaByDistance,defaultUndergroundColorAlphaByDistance),_=isUndergroundVisible(e,n)&&n.mode===SceneMode$1.SCENE3D&&m.alpha>0&&(g.nearValue>0||g.farValue>0),y=e.lambertDiffuseMultiplier,C=e.hasWaterMask&&defined(s),T=e.oceanNormalMap,S=C&&defined(T),A=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,v=n.fog.enabled&&!l,E=e.showGroundAtmosphere&&n.mode===SceneMode$1.SCENE3D,b=ShadowMode$1.castShadows(e.shadows)&&!d,x=ShadowMode$1.receiveShadows(e.shadows)&&!d,P=e.hueShift,D=e.saturationShift,w=e.brightnessShift;let M=!(CesiumMath.equalsEpsilon(P,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(D,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(w,0,CesiumMath.EPSILON7)),I=!1;if(E){I=Cartesian3.magnitude(n.camera.positionWC)>e.nightFadeOutDistance}C&&--a,S&&--a,defined(n.shadowState)&&n.shadowState.shadowsEnabled&&--a,defined(e.clippingPlanes)&&e.clippingPlanes.enabled&&--a,a-=u.numberOfTextureUniforms;const R=i.renderedMesh;let O=R.center;const B=R.encoding,L=i.tileBoundingRegion,F=n.terrainExaggeration,N=n.terrainExaggerationRelativeHeight,V=1!==F,k=B.hasGeodeticSurfaceNormals,U=tileRectangleScratch;let G=0,$=0,z=0,H=0,W=!1;if(n.mode!==SceneMode$1.SCENE3D){const e=n.mapProjection,i=e.project(Rectangle.southwest(t.rectangle),southwestScratch),r=e.project(Rectangle.northeast(t.rectangle),northeastScratch);if(U.x=i.x,U.y=i.y,U.z=r.x,U.w=r.y,n.mode!==SceneMode$1.MORPHING&&(O=rtcScratch,O.x=0,O.y=.5*(U.z+U.x),O.z=.5*(U.w+U.y),U.x-=O.y,U.y-=O.z,U.z-=O.y,U.w-=O.z),n.mode===SceneMode$1.SCENE2D&&B.quantization===TerrainQuantization$1.BITS12){const e=1/(Math.pow(2,12)-1)*.5,t=(U.z-U.x)*e,n=(U.w-U.y)*e;U.x-=t,U.y-=n,U.z+=t,U.w+=n}e instanceof WebMercatorProjection&&(G=t.rectangle.south,$=t.rectangle.north,z=WebMercatorProjection.geodeticLatitudeToMercatorAngle(G),H=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle($)-z),W=!0)}const q=surfaceShaderSetOptionsScratch;q.frameState=n,q.surfaceTile=i,q.showReflectiveOcean=C,q.showOceanWaves=S,q.enableLighting=e.enableLighting,q.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,q.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,q.showGroundAtmosphere=E,q.perFragmentGroundAtmosphere=I,q.hasVertexNormals=A,q.useWebMercatorProjection=W,q.clippedByBoundaries=i.clippedByBoundaries,q.hasGeodeticSurfaceNormals=k,q.hasExaggeration=V;const j=i.imagery;let X=0;const Y=j.length,K=e.showSkirts&&!l&&!d,J=e.backFaceCulling&&!l&&!d,Q=J?e._renderState:e._disableCullingRenderState,Z=J?e._blendRenderState:e._disableCullingBlendRenderState;let ee=Q,te=e._firstPassInitialColor;const ne=n.context;defined(e._debug.boundingSphereTile)||debugDestroyPrimitive();if(e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const t=e._drawCommands.length;for(let i=0;i<t;++i)e._uniformMaps[i]=createTileUniformMap(n,e)}do{let o,C,S=0;if(e._drawCommands.length<=e._usedDrawCommands?(o=new DrawCommand,o.owner=t,o.cull=!1,o.boundingVolume=new BoundingSphere,o.orientedBoundingBox=void 0,C=createTileUniformMap(n,e),e._drawCommands.push(o),e._uniformMaps.push(C)):(o=e._drawCommands[e._usedDrawCommands],C=e._uniformMaps[e._usedDrawCommands]),o.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const e=L.boundingVolume,t=L.boundingSphere;defined(e)?getDebugOrientedBoundingBox(e,Color.RED).update(n):defined(t)&&getDebugBoundingSphere(t,Color.RED).update(n)}const A=C.properties;Cartesian4.clone(te,A.initialColor),A.oceanNormalMap=T,A.lightingFadeDistance.x=e.lightingFadeOutDistance,A.lightingFadeDistance.y=e.lightingFadeInDistance,A.nightFadeDistance.x=e.nightFadeOutDistance,A.nightFadeDistance.y=e.nightFadeInDistance,A.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const I=l?p:h,V=l?h:p;defined(I)&&(Cartesian4.fromElements(I.near,I.nearValue,I.far,I.farValue,A.frontFaceAlphaByDistance),Cartesian4.fromElements(V.near,V.nearValue,V.far,V.farValue,A.backFaceAlphaByDistance)),Cartesian4.fromElements(g.near,g.nearValue,g.far,g.farValue,A.undergroundColorAlphaByDistance),Color.clone(m,A.undergroundColor),A.lambertDiffuseMultiplier=y;const k=!defined(i.vertexArray)&&defined(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;k&&Color.clone(e.fillHighlightColor,A.fillHighlightColor),A.terrainExaggerationAndRelativeHeight.x=F,A.terrainExaggerationAndRelativeHeight.y=N,A.center3D=R.center,Cartesian3.clone(O,A.rtc),Cartesian4.clone(U,A.tileRectangle),A.southAndNorthLatitude.x=G,A.southAndNorthLatitude.y=$,A.southMercatorYAndOneOverHeight.x=z,A.southMercatorYAndOneOverHeight.y=H;const W=localizedCartographicLimitRectangleScratch,J=clipRectangleAntimeridian(t.rectangle,e.cartographicLimitRectangle),Q=localizedTranslucencyRectangleScratch,ie=clipRectangleAntimeridian(t.rectangle,f);Cartesian3.fromElements(P,D,w,A.hsbShift);const re=t.rectangle,oe=1/re.width,ae=1/re.height;W.x=(J.west-re.west)*oe,W.y=(J.south-re.south)*ae,W.z=(J.east-re.west)*oe,W.w=(J.north-re.south)*ae,Cartesian4.clone(W,A.localizedCartographicLimitRectangle),Q.x=(ie.west-re.west)*oe,Q.y=(ie.south-re.south)*ae,Q.z=(ie.east-re.west)*oe,Q.w=(ie.north-re.south)*ae,Cartesian4.clone(Q,A.localizedTranslucencyRectangle);const se=v&&CesiumMath.fog(t._distance,n.fog.density)>CesiumMath.EPSILON3;M=M&&(se||E);let ce=!1,le=!1,ue=!1,de=!1,he=!1,pe=!1,fe=!1,me=!1,ge=!1,_e=!1;for(;S<a&&X<Y;){const e=j[X],n=e.readyImagery;if(++X,!defined(n)||0===n.imageryLayer.alpha)continue;const i=e.useWebMercatorT?n.textureWebMercator:n.texture,o=n.imageryLayer;defined(e.textureTranslationAndScale)||(e.textureTranslationAndScale=o._calculateTextureTranslationAndScale(t,e)),A.dayTextures[S]=i,A.dayTextureTranslationAndScale[S]=e.textureTranslationAndScale,A.dayTextureTexCoordsRectangle[S]=e.textureCoordinateRectangle,A.dayTextureUseWebMercatorT[S]=e.useWebMercatorT,A.dayTextureAlpha[S]=o.alpha,pe=pe||1!==A.dayTextureAlpha[S],A.dayTextureNightAlpha[S]=o.nightAlpha,fe=fe||1!==A.dayTextureNightAlpha[S],A.dayTextureDayAlpha[S]=o.dayAlpha,fe=fe||1!==A.dayTextureDayAlpha[S],A.dayTextureBrightness[S]=o.brightness,ce=ce||A.dayTextureBrightness[S]!==ImageryLayer.DEFAULT_BRIGHTNESS,A.dayTextureContrast[S]=o.contrast,le=le||A.dayTextureContrast[S]!==ImageryLayer.DEFAULT_CONTRAST,A.dayTextureHue[S]=o.hue,ue=ue||A.dayTextureHue[S]!==ImageryLayer.DEFAULT_HUE,A.dayTextureSaturation[S]=o.saturation,de=de||A.dayTextureSaturation[S]!==ImageryLayer.DEFAULT_SATURATION,A.dayTextureOneOverGamma[S]=1/o.gamma,he=he||A.dayTextureOneOverGamma[S]!==1/ImageryLayer.DEFAULT_GAMMA,A.dayTextureSplit[S]=o.splitDirection,me=me||0!==A.dayTextureSplit[S];let a=A.dayTextureCutoutRectangles[S];if(defined(a)||(a=A.dayTextureCutoutRectangles[S]=new Cartesian4),Cartesian4.clone(Cartesian4.ZERO,a),defined(o.cutoutRectangle)){const e=clipRectangleAntimeridian(re,o.cutoutRectangle);ge=defined(Rectangle.simpleIntersection(e,re,rectangleIntersectionScratch))||ge,a.x=(e.west-re.west)*oe,a.y=(e.south-re.south)*ae,a.z=(e.east-re.west)*oe,a.w=(e.north-re.south)*ae}let s=A.colorsToAlpha[S];defined(s)||(s=A.colorsToAlpha[S]=new Cartesian4);const c=defined(o.colorToAlpha)&&o.colorToAlphaThreshold>0;if(_e=_e||c,c){const e=o.colorToAlpha;s.x=e.red,s.y=e.green,s.z=e.blue,s.w=o.colorToAlphaThreshold}else s.w=-1;if(defined(n.credits)){const e=n.credits;for(let t=0,n=e.length;t<n;++t)r.addCredit(e[t])}++S}A.dayTextures.length=S,A.waterMask=s,Cartesian4.clone(c,A.waterMaskTranslationAndScale),A.minMaxHeight.x=B.minimumHeight,A.minMaxHeight.y=B.maximumHeight,Matrix4.clone(B.matrix,A.scaleAndBias);const ye=e._clippingPlanes,Ce=defined(ye)&&ye.enabled&&t.isClipped;Ce&&(A.clippingPlanesEdgeColor=Color.clone(ye.edgeColor,A.clippingPlanesEdgeColor),A.clippingPlanesEdgeWidth=ye.edgeWidth),q.numberOfDayTextures=S,q.applyBrightness=ce,q.applyContrast=le,q.applyHue=ue,q.applySaturation=de,q.applyGamma=he,q.applyAlpha=pe,q.applyDayNightAlpha=fe,q.applySplit=me,q.enableFog=se,q.enableClippingPlanes=Ce,q.clippingPlanes=ye,q.hasImageryLayerCutout=ge,q.colorCorrect=M,q.highlightFillTile=k,q.colorToAlpha=_e,q.showUndergroundColor=_,q.translucent=d;let Te=i.renderedMesh.indices.length;K||(Te=i.renderedMesh.indexCountWithoutSkirts),o.shaderProgram=e._surfaceShaderSet.getShaderProgram(q),o.castShadows=b,o.receiveShadows=x,o.renderState=ee,o.primitiveType=PrimitiveType$1.TRIANGLES,o.vertexArray=i.vertexArray||i.fill.vertexArray,o.count=Te,o.uniformMap=C,o.pass=Pass$1.GLOBE,e._debug.wireframe&&(createWireframeVertexArrayIfNecessary(ne,e,t),defined(i.wireframeVertexArray)&&(o.vertexArray=i.wireframeVertexArray,o.primitiveType=PrimitiveType$1.LINES,o.count=2*Te));let Se=o.boundingVolume;const Ae=o.orientedBoundingBox;n.mode!==SceneMode$1.SCENE3D?(BoundingSphere.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,L.minimumHeight,L.maximumHeight,Se),Cartesian3.fromElements(Se.center.z,Se.center.x,Se.center.y,Se.center),n.mode===SceneMode$1.MORPHING&&(Se=BoundingSphere.union(L.boundingSphere,Se,Se))):(o.boundingVolume=BoundingSphere.clone(L.boundingSphere,Se),o.orientedBoundingBox=OrientedBoundingBox.clone(L.boundingVolume,Ae)),o.dirty=!0,d&&u.updateDerivedCommands(o,n),pushCommand(o,n),ee=Z,te=otherPassesInitialColor}while(X<Y)}function GlobeTranslucency(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE)}function ImageryLayerCollection(){this._layers=[],this.layerAdded=new Event,this.layerRemoved=new Event,this.layerMoved=new Event,this.layerShownOrHidden=new Event}function getLayerIndex(e,t){return e.indexOf(t)}function swapLayers(e,t,n){const i=e._layers;if((t=CesiumMath.clamp(t,0,i.length-1))===(n=CesiumMath.clamp(n,0,i.length-1)))return;const r=i[t];i[t]=i[n],i[n]=r,e._update(),e.layerMoved.raiseEvent(r,n,t)}Object.defineProperties(GlobeTranslucency.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){this._frontFaceAlphaByDistance=NearFarScalar.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){this._backFaceAlphaByDistance=NearFarScalar.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),Rectangle.clone(e,this._rectangle)}}}),Object.defineProperties(ImageryLayerCollection.prototype,{length:{get:function(){return this._layers.length}}}),ImageryLayerCollection.prototype.add=function(e,t){defined(t)?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)},ImageryLayerCollection.prototype.addImageryProvider=function(e,t){const n=new ImageryLayer(e);return this.add(n,t),n},ImageryLayerCollection.prototype.remove=function(e,t){t=defaultValue(t,!0);const n=this._layers.indexOf(e);return-1!==n&&(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0)},ImageryLayerCollection.prototype.removeAll=function(e){e=defaultValue(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const i=t[n];this.layerRemoved.raiseEvent(i,n),e&&i.destroy()}this._layers=[]},ImageryLayerCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},ImageryLayerCollection.prototype.indexOf=function(e){return this._layers.indexOf(e)},ImageryLayerCollection.prototype.get=function(e){return this._layers[e]},ImageryLayerCollection.prototype.raise=function(e){const t=getLayerIndex(this._layers,e);swapLayers(this,t,t+1)},ImageryLayerCollection.prototype.lower=function(e){const t=getLayerIndex(this._layers,e);swapLayers(this,t,t-1)},ImageryLayerCollection.prototype.raiseToTop=function(e){const t=getLayerIndex(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))},ImageryLayerCollection.prototype.lowerToBottom=function(e){const t=getLayerIndex(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const applicableRectangleScratch=new Rectangle;function pickImageryHelper(e,t,n,i){const r=e.globe._surface._tilesToRender;let o;for(let e=0;!defined(o)&&e<r.length;++e){const n=r[e];Rectangle.contains(n.rectangle,t)&&(o=n)}if(!defined(o))return;const a=o.data.imagery;for(let e=a.length-1;e>=0;--e){const r=a[e],s=r.readyImagery;if(!defined(s))continue;const c=s.imageryLayer.imageryProvider;if(n&&!defined(c.pickFeatures))continue;if(!Rectangle.contains(s.rectangle,t))continue;const l=applicableRectangleScratch,u=1/1024;l.west=CesiumMath.lerp(o.rectangle.west,o.rectangle.east,r.textureCoordinateRectangle.x-u),l.east=CesiumMath.lerp(o.rectangle.west,o.rectangle.east,r.textureCoordinateRectangle.z+u),l.south=CesiumMath.lerp(o.rectangle.south,o.rectangle.north,r.textureCoordinateRectangle.y-u),l.north=CesiumMath.lerp(o.rectangle.south,o.rectangle.north,r.textureCoordinateRectangle.w+u),Rectangle.contains(l,t)&&i(s)}}function QuadtreeOccluders(e){this._ellipsoid=new EllipsoidalOccluder(e.ellipsoid,Cartesian3.ZERO)}function QuadtreeTile(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._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=TileSelectionResult.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}function freeTile(e){defined(e)&&e.freeResources()}function TileReplacementQueue(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function remove(e,t){const n=t.replacementPrevious,i=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=i),t===e.head?e.head=i:n.replacementNext=i,t===e.tail?e.tail=n:i.replacementPrevious=n,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}function QuadtreePrimitive(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue(e);const n=e._levelZeroTiles;if(defined(n))for(let t=0;t<n.length;++t){const i=n[t].customData,r=i.length;for(let t=0;t<r;++t){const n=i[t];n.level=0,e._addHeightCallbacks.push(n)}n[t].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue(e){const t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}function updateTileLoadProgress(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;(n!==e._lastTileLoadQueueLength||e._tilesInvalidated)&&(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n)),e._lastTileLoadQueueLength=n);const i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),i.tilesRendered=e._tilesToRender.length,i.tilesVisited===i.lastTilesVisited&&i.tilesRendered===i.lastTilesRendered&&i.tilesCulled===i.lastTilesCulled&&i.maxDepth===i.lastMaxDepth&&i.tilesWaitingForChildren===i.lastTilesWaitingForChildren&&i.maxDepthVisited===i.lastMaxDepthVisited||(console.log("Visited "+i.tilesVisited+", Rendered: "+i.tilesRendered+", Culled: "+i.tilesCulled+", Max Depth Rendered: "+i.maxDepth+", Max Depth Visited: "+i.maxDepthVisited+", 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,i.lastMaxDepthVisited=i.maxDepthVisited))}let comparisonPoint;ImageryLayerCollection.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!defined(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),r=[];return pickImageryHelper(t,i,!1,(function(e){r.push(e.imageryLayer)})),0!==r.length?r:void 0},ImageryLayerCollection.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!defined(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),r=[],o=[];return pickImageryHelper(t,i,!0,(function(e){const t=e.imageryLayer.imageryProvider.pickFeatures(e.x,e.y,e.level,i.longitude,i.latitude);defined(t)&&(r.push(t),o.push(e.imageryLayer))})),0!==r.length?when.all(r,(function(e){const t=[];for(let n=0;n<e.length;++n){const r=e[n],a=o[n];if(defined(r)&&r.length>0)for(let e=0;e<r.length;++e){const n=r[e];n.imageryLayer=a,defined(n.position)||(n.position=i),t.push(n)}}return t})):void 0},ImageryLayerCollection.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)},ImageryLayerCollection.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()},ImageryLayerCollection.prototype.isDestroyed=function(){return!1},ImageryLayerCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},ImageryLayerCollection.prototype._update=function(){let e=!0;const t=this._layers;let n,i,r,o;for(r=0,o=t.length;r<o;++r)i=t[r],i._layerIndex=r,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(defined(i._show)&&(defined(n)||(n=[]),n.push(i)),i._show=i.show);if(defined(n))for(r=0,o=n.length;r<o;++r)i=n[r],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},Object.defineProperties(QuadtreeOccluders.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),QuadtreeTile.createLevelZeroTiles=function(e){const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let r=0;for(let o=0;o<n;++o)for(let n=0;n<t;++n)i[r++]=new QuadtreeTile({tilingScheme:e,x:n,y:o,level:0});return i},QuadtreeTile.prototype._updateCustomData=function(e,t,n){let i,r,o,a=this.customData;if(defined(t)&&defined(n)){for(a=a.filter((function(e){return-1===n.indexOf(e)})),this._customData=a,o=this._rectangle,i=0;i<t.length;++i)r=t[i],Rectangle.contains(o,r.positionCartographic)&&a.push(r);this._frameUpdated=e}else{const e=this._parent;if(defined(e)&&this._frameUpdated!==e._frameUpdated){a.length=0,o=this._rectangle;const t=e.customData;for(i=0;i<t.length;++i)r=t[i],Rectangle.contains(o,r.positionCartographic)&&a.push(r);this._frameUpdated=e._frameUpdated}}},Object.defineProperties(QuadtreeTile.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(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return defined(this._southwestChild)||(this._southwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return defined(this._southeastChild)||(this._southeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return defined(this._northwestChild)||(this._northwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return defined(this._northeastChild)||(this._northeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<QuadtreeTileLoadState$1.DONE}},eligibleForUnloading:{get:function(){let e=!0;return defined(this.data)&&(e=this.data.eligibleForUnloading,defined(e)||(e=!0)),e}}}),QuadtreeTile.prototype.findLevelZeroTile=function(e,t,n){const i=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=i:t>=i&&(t-=i),!(n<0||n>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter((function(e){return e.x===t&&e.y===n}))[0]},QuadtreeTile.prototype.findTileToWest=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;const n=t.findTileToWest(e);return void 0!==n?t.southwestChild===this?n.southeastChild:n.northeastChild:void 0},QuadtreeTile.prototype.findTileToEast=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;const n=t.findTileToEast(e);return void 0!==n?t.southeastChild===this?n.southwestChild:n.northwestChild:void 0},QuadtreeTile.prototype.findTileToSouth=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;const n=t.findTileToSouth(e);return void 0!==n?t.southwestChild===this?n.northwestChild:n.northeastChild:void 0},QuadtreeTile.prototype.findTileToNorth=function(e){const t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;const n=t.findTileToNorth(e);return void 0!==n?t.northwestChild===this?n.southwestChild:n.southeastChild:void 0},QuadtreeTile.prototype.freeResources=function(){this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,defined(this.data)&&defined(this.data.freeResources)&&this.data.freeResources(),freeTile(this._southwestChild),this._southwestChild=void 0,freeTile(this._southeastChild),this._southeastChild=void 0,freeTile(this._northwestChild),this._northwestChild=void 0,freeTile(this._northeastChild),this._northeastChild=void 0},TileReplacementQueue.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},TileReplacementQueue.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&defined(this._lastBeforeStartOfFrame)&&this.count>e&&defined(t);){n=t!==this._lastBeforeStartOfFrame;const e=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),remove(this,t)),t=e}},TileReplacementQueue.prototype.markTileRendered=function(e){const t=this.head;if(t!==e){if(++this.count,!defined(t))return e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,void(this.tail=e);(defined(e.replacementPrevious)||defined(e.replacementNext))&&remove(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e}else e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext)},Object.defineProperties(QuadtreePrimitive.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitive.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitive.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitive.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])},QuadtreePrimitive.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){const e=n._addHeightCallbacks,t=e.length;for(let n=0;n<t;++n)if(e[n]===i){e.splice(n,1);break}n._removeHeightCallbacks.push(i)}};return n._addHeightCallbacks.push(i),i.removeFunc},QuadtreePrimitive.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitive.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitive.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),selectTilesForRendering(this,e),createRenderCommandsForSelectedTiles(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)},QuadtreePrimitive.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue(this,e),updateHeights(this,e),updateTileLoadProgress(this,e))},QuadtreePrimitive.prototype.isDestroyed=function(){return!1},QuadtreePrimitive.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};const centerScratch=new Cartographic;function compareDistanceToPoint(e,t){let n=Rectangle.center(e.rectangle,centerScratch);const i=n.longitude-comparisonPoint.longitude,r=n.latitude-comparisonPoint.latitude;n=Rectangle.center(t.rectangle,centerScratch);const o=n.longitude-comparisonPoint.longitude,a=n.latitude-comparisonPoint.latitude;return i*i+r*r-(o*o+a*a)}const cameraOriginScratch=new Cartesian3;let rootTraversalDetails=[];function selectTilesForRendering(e,t){const n=e._debug;if(n.suspendLodUpdate)return;let i;e._tilesToRender.length=0;const r=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!r.ready)return;{const t=r.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(t);const n=e._levelZeroTiles.length;if(rootTraversalDetails.length<n)for(rootTraversalDetails=new Array(n),i=0;i<n;++i)void 0===rootTraversalDetails[i]&&(rootTraversalDetails[i]=new TraversalDetails)}}let o;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;const a=e._levelZeroTiles,s=a.length>1?e._occluders:void 0;comparisonPoint=t.camera.positionCartographic,a.sort(compareDistanceToPoint);const c=e._addHeightCallbacks,l=e._removeHeightCallbacks,u=t.frameNumber;let d;if(c.length>0||l.length>0){for(i=0,d=a.length;i<d;++i)o=a[i],o._updateCustomData(u,c,l);c.length=0,l.length=0}const h=t.camera;e._cameraPositionCartographic=h.positionCartographic;const p=Matrix4.getTranslation(h.transform,cameraOriginScratch);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),i=0,d=a.length;i<d;++i)o=a[i],e._tileReplacementQueue.markTileRendered(o),o.renderable?visitIfVisible(e,o,r,t,s,!1,rootTraversalDetails[i]):(queueTileLoad(e,e._tileLoadQueueHigh,o,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=u}function queueTileLoad(e,t,n,i){n.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function TraversalDetails(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails(){this.southwest=new TraversalDetails,this.southeast=new TraversalDetails,this.northwest=new TraversalDetails,this.northeast=new TraversalDetails}TraversalQuadDetails.prototype.combine=function(e){const t=this.southwest,n=this.southeast,i=this.northwest,r=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&r.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+r.notYetRenderableCount};const traversalQuadsByLevel=new Array(31);for(let e=0;e<traversalQuadsByLevel.length;++e)traversalQuadsByLevel[e]=new TraversalQuadDetails;function visitTile(e,t,n,i,r){const o=e._debug;++o.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>o.maxDepthVisited&&(o.maxDepthVisited=n.level);const a=screenSpaceError(e,t,n)<e.maximumScreenSpaceError,s=n.southwestChild,c=n.southeastChild,l=n.northwestChild,u=n.northeastChild,d=e._lastSelectionFrameNumber,h=n._lastSelectionResultFrame===d?n._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(a||i){const o=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,s=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,c=n.state===QuadtreeTileLoadState$1.DONE;let l=o||s||c;if(l||defined(p.canRenderWithoutLosingDetail)&&(l=p.canRenderWithoutLosingDetail(n)),l)return a&&queueTileLoad(e,e._tileLoadQueueMedium,n,t),addTileToRenderList(e,n),r.allAreRenderable=n.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n));i=!0,a&&queueTileLoad(e,e._tileLoadQueueHigh,n,t)}if(p.canRefine(n)){if(s.upsampledFromParent&&c.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList(e,n),queueTileLoad(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),r.allAreRenderable=n.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=TileSelectionResult.RENDERED,void(r.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n));n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=TileSelectionResult.REFINED;const a=e._tilesToRender.length,d=e._tileLoadQueueLow.length,p=e._tileLoadQueueMedium.length,f=e._tileLoadQueueHigh.length,m=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar(e,s,c,l,u,t,i,r),a!==e._tilesToRender.length){const i=r.allAreRenderable,s=r.anyWereRenderedLastFrame,c=r.notYetRenderableCount;let l=!1;if(!i&&!s){const i=e._tilesToRender;for(let e=a;e<i.length;++e){let t=i[e];for(;void 0!==t&&t._lastSelectionResult!==TileSelectionResult.KICKED&&t!==n;)t._lastSelectionResult=TileSelectionResult.kick(t._lastSelectionResult),t=t.parent}e._tilesToRender.length=a,e._tileToUpdateHeights.length=m,addTileToRenderList(e,n),n._lastSelectionResult=TileSelectionResult.RENDERED;const s=h===TileSelectionResult.RENDERED;!s&&c>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=d,e._tileLoadQueueMedium.length=p,e._tileLoadQueueHigh.length=f,queueTileLoad(e,e._tileLoadQueueMedium,n,t),r.notYetRenderableCount=n.renderable?0:1,l=!0),r.allAreRenderable=n.renderable,r.anyWereRenderedLastFrame=s,s||e._tileToUpdateHeights.push(n),++o.tilesWaitingForChildren}e.preloadAncestors&&!l&&queueTileLoad(e,e._tileLoadQueueLow,n,t)}}else n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList(e,n),queueTileLoad(e,e._tileLoadQueueHigh,n,t),r.allAreRenderable=n.renderable,r.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,r.notYetRenderableCount=n.renderable?0:1}function visitVisibleChildrenNearToFar(e,t,n,i,r,o,a,s){const c=o.camera.positionCartographic,l=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,n,l,o,u,a,p),visitIfVisible(e,i,l,o,u,a,f),visitIfVisible(e,r,l,o,u,a,m)):(visitIfVisible(e,i,l,o,u,a,f),visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,n,l,o,u,a,p)):c.latitude<t.rectangle.north?(visitIfVisible(e,n,l,o,u,a,p),visitIfVisible(e,t,l,o,u,a,h),visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,i,l,o,u,a,f)):(visitIfVisible(e,r,l,o,u,a,m),visitIfVisible(e,i,l,o,u,a,f),visitIfVisible(e,n,l,o,u,a,p),visitIfVisible(e,t,l,o,u,a,h)),d.combine(s)}function containsNeededPosition(e,t){const n=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(n,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(n,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible(e,t,n,i,r,o,a){if(n.computeTileVisibility(t,i,r)!==Visibility$1.NONE)return visitTile(e,i,t,o,a);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),a.allAreRenderable=!0,a.anyWereRenderedLastFrame=!1,a.notYetRenderableCount=0,containsNeededPosition(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad(e,e._tileLoadQueueMedium,t,i);const n=e._lastSelectionFrameNumber,r=t._lastSelectionResultFrame===n?t._lastSelectionResult:TileSelectionResult.NONE;r!==TileSelectionResult.CULLED_BUT_NEEDED&&r!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(queueTileLoad(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=TileSelectionResult.CULLED):t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=i.frameNumber}function screenSpaceError(e,t,n){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),r=n._distance;let o=i*t.context.drawingBufferHeight/(r*t.camera.frustum.sseDenominator);return t.fog.enabled&&(o-=CesiumMath.fog(r,t.fog.density)*t.fog.sse),o/=t.pixelRatio,o}function screenSpaceError2D(e,t,n){let i=t.camera.frustum;defined(i._offCenterFrustum)&&(i=i._offCenterFrustum);const r=t.context,o=r.drawingBufferWidth,a=r.drawingBufferHeight;let s=e._tileProvider.getLevelMaximumGeometricError(n.level)/(Math.max(i.top-i.bottom,i.right-i.left)/Math.max(o,a));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(n._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio,s}function addTileToRenderList(e,t){e._tilesToRender.push(t)}function processTileLoadQueue(e,t){const n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,r=e._tileLoadQueueLow;if(0===n.length&&0===i.length&&0===r.length)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const o=getTimestamp$1()+e._loadQueueTimeSlice,a=e._tileProvider;let s=processSinglePriorityLoadQueue(e,t,a,o,n,!1);s=processSinglePriorityLoadQueue(e,t,a,o,i,s),processSinglePriorityLoadQueue(e,t,a,o,r,s)}function sortByLoadPriority(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue(e,t,n,i,r,o){void 0!==n.computeTileLoadPriority&&r.sort(sortByLoadPriority);for(let a=0,s=r.length;a<s&&(getTimestamp$1()<i||!o);++a){const i=r[a];e._tileReplacementQueue.markTileRendered(i),n.loadTile(t,i),o=!0}return o}const scratchRay=new Ray,scratchCartographic$2=new Cartographic,scratchPosition$1=new Cartesian3,scratchArray$1=[];function updateHeights(e,t){if(!e.tileProvider.ready)return;const n=scratchArray$1;n.length=0;const i=e._tileToUpdateHeights,r=getTimestamp$1()+e._updateHeightsTimeSlice,o=t.mode,a=t.mapProjection,s=e.tileProvider.tilingScheme.ellipsoid;let c;for(;i.length>0;){const t=i[0];if(!defined(t.data)||!defined(t.data.mesh)){const r=t._lastSelectionResultFrame===e._lastSelectionFrameNumber?t._lastSelectionResult:TileSelectionResult.NONE;r!==TileSelectionResult.RENDERED&&r!==TileSelectionResult.CULLED_BUT_NEEDED||n.push(t),i.shift(),e._lastTileIndex=0;continue}const l=t.customData,u=l.length;let d=!1;for(c=e._lastTileIndex;c<u;++c){const e=l[c],n=t.data.terrainData,i=defined(n)&&n.wasCreatedByUpsampling();if(t.level>e.level&&!i){if(defined(e.positionOnEllipsoidSurface)||(e.positionOnEllipsoidSurface=Cartesian3.fromRadians(e.positionCartographic.longitude,e.positionCartographic.latitude,0,s)),o===SceneMode$1.SCENE3D){const n=s.geodeticSurfaceNormal(e.positionOnEllipsoidSurface,scratchRay.direction);if(!defined(s.getSurfaceNormalIntersectionWithZAxis(e.positionOnEllipsoidSurface,11500,scratchRay.origin))){let i=0;defined(t.data.tileBoundingRegion)&&(i=t.data.tileBoundingRegion.minimumHeight);const r=Math.min(i,-11500),o=Cartesian3.multiplyByScalar(n,Math.abs(r)+1,scratchPosition$1);Cartesian3.subtract(e.positionOnEllipsoidSurface,o,scratchRay.origin)}}else Cartographic.clone(e.positionCartographic,scratchCartographic$2),scratchCartographic$2.height=-11500,a.project(scratchCartographic$2,scratchPosition$1),Cartesian3.fromElements(scratchPosition$1.z,scratchPosition$1.x,scratchPosition$1.y,scratchPosition$1),Cartesian3.clone(scratchPosition$1,scratchRay.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay.direction);const n=t.data.pick(scratchRay,o,a,!1,scratchPosition$1);defined(n)&&(e.callback(n),e.level=t.level)}if(getTimestamp$1()>=r){d=!0;break}}if(d){e._lastTileIndex=c;break}e._lastTileIndex=0,i.shift()}for(c=0;c<n.length;c++)i.push(n[c])}function createRenderCommandsForSelectedTiles(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let e=0,r=i.length;e<r;++e){const r=i[e];n.showTileThisFrame(r,t)}}function Globe(e){const t=new EllipsoidTerrainProvider({ellipsoid:e=defaultValue(e,Ellipsoid.WGS84)}),n=new ImageryLayerCollection;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new GlobeSurfaceShaderSet,this._material=void 0,this._surface=new QuadtreePrimitive({tileProvider:new GlobeSurfaceTileProvider({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Event,this._undergroundColor=Color.clone(Color.BLACK),this._undergroundColorAlphaByDistance=new NearFarScalar(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new GlobeTranslucency,makeShadersDirty(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Resource({url:buildModuleUrl("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0}function makeShadersDirty(e){const t=[],n=defined(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),i=[GroundAtmosphere];!defined(e._material)||n&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.materialUniformMap=void 0:(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms),i.push(GlobeFS),e._surfaceShaderSet.baseVertexShaderSource=new ShaderSource({sources:[GroundAtmosphere,GlobeVS],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ShaderSource({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function createComparePickTileFunction(e){return function(t,n){return BoundingSphere.distanceSquaredTo(t.pickBoundingSphere,e)-BoundingSphere.distanceSquaredTo(n.pickBoundingSphere,e)}}Object.defineProperties(Globe.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return!defined(this._surface)||this._surface.tileProvider.ready&&0===this._surface._tileLoadQueueHigh.length&&0===this._surface._tileLoadQueueMedium.length&&0===this._surface._tileLoadQueueLow.length}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),defined(this._material)&&makeShadersDirty(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeShadersDirty(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=Color.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){this._undergroundColorAlphaByDistance=NearFarScalar.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});const scratchArray=[],scratchSphereIntersectionResult={start:0,stop:0};Globe.prototype.pickWorldCoordinates=function(e,t,n,i){n=defaultValue(n,!0);const r=t.mode,o=t.mapProjection,a=scratchArray;a.length=0;const s=this._surface._tilesToRender;let c,l,u,d=s.length;for(l=0;l<d;++l){c=s[l];const t=c.data;if(!defined(t))continue;let n=t.pickBoundingSphere;if(r!==SceneMode$1.SCENE3D)t.pickBoundingSphere=n=BoundingSphere.fromRectangleWithHeights2D(c.rectangle,o,t.tileBoundingRegion.minimumHeight,t.tileBoundingRegion.maximumHeight,n),Cartesian3.fromElements(n.center.z,n.center.x,n.center.y,n.center);else{if(!defined(t.renderedMesh))continue;BoundingSphere.clone(t.tileBoundingRegion.boundingSphere,n)}defined(IntersectionTests.raySphere(e,n,scratchSphereIntersectionResult))&&a.push(t)}for(a.sort(createComparePickTileFunction(e.origin)),d=a.length,l=0;l<d&&(u=a[l].pick(e,t.mode,t.mapProjection,n,i),!defined(u));++l);return u};const cartoScratch=new Cartographic;Globe.prototype.pick=function(e,t,n){if(defined(n=this.pickWorldCoordinates(e,t,!0,n))&&t.mode!==SceneMode$1.SCENE3D){n=Cartesian3.fromElements(n.y,n.z,n.x,n);const e=t.mapProjection.unproject(n,cartoScratch);n=t.globe.ellipsoid.cartographicToCartesian(e,n)}return n};const scratchGetHeightCartesian=new Cartesian3,scratchGetHeightIntersection=new Cartesian3,scratchGetHeightCartographic=new Cartographic,scratchGetHeightRay=new Ray;function tileIfContainsCartographic(e,t){return defined(e)&&Rectangle.contains(e.rectangle,t)?e:void 0}Globe.prototype.getHeight=function(e){const t=this._surface._levelZeroTiles;if(!defined(t))return;let n,i;const r=t.length;for(i=0;i<r&&(n=t[i],!Rectangle.contains(n.rectangle,e));++i);if(i>=r)return;let o=n;for(;defined(n);)n=tileIfContainsCartographic(n._southwestChild,e)||tileIfContainsCartographic(n._southeastChild,e)||tileIfContainsCartographic(n._northwestChild,e)||n._northeastChild,defined(n)&&defined(n.data)&&defined(n.data.renderedMesh)&&(o=n);if(n=o,!defined(n)||!defined(n.data)||!defined(n.data.renderedMesh))return;const a=this._surface._tileProvider.tilingScheme.projection,s=this._surface._tileProvider.tilingScheme.ellipsoid,c=Cartesian3.fromRadians(e.longitude,e.latitude,0,s,scratchGetHeightCartesian),l=scratchGetHeightRay,u=s.geodeticSurfaceNormal(c,l.direction);if(!defined(s.getSurfaceNormalIntersectionWithZAxis(c,11500,l.origin))){let e;defined(n.data.tileBoundingRegion)&&(e=n.data.tileBoundingRegion.minimumHeight);const t=Math.min(defaultValue(e,0),-11500),i=Cartesian3.multiplyByScalar(u,Math.abs(t)+1,scratchGetHeightIntersection);Cartesian3.subtract(c,i,l.origin)}const d=n.data.pick(l,void 0,a,!1,scratchGetHeightIntersection);return defined(d)?s.cartesianToCartographic(d,scratchGetHeightCartographic).height:void 0},Globe.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)},Globe.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,r=this.showWaterEffect&&i.ready&&i.hasWaterMask;if(r&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const t=this._oceanNormalMapResource,n=t.url;if(defined(n)){const i=this;when(t.fetchImage(),(function(t){n===i._oceanNormalMapResource.url&&(i._oceanNormalMap=i._oceanNormalMap&&i._oceanNormalMap.destroy(),i._oceanNormalMap=new Texture({context:e.context,source:t}))}))}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const o=e.passes,a=e.mode;o.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,n.terrainProvider=this.terrainProvider,n.lightingFadeOutDistance=this.lightingFadeOutDistance,n.lightingFadeInDistance=this.lightingFadeInDistance,n.nightFadeOutDistance=this.nightFadeOutDistance,n.nightFadeInDistance=this.nightFadeInDistance,n.zoomedOutOceanSpecularIntensity=a===SceneMode$1.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=r,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.shadows=this.shadows,n.hueShift=this.atmosphereHueShift,n.saturationShift=this.atmosphereSaturationShift,n.brightnessShift=this.atmosphereBrightnessShift,n.fillHighlightColor=this.fillHighlightColor,n.showSkirts=this.showSkirts,n.backFaceCulling=this.backFaceCulling,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))},Globe.prototype.render=function(e){this.show&&(defined(this._material)&&this._material.update(e.context),this._surface.render(e))},Globe.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)},Globe.prototype.isDestroyed=function(){return!1},Globe.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(),destroyObject(this)};var PassThrough="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n}\n",PassThroughDepth="uniform highp sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);\n}\n";function GlobeDepth(){this._tempCopyDepthTexture=void 0,this._colorFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new FramebufferManager,this._tempCopyDepthFramebuffer=new FramebufferManager,this._updateDepthFramebuffer=new FramebufferManager({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}function destroyFramebuffers$2(e){e._colorFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function updateCopyCommands$1(e,t,n,i,r){e._viewport.width=n,e._viewport.height=i;const o=!BoundingRectangle.equals(e._viewport,r.viewport);let a=o!==e._useScissorTest;e._useScissorTest=o,BoundingRectangle.equals(e._scissorRectangle,r.viewport)||(e._scissorRectangle=BoundingRectangle.clone(r.viewport,e._scissorRectangle),a=!0),defined(e._rs)&&BoundingRectangle.equals(e._viewport,e._rs.viewport)&&!a||(e._rs=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND}),e._rsUpdate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._colorFramebuffer.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,defined(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._colorFramebuffer.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,defined(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,defined(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,defined(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}function GlobeTranslucencyFramebuffer(){this._framebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new FramebufferManager,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new BoundingRectangle,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}function destroyResources$3(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function updateResources$1(e,t,n,i,r){const o=r?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,o),e._packedDepthFramebuffer.update(t,n,i)}function updateCommands(e,t,n,i,r){e._viewport.width=n,e._viewport.height=i;const o=!BoundingRectangle.equals(e._viewport,r.viewport);let a=o!==e._useScissorTest;e._useScissorTest=o,BoundingRectangle.equals(e._scissorRectangle,r.viewport)||(e._scissorRectangle=BoundingRectangle.clone(r.viewport,e._scissorRectangle),a=!0),defined(e._renderState)&&BoundingRectangle.equals(e._viewport,e._renderState.viewport)&&!a||(e._renderState=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),defined(e._clearCommand)||(e._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}Object.defineProperties(GlobeDepth.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}}}),GlobeDepth.prototype.update=function(e,t,n,i,r){const o=n.width,a=n.height,s=i?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._colorFramebuffer.update(e,o,a,s),this._copyDepthFramebuffer.update(e,o,a),updateCopyCommands$1(this,e,o,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=i,this._clearGlobeDepth=r},GlobeDepth.prototype.executeCopyDepth=function(e,t){defined(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())},GlobeDepth.prototype.executeUpdateDepth=function(e,t,n){const i=t.framebuffer.depthStencilTexture;if(n||i!==this._colorFramebuffer.getDepthStencilTexture()){if(defined(this._updateDepthCommand)){if(!defined(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==i||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const n=this._copyDepthFramebuffer.getColorTexture().width,i=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,n,i);const r=this._copyDepthFramebuffer.getColorTexture(),o=t.framebuffer.depthStencilTexture;this._updateDepthFramebuffer.setColorTexture(r,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,n,i),updateCopyCommands$1(this,e,n,i,t)}this._tempCopyDepthTexture=i,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}}else defined(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)},GlobeDepth.prototype.executeCopyColor=function(e,t){defined(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},GlobeDepth.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;defined(i)&&(Color.clone(n,i.color),this._colorFramebuffer.clear(e,i,t))},GlobeDepth.prototype.isDestroyed=function(){return!1},GlobeDepth.prototype.destroy=function(){return destroyFramebuffers$2(this),defined(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),defined(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),defined(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(GlobeTranslucencyFramebuffer.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}}),GlobeTranslucencyFramebuffer.prototype.updateAndClear=function(e,t,n,i){const r=t.width,o=t.height;updateResources$1(this,n,r,o,e),updateCommands(this,n,r,o,i),this._useHdr=e},GlobeTranslucencyFramebuffer.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)},GlobeTranslucencyFramebuffer.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture},GlobeTranslucencyFramebuffer.prototype.isDestroyed=function(){return!1},GlobeTranslucencyFramebuffer.prototype.destroy=function(){return destroyResources$3(this),destroyObject(this)};const DerivedCommandType={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},derivedCommandsMaximumLength=DerivedCommandType.DERIVED_COMMANDS_MAXIMUM_LENGTH,DerivedCommandNames=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function GlobeTranslucencyState(){this._frontFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._backFaceAlphaByDistance=new NearFarScalar(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedBlendCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedPickCommandTypes=new Array(derivedCommandsMaximumLength),this._derivedCommandTypesToUpdate=new Array(derivedCommandsMaximumLength),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}function updateAlphaByDistance(e,t,n,i){return e?defined(n)?(NearFarScalar.clone(n,i),i.nearValue*=t,i.farValue*=t,i):(i.nearValue=t,i.farValue=t,i):(i.nearValue=1,i.farValue=1,i)}function isFaceTranslucent(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function isSunVisibleThroughGlobe(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function isEnvironmentVisible(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function useDepthPlane(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function requiresManualDepthTest(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==SceneMode$1.SCENE2D&&t.context.depthTexture}function getNumberOfTextureUniforms(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function gatherDerivedCommandRequirements(e,t){let n;e._derivedCommandsLength=getDerivedCommandTypes(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=getDerivedCommandTypes(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=getDerivedCommandTypes(e,t,!1,!0,e._derivedPickCommandTypes);let i=0;for(n=0;n<e._derivedCommandsLength;++n)i|=1<<e._derivedCommandTypes[n];for(n=0;n<e._derivedBlendCommandsLength;++n)i|=1<<e._derivedBlendCommandTypes[n];for(n=0;n<e._derivedPickCommandsLength;++n)i|=1<<e._derivedPickCommandTypes[n];let r=0;for(n=0;n<derivedCommandsMaximumLength;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[r++]=n);e._derivedCommandsToUpdateLength=r;const o=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=o,!defined(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=createDerivedCommandPacks())}function getDerivedCommandTypes(e,t,n,i,r){let o=0;const a=e._frontFaceTranslucent,s=e._backFaceTranslucent;if(!a)return o;const c=t.cameraUnderground,l=e._requiresManualDepthTest,u=i?DerivedCommandType.PICK_FRONT_FACE:l?DerivedCommandType.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_FRONT_FACE,d=i?DerivedCommandType.PICK_BACK_FACE:l?DerivedCommandType.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:DerivedCommandType.TRANSLUCENT_BACK_FACE;return t.mode===SceneMode$1.SCENE2D?(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE,r[o++]=u,o):(s?(n||(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(r[o++]=u,r[o++]=d):(r[o++]=d,r[o++]=u)):c?(n||(r[o++]=DerivedCommandType.DEPTH_ONLY_BACK_FACE),r[o++]=DerivedCommandType.OPAQUE_FRONT_FACE,r[o++]=d):(n||(r[o++]=DerivedCommandType.DEPTH_ONLY_FRONT_FACE),r[o++]=DerivedCommandType.OPAQUE_BACK_FACE,r[o++]=u),o)}function removeDefine(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function hasDefine(e,t){return e.indexOf(t)>-1}function getOpaqueFrontFaceShaderProgram(e,t){removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getOpaqueBackFaceShaderProgram(e,t){removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG"),removeDefine(e.defines,"TRANSLUCENT"),removeDefine(t.defines,"TRANSLUCENT")}function getDepthOnlyShaderProgram(e,t){if(hasDefine(t.defines,"TILE_LIMIT_RECTANGLE")||hasDefine(t.defines,"ENABLE_CLIPPING_PLANES"))return;t.sources=["void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n"]}function getTranslucentShaderProgram$1(e,t){const n=t.sources,i=n.length;for(let e=0;e<i;++e)n[e]=ShaderSource.replaceMain(n[e],"czm_globe_translucency_main");n.push("\n\nuniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n#ifdef MANUAL_DEPTH_TEST \n float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st)); \n if (logDepthOrDepth != 0.0) \n { \n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n if (v_positionEC.z < depthEC) \n { \n discard; \n } \n } \n#endif \n czm_globe_translucency_main(); \n vec4 classificationColor = texture2D(u_classificationTexture, st); \n if (classificationColor.a > 0.0) \n { \n // Reverse premultiplication process to get the correct composited result of the classification primitives \n classificationColor.rgb /= classificationColor.a; \n } \n gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a); \n} \n")}function getTranslucentBackFaceShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),removeDefine(e.defines,"GROUND_ATMOSPHERE"),removeDefine(t.defines,"GROUND_ATMOSPHERE"),removeDefine(e.defines,"FOG"),removeDefine(t.defines,"FOG")}function getTranslucentFrontFaceManualDepthTestShaderProgram(e,t){getTranslucentShaderProgram$1(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getTranslucentBackFaceManualDepthTestShaderProgram(e,t){getTranslucentBackFaceShaderProgram(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function getPickShaderProgram(e,t){t.sources=["uniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n vec4 pickColor = texture2D(u_classificationTexture, st); \n if (pickColor == vec4(0.0)) \n { \n discard; \n } \n gl_FragColor = pickColor; \n} \n"]}function getDerivedShaderProgram(e,t,n,i,r,o){if(!defined(r))return t;if(!i&&defined(n))return n;let a=e.shaderCache.getDerivedShaderProgram(t,o);if(!defined(a)){const n=t._attributeLocations,i=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();i.defines=defined(i.defines)?i.defines.slice(0):[],s.defines=defined(s.defines)?s.defines.slice(0):[],r(i,s),a=e.shaderCache.createDerivedShaderProgram(t,o,{vertexShaderSource:i,fragmentShaderSource:s,attributeLocations:n})}return a}function getOpaqueFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0}function getOpaqueBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0}function getDepthOnlyFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getDepthOnlyFrontAndBackFaceRenderState(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function getTranslucentFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getTranslucentBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=BlendingState$1.ALPHA_BLEND}function getPickFrontFaceRenderState(e){e.cull.face=CullFace$1.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function getPickBackFaceRenderState(e){e.cull.face=CullFace$1.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function getDerivedRenderState(e,t,n,i,r){if(!defined(i))return e;if(!n&&defined(t))return t;let o=r[e.id];if(!defined(o)){const t=RenderState.getState(e);i(t),o=RenderState.fromCache(t),r[e.id]=o}return o}function getTranslucencyUniformMap(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function getDerivedUniformMap(e,t,n,i,r){return defined(r)?!i&&defined(n)?n:combine$2(t,r(e),!1):t}function DerivedCommandPack(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function createDerivedCommandPacks(){return[new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueFrontFaceShaderProgram,getRenderStateFunction:getOpaqueFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getOpaqueBackFaceShaderProgram,getRenderStateFunction:getOpaqueBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.GLOBE,pickOnly:!1,getShaderProgramFunction:getDepthOnlyShaderProgram,getRenderStateFunction:getDepthOnlyFrontAndBackFaceRenderState,getUniformMapFunction:void 0}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentShaderProgram$1,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentFrontFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:getTranslucentBackFaceManualDepthTestShaderProgram,getRenderStateFunction:getTranslucentBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickFrontFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap}),new DerivedCommandPack({pass:Pass$1.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:getPickShaderProgram,getRenderStateFunction:getPickBackFaceRenderState,getUniformMapFunction:getTranslucencyUniformMap})]}Object.defineProperties(GlobeTranslucencyState.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}}),GlobeTranslucencyState.prototype.update=function(e){const t=e.globe;if(!defined(t)||!t.show)return this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,void(this._useDepthPlane=!1);this._frontFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=updateAlphaByDistance(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=isFaceTranslucent(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=requiresManualDepthTest(this,e,t),this._sunVisibleThroughGlobe=isSunVisibleThroughGlobe(this,e),this._environmentVisible=isEnvironmentVisible(this,e),this._useDepthPlane=useDepthPlane(this,e),this._numberOfTextureUniforms=getNumberOfTextureUniforms(this),this._rectangle=Rectangle.clone(t.translucency.rectangle,this._rectangle),gatherDerivedCommandRequirements(this,e)};const derivedCommandNames=new Array(derivedCommandsMaximumLength),derivedCommandPacks=new Array(derivedCommandsMaximumLength);function updateDerivedCommands$1(e,t,n,i,r,o,a){let s=t.derivedCommands.globeTranslucency;const c=e._derivedCommandsDirty;if(t.dirty||!defined(s)||c){t.dirty=!1,defined(s)||(s={},t.derivedCommands.globeTranslucency=s);const c=a.frameNumber,l=defaultValue(s.uniformMapDirtyFrame,0),u=defaultValue(s.shaderProgramDirtyFrame,0),d=defaultValue(s.renderStateDirtyFrame,0),h=s.uniformMap!==t.uniformMap,p=s.shaderProgramId!==t.shaderProgram.id,f=s.renderStateId!==t.renderState.id;h&&(s.uniformMapDirtyFrame=c),p&&(s.shaderProgramDirtyFrame=c),f&&(s.renderStateDirtyFrame=c),s.uniformMap=t.uniformMap,s.shaderProgramId=t.shaderProgram.id,s.renderStateId=t.renderState.id;for(let m=0;m<n;++m){const n=o[m],g=i[m],_=r[m];let y,C,T,S=s[_];defined(S)?(y=S.uniformMap,C=S.shaderProgram,T=S.renderState):(y=void 0,C=void 0,T=void 0),S=DrawCommand.shallowClone(t,S),s[_]=S;const A=defaultValue(S.derivedCommands.uniformMapDirtyFrame,0),v=defaultValue(S.derivedCommands.shaderProgramDirtyFrame,0),E=defaultValue(S.derivedCommands.renderStateDirtyFrame,0),b=h||A<l,x=p||v<u,P=f||E<d;b&&(S.derivedCommands.uniformMapDirtyFrame=c),x&&(S.derivedCommands.shaderProgramDirtyFrame=c),P&&(S.derivedCommands.renderStateDirtyFrame=c),S.derivedCommands.type=g,S.pass=n.pass,S.pickOnly=n.pickOnly,S.uniformMap=getDerivedUniformMap(e,t.uniformMap,y,b,n.getUniformMapFunction),S.shaderProgram=getDerivedShaderProgram(a.context,t.shaderProgram,C,x,n.getShaderProgramFunction,_),S.renderState=getDerivedRenderState(t.renderState,T,P,n.getRenderStateFunction,n.renderStateCache)}}}function executeCommandsMatchingType(e,t,n,i,r,o,a){for(let s=0;s<t;++s){const t=e[s],c=t.derivedCommands.type;(!defined(a)||a.indexOf(c)>-1)&&n(t,i,r,o)}}function executeCommands$1(e,t,n,i,r,o){for(let a=0;a<t;++a)n(e[a],i,r,o)}GlobeTranslucencyState.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(0!==i){for(let e=0;e<i;++e)derivedCommandPacks[e]=this._derivedCommandPacks[n[e]],derivedCommandNames[e]=DerivedCommandNames[n[e]];updateDerivedCommands$1(this,e,i,n,derivedCommandNames,derivedCommandPacks,t)}},GlobeTranslucencyState.prototype.pushDerivedCommands=function(e,t,n){const i=n.passes.pick;if(i&&t)return;let r=this._derivedCommandTypes,o=this._derivedCommandsLength;if(i?(r=this._derivedPickCommandTypes,o=this._derivedPickCommandsLength):t&&(r=this._derivedBlendCommandTypes,o=this._derivedBlendCommandsLength),0===o)return void n.commandList.push(e);const a=e.derivedCommands.globeTranslucency;for(let e=0;e<o;++e){const t=DerivedCommandNames[r[e]];n.commandList.push(a[t])}};const opaqueTypes=[DerivedCommandType.OPAQUE_FRONT_FACE,DerivedCommandType.OPAQUE_BACK_FACE],depthOnlyTypes=[DerivedCommandType.DEPTH_ONLY_FRONT_FACE,DerivedCommandType.DEPTH_ONLY_BACK_FACE,DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE];function GoogleEarthEnterpriseDiscardPolicy(){this._image=new Image}function GoogleEarthEnterpriseImageryProvider(e){let t;if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,defined(e.metadata))t=e.metadata;else{const n=Resource.createIfNeeded(e.url);t=new GoogleEarthEnterpriseMetadata(n)}this._metadata=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});let n=e.credit;"string"==typeof n&&(n=new Credit(n)),this._credit=n,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new GoogleEarthEnterpriseDiscardPolicy),this._errorEvent=new Event,this._ready=!1;const i=this;let r;this._readyPromise=t.readyPromise.then((function(e){if(!t.imageryPresent){const e=new RuntimeError("The server "+t.url+" doesn't have imagery");return r=TileProviderError.handleError(r,i,i._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}return TileProviderError.handleSuccess(r),i._ready=e,e})).otherwise((function(e){return r=TileProviderError.handleError(r,i,i._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)}))}function buildImageResource(e,t,n,i,r,o){const a=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(n,i,r);let s=t.imageryVersion;return s=defined(s)&&s>0?s:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1-0"+a+"-i."+s.toString(),request:o})}function getImageType(e){const t="JFIF";if(e[6]===t.charCodeAt(0)&&e[7]===t.charCodeAt(1)&&e[8]===t.charCodeAt(2)&&e[9]===t.charCodeAt(3))return"image/jpeg";const n="PNG";return e[1]===n.charCodeAt(0)&&e[2]===n.charCodeAt(1)&&e[3]===n.charCodeAt(2)?"image/png":void 0}function decodeEarthImageryPacket(e){const t=protobuf$1.Reader.create(e),n=t.len,i={};for(;t.pos<n;){const e=t.uint32();let n;switch(e>>>3){case 1:i.imageType=t.uint32();break;case 2:i.imageData=t.bytes();break;case 3:i.alphaType=t.uint32();break;case 4:i.imageAlpha=t.bytes();break;case 5:if(n=i.copyrightIds,defined(n)||(n=i.copyrightIds=[]),2==(7&e)){const e=t.uint32()+t.pos;for(;t.pos<e;)n.push(t.uint32())}else n.push(t.uint32());break;default:t.skipType(7&e)}}const r=i.imageType;if(defined(r))switch(r){case 0:i.imageType="image/jpeg";break;case 4:i.imageType="image/png";break;default:throw new RuntimeError("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}const o=i.alphaType;return defined(o)&&0!==o&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete i.alphaType,delete i.imageAlpha),i}GlobeTranslucencyState.prototype.executeGlobeCommands=function(e,t,n,i,r){const o=i.context,a=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE];0!==s&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(o,r),executeCommandsMatchingType(a,s,t,i,o,r,opaqueTypes))},GlobeTranslucencyState.prototype.executeGlobeClassificationCommands=function(e,t,n,i,r){const o=i.context,a=e.commands[Pass$1.GLOBE],s=e.indices[Pass$1.GLOBE],c=e.commands[Pass$1.TERRAIN_CLASSIFICATION],l=e.indices[Pass$1.TERRAIN_CLASSIFICATION];if(0===s||0===l)return;const u=this._frontFaceTranslucent,d=this._backFaceTranslucent;if(u&&d||executeCommands$1(c,l,t,i,o,r),!u&&!d)return;this._globeTranslucencyFramebuffer=n;const h=o.uniformState.globeDepthTexture,p=r.framebuffer;if(r.framebuffer=n.classificationFramebuffer,executeCommandsMatchingType(a,s,t,i,o,r,depthOnlyTypes),o.depthTexture){const e=n.packDepth(o,r);o.uniformState.globeDepthTexture=e}executeCommands$1(c,l,t,i,o,r),o.uniformState.globeDepthTexture=h,r.framebuffer=p},GoogleEarthEnterpriseDiscardPolicy.prototype.isReady=function(){return!0},GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage=function(e){return e===this._image},Object.defineProperties(GoogleEarthEnterpriseImageryProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.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._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}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}}),GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits=function(e,t,n){const i=this._metadata,r=i.getTileInformation(e,t,n);if(defined(r)){const e=i.providers[r.imageryProvider];if(defined(e))return[e]}},GoogleEarthEnterpriseImageryProvider.prototype.requestImage=function(e,t,n,i){const r=this._tileDiscardPolicy._image,o=this._metadata,a=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,n),s=o.getTileInformation(e,t,n);if(!defined(s)){if(o.isValid(a)){const r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction});return void o.populateSubtree(e,t,n,r)}return r}if(!s.hasImagery())return r;const c=buildImageResource(this,s,e,t,n,i).fetchArrayBuffer();return defined(c)?c.then((function(e){decodeGoogleEarthEnterpriseData(o.key,e);let t,n=new Uint8Array(e);const i=o.protoImagery;if(defined(i)&&i||(t=getImageType(n)),!defined(t)&&(!defined(i)||i)){const e=decodeEarthImageryPacket(n);t=e.imageType,n=e.imageData}return defined(t)&&defined(n)?loadImageFromTypedArray({uint8Array:n,format:t,flipY:!0}):r})):void 0},GoogleEarthEnterpriseImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){};const defaultColor=new Color(1,1,1,.4),defaultGlowColor=new Color(0,1,0,.05),defaultBackgroundColor=new Color(0,.5,0,.2);function GridImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._cells=defaultValue(e.cells,8),this._color=defaultValue(e.color,defaultColor),this._glowColor=defaultValue(e.glowColor,defaultGlowColor),this._glowWidth=defaultValue(e.glowWidth,6),this._backgroundColor=defaultValue(e.backgroundColor,defaultBackgroundColor),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._canvasSize=defaultValue(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=when.resolve(!0)}function InvertClassification(){this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._fbo=new FramebufferManager({createDepthAttachments:!1}),this._fboClassified=new FramebufferManager({createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(GridImageryProvider.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}}}),GridImageryProvider.prototype._drawGrid=function(e){const t=this._canvasSize;for(let n=0;n<=this._cells;++n){const i=1+n/this._cells*(t-1);e.moveTo(i,0),e.lineTo(i,t),e.moveTo(0,i),e.lineTo(t,i)}e.stroke()},GridImageryProvider.prototype._createGridCanvas=function(){const e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;const t=this._canvasSize,n=e.getContext("2d"),i=this._backgroundColor.toCssColorString();n.fillStyle=i,n.fillRect(0,0,t,t);const r=this._glowColor.toCssColorString();n.strokeStyle=r,n.lineWidth=this._glowWidth,n.strokeRect(0,0,t,t),this._drawGrid(n),n.lineWidth=.5*this._glowWidth,n.strokeRect(0,0,t,t),this._drawGrid(n);const o=this._color.toCssColorString();return n.strokeStyle=o,n.lineWidth=2,n.strokeRect(0,0,t,t),n.lineWidth=1,this._drawGrid(n),e},GridImageryProvider.prototype.getTileCredits=function(e,t,n){},GridImageryProvider.prototype.requestImage=function(e,t,n,i){return this._canvas},GridImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){},Object.defineProperties(InvertClassification.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}}),InvertClassification.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const rsUnclassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsClassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsDefault={depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK,blending:BlendingState$1.ALPHA_BLEND},translucentFS="#extension GL_EXT_frag_depth : enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));\n#ifdef UNCLASSIFIED\n vec4 highlightColor = czm_invertClassificationColor;\n if (isClassified)\n {\n discard;\n }\n#else\n vec4 highlightColor = vec4(1.0);\n if (!isClassified)\n {\n discard;\n }\n#endif\n gl_FragColor = color * highlightColor;\n gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;\n}\n",opaqueFS="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n#ifdef UNCLASSIFIED\n gl_FragColor = color * czm_invertClassificationColor;\n#else\n gl_FragColor = color;\n#endif\n}\n";function JobTypeBudget(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}function JobScheduler(e){const t=new Array(JobType$1.NUMBER_OF_JOB_TYPES);t[JobType$1.TEXTURE]=new JobTypeBudget(defined(e)?e[JobType$1.TEXTURE]:10),t[JobType$1.PROGRAM]=new JobTypeBudget(defined(e)?e[JobType$1.PROGRAM]:10),t[JobType$1.BUFFER]=new JobTypeBudget(defined(e)?e[JobType$1.BUFFER]:30);const n=t.length;let i,r=0;for(i=0;i<n;++i)r+=t[i].total;const o=new Array(n);for(i=0;i<n;++i)o[i]=!1;this._totalBudget=r,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=o}function Light(){}InvertClassification.prototype.update=function(e){const t=this._fbo.getColorTexture(),n=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const i=e.drawingBufferWidth,r=e.drawingBufferHeight,o=!defined(t)||t.width!==i||t.height!==r;if((o||n)&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),defined(this._previousFramebuffer)||(this._depthStencilTexture=new Texture({context:e,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}))),!defined(this._fbo.framebuffer)||o||n){let t,n;this._fbo.destroy(),this._fboClassified.destroy(),defined(this._previousFramebuffer)?(t=this._previousFramebuffer.depthStencilTexture,n=this._previousFramebuffer.depthStencilRenderbuffer):t=this._depthStencilTexture,this._fbo.setDepthStencilTexture(t),defined(n)&&this._fbo.setDepthStencilRenderbuffer(n),this._fbo.update(e,i,r),defined(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(t),this._fboClassified.update(e,i,r))}if(defined(this._rsUnclassified)||(this._rsUnclassified=RenderState.fromCache(rsUnclassified),this._rsClassified=RenderState.fromCache(rsClassified),this._rsDefault=RenderState.fromCache(rsDefault)),!defined(this._unclassifiedCommand)||n){defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const t=defined(this._previousFramebuffer)?opaqueFS:translucentFS,n=new ShaderSource({defines:["UNCLASSIFIED"],sources:[t]}),i=new ShaderSource({sources:[t]});this._unclassifiedCommand=e.createViewportQuadCommand(n,{renderState:defined(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(i,{renderState:defined(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),defined(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),defined(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(PassThrough,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}},InvertClassification.prototype.clear=function(e,t){defined(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))},InvertClassification.prototype.executeClassified=function(e,t){if(!defined(this._previousFramebuffer)){const n=t.framebuffer;t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)},InvertClassification.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)},InvertClassification.prototype.isDestroyed=function(){return!1},InvertClassification.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(JobTypeBudget.prototype,{total:{get:function(){return this._total}}}),JobScheduler.getTimestamp=getTimestamp$1,Object.defineProperties(JobScheduler.prototype,{totalBudget:{get:function(){return this._totalBudget}}}),JobScheduler.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget},JobScheduler.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const t=e[n];t.starvedLastFrame=t.starvedThisFrame,t.starvedThisFrame=!1,t.usedThisFrame=0,t.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0},JobScheduler.prototype.execute=function(e,t){const n=this._budgets,i=n[t],r=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&r)return i.starvedThisFrame=!0,!1;let o;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){const e=n.length;let t;for(t=0;t<e&&(o=n[t],!(o.usedThisFrame+o.stolenFromMeThisFrame<o.total)||o.starvedLastFrame);++t);if(t===e&&r)return!1;r&&(i.starvedThisFrame=!0)}const a=JobScheduler.getTimestamp();e.execute();const s=JobScheduler.getTimestamp()-a;return this._totalUsedThisFrame+=s,o?o.stolenFromMeThisFrame+=s:i.usedThisFrame+=s,this._executedThisFrame[t]=!0,!0},Object.defineProperties(Light.prototype,{color:{get:DeveloperError.throwInstantiationError},intensity:{get:DeveloperError.throwInstantiationError}});const trailingSlashRegex=/\/$/,defaultCredit$1=new Credit('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxStyleImageryProvider(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).styleId,n=e.accessToken;this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const i=Resource.createIfNeeded(defaultValue(e.url,"https://api.mapbox.com/styles/v1/"));this._styleId=t,this._accessToken=n;const r=defaultValue(e.tilesize,512);this._tilesize=r;const o=defaultValue(e.username,"mapbox");this._username=o;const a=defined(e.scaleFactor)?"@2x":"";let s,c=i.getUrlComponent();trailingSlashRegex.test(c)||(c+="/"),c+=this._username+"/"+t+"/tiles/"+this._tilesize+"/{z}/{x}/{y}"+a,i.url=c,i.setQueryParameters({access_token:n}),defined(e.credit)?(s=e.credit,"string"==typeof s&&(s=new Credit(s))):s=defaultCredit$1,this._resource=i,this._imageryProvider=new UrlTemplateImageryProvider({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function Moon(e){let t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureUrl;defined(t)||(t=buildModuleUrl("Assets/Textures/moonSmall.jpg")),this.show=defaultValue(e.show,!0),this.textureUrl=t,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.MOON),this.onlySunLighting=defaultValue(e.onlySunLighting,!0),this._ellipsoidPrimitive=new EllipsoidPrimitive({radii:this.ellipsoid.radii,material:Material$4.fromType(Material$4.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new IauOrientationAxes}Object.defineProperties(MapboxStyleImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.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}}}),MapboxStyleImageryProvider.prototype.getTileCredits=function(e,t,n){},MapboxStyleImageryProvider.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)},MapboxStyleImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){return this._imageryProvider.pickFeatures(e,t,n,i,r)},MapboxStyleImageryProvider._defaultCredit=defaultCredit$1,Object.defineProperties(Moon.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const icrfToFixed=new Matrix3,rotationScratch=new Matrix3,translationScratch=new Cartesian3,scratchCommandList=[];function NeverTileDiscardPolicy(e){}Moon.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const n=e.time;defined(Transforms.computeIcrfToFixedMatrix(n,icrfToFixed))||Transforms.computeTemeToPseudoFixedMatrix(n,icrfToFixed);const i=this._axes.evaluate(n,rotationScratch);Matrix3.transpose(i,i),Matrix3.multiply(icrfToFixed,i,i);const r=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(n,translationScratch);Matrix3.multiplyByVector(icrfToFixed,r,r),Matrix4.fromRotationTranslation(i,r,t.modelMatrix);const o=e.commandList;return e.commandList=scratchCommandList,scratchCommandList.length=0,t.update(e),e.commandList=o,1===scratchCommandList.length?scratchCommandList[0]:void 0},Moon.prototype.isDestroyed=function(){return!1},Moon.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),destroyObject(this)},NeverTileDiscardPolicy.prototype.isReady=function(){return!0},NeverTileDiscardPolicy.prototype.shouldDiscardImage=function(e){return!1};var AdjustTranslucentFS="#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",CompositeOITFS="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;\nif (opaque != czm_backgroundColor)\n{\ngl_FragColor.a = 1.0;\n}\n}\n";function OIT(e){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new FramebufferManager({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1}),this._alphaFBO=new FramebufferManager({createColorAttachments:!1,createDepthAttachments:!1}),this._adjustTranslucentFBO=new FramebufferManager({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new FramebufferManager({createColorAttachments:!1}),this._opaqueClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ClearCommand({color:new Color(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._alphaClearCommand=new ClearCommand({color:new Color(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function destroyTextures$1(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function destroyFramebuffers$1(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function destroyResources$2(e){destroyTextures$1(e),destroyFramebuffers$1(e)}function updateTextures$1(e,t,n,i){destroyTextures$1(e),e._accumulationTexture=new Texture({context:t,width:n,height:i,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT});const r=new Float32Array(n*i*4);e._revealageTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,source:{arrayBufferView:r,width:n,height:i},flipY:!1})}function updateFramebuffers$3(e,t){destroyFramebuffers$1(e);const n=WebGLConstants$1.FRAMEBUFFER_COMPLETE;let i=!0;const r=e._accumulationTexture.width,o=e._accumulationTexture.height;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,r,o),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,r,o),e._translucentFBO.status===n&&e._adjustTranslucentFBO.status===n||(destroyFramebuffers$1(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,r,o),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,r,o),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,r,o),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,r,o);const a=e._translucentFBO.status===n,s=e._alphaFBO.status===n,c=e._adjustTranslucentFBO.status===n,l=e._adjustAlphaFBO.status===n;a&&s&&c&&l||(destroyResources$2(e),e._translucentMultipassSupport=!1,i=!1)}return i}OIT.prototype.update=function(e,t,n,i){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.depthStencilTexture;const r=this._opaqueTexture.width,o=this._opaqueTexture.height,a=this._accumulationTexture,s=!defined(a)||a.width!==r||a.height!==o||i!==this._useHDR;if(s&&updateTextures$1(this,e,r,o),(!defined(this._translucentFBO.framebuffer)||s)&&!updateFramebuffers$3(this,e))return;this._useHDR=i;const c=this;let l,u;defined(this._compositeCommand)||(l=new ShaderSource({sources:[CompositeOITFS]}),this._translucentMRTSupport&&l.defines.push("MRT"),u={u_opaque:function(){return c._opaqueTexture},u_accumulation:function(){return c._accumulationTexture},u_revealage:function(){return c._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(l,{uniformMap:u,owner:this})),defined(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(l=new ShaderSource({defines:["MRT"],sources:[AdjustTranslucentFS]}),u={u_bgColor:function(){return c._translucentMRTClearCommand.color},u_depthTexture:function(){return c._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:u,owner:this})):this._translucentMultipassSupport&&(l=new ShaderSource({sources:[AdjustTranslucentFS]}),u={u_bgColor:function(){return c._translucentMultipassClearCommand.color},u_depthTexture:function(){return c._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:u,owner:this}),u={u_bgColor:function(){return c._alphaClearCommand.color},u_depthTexture:function(){return c._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(l,{uniformMap:u,owner:this}))),this._viewport.width=r,this._viewport.height=o;const d=!BoundingRectangle.equals(this._viewport,t.viewport);let h=d!==this._useScissorTest;this._useScissorTest=d,BoundingRectangle.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=BoundingRectangle.clone(t.viewport,this._scissorRectangle),h=!0),defined(this._rs)&&BoundingRectangle.equals(this._viewport,this._rs.viewport)&&!h||(this._rs=RenderState.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),defined(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const translucentMRTBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA},translucentColorBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE},translucentAlphaBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ZERO,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA};function getTranslucentRenderState(e,t,n,i){let r=n[i.id];if(!defined(r)){const e=RenderState.getState(i);e.depthMask=!1,e.blending=t,r=RenderState.fromCache(e),n[i.id]=r}return r}function getTranslucentMRTRenderState(e,t,n){return getTranslucentRenderState(t,translucentMRTBlend,e._translucentRenderStateCache,n)}function getTranslucentColorRenderState(e,t,n){return getTranslucentRenderState(t,translucentColorBlend,e._translucentRenderStateCache,n)}function getTranslucentAlphaRenderState(e,t,n){return getTranslucentRenderState(t,translucentAlphaBlend,e._alphaRenderStateCache,n)}const mrtShaderSource=" 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",colorShaderSource=" 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",alphaShaderSource=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";function getTranslucentShaderProgram(e,t,n,i){let r=e.shaderCache.getDerivedShaderProgram(t,n);if(!defined(r)){const o=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map((function(e){return e=(e=(e=(e=ShaderSource.replaceMain(e,"czm_translucent_main")).replace(/gl_FragColor/g,"czm_gl_FragColor")).replace(/\bdiscard\b/g,"czm_discard = true")).replace(/czm_phong/g,"czm_translucentPhong")})),a.sources.splice(0,0,(-1!==i.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),a.sources.push("void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"+i+"}\n"),r=e.shaderCache.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:o})}return r}function getTranslucentMRTShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMRT",mrtShaderSource)}function getTranslucentColorShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMultipass",colorShaderSource)}function getTranslucentAlphaShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"alphaMultipass",alphaShaderSource)}function executeTranslucentCommandsSortedMultipass(e,t,n,i,r,o){let a,s,c;const l=t.context,u=t.frameState.useLogDepth,d=t._hdr,h=i.framebuffer,p=r.length,f=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(l,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(l,i);const m=e._opaqueFBO;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<p;++c)a=r[c],a=u?a.derivedCommands.logDepth.command:a,a=d?a.derivedCommands.hdr.command:a,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.translucentCommand:a.derivedCommands.oit.translucentCommand,n(s,t,l,i,m);for(defined(o)&&(a=o.unclassifiedCommand,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.translucentCommand:a.derivedCommands.oit.translucentCommand,n(s,t,l,i,m)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<p;++c)a=r[c],a=u?a.derivedCommands.logDepth.command:a,a=d?a.derivedCommands.hdr.command:a,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.alphaCommand:a.derivedCommands.oit.alphaCommand,n(s,t,l,i,m);defined(o)&&(a=o.unclassifiedCommand,s=f&&a.receiveShadows?a.derivedCommands.oit.shadows.alphaCommand:a.derivedCommands.oit.alphaCommand,n(s,t,l,i,m)),i.framebuffer=h}function executeTranslucentCommandsSortedMRT(e,t,n,i,r,o){const a=t.context,s=t.frameState.useLogDepth,c=t._hdr,l=i.framebuffer,u=r.length,d=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(a,i);const h=e._opaqueFBO;let p,f;i.framebuffer=e._translucentFBO.framebuffer;for(let e=0;e<u;++e)p=r[e],p=s?p.derivedCommands.logDepth.command:p,p=c?p.derivedCommands.hdr.command:p,f=d&&p.receiveShadows?p.derivedCommands.oit.shadows.translucentCommand:p.derivedCommands.oit.translucentCommand,n(f,t,a,i,h);defined(o)&&(p=o.unclassifiedCommand,f=d&&p.receiveShadows?p.derivedCommands.oit.shadows.translucentCommand:p.derivedCommands.oit.translucentCommand,n(f,t,a,i,h)),i.framebuffer=l}OIT.prototype.createDerivedCommands=function(e,t,n){if(defined(n)||(n={}),this._translucentMRTSupport){let i,r;defined(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,r=n.translucentCommand.renderState),n.translucentCommand=DrawCommand.shallowClone(e,n.translucentCommand),defined(i)&&n.shaderProgramId===e.shaderProgram.id?(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=r):(n.translucentCommand.shaderProgram=getTranslucentMRTShaderProgram(t,e.shaderProgram),n.translucentCommand.renderState=getTranslucentMRTRenderState(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id)}else{let i,r,o,a;defined(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,r=n.translucentCommand.renderState,o=n.alphaCommand.shaderProgram,a=n.alphaCommand.renderState),n.translucentCommand=DrawCommand.shallowClone(e,n.translucentCommand),n.alphaCommand=DrawCommand.shallowClone(e,n.alphaCommand),defined(i)&&n.shaderProgramId===e.shaderProgram.id?(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=r,n.alphaCommand.shaderProgram=o,n.alphaCommand.renderState=a):(n.translucentCommand.shaderProgram=getTranslucentColorShaderProgram(t,e.shaderProgram),n.translucentCommand.renderState=getTranslucentColorRenderState(this,t,e.renderState),n.alphaCommand.shaderProgram=getTranslucentAlphaShaderProgram(t,e.shaderProgram),n.alphaCommand.renderState=getTranslucentAlphaRenderState(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id)}return n},OIT.prototype.executeCommands=function(e,t,n,i,r){this._translucentMRTSupport?executeTranslucentCommandsSortedMRT(this,e,t,n,i,r):executeTranslucentCommandsSortedMultipass(this,e,t,n,i,r)},OIT.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},OIT.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO,Color.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer;(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=i},OIT.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},OIT.prototype.isDestroyed=function(){return!1},OIT.prototype.destroy=function(){return destroyResources$2(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),destroyObject(this)};const defaultCredit=new Credit("MapQuest, Open Street Map and contributors, CC-BY-SA");function OpenStreetMapImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=Resource.createIfNeeded(defaultValue(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+="{z}/{x}/{y}."+defaultValue(e.fileExtension,"png");const n=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),i=defaultValue(e.minimumLevel,0),r=e.maximumLevel,o=defaultValue(e.rectangle,n.rectangle),a=n.positionToTileXY(Rectangle.southwest(o),i),s=n.positionToTileXY(Rectangle.northeast(o),i);Math.abs(s.x-a.x),Math.abs(s.y-a.y);let c=defaultValue(e.credit,defaultCredit);"string"==typeof c&&(c=new Credit(c)),UrlTemplateImageryProvider.call(this,{url:t,credit:c,tilingScheme:n,tileWidth:256,tileHeight:256,minimumLevel:i,maximumLevel:r,rectangle:o})}defined(Object.create)&&(OpenStreetMapImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),OpenStreetMapImageryProvider.prototype.constructor=OpenStreetMapImageryProvider);const defaultSize=new Cartesian2(1,1);function Particle(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.mass=defaultValue(e.mass,1),this.position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this.velocity=Cartesian3.clone(defaultValue(e.velocity,Cartesian3.ZERO)),this.life=defaultValue(e.life,Number.MAX_VALUE),this.image=e.image,this.startColor=Color.clone(defaultValue(e.startColor,Color.WHITE)),this.endColor=Color.clone(defaultValue(e.endColor,Color.WHITE)),this.startScale=defaultValue(e.startScale,1),this.endScale=defaultValue(e.endScale,1),this.imageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultSize)),this._age=0,this._normalizedAge=0,this._billboard=void 0}Object.defineProperties(Particle.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});const deltaScratch=new Cartesian3;function ParticleBurst(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.time=defaultValue(e.time,0),this.minimum=defaultValue(e.minimum,0),this.maximum=defaultValue(e.maximum,50),this._complete=!1}function ParticleEmitter(e){}Particle.prototype.update=function(e,t){return Cartesian3.multiplyByScalar(this.velocity,e,deltaScratch),Cartesian3.add(this.position,deltaScratch,this.position),defined(t)&&t(this,e),this._age+=e,this.life===Number.MAX_VALUE?this._normalizedAge=0:this._normalizedAge=this._age/this.life,this._age<=this.life},Object.defineProperties(ParticleBurst.prototype,{complete:{get:function(){return this._complete}}}),ParticleEmitter.prototype.emit=function(e){DeveloperError.throwInstantiationError()};const defaultImageSize=new Cartesian2(1,1);function ParticleSystem(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.updateCallback=e.updateCallback,this.loop=defaultValue(e.loop,!0),this.image=defaultValue(e.image,void 0);let t=e.emitter;defined(t)||(t=new CircleEmitter(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._emitterModelMatrix=Matrix4.clone(defaultValue(e.emitterModelMatrix,Matrix4.IDENTITY)),this._matrixDirty=!0,this._combinedMatrix=new Matrix4,this._startColor=Color.clone(defaultValue(e.color,defaultValue(e.startColor,Color.WHITE))),this._endColor=Color.clone(defaultValue(e.color,defaultValue(e.endColor,Color.WHITE))),this._startScale=defaultValue(e.scale,defaultValue(e.startScale,1)),this._endScale=defaultValue(e.scale,defaultValue(e.endScale,1)),this._emissionRate=defaultValue(e.emissionRate,5),this._minimumSpeed=defaultValue(e.speed,defaultValue(e.minimumSpeed,1)),this._maximumSpeed=defaultValue(e.speed,defaultValue(e.maximumSpeed,1)),this._minimumParticleLife=defaultValue(e.particleLife,defaultValue(e.minimumParticleLife,5)),this._maximumParticleLife=defaultValue(e.particleLife,defaultValue(e.maximumParticleLife,5)),this._minimumMass=defaultValue(e.mass,defaultValue(e.minimumMass,1)),this._maximumMass=defaultValue(e.mass,defaultValue(e.maximumMass,1)),this._minimumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.minimumImageSize,defaultImageSize))),this._maximumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.maximumImageSize,defaultImageSize))),this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._lifetime=defaultValue(e.lifetime,Number.MAX_VALUE),this._billboardCollection=void 0,this._particles=[],this._particlePool=[],this._previousTime=void 0,this._currentTime=0,this._carryOver=0,this._complete=new Event,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}function updateParticlePool(e){const t=e._emissionRate,n=e._maximumParticleLife;let i=0;const r=e._bursts;if(defined(r)){const e=r.length;for(let t=0;t<e;++t)i+=r[t].maximum}const o=e._billboardCollection,a=e.image,s=Math.ceil(t*n+i),c=e._particles,l=e._particlePool,u=Math.max(s-c.length-l.length,0);for(let e=0;e<u;++e){const e=new Particle;e._billboard=o.add({image:a}),l.push(e)}e._particleEstimate=s}function getOrCreateParticle(e){let t=e._particlePool.pop();return defined(t)||(t=new Particle),t}function addParticleToPool(e,t){e._particlePool.push(t)}function freeParticlePool(e){const t=e._particles,n=e._particlePool,i=e._billboardCollection,r=t.length,o=n.length,a=e._particleEstimate,s=o-Math.max(a-r-o,0);for(let e=s;e<o;++e){const t=n[e];i.remove(t._billboard)}n.length=s}function removeBillboard(e){defined(e._billboard)&&(e._billboard.show=!1)}function updateBillboard(e,t){let n=t._billboard;defined(n)||(n=t._billboard=e._billboardCollection.add({image:t.image})),n.width=t.imageSize.x,n.height=t.imageSize.y,n.position=t.position,n.sizeInMeters=e.sizeInMeters,n.show=!0;const i=CesiumMath.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),r=CesiumMath.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),o=CesiumMath.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),a=CesiumMath.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);n.color=new Color(i,r,o,a),n.scale=CesiumMath.lerp(t.startScale,t.endScale,t.normalizedAge)}function addParticle(e,t){t.startColor=Color.clone(e._startColor,t.startColor),t.endColor=Color.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=CesiumMath.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=CesiumMath.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=CesiumMath.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=CesiumMath.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;const n=CesiumMath.randomBetween(e._minimumSpeed,e._maximumSpeed);Cartesian3.multiplyByScalar(t.velocity,n,t.velocity),e._particles.push(t)}function calculateNumberToEmit(e,t){if(e._isComplete)return 0;const n=(t=CesiumMath.mod(t,e._lifetime))*e._emissionRate;let i=Math.floor(n);if(e._carryOver+=n-i,e._carryOver>1&&(i++,e._carryOver-=1),defined(e.bursts)){const t=e.bursts.length;for(let n=0;n<t;n++){const t=e.bursts[n],r=e._currentTime;defined(t)&&!t._complete&&r>t.time&&(i+=CesiumMath.randomBetween(t.minimum,t.maximum),t._complete=!0)}}return i}Object.defineProperties(ParticleSystem.prototype,{emitter:{get:function(){return this._emitter},set:function(e){this._emitter=e}},bursts:{get:function(){return this._bursts},set:function(e){this._bursts=e,this._updateParticlePool=!0}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._modelMatrix,e),Matrix4.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._emitterModelMatrix,e),Matrix4.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){Color.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){Color.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){this._maximumImageSize=e}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters=e}},lifetime:{get:function(){return this._lifetime},set:function(e){this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});const rotatedVelocityScratch=new Cartesian3;function PerformanceDisplay(e){const t=getElement((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).container);this._container=t;const n=document.createElement("div");n.className="cesium-performanceDisplay";const i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);const r=document.createElement("div");r.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),r.appendChild(this._msText),n.appendChild(r),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=getTimestamp$1(),this._lastMsSampleTime=getTimestamp$1(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const o=document.createElement("div");o.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),o.appendChild(this._throttledText),n.appendChild(o)}function PickDepth(){this._framebuffer=new FramebufferManager,this._textureToCopy=void 0,this._copyDepthCommand=void 0}function updateFramebuffers$2(e,t,n){const i=n.width,r=n.height;e._framebuffer.update(t,i,r)}function updateCopyCommands(e,t,n){if(!defined(e._copyDepthCommand)){const n="uniform highp sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";e._copyDepthCommand=t.createViewportQuadCommand(n,{renderState:RenderState.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}ParticleSystem.prototype.update=function(e){if(!this.show)return;defined(this._billboardCollection)||(this._billboardCollection=new BillboardCollection),this._updateParticlePool&&(updateParticlePool(this),this._updateParticlePool=!1);let t=0;this._previousTime&&(t=JulianDate.secondsDifference(e.time,this._previousTime)),t<0&&(t=0);const n=this._particles,i=this._emitter,r=this.updateCallback;let o,a,s=n.length;for(o=0;o<s;++o)a=n[o],a.update(t,r)?updateBillboard(this,a):(removeBillboard(a),addParticleToPool(this,a),n[o]=n[s-1],--o,--s);n.length=s;const c=calculateNumberToEmit(this,t);if(c>0&&defined(i)){this._matrixDirty&&(this._combinedMatrix=Matrix4.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);const e=this._combinedMatrix;for(o=0;o<c;o++)a=getOrCreateParticle(this),this._emitter.emit(a),Cartesian3.add(a.position,a.velocity,rotatedVelocityScratch),Matrix4.multiplyByPoint(e,rotatedVelocityScratch,rotatedVelocityScratch),a.position=Matrix4.multiplyByPoint(e,a.position,a.position),Cartesian3.subtract(rotatedVelocityScratch,a.position,a.velocity),Cartesian3.normalize(a.velocity,a.velocity),addParticle(this,a),updateBillboard(this,a)}if(this._billboardCollection.update(e),this._previousTime=JulianDate.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=CesiumMath.mod(this._currentTime,this._lifetime),this.bursts){const e=this.bursts.length;for(o=0;o<e;o++)this.bursts[o]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120==0&&freeParticlePool(this)},ParticleSystem.prototype.isDestroyed=function(){return!1},ParticleSystem.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),destroyObject(this)},Object.defineProperties(PerformanceDisplay.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(this._throttledText.nodeValue=e?"(throttled)":"",this._throttled=e)}}}),PerformanceDisplay.prototype.update=function(e){const t=getTimestamp$1(),n=defaultValue(e,!0);this._fpsFrameCount++;const i=t-this._lastFpsSampleTime;if(i>1e3){let e="N/A";n&&(e=1e3*this._fpsFrameCount/i|0),this._fpsText.nodeValue=e+" FPS",this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const r=t-this._lastMsSampleTime;if(r>200){let e="N/A";n&&(e=(r/this._msFrameCount).toFixed(2)),this._msText.nodeValue=e+" MS",this._lastMsSampleTime=t,this._msFrameCount=0}},PerformanceDisplay.prototype.destroy=function(){return destroyObject(this)},Object.defineProperties(PickDepth.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),PickDepth.prototype.update=function(e,t){updateFramebuffers$2(this,e,t),updateCopyCommands(this,e,t)};const scratchPackedDepth=new Cartesian4,packedDepthScale=new Cartesian4(1,1/255,1/65025,1/16581375);function PickDepthFramebuffer(){this._framebuffer=new FramebufferManager({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}function destroyResources$1(e){e._framebuffer.destroy()}function createResources(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const r=new PassState(t);r.blendingEnabled=!1,r.scissorTest={enabled:!0,rectangle:new BoundingRectangle},r.viewport=new BoundingRectangle,e._passState=r}function PickFramebuffer(e){const t=new PassState(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new BoundingRectangle},t.viewport=new BoundingRectangle,this._context=e,this._fb=new FramebufferManager({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}PickDepth.prototype.getDepth=function(e,t,n){if(!defined(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),r=Cartesian4.unpack(i,0,scratchPackedDepth);return Cartesian4.divideByScalar(r,255,r),Cartesian4.dot(r,packedDepthScale)},PickDepth.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},PickDepth.prototype.isDestroyed=function(){return!1},PickDepth.prototype.destroy=function(){return this._framebuffer.destroy(),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=defined(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),destroyObject(this)},Object.defineProperties(PickDepthFramebuffer.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),PickDepthFramebuffer.prototype.update=function(e,t,n){const i=n.width,r=n.height;this._framebuffer.isDirty(i,r)&&createResources(this,e);const o=this.framebuffer,a=this._passState;return a.framebuffer=o,a.viewport.width=i,a.viewport.height=r,a.scissorTest.rectangle.x=t.x,a.scissorTest.rectangle.y=r-t.y,a.scissorTest.rectangle.width=1,a.scissorTest.rectangle.height=1,a},PickDepthFramebuffer.prototype.isDestroyed=function(){return!1},PickDepthFramebuffer.prototype.destroy=function(){return destroyResources$1(this),destroyObject(this)},PickFramebuffer.prototype.begin=function(e,t){const n=this._context,i=t.width,r=t.height;return BoundingRectangle.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=r,this._fb.update(n,i,r),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=r,this._passState};const colorScratch=new Color;function SceneFramebuffer(){this._colorFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new Color(0,0,0,0),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,owner:this})}function destroyResources(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}function ShadowMapShader(){}function ShadowMap(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context;this._enabled=defaultValue(e.enabled,!0),this._softShadows=defaultValue(e.softShadows,!1),this._normalOffset=defaultValue(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=defaultValue(e.fromLightSource,!0),this.darkness=defaultValue(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=defaultValue(e.fadingEnabled,!0),this.maximumDistance=defaultValue(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n,i=!0;(FeatureDetection.isInternetExplorer()||FeatureDetection.isEdge()||(FeatureDetection.isChrome()||FeatureDetection.isFirefox())&&FeatureDetection.isWindows()&&!t.depthTexture)&&(i=!1),this._polygonOffsetSupported=i,this._terrainBias={polygonOffset:i,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:i,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new Matrix4,this._shadowMapTexture=void 0,this._lightDirectionEC=new Cartesian3,this._lightPositionEC=new Cartesian4,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new ShadowMapCamera,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new BoundingSphere,this._isPointLight=defaultValue(e.isPointLight,!1),this._pointLightRadius=defaultValue(e.pointLightRadius,100),this._cascadesEnabled=!this._isPointLight&&defaultValue(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?defaultValue(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new Cartesian2,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new OrthographicOffCenterFrustum:defined(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new Cartesian4,new Cartesian4],this._cascadeMatrices=[new Matrix4,new Matrix4,new Matrix4,new Matrix4],this._cascadeDistances=new Cartesian4,n=this._isPointLight?6:this._cascadesEnabled?this._numberOfCascades:1,this._passes=new Array(n);for(let e=0;e<n;++e)this._passes[e]=new ShadowPass(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,createRenderStates(this),this._clearCommand=new ClearCommand({depth:1,color:new Color}),this._clearPassState=new PassState(t),this._size=defaultValue(e.size,2048),this.size=this._size}function ShadowPass(e){this.camera=new ShadowMapCamera,this.passState=new PassState(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function createRenderState(e,t){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function createRenderStates(e){const t=!e._usesDepthTexture;e._primitiveRenderState=createRenderState(t,e._primitiveBias),e._terrainRenderState=createRenderState(t,e._terrainBias),e._pointRenderState=createRenderState(t,e._pointBias)}function destroyFramebuffer(e){const t=e._passes.length;for(let n=0;n<t;++n){const t=e._passes[n],i=t.framebuffer;defined(i)&&!i.isDestroyed()&&i.destroy(),t.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function createFramebufferColor(e,t){const n=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),i=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),r=new Framebuffer({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),o=e._passes.length;for(let t=0;t<o;++t){const n=e._passes[t];n.framebuffer=r,n.passState.framebuffer=r}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function createFramebufferDepth(e,t){const n=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST}),i=new Framebuffer({context:t,depthStencilTexture:n,destroyAttachments:!1}),r=e._passes.length;for(let t=0;t<r;++t){const n=e._passes[t];n.framebuffer=i,n.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function createFramebufferCube(e,t){const n=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),i=new CubeMap({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:Sampler.NEAREST}),r=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let i=0;i<6;++i){const o=new Framebuffer({context:t,depthRenderbuffer:n,colorTextures:[r[i]],destroyAttachments:!1}),a=e._passes[i];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function createFramebuffer(e,t){e._isPointLight?createFramebufferCube(e,t):e._usesDepthTexture?createFramebufferDepth(e,t):createFramebufferColor(e,t)}function checkFramebuffer(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==WebGLConstants$1.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,createRenderStates(e),destroyFramebuffer(e),createFramebuffer(e,t))}function updateFramebuffer(e,t){defined(e._passes[0].framebuffer)&&e._shadowMapTexture.width===e._textureSize.x||(destroyFramebuffer(e),createFramebuffer(e,t),checkFramebuffer(e,t),clearFramebuffer(e,t))}function clearFramebuffer(e,t,n){n=defaultValue(n,0),(e._isPointLight||0===n)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function resize(e,t){e._size=t;const n=e._passes,i=n.length,r=e._textureSize;if(e._isPointLight){t=ContextLimits.maximumCubeMapSize>=t?t:ContextLimits.maximumCubeMapSize,r.x=t,r.y=t;const e=new BoundingRectangle(0,0,t,t);n[0].passState.viewport=e,n[1].passState.viewport=e,n[2].passState.viewport=e,n[3].passState.viewport=e,n[4].passState.viewport=e,n[5].passState.viewport=e}else 1===i?(t=ContextLimits.maximumTextureSize>=t?t:ContextLimits.maximumTextureSize,r.x=t,r.y=t,n[0].passState.viewport=new BoundingRectangle(0,0,t,t)):4===i&&(t=ContextLimits.maximumTextureSize>=2*t?t:ContextLimits.maximumTextureSize/2,r.x=2*t,r.y=2*t,n[0].passState.viewport=new BoundingRectangle(0,0,t,t),n[1].passState.viewport=new BoundingRectangle(t,0,t,t),n[2].passState.viewport=new BoundingRectangle(0,t,t,t),n[3].passState.viewport=new BoundingRectangle(t,t,t,t));e._clearPassState.viewport=new BoundingRectangle(0,0,r.x,r.y);for(let e=0;e<i;++e){const t=n[e],i=t.passState.viewport,o=i.x/r.x,a=i.y/r.y,s=i.width/r.x,c=i.height/r.y;t.textureOffsets=new Matrix4(s,0,0,o,0,c,0,a,0,0,1,0,0,0,0,1)}}PickFramebuffer.prototype.end=function(e){const t=defaultValue(e.width,1),n=defaultValue(e.height,1),i=this._context,r=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),o=Math.max(t,n),a=o*o,s=Math.floor(.5*t),c=Math.floor(.5*n);let l=0,u=0,d=0,h=-1;for(let e=0;e<a;++e){if(-s<=l&&l<=s&&-c<=u&&u<=c){const e=4*((c-u)*t+l+s);colorScratch.red=Color.byteToFloat(r[e]),colorScratch.green=Color.byteToFloat(r[e+1]),colorScratch.blue=Color.byteToFloat(r[e+2]),colorScratch.alpha=Color.byteToFloat(r[e+3]);const n=i.getObjectByPickColor(colorScratch);if(defined(n))return n}if(l===u||l<0&&-l===u||l>0&&l===1-u){const e=d;d=-h,h=e}l+=d,u+=h}},PickFramebuffer.prototype.isDestroyed=function(){return!1},PickFramebuffer.prototype.destroy=function(){return this._fb.destroy(),destroyObject(this)},Object.defineProperties(SceneFramebuffer.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}}}),SceneFramebuffer.prototype.update=function(e,t,n){const i=t.width,r=t.height,o=n?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._colorFramebuffer.update(e,i,r,o),this._idFramebuffer.update(e,i,r)},SceneFramebuffer.prototype.clear=function(e,t,n){Color.clone(n,this._clearCommand.color),Color.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)},SceneFramebuffer.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer},SceneFramebuffer.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer},SceneFramebuffer.prototype.isDestroyed=function(){return!1},SceneFramebuffer.prototype.destroy=function(){return destroyResources(this),destroyObject(this)},ShadowMapShader.getShadowCastShaderKeyword=function(e,t,n,i){return"castShadow "+e+" "+t+" "+n+" "+i},ShadowMapShader.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),r=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const o=defined(ShaderSource.findPositionVarying(e));if(t&&!o){const e=r.length;for(let t=0;t<e;++t)r[t]=ShaderSource.replaceMain(r[t],"czm_shadow_cast_main");const t="varying vec3 v_positionEC; \nvoid main() \n{ \n czm_shadow_cast_main(); \n v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}";r.push(t)}return new ShaderSource({defines:i,sources:r})},ShadowMapShader.createShadowCastFragmentShader=function(e,t,n,i){const r=e.defines.slice(0),o=e.sources.slice(0);let a=ShaderSource.findPositionVarying(e);const s=defined(a);s||(a="v_positionEC");const c=o.length;for(let e=0;e<c;++e)o[e]=ShaderSource.replaceMain(o[e],"czm_shadow_cast_main");let l="";return t&&(s||(l+="varying vec3 v_positionEC; \n"),l+="uniform vec4 shadowMap_lightPositionEC; \n"),l+=i?"void main() \n{ \n":"void main() \n{ \n czm_shadow_cast_main(); \n if (gl_FragColor.a == 0.0) \n { \n discard; \n } \n",l+=t?" float distance = length("+a+"); \n if (distance >= shadowMap_lightPositionEC.w) \n { \n discard; \n } \n distance /= shadowMap_lightPositionEC.w; // radius \n gl_FragColor = czm_packDepth(distance); \n":n?" gl_FragColor = vec4(1.0); \n":" gl_FragColor = czm_packDepth(gl_FragCoord.z); \n",l+="} \n",o.push(l),new ShaderSource({defines:r,sources:o})},ShadowMapShader.getShadowReceiveShaderKeyword=function(e,t,n,i){return"receiveShadow "+e._usesDepthTexture+e._polygonOffsetSupported+e._isPointLight+e._isSpotLight+(e._numberOfCascades>1)+e.debugCascadeColors+e.softShadows+t+n+i},ShadowMapShader.createShadowReceiveVertexShader=function(e,t,n){const i=e.defines.slice(0),r=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new ShaderSource({defines:i,sources:r})},ShadowMapShader.createShadowReceiveFragmentShader=function(e,t,n,i,r){const o=ShaderSource.findNormalVarying(e),a=!i&&defined(o)||i&&r,s=ShaderSource.findPositionVarying(e),c=defined(s),l=t._usesDepthTexture,u=t._polygonOffsetSupported,d=t._isPointLight,h=t._isSpotLight,p=t._numberOfCascades>1,f=t.debugCascadeColors,m=t.softShadows,g=d?t._pointBias:i?t._terrainBias:t._primitiveBias,_=e.defines.slice(0),y=e.sources.slice(0),C=y.length;for(let e=0;e<C;++e)y[e]=ShaderSource.replaceMain(y[e],"czm_shadow_receive_main");d?_.push("USE_CUBE_MAP_SHADOW"):l&&_.push("USE_SHADOW_DEPTH_TEXTURE"),m&&!d&&_.push("USE_SOFT_SHADOWS"),p&&n&&i&&(a?_.push("ENABLE_VERTEX_LIGHTING"):_.push("ENABLE_DAYNIGHT_SHADING")),n&&g.normalShading&&a&&(_.push("USE_NORMAL_SHADING"),g.normalShadingSmooth>0&&_.push("USE_NORMAL_SHADING_SMOOTH"));let T,S="";return S+=d?"uniform samplerCube shadowMap_textureCube; \n":"uniform sampler2D shadowMap_texture; \n",T=c?" return vec4("+s+", 1.0); \n":"#ifndef LOG_DEPTH \n return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n return vec4(v_logPositionEC, 1.0); \n#endif \n",S+="uniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n#ifdef LOG_DEPTH \nvarying vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n"+T+"} \nvec3 getNormalEC() \n{ \n"+(a?" return normalize("+o+"); \n":" return vec3(1.0); \n")+"} \nvoid applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) \n{ \n"+(g.normalOffset&&a?" float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n float normalOffsetScale = 1.0 - nDotL; \n vec3 offset = normalOffset * normalOffsetScale * normalEC; \n positionEC.xyz += offset; \n":"")+"} \n",S+="void main() \n{ \n czm_shadow_receive_main(); \n vec4 positionEC = getPositionEC(); \n vec3 normalEC = getNormalEC(); \n float depth = -positionEC.z; \n",S+=" czm_shadowParameters shadowParameters; \n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n",i?S+=" shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n":u||(S+=" shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n"),S+=d?" vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n float distance = length(directionEC); \n directionEC = normalize(directionEC); \n float radius = shadowMap_lightPositionEC.w; \n // Stop early if the fragment is beyond the point light radius \n if (distance > radius) \n { \n return; \n } \n vec3 directionWC = czm_inverseViewRotation * directionEC; \n shadowParameters.depth = distance / radius; \n shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n shadowParameters.texCoords = directionWC; \n float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); \n":h?" vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Spot light uses a perspective projection, so perform the perspective divide \n shadowPosition /= shadowPosition.w; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n":p?" float maxDepth = shadowMap_cascadeSplits[1].w; \n // Stop early if the eye depth exceeds the last cascade \n if (depth > maxDepth) \n { \n return; \n } \n // Get the cascade based on the eye-space depth \n vec4 weights = czm_cascadeWeights(depth); \n // Apply normal offset \n float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n // Transform position into the cascade \n vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n // Get visibility \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n // Fade out shadows that are far away \n float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n visibility = mix(visibility, 1.0, fade); \n"+(f?" // Draw cascade colors for debugging \n gl_FragColor *= czm_cascadeColor(weights); \n":""):" float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n",S+=" gl_FragColor.rgb *= visibility; \n} \n",y.push(S),new ShaderSource({defines:_,sources:y})},ShadowMap.MAXIMUM_DISTANCE=2e4,ShadowMap.prototype.debugCreateRenderStates=function(){createRenderStates(this)},Object.defineProperties(ShadowMap.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){resize(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});const scratchViewport=new BoundingRectangle;function createDebugShadowViewCommand(e,t){let n;n=e._isPointLight?"uniform samplerCube shadowMap_textureCube; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n vec2 uv = v_textureCoordinates; \n vec3 dir; \n \n if (uv.y < 0.5) \n { \n if (uv.x < 0.333) \n { \n dir.x = -1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = -1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else \n { \n dir.z = -1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 1.0; \n } \n } \n else \n { \n if (uv.x < 0.333) \n { \n dir.x = 1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = 1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else \n { \n dir.z = 1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 3.0; \n } \n } \n \n float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir)); \n gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n":"uniform sampler2D shadowMap_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n"+(e._usesDepthTexture?" float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r; \n":" float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates)); \n")+" gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n";const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=Pass$1.OVERLAY,i}function updateDebugShadowViewCommand(e,t){const n=t.context,i=t.context.drawingBufferWidth,r=t.context.drawingBufferHeight,o=.3*Math.min(i,r),a=scratchViewport;a.x=i-o,a.y=0,a.width=o,a.height=o;let s=e._debugShadowViewCommand;defined(s)||(s=createDebugShadowViewCommand(e,n),e._debugShadowViewCommand=s),defined(s.renderState)&&BoundingRectangle.equals(s.renderState.viewport,a)||(s.renderState=RenderState.fromCache({viewport:BoundingRectangle.clone(a)})),t.commandList.push(e._debugShadowViewCommand)}const frustumCornersNDC=new Array(8);frustumCornersNDC[0]=new Cartesian4(-1,-1,-1,1),frustumCornersNDC[1]=new Cartesian4(1,-1,-1,1),frustumCornersNDC[2]=new Cartesian4(1,1,-1,1),frustumCornersNDC[3]=new Cartesian4(-1,1,-1,1),frustumCornersNDC[4]=new Cartesian4(-1,-1,1,1),frustumCornersNDC[5]=new Cartesian4(1,-1,1,1),frustumCornersNDC[6]=new Cartesian4(1,1,1,1),frustumCornersNDC[7]=new Cartesian4(-1,1,1,1);const scratchMatrix=new Matrix4,scratchFrustumCorners=new Array(8);for(let e=0;e<8;++e)scratchFrustumCorners[e]=new Cartesian4;function createDebugPointLight(e,t){return new Primitive$3({geometryInstances:[new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-.5,-.5,-.5),maximum:new Cartesian3(.5,.5,.5)}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}}),new GeometryInstance({geometry:new SphereOutlineGeometry({radius:.5}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}})],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const debugOutlineColors=[Color.RED,Color.GREEN,Color.BLUE,Color.MAGENTA],scratchScale=new Cartesian3;function applyDebugSettings(e,t){updateDebugShadowViewCommand(e,t);const n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new DebugCameraPrimitive({camera:e._sceneCamera,color:Color.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new DebugCameraPrimitive({camera:e._passes[i].camera,color:debugOutlineColors[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!defined(e._debugLightFrustum)||e._needsUpdate){const t=e._shadowMapCamera.positionWC,n=Quaternion.IDENTITY,i=2*e._pointLightRadius,r=Cartesian3.fromElements(i,i,i,scratchScale),o=Matrix4.fromTranslationQuaternionRotationScale(t,n,r,scratchMatrix);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=createDebugPointLight(o,Color.YELLOW)}e._debugLightFrustum.update(t)}else defined(e._debugLightFrustum)&&!e._needsUpdate||(e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function ShadowMapCamera(){this.viewMatrix=new Matrix4,this.inverseViewMatrix=new Matrix4,this.frustum=void 0,this.positionCartographic=new Cartographic,this.positionWC=new Cartesian3,this.directionWC=Cartesian3.clone(Cartesian3.UNIT_Z),this.upWC=Cartesian3.clone(Cartesian3.UNIT_Y),this.rightWC=Cartesian3.clone(Cartesian3.UNIT_X),this.viewProjectionMatrix=new Matrix4}ShadowMapCamera.prototype.clone=function(e){Matrix4.clone(e.viewMatrix,this.viewMatrix),Matrix4.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Cartographic.clone(e.positionCartographic,this.positionCartographic),Cartesian3.clone(e.positionWC,this.positionWC),Cartesian3.clone(e.directionWC,this.directionWC),Cartesian3.clone(e.upWC,this.upWC),Cartesian3.clone(e.rightWC,this.rightWC)};const scaleBiasMatrix=new Matrix4(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);ShadowMapCamera.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return Matrix4.multiply(t,e,this.viewProjectionMatrix),Matrix4.multiply(scaleBiasMatrix,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const scratchSplits=new Array(5),scratchFrustum=new PerspectiveFrustum,scratchCascadeDistances=new Array(4),scratchMin=new Cartesian3,scratchMax=new Cartesian3;function computeCascades(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,r=i.frustum.near,o=i.frustum.far,a=e._numberOfCascades;let s;const c=o-r,l=o/r;let u=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,u=.9);const h=scratchCascadeDistances,p=scratchSplits;for(p[0]=r,p[a]=o,s=0;s<a;++s){const e=(s+1)/a,t=r*Math.pow(l,e),n=r+c*e,i=CesiumMath.lerp(n,t,u);p[s+1]=i,h[s]=i-p[s]}if(d){for(s=0;s<a;++s)h[s]=Math.min(h[s],e._maximumCascadeDistances[s]);let t=p[0];for(s=0;s<a-1;++s)t+=h[s],p[s+1]=t}Cartesian4.unpack(p,0,e._cascadeSplits[0]),Cartesian4.unpack(p,1,e._cascadeSplits[1]),Cartesian4.unpack(h,0,e._cascadeDistances);const f=n.frustum,m=f.left,g=f.right,_=f.bottom,y=f.top,C=f.near,T=f.far,S=n.positionWC,A=n.directionWC,v=n.upWC,E=i.frustum.clone(scratchFrustum),b=n.getViewProjection();for(s=0;s<a;++s){E.near=p[s],E.far=p[s+1];const t=Matrix4.multiply(E.projectionMatrix,i.viewMatrix,scratchMatrix),r=Matrix4.inverse(t,scratchMatrix),o=Matrix4.multiply(b,r,scratchMatrix),a=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),c=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax);for(let e=0;e<8;++e){const t=Cartesian4.clone(frustumCornersNDC[e],scratchFrustumCorners[e]);Matrix4.multiplyByVector(o,t,t),Cartesian3.divideByScalar(t,t.w,t),Cartesian3.minimumByComponent(t,a,a),Cartesian3.maximumByComponent(t,c,c)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0),a.z=0,c.x=Math.min(c.x,1),c.y=Math.min(c.y,1),c.z=Math.min(c.z,1);const l=e._passes[s],u=l.camera;u.clone(n);const d=u.frustum;d.left=m+a.x*(g-m),d.right=m+c.x*(g-m),d.bottom=_+a.y*(y-_),d.top=_+c.y*(y-_),d.near=C+a.z*(T-C),d.far=C+c.z*(T-C),l.cullingVolume=u.frustum.computeCullingVolume(S,A,v);const h=e._cascadeMatrices[s];Matrix4.multiply(u.getViewProjection(),i.inverseViewMatrix,h),Matrix4.multiply(l.textureOffsets,h,h)}}const scratchLightView=new Matrix4,scratchRight$1=new Cartesian3,scratchUp$1=new Cartesian3,scratchTranslation=new Cartesian3;function fitShadowMapToScene(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,r=Matrix4.multiply(i.frustum.projectionMatrix,i.viewMatrix,scratchMatrix),o=Matrix4.inverse(r,scratchMatrix),a=n.directionWC;let s=i.directionWC;Cartesian3.equalsEpsilon(a,s,CesiumMath.EPSILON10)&&(s=i.upWC);const c=Cartesian3.cross(a,s,scratchRight$1);s=Cartesian3.cross(c,a,scratchUp$1),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c);const l=Cartesian3.fromElements(0,0,0,scratchTranslation);let u=Matrix4.computeView(l,a,s,c,scratchLightView);const d=Matrix4.multiply(u,o,scratchMatrix),h=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin),p=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax);for(let e=0;e<8;++e){const t=Cartesian4.clone(frustumCornersNDC[e],scratchFrustumCorners[e]);Matrix4.multiplyByVector(d,t,t),Cartesian3.divideByScalar(t,t.w,t),Cartesian3.minimumByComponent(t,h,h),Cartesian3.maximumByComponent(t,p,p)}p.z+=1e3,h.z-=10;const f=scratchTranslation;f.x=-.5*(h.x+p.x),f.y=-.5*(h.y+p.y),f.z=-p.z;const m=Matrix4.fromTranslation(f,scratchMatrix);u=Matrix4.multiply(m,u,u);const g=.5*(p.x-h.x),_=.5*(p.y-h.y),y=p.z-h.z,C=n.frustum;C.left=-g,C.right=g,C.bottom=-_,C.top=_,C.near=.01,C.far=y,Matrix4.clone(u,n.viewMatrix),Matrix4.inverse(u,n.inverseViewMatrix),Matrix4.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),Cartesian3.clone(a,n.directionWC),Cartesian3.clone(s,n.upWC),Cartesian3.clone(c,n.rightWC)}const directions=[new Cartesian3(-1,0,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(0,1,0),new Cartesian3(0,0,1)],ups=[new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(0,-1,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,1),new Cartesian3(0,-1,0)],rights=[new Cartesian3(0,0,1),new Cartesian3(1,0,0),new Cartesian3(-1,0,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(1,0,0)];function computeOmnidirectional(e,t){const n=new PerspectiveFrustum;n.fov=CesiumMath.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const r=e._passes[i].camera;r.positionWC=e._shadowMapCamera.positionWC,r.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(r.positionWC,r.positionCartographic),r.directionWC=directions[i],r.upWC=ups[i],r.rightWC=rights[i],Matrix4.computeView(r.positionWC,r.directionWC,r.upWC,r.rightWC,r.viewMatrix),Matrix4.inverse(r.viewMatrix,r.inverseViewMatrix),r.frustum=n}}const scratchCartesian1=new Cartesian3,scratchCartesian2=new Cartesian3,scratchBoundingSphere=new BoundingSphere,scratchCenter$1=scratchBoundingSphere.center;function checkVisibility(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,r=scratchBoundingSphere;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance)return e._outOfView=!0,void(e._needsUpdate=!1);const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,scratchCartesian1),o=Cartesian3.negate(i.directionWC,scratchCartesian2),a=Cartesian3.dot(r,o);if(e.fadingEnabled){const t=CesiumMath.clamp(a/.1,0,1);e._darkness=CesiumMath.lerp(1,e.darkness,t)}else e._darkness=e.darkness;if(a<0)return e._outOfView=!0,void(e._needsUpdate=!1);e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)r.center=i.positionWC,r.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(r)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(r),BoundingSphere.clone(r,e._boundingSphere);else{const n=i.frustum.far/2,o=Cartesian3.add(i.positionWC,Cartesian3.multiplyByScalar(i.directionWC,n,scratchCenter$1),scratchCenter$1);r.center=o,r.radius=n,e._outOfView=t.cullingVolume.computeVisibility(r)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(r),BoundingSphere.clone(r,e._boundingSphere)}}function updateCameras(e,t){const n=t.camera,i=e._lightCamera,r=e._sceneCamera,o=e._shadowMapCamera;e._cascadesEnabled?Cartesian3.clone(i.directionWC,o.directionWC):e._isPointLight?Cartesian3.clone(i.positionWC,o.positionWC):o.clone(i);const a=e._lightDirectionEC;let s,c;Matrix4.multiplyByPointAsVector(n.viewMatrix,o.directionWC,a),Cartesian3.normalize(a,a),Cartesian3.negate(a,a),Matrix4.multiplyByPoint(n.viewMatrix,o.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius,e._fitNearFar?(s=Math.min(t.shadowState.nearPlane,e.maximumDistance),c=Math.min(t.shadowState.farPlane,e.maximumDistance),c=Math.max(c,s+1)):(s=n.frustum.near,c=e.maximumDistance),e._sceneCamera=Camera.clone(n,r),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=s,e._sceneCamera.frustum.far=c,e._distance=c-s,checkVisibility(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}ShadowMap.prototype.update=function(e){if(updateCameras(this,e),this._needsUpdate)if(updateFramebuffer(this,e.context),this._isPointLight&&computeOmnidirectional(this,e),this._cascadesEnabled&&(fitShadowMapToScene(this,e),this._numberOfCascades>1&&computeCascades(this,e)),this._isPointLight)this._shadowMapCullingVolume=CullingVolume.fromBoundingSphere(this._boundingSphere);else{const e=this._shadowMapCamera,t=e.positionWC,n=e.directionWC,i=e.upWC;this._shadowMapCullingVolume=e.frustum.computeCullingVolume(t,n,i),1===this._passes.length&&this._passes[0].camera.clone(e)}if(1===this._passes.length){const e=this._sceneCamera.inverseViewMatrix;Matrix4.multiply(this._shadowMapCamera.getViewProjection(),e,this._shadowMapMatrix)}this.debugShow&&applyDebugSettings(this,e)},ShadowMap.prototype.updatePass=function(e,t){clearFramebuffer(this,e,t)};const scratchTexelStepSize=new Cartesian2;function combineUniforms(e,t,n){const i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias;return combine$2(t,{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){const t=scratchTexelStepSize;return t.x=1/e._textureSize.x,t.y=1/e._textureSize.y,Cartesian4.fromElements(t.x,t.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return Cartesian4.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new Cartesian4,combinedUniforms2:new Cartesian4},!1)}function createCastDerivedCommand(e,t,n,i,r,o){let a,s,c;if(defined(o)&&(a=o.shaderProgram,s=o.renderState,c=o.uniformMap),(o=DrawCommand.shallowClone(n,o)).castShadows=!0,o.receiveShadows=!1,!defined(a)||r!==n.shaderProgram.id||t){const t=n.shaderProgram,r=n.pass===Pass$1.GLOBE,o=n.pass!==Pass$1.TRANSLUCENT,l=e._isPointLight,u=e._usesDepthTexture,d=ShadowMapShader.getShadowCastShaderKeyword(l,r,u,o);if(a=i.shaderCache.getDerivedShaderProgram(t,d),!defined(a)){const e=t.vertexShaderSource,n=t.fragmentShaderSource,s=ShadowMapShader.createShadowCastVertexShader(e,l,r),c=ShadowMapShader.createShadowCastFragmentShader(n,l,u,o);a=i.shaderCache.createDerivedShaderProgram(t,d,{vertexShaderSource:s,fragmentShaderSource:c,attributeLocations:t._attributeLocations})}s=e._primitiveRenderState,l?s=e._pointRenderState:r&&(s=e._terrainRenderState);n.renderState.cull.enabled||(s=clone$1(s,!1),s.cull=clone$1(s.cull,!1),s.cull.enabled=!1,s=RenderState.fromCache(s)),c=combineUniforms(e,n.uniformMap,r)}return o.shaderProgram=a,o.renderState=s,o.uniformMap=c,o}ShadowMap.createReceiveDerivedCommand=function(e,t,n,i,r){defined(r)||(r={});const o=e.length>0,a=t.shaderProgram,s=a.vertexShaderSource,c=a.fragmentShaderSource,l=t.pass===Pass$1.GLOBE;let u=!1;if(l&&(u=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&o){let o,d;defined(r.receiveCommand)&&(o=r.receiveCommand.shaderProgram,d=r.receiveCommand.uniformMap),r.receiveCommand=DrawCommand.shallowClone(t,r.receiveCommand),r.castShadows=!1,r.receiveShadows=!0;const h=r.receiveShaderCastShadows!==t.castShadows,p=r.receiveShaderProgramId!==t.shaderProgram.id;if(!defined(o)||p||n||h){const n=ShadowMapShader.getShadowReceiveShaderKeyword(e[0],t.castShadows,l,u);if(o=i.shaderCache.getDerivedShaderProgram(a,n),!defined(o)){const r=ShadowMapShader.createShadowReceiveVertexShader(s,l,u),d=ShadowMapShader.createShadowReceiveFragmentShader(c,e[0],t.castShadows,l,u);o=i.shaderCache.createDerivedShaderProgram(a,n,{vertexShaderSource:r,fragmentShaderSource:d,attributeLocations:a._attributeLocations})}d=combineUniforms(e[0],t.uniformMap,l)}r.receiveCommand.shaderProgram=o,r.receiveCommand.uniformMap=d,r.receiveShaderProgramId=t.shaderProgram.id,r.receiveShaderCastShadows=t.castShadows}return r},ShadowMap.createCastDerivedCommand=function(e,t,n,i,r){if(defined(r)||(r={}),t.castShadows){let o=r.castCommands;defined(o)||(o=r.castCommands=[]);const a=r.castShaderProgramId,s=e.length;o.length=s;for(let r=0;r<s;++r)o[r]=createCastDerivedCommand(e[r],n,t,i,a,o[r]);r.castShaderProgramId=t.shaderProgram.id}return r},ShadowMap.prototype.isDestroyed=function(){return!1},ShadowMap.prototype.destroy=function(){destroyFramebuffer(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return destroyObject(this)};var CompareAndPackTranslucentDepth="uniform sampler2D u_opaqueDepthTexture;\nuniform sampler2D u_translucentDepthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;\nfloat translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;\ntranslucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);\ngl_FragColor = czm_packDepth(translucentDepth);\n}\n",CompositeTranslucentClassification="uniform sampler2D colorTexture;\n#ifdef DEBUG_SHOW_DEPTH\nuniform sampler2D u_packedTranslucentDepth;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n#ifdef DEBUG_SHOW_DEPTH\nif (v_textureCoordinates.x < 0.5)\n{\ngl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));\ngl_FragColor.a = 1.0;\n}\n#else\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef PICK\nif (color == vec4(0.0))\n{\ndiscard;\n}\n#else\ncolor.rgb /= color.a;\n#endif\ngl_FragColor = color;\n#endif\n}\n";function TranslucentTileClassification(e){this._drawClassificationFBO=new FramebufferManager({createDepthAttachments:!1}),this._accumulationFBO=new FramebufferManager({createDepthAttachments:!1}),this._packFBO=new FramebufferManager,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ClearCommand({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new BoundingRectangle,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}function destroyTextures(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function destroyFramebuffers(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function updateTextures(e,t,n,i){destroyTextures(e),e._translucentDepthStencilTexture=new Texture({context:t,width:n,height:i,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:Sampler.NEAREST})}function updateFramebuffers$1(e,t,n,i){destroyFramebuffers(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}function updateResources(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i.depthStencilTexture;const r=e._opaqueDepthStencilTexture.width,o=e._opaqueDepthStencilTexture.height;let a,s;if(e._drawClassificationFBO.isDirty(r,o)&&(updateTextures(e,t,r,o),updateFramebuffers$1(e,t,r,o)),defined(e._packDepthCommand)||(a=new ShaderSource({sources:[CompareAndPackTranslucentDepth]}),s={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),!defined(e._compositeCommand)){a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e});const n=e._compositeCommand,i=n.shaderProgram,r=t.shaderCache.createDerivedShaderProgram(i,"pick",{vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:new ShaderSource({sources:a.sources,defines:["PICK"]}),attributeLocations:i._attributeLocations}),o=DrawCommand.shallowClone(n);o.shaderProgram=r,n.derivedCommands.pick=o}defined(e._copyCommand)||(a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),defined(e._accumulateCommand)||(a=new ShaderSource({sources:[CompositeTranslucentClassification]}),s={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(a,{uniformMap:s,owner:e})),e._viewport.width=r,e._viewport.height=o;const c=!BoundingRectangle.equals(e._viewport,n.viewport);let l=c!==e._useScissorTest;e._useScissorTest=c,BoundingRectangle.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=BoundingRectangle.clone(n.viewport,e._scissorRectangle),l=!0),defined(e._rsDepth)&&BoundingRectangle.equals(e._viewport,e._rsDepth.viewport)&&!l||(e._rsDepth=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),defined(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),defined(e._rsAccumulate)&&BoundingRectangle.equals(e._viewport,e._rsAccumulate.viewport)&&!l||(e._rsAccumulate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,reference:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),defined(e._rsComp)&&BoundingRectangle.equals(e._viewport,e._rsComp.viewport)&&!l||(e._rsComp=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND})),defined(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}function clear(e,t,n){if(!e._hasTranslucentDepth)return;const i=n.framebuffer;n.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,n),n.framebuffer=i,e._frustumsDrawn>1&&(n.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,n)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}function CommandExtent(){this.command=void 0,this.near=void 0,this.far=void 0}function View(e,t,n){const i=e.context;let r,o;i.depthTexture&&(r=new GlobeDepth),e._useOIT&&i.depthTexture&&(o=new OIT(i));const a=new PassState(i);a.viewport=BoundingRectangle.clone(n),this.camera=t,this._cameraClone=Camera.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=a,this.pickFramebuffer=new PickFramebuffer(i),this.pickDepthFramebuffer=new PickDepthFramebuffer,this.sceneFramebuffer=new SceneFramebuffer,this.globeDepth=r,this.globeTranslucencyFramebuffer=new GlobeTranslucencyFramebuffer,this.oit=o,this.translucentTileClassification=new TranslucentTileClassification(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}Object.defineProperties(TranslucentTileClassification.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}}),TranslucentTileClassification.prototype.executeTranslucentCommands=function(e,t,n,i,r){const o=i.length;let a,s;const c=e.frameState.useLogDepth,l=e.context,u=n.framebuffer;for(s=0;s<o;++s)if(a=i[s],a=c?a.derivedCommands.logDepth.command:a,a.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(updateResources(this,l,n,r),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(l,n),s=0;s<o;++s){if(a=i[s],a=c?a.derivedCommands.logDepth.command:a,!a.depthForTranslucentClassification)continue;t(a.derivedCommands.depth.depthOnlyCommand,e,l,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(l,n)),n.framebuffer=u}},TranslucentTileClassification.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const r=e.context,o=r.uniformState,a=n.framebuffer;2===this._frustumsDrawn&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(r,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(r,n),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION);const s=o.globeDepthTexture;o.globeDepthTexture=this._packFBO.getColorTexture();const c=i.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],l=i.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION];for(let i=0;i<l;++i)t(c[i],e,r,n);o.globeDepthTexture=s,n.framebuffer=a,1!==this._frustumsDrawn&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(r,n),n.framebuffer=a)},TranslucentTileClassification.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;1===this._frustumsDrawn?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture();(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),clear(this,e,t)},TranslucentTileClassification.prototype.isSupported=function(){return this._supported},TranslucentTileClassification.prototype.isDestroyed=function(){return!1},TranslucentTileClassification.prototype.destroy=function(){return destroyTextures(this),destroyFramebuffers(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),destroyObject(this)};const scratchPosition0=new Cartesian3,scratchPosition1=new Cartesian3;function maxComponent(e,t){const n=Math.max(Math.abs(e.x),Math.abs(t.x)),i=Math.max(Math.abs(e.y),Math.abs(t.y)),r=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),r)}function cameraEqual(e,t,n){const i=1/Math.max(1,maxComponent(e.position,t.position));return Cartesian3.multiplyByScalar(e.position,i,scratchPosition0),Cartesian3.multiplyByScalar(t.position,i,scratchPosition1),Cartesian3.equalsEpsilon(scratchPosition0,scratchPosition1,n)&&Cartesian3.equalsEpsilon(e.direction,t.direction,n)&&Cartesian3.equalsEpsilon(e.up,t.up,n)&&Cartesian3.equalsEpsilon(e.right,t.right,n)&&Matrix4.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}function updateFrustums(e,t,n,i){const r=t.frameState,o=r.camera,a=r.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,s=t.mode===SceneMode$1.SCENE2D,c=t.nearToFarDistance2D;let l;i*=1+CesiumMath.EPSILON2,n=Math.min(Math.max(n,o.frustum.near),o.frustum.far),i=Math.max(Math.min(i,o.frustum.far),n),s?(i=Math.min(i,o.position.z+t.nearToFarDistance2D),n=Math.min(n,i),l=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):l=Math.ceil(Math.log(i/n)/Math.log(a));const u=e.frustumCommandsList;u.length=l;for(let e=0;e<l;++e){let t,r;s?(t=Math.min(i-c,n+e*c),r=Math.min(i,t+c)):(t=Math.max(n,Math.pow(a,e)*n),r=Math.min(i,a*t));let o=u[e];defined(o)?(o.near=t,o.far=r):o=u[e]=new FrustumCommands(t,r)}}function insertIntoBin(e,t,n,i,r){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const o=e.frustumCommandsList,a=o.length;for(let e=0;e<a;++e){const a=o[e],s=a.near;if(i>a.far)continue;if(r<s)break;const c=n.pass,l=a.indices[c]++;if(a.commands[c][l]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<e),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const t=e.debugFrustumStatistics.commandsInFrustums;t[n.debugOverlappingFrustums]=defined(t[n.debugOverlappingFrustums])?t[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}View.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return cameraEqual(t,n,CesiumMath.EPSILON15)?(this._cameraStartFired&&getTimestamp$1()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=getTimestamp$1(),Camera.clone(t,n),!0)};const scratchCullingVolume$1=new CullingVolume,scratchNearFarInterval=new Interval;View.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,n=t.camera,i=n.directionWC,r=n.positionWC,o=e._computeCommandList,a=e._overlayCommandList,s=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const c=this.frustumCommandsList,l=c.length,u=Pass$1.NUMBER_OF_PASSES;for(let e=0;e<l;++e)for(let t=0;t<u;++t)c[e].indices[t]=0;o.length=0,a.length=0;const d=this._commandExtents,h=d.length;let p=0,f=+Number.MAX_VALUE,m=-Number.MAX_VALUE;const g=t.shadowState.shadowsEnabled;let _=+Number.MAX_VALUE,y=-Number.MAX_VALUE,C=Number.MAX_VALUE;const T=t.mode===SceneMode$1.SCENE3D?t.occluder:void 0;let S=t.cullingVolume;const A=scratchCullingVolume$1.planes;for(let e=0;e<5;++e)A[e]=S.planes[e];S=scratchCullingVolume$1;const v=s.length;for(let t=0;t<v;++t){const c=s[t],l=c.pass;if(l===Pass$1.COMPUTE)o.push(c);else if(l===Pass$1.OVERLAY)a.push(c);else{let t,o;const a=c.boundingVolume;if(defined(a)){if(!e.isVisible(c,S,T))continue;const n=a.computePlaneDistances(r,i,scratchNearFarInterval);if(t=n.start,o=n.stop,f=Math.min(f,t),m=Math.max(m,o),g&&c.receiveShadows&&t<ShadowMap.MAXIMUM_DISTANCE&&!(l===Pass$1.GLOBE&&t<-100&&o>100)){const e=o-t;l!==Pass$1.GLOBE&&t<100&&(C=Math.min(C,e)),_=Math.min(_,t),y=Math.max(y,o)}}else c instanceof ClearCommand?(t=n.frustum.near,o=n.frustum.far):(t=n.frustum.near,o=n.frustum.far,f=Math.min(f,t),m=Math.max(m,o));let s=d[p];defined(s)||(s=d[p]=new CommandExtent),s.command=c,s.near=t,s.far=o,p++}}let E,b;for(g&&(_=Math.min(Math.max(_,n.frustum.near),n.frustum.far),y=Math.max(Math.min(y,n.frustum.far),_)),g&&(t.shadowState.nearPlane=_,t.shadowState.farPlane=y,t.shadowState.closestObjectSize=C),updateFrustums(this,e,f,m),E=0;E<p;E++)b=d[E],insertIntoBin(this,e,b.command,b.near,b.far);if(p<h)for(E=p;E<h&&(b=d[E],defined(b.command));E++)b.command=void 0;const x=c.length,P=t.frustumSplits;P.length=x+1;for(let e=0;e<x;++e)P[e]=c[e].near,e===x-1&&(P[e+1]=c[e].far)},View.prototype.destroy=function(){let e;this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const offscreenDefaultWidth=.1,mostDetailedPreloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PRELOAD}),mostDetailedPickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PICK}),pickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PICK});function Picking(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new BoundingRectangle(0,0,1,1),n=new Camera(e);n.frustum=new OrthographicFrustum({width:offscreenDefaultWidth,aspectRatio:1,near:.1}),this._pickOffscreenView=new View(e,n,t)}Picking.prototype.update=function(){this._pickPositionCacheDirty=!0},Picking.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return defined(i)||(i=new PickDepth,n[t]=i),i};const scratchOrthoPickingFrustum=new OrthographicOffCenterFrustum,scratchOrthoOrigin=new Cartesian3,scratchOrthoDirection=new Cartesian3,scratchOrthoPixelSize=new Cartesian2,scratchOrthoPickVolumeMatrix4=new Matrix4;function getPickOrthographicCullingVolume(e,t,n,i,r){const o=e.camera;let a=o.frustum;defined(a._offCenterFrustum)&&(a=a._offCenterFrustum);let s=2*(t.x-r.x)/r.width-1;s*=.5*(a.right-a.left);let c=2*(r.height-t.y-r.y)/r.height-1;c*=.5*(a.top-a.bottom);const l=Matrix4.clone(o.transform,scratchOrthoPickVolumeMatrix4);o._setTransform(Matrix4.IDENTITY);const u=Cartesian3.clone(o.position,scratchOrthoOrigin);Cartesian3.multiplyByScalar(o.right,s,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),Cartesian3.multiplyByScalar(o.up,c,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),o._setTransform(l),e.mode===SceneMode$1.SCENE2D&&Cartesian3.fromElements(u.z,u.x,u.y,u);const d=a.getPixelDimensions(r.width,r.height,1,1,scratchOrthoPixelSize),h=scratchOrthoPickingFrustum;return h.right=.5*d.x,h.left=-h.right,h.top=.5*d.y,h.bottom=-h.top,h.near=a.near,h.far=a.far,h.computeCullingVolume(u,o.directionWC,o.upWC)}const scratchPerspPickingFrustum=new PerspectiveOffCenterFrustum,scratchPerspPixelSize=new Cartesian2;function getPickPerspectiveCullingVolume(e,t,n,i,r){const o=e.camera,a=o.frustum,s=a.near,c=Math.tan(.5*a.fovy),l=a.aspectRatio*c,u=(2*(t.x-r.x)/r.width-1)*s*l,d=(2*(r.height-t.y-r.y)/r.height-1)*s*c,h=a.getPixelDimensions(r.width,r.height,1,1,scratchPerspPixelSize),p=h.x*n*.5,f=h.y*i*.5,m=scratchPerspPickingFrustum;return m.top=d+f,m.bottom=d-f,m.right=u+p,m.left=u-p,m.near=s,m.far=a.far,m.computeCullingVolume(o.positionWC,o.directionWC,o.upWC)}function getPickCullingVolume(e,t,n,i,r){const o=e.camera.frustum;return o instanceof OrthographicFrustum||o instanceof OrthographicOffCenterFrustum?getPickOrthographicCullingVolume(e,t,n,i,r):getPickPerspectiveCullingVolume(e,t,n,i,r)}let scratchRectangleWidth=3,scratchRectangleHeight=3,scratchRectangle=new BoundingRectangle(0,0,scratchRectangleWidth,scratchRectangleHeight);const scratchPosition=new Cartesian2,scratchColorZero=new Color(0,0,0,0);function renderTranslucentDepthForPick(e,t){const n=e.context,i=e.frameState,r=e.environmentState,o=e.defaultView;e.view=o;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;let s=o.passState;s.viewport=BoundingRectangle.clone(a,s.viewport),e.clearPasses(i.passes),i.passes.pick=!0,i.passes.depth=!0,i.cullingVolume=getPickCullingVolume(e,t,1,1,a),i.tilesetPassState=pickTilesetPassState,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,s=o.pickDepthFramebuffer.update(n,t,a),e.updateAndExecuteCommands(s,scratchColorZero),e.resolveFramebuffers(s),n.endFrame()}Picking.prototype.pick=function(e,t,n,i){scratchRectangleWidth=defaultValue(n,3),scratchRectangleHeight=defaultValue(i,scratchRectangleWidth);const r=e.context,o=r.uniformState,a=e.frameState,s=e.defaultView;e.view=s;const c=s.viewport;c.x=0,c.y=0,c.width=r.drawingBufferWidth,c.height=r.drawingBufferHeight;let l=s.passState;l.viewport=BoundingRectangle.clone(c,l.viewport);const u=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition);e.jobScheduler.disableThisFrame(),e.updateFrameState(),a.cullingVolume=getPickCullingVolume(e,u,scratchRectangleWidth,scratchRectangleHeight,c),a.invertClassification=!1,a.passes.pick=!0,a.tilesetPassState=pickTilesetPassState,o.update(a),e.updateEnvironment(),scratchRectangle.x=u.x-.5*(scratchRectangleWidth-1),scratchRectangle.y=e.drawingBufferHeight-u.y-.5*(scratchRectangleHeight-1),scratchRectangle.width=scratchRectangleWidth,scratchRectangle.height=scratchRectangleHeight,l=s.pickFramebuffer.begin(scratchRectangle,s.viewport),e.updateAndExecuteCommands(l,scratchColorZero),e.resolveFramebuffers(l);const d=s.pickFramebuffer.end(scratchRectangle);return r.endFrame(),d};const scratchPerspectiveFrustum$1=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum$1=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum$1=new OrthographicFrustum,scratchOrthographicOffCenterFrustum$1=new OrthographicOffCenterFrustum;Picking.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return Cartesian3.clone(this._pickPositionCache[i],n);const r=e.frameState,o=e.context,a=o.uniformState,s=e.defaultView;e.view=s;const c=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition);e.pickTranslucentDepth?renderTranslucentDepthForPick(e,c):(e.updateFrameState(),a.update(r),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;const l=e.camera;let u;u=defined(l.frustum.fov)?l.frustum.clone(scratchPerspectiveFrustum$1):defined(l.frustum.infiniteProjectionMatrix)?l.frustum.clone(scratchPerspectiveOffCenterFrustum$1):defined(l.frustum.width)?l.frustum.clone(scratchOrthographicFrustum$1):l.frustum.clone(scratchOrthographicOffCenterFrustum$1);const d=s.frustumCommandsList,h=d.length;for(let t=0;t<h;++t){const s=this.getPickDepth(e,t).getDepth(o,c.x,c.y);if(defined(s)&&(s>0&&s<1)){const o=d[t];let h;return e.mode===SceneMode$1.SCENE2D?(h=l.position.z,l.position.z=h-o.near+1,u.far=Math.max(1,o.far-o.near),u.near=1,a.update(r),a.updateFrustum(u)):(u.near=o.near*(0!==t?e.opaqueFrustumNearOffset:1),u.far=o.far,a.updateFrustum(u)),n=SceneTransforms.drawingBufferToWgs84Coordinates(e,c,s,n),e.mode===SceneMode$1.SCENE2D&&(l.position.z=h,a.update(r)),this._pickPositionCache[i]=Cartesian3.clone(n),n}}this._pickPositionCache[i]=void 0};const scratchPickPositionCartographic=new Cartographic;function drillPick(e,t){let n,i;const r=[],o=[],a=[],s=[];defined(e)||(e=Number.MAX_VALUE);let c=t();for(;defined(c);){const n=c.object,l=c.position,u=c.exclude;if(defined(l)&&!defined(n)){r.push(c);break}if(!defined(n)||!defined(n.primitive))break;if(!u&&(r.push(c),0>=--e))break;const d=n.primitive;let h=!1;"function"==typeof d.getGeometryInstanceAttributes&&defined(n.id)&&(i=d.getGeometryInstanceAttributes(n.id),defined(i)&&defined(i.show)&&(h=!0,i.show=ShowGeometryInstanceAttribute.toValue(!1,i.show),a.push(i))),n instanceof Cesium3DTileFeature&&(h=!0,n.show=!1,s.push(n)),h||(d.show=!1,o.push(d)),c=t()}for(n=0;n<o.length;++n)o[n].show=!0;for(n=0;n<a.length;++n)i=a[n],i.show=ShowGeometryInstanceAttribute.toValue(!0,i.show);for(n=0;n<s.length;++n)s[n].show=!0;return r}Picking.prototype.pickPosition=function(e,t,n){if(defined(n=this.pickPositionWorldCoordinates(e,t,n))&&e.mode!==SceneMode$1.SCENE3D){Cartesian3.fromElements(n.y,n.z,n.x,n);const t=e.mapProjection,i=t.ellipsoid,r=t.unproject(n,scratchPickPositionCartographic);i.cartographicToCartesian(r,n)}return n},Picking.prototype.drillPick=function(e,t,n,i,r){const o=this,a=drillPick(n,(function(){const n=o.pick(e,t,i,r);if(defined(n))return{object:n,position:void 0,exclude:!1}}));return a.map((function(e){return e.object}))};const scratchRight=new Cartesian3,scratchUp=new Cartesian3;function MostDetailedRayPick(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1,this.deferred=when.defer(),this.promise=this.deferred.promise}function updateOffscreenCameraFromRay(e,t,n,i){const r=t.direction,o=Cartesian3.mostOrthogonalAxis(r,scratchRight),a=Cartesian3.cross(r,o,scratchRight),s=Cartesian3.cross(r,a,scratchUp);return i.position=t.origin,i.direction=r,i.up=s,i.right=a,i.frustum.width=defaultValue(n,offscreenDefaultWidth),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function updateMostDetailedRayPick(e,t,n){const i=t.frameState,r=n.ray,o=n.width,a=n.tilesets,s=e._pickOffscreenView.camera,c=updateOffscreenCameraFromRay(e,r,o,s),l=mostDetailedPreloadTilesetPassState;l.camera=s,l.cullingVolume=c;let u=!0;const d=a.length;for(let e=0;e<d;++e){const n=a[e];n.show&&t.primitives.contains(n)&&(n.updateForPass(i,l),u=u&&l.ready)}return u&&n.deferred.resolve(),u}function getTilesets(e,t,n){const i=e.length;for(let r=0;r<i;++r){const i=e.get(r);i.show&&(defined(i.isCesium3DTileset)?defined(t)&&-1!==t.indexOf(i)||n.push(i):i instanceof PrimitiveCollection&&getTilesets(i,t,n))}}function launchMostDetailedRayPick(e,t,n,i,r,o){const a=[];if(getTilesets(t.primitives,i,a),0===a.length)return when.resolve(o());const s=new MostDetailedRayPick(n,r,a);return e._mostDetailedRayPicks.push(s),s.promise.then((function(){return o()}))}function isExcluded(e,t){return!(!defined(e)||!defined(t)||0===t.length)&&(t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1)}function getRayIntersection(e,t,n,i,r,o,a){const s=t.context,c=s.uniformState,l=t.frameState,u=e._pickOffscreenView;t.view=u,updateOffscreenCameraFromRay(e,n,r,u.camera),scratchRectangle=BoundingRectangle.clone(u.viewport,scratchRectangle);const d=u.pickFramebuffer.begin(scratchRectangle,u.viewport);let h;t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,l.tilesetPassState=a?mostDetailedPickTilesetPassState:pickTilesetPassState,c.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(d,scratchColorZero),t.resolveFramebuffers(d);const p=u.pickFramebuffer.end(scratchRectangle);if(t.context.depthTexture){const i=u.frustumCommandsList.length;for(let r=0;r<i;++r){const i=e.getPickDepth(t,r).getDepth(s,0,0);if(defined(i)&&(i>0&&i<1)){const e=u.frustumCommandsList[r],o=e.near*(0!==r?t.opaqueFrustumNearOffset:1),a=o+i*(e.far-o);h=Ray.getPoint(n,a);break}}}if(t.view=t.defaultView,s.endFrame(),defined(p)||defined(h))return{object:p,position:h,exclude:!defined(h)&&o||isExcluded(p,i)}}function getRayIntersections(e,t,n,i,r,o,a,s){return drillPick(i,(function(){return getRayIntersection(e,t,n,r,o,a,s)}))}function pickFromRay(e,t,n,i,r,o,a){const s=getRayIntersections(e,t,n,1,i,r,o,a);if(s.length>0)return s[0]}function drillPickFromRay(e,t,n,i,r,o,a,s){return getRayIntersections(e,t,n,i,r,o,a,s)}function deferPromiseUntilPostRender(e,t){const n=when.defer();return t.then((function(t){const i=e.postRender.addEventListener((function(){n.resolve(t),i()}));e.requestRender()})).otherwise((function(e){n.reject(e)})),n.promise}Picking.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)updateMostDetailedRayPick(this,e,t[n])&&t.splice(n--,1)},Picking.prototype.pickFromRay=function(e,t,n,i){return pickFromRay(this,e,t,n,i,!1,!1)},Picking.prototype.drillPickFromRay=function(e,t,n,i,r){return drillPickFromRay(this,e,t,n,i,r,!1,!1)},Picking.prototype.pickFromRayMostDetailed=function(e,t,n,i){const r=this;return t=Ray.clone(t),n=defined(n)?n.slice():n,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(r,e,t,n,i,(function(){return pickFromRay(r,e,t,n,i,!1,!0)})))},Picking.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,r){const o=this;return t=Ray.clone(t),i=defined(i)?i.slice():i,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(o,e,t,i,r,(function(){return drillPickFromRay(o,e,t,n,i,r,!1,!0)})))};const scratchSurfacePosition=new Cartesian3,scratchSurfaceNormal$1=new Cartesian3,scratchSurfaceRay=new Ray,scratchCartographic$1=new Cartographic;function getRayForSampleHeight(e,t){const n=e.globe,i=defined(n)?n.ellipsoid:e.mapProjection.ellipsoid,r=ApproximateTerrainHeights._defaultMaxTerrainHeight,o=i.geodeticSurfaceNormalCartographic(t,scratchSurfaceNormal$1),a=Cartographic.toCartesian(t,i,scratchSurfacePosition),s=scratchSurfaceRay;s.origin=a,s.direction=o;const c=new Ray;return Ray.getPoint(s,r,c.origin),Cartesian3.negate(o,c.direction),c}function getRayForClampToHeight(e,t){const n=e.globe,i=defined(n)?n.ellipsoid:e.mapProjection.ellipsoid;return getRayForSampleHeight(e,Cartographic.fromCartesian(t,i,scratchCartographic$1))}function getHeightFromCartesian(e,t){const n=e.globe,i=defined(n)?n.ellipsoid:e.mapProjection.ellipsoid;return Cartographic.fromCartesian(t,i,scratchCartographic$1).height}function sampleHeightMostDetailed(e,t,n,i,r){const o=getRayForSampleHeight(t,n);return launchMostDetailedRayPick(e,t,o,i,r,(function(){const n=pickFromRay(e,t,o,i,r,!0,!0);if(defined(n))return getHeightFromCartesian(t,n.position)}))}function clampToHeightMostDetailed(e,t,n,i,r,o){const a=getRayForClampToHeight(t,n);return launchMostDetailedRayPick(e,t,a,i,r,(function(){const n=pickFromRay(e,t,a,i,r,!0,!0);if(defined(n))return Cartesian3.clone(n.position,o)}))}Picking.prototype.sampleHeight=function(e,t,n,i){const r=pickFromRay(this,e,getRayForSampleHeight(e,t),n,i,!0,!1);if(defined(r))return getHeightFromCartesian(e,r.position)},Picking.prototype.clampToHeight=function(e,t,n,i,r){const o=pickFromRay(this,e,getRayForClampToHeight(e,t),n,i,!0,!1);if(defined(o))return Cartesian3.clone(o.position,r)},Picking.prototype.sampleHeightMostDetailed=function(e,t,n,i){n=defined(n)?n.slice():n;const r=t.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=sampleHeightMostDetailed(this,e,t[a],n,i);return deferPromiseUntilPostRender(e,when.all(o).then((function(e){const n=e.length;for(let i=0;i<n;++i)t[i].height=e[i];return t})))},Picking.prototype.clampToHeightMostDetailed=function(e,t,n,i){n=defined(n)?n.slice():n;const r=t.length,o=new Array(r);for(let a=0;a<r;++a)o[a]=clampToHeightMostDetailed(this,e,t[a],n,i,t[a]);return deferPromiseUntilPostRender(e,when.all(o).then((function(e){const n=e.length;for(let i=0;i<n;++i)t[i]=e[i];return t})))},Picking.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const PostProcessStageSampleMode={NEAREST:0,LINEAR:1};function PostProcessStage(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).fragmentShader,n=defaultValue(e.textureScale,1),i=defaultValue(e.pixelFormat,PixelFormat$1.RGBA);this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=defaultValue(e.forcePowerOfTwo,!1),this._sampleMode=defaultValue(e.sampleMode,PostProcessStageSampleMode.NEAREST),this._pixelFormat=i,this._pixelDatatype=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),this._clearColor=defaultValue(e.clearColor,Color.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;const r=new PassState;r.scissorTest={enabled:!0,rectangle:defined(e.scissorRectangle)?BoundingRectangle.clone(e.scissorRectangle):new BoundingRectangle},this._passState=r,this._ready=!1;let o=e.name;defined(o)||(o=createGuid()),this._name=o,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(PostProcessStage.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(defined(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(defined(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});const depthTextureRegex=/uniform\s+sampler2D\s+depthTexture/g;function getUniformValueGetterAndSetter(e,t,n){const i=t[n];return("string"==typeof i||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(i){const r=t[n];t[n]=i;const o=e._actualUniforms,a=o[n];defined(a)&&a!==r&&a instanceof Texture&&!defined(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete o[n],delete o[n+"Dimensions"]),r instanceof Texture&&e._texturesToRelease.push(r),"string"==typeof i||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData?e._dirtyUniforms.push(n):o[n]=i}}}function getUniformMapFunction(e,t){return function(){const n=e._actualUniforms[t];return"function"==typeof n?n():n}}function getUniformMapDimensionsFunction(e,t){return function(){const n=e[t]();if(defined(n))return n.dimensions}}function createUniformMap(e){if(defined(e._uniformMap))return;const t={},n={},i=e._uniforms,r=e._actualUniforms;for(const o in i)if(i.hasOwnProperty(o)){"function"!=typeof i[o]?(t[o]=getUniformMapFunction(e,o),n[o]=getUniformValueGetterAndSetter(e,i,o)):(t[o]=i[o],n[o]=i[o]),r[o]=i[o];const a=t[o]();("string"==typeof a||a instanceof Texture||a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement)&&(t[o+"Dimensions"]=getUniformMapDimensionsFunction(t,o))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=combine$2(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}function createDrawCommand(e,t){if(defined(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(defined(e._selectedIdTexture)){const t=e._selectedIdTexture.width;n=n.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""),n="#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nvarying vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n bool selected = false;\n vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset); \n for (int i = 0; i < "+t+"; ++i) \n { \n vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5)); \n if (all(equal(id, selectedId))) \n { \n return true; \n } \n } \n return false; \n} \n\nbool czm_selected() \n{ \n return czm_selected(vec2(0.0)); \n} \n\n"+n}const i=new ShaderSource({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function createSampler(e){let t,n;e._sampleMode===PostProcessStageSampleMode.LINEAR?(t=TextureMinificationFilter$1.LINEAR,n=TextureMagnificationFilter$1.LINEAR):(t=TextureMinificationFilter$1.NEAREST,n=TextureMagnificationFilter$1.NEAREST);const i=e._sampler;defined(i)&&i.minificationFilter===t&&i.magnificationFilter===n||(e._sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:t,magnificationFilter:n}))}function createLoadImageFunction(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function createStageOutputTextureFunction(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function updateUniformTextures(e,t){let n,i,r;const o=e._texturesToRelease;let a=o.length;for(n=0;n<a;++n)i=o[n],i=i&&i.destroy();o.length=0;const s=e._texturesToCreate;for(a=s.length,n=0;n<a;++n){const i=s[n];r=i.name;const o=i.source;e._actualUniforms[r]=new Texture({context:t,source:o})}s.length=0;const c=e._dirtyUniforms;if(0===c.length&&!defined(e._texturePromise))return void(e._ready=!0);if(0===c.length||defined(e._texturePromise))return;a=c.length;const l=e._uniforms,u=[];for(n=0;n<a;++n){r=c[n];const t=l[r];if(defined(e._textureCache.getStageByName(t)))e._actualUniforms[r]=createStageOutputTextureFunction(e,t);else if("string"==typeof t){const n=new Resource({url:t});u.push(n.fetchImage().then(createLoadImageFunction(e,r)))}else e._texturesToCreate.push({name:r,source:t})}c.length=0,u.length>0?(e._ready=!1,e._texturePromise=when.all(u).then((function(){e._ready=!0,e._texturePromise=void 0}))):e._ready=!0}function releaseResources$1(e){defined(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!defined(t))return;const n=e._uniforms,i=e._actualUniforms;for(const r in i)i.hasOwnProperty(r)&&i[r]instanceof Texture&&(defined(t.getStageByName(n[r]))||i[r].destroy(),e._dirtyUniforms.push(r))}function isSelectedTextureDirty$1(e){let t=defined(e._selected)?e._selected.length:0;const n=defined(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return i}function createSelectedTexture(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!defined(n))return;let i,r,o=0;const a=n.length;for(i=0;i<a;++i)r=n[i],defined(r.pickIds)?o+=r.pickIds.length:defined(r.pickId)&&++o;if(0===a||0===o){const n=new Uint8Array(4);return n[0]=255,n[1]=255,n[2]=255,n[3]=255,void(e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:n,width:1,height:1},sampler:Sampler.NEAREST}))}let s,c=0;const l=new Uint8Array(4*o);for(i=0;i<a;++i)if(r=n[i],defined(r.pickIds)){const e=r.pickIds,t=e.length;for(let n=0;n<t;++n)s=e[n].color,l[c]=Color.floatToByte(s.red),l[c+1]=Color.floatToByte(s.green),l[c+2]=Color.floatToByte(s.blue),l[c+3]=Color.floatToByte(s.alpha),c+=4}else defined(r.pickId)&&(s=r.pickId.color,l[c]=Color.floatToByte(s.red),l[c+1]=Color.floatToByte(s.green),l[c+2]=Color.floatToByte(s.blue),l[c+3]=Color.floatToByte(s.alpha),c+=4);e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:o,height:1},sampler:Sampler.NEAREST})}PostProcessStage.prototype._isSupported=function(e){return!depthTextureRegex.test(this._fragmentShader)||e.depthTexture},PostProcessStage.prototype.update=function(e,t){if(this.enabled===this._enabled||this.enabled||releaseResources$1(this),this._enabled=this.enabled,!this._enabled)return;if(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=isSelectedTextureDirty$1(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0,createSelectedTexture(this,e),createUniformMap(this),updateUniformTextures(this,e),createDrawCommand(this,e),createSampler(this),this._selectedDirty=!1,!this._ready)return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!defined(n))return;const i=n.getColorTexture(0);let r;i.width===e.drawingBufferWidth&&i.height===e.drawingBufferHeight||(r=this._renderState,defined(r)&&i.width===r.viewport.width&&i.height===r.viewport.height||(this._renderState=RenderState.fromCache({viewport:new BoundingRectangle(0,0,i.width,i.height)}))),this._command.renderState=r},PostProcessStage.prototype.execute=function(e,t,n,i){if(!(defined(this._command)&&defined(this._command.framebuffer)&&this._ready&&this._enabled))return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,Sampler.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const r=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;defined(r)&&(r.context=e),this._command.execute(e,r)},PostProcessStage.prototype.isDestroyed=function(){return!1},PostProcessStage.prototype.destroy=function(){return releaseResources$1(this),destroyObject(this)};var AcesTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\ncolor /= texture2D(autoExposure, vec2(0.5)).r;\n#endif\ncolor = czm_acesTonemapping(color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",AmbientOcclusionGenerate="uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\nvarying vec2 v_textureCoordinates;\nvec4 clipToEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\nposEC = posEC / posEC.w;\nreturn posEC;\n}\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\nvec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\nvec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\nvec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\nvec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\nvec3 up = posInCamera.xyz - posInCameraUp.xyz;\nvec3 down = posInCameraDown.xyz - posInCamera.xyz;\nvec3 left = posInCamera.xyz - posInCameraLeft.xyz;\nvec3 right = posInCameraRight.xyz - posInCamera.xyz;\nvec3 DX = length(left) < length(right) ? left : right;\nvec3 DY = length(up) < length(down) ? up : down;\nreturn normalize(cross(DY, DX));\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = clipToEye(v_textureCoordinates, depth);\nif (posInCamera.z > frustumLength)\n{\ngl_FragColor = vec4(1.0);\nreturn;\n}\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nfloat depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\nfloat depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\nfloat depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\nfloat depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\nvec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\nfloat ao = 0.0;\nvec2 sampleDirection = vec2(1.0, 0.0);\nfloat gapAngle = 90.0 * czm_radiansPerDegree;\nfloat randomVal = texture2D(randomTexture, v_textureCoordinates).x;\nfor (int i = 0; i < 4; i++)\n{\nfloat newGapAngle = gapAngle * (float(i) + randomVal);\nfloat cosVal = cos(newGapAngle);\nfloat sinVal = sin(newGapAngle);\nvec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\nfloat localAO = 0.0;\nfloat localStepSize = stepSize;\nfor (int j = 0; j < 6; j++)\n{\nvec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\nif(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n{\nbreak;\n}\nfloat stepDepthInfo = czm_readDepth(depthTexture, newCoords);\nvec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\nvec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\nfloat len = length(diffVec);\nif (len > lengthCap)\n{\nbreak;\n}\nfloat dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\nfloat weight = len / lengthCap;\nweight = 1.0 - weight * weight;\nif (dotVal < bias)\n{\ndotVal = 0.0;\n}\nlocalAO = max(localAO, dotVal * weight);\nlocalStepSize += stepSize;\n}\nao += localAO;\n}\nao /= 4.0;\nao = 1.0 - clamp(ao, 0.0, 1.0);\nao = pow(ao, intensity);\ngl_FragColor = vec4(vec3(ao), 1.0);\n}\n",AmbientOcclusionModulate="uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;\ngl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;\n}\n",BlackAndWhite="uniform sampler2D colorTexture;\nuniform float gradations;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = vec4(rgb, 1.0);\nreturn;\n}\n#endif\nfloat luminance = czm_luminance(rgb);\nfloat darkness = luminance * gradations;\ndarkness = (darkness - fract(darkness)) / gradations;\ngl_FragColor = vec4(vec3(darkness), 1.0);\n}\n",BloomComposite="uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = color;\nreturn;\n}\n#endif\nvec4 bloom = texture2D(bloomTexture, v_textureCoordinates);\ngl_FragColor = glowOnly ? bloom : bloom + color;\n}\n",Brightness="uniform sampler2D colorTexture;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 target = vec3(0.0);\ngl_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n",ContrastBias="uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;\nsceneColor = czm_RGBToHSB(sceneColor);\nsceneColor.z += brightness;\nsceneColor = czm_HSBToRGB(sceneColor);\nfloat factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\nsceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\ngl_FragColor = vec4(sceneColor, 1.0);\n}\n",DepthOfField="uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\nvarying vec2 v_textureCoordinates;\nvec4 toEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\nposInCamera = posInCamera / posInCamera.w;\nreturn posInCamera;\n}\nfloat computeDepthBlur(float depth)\n{\nfloat f;\nif (depth < focalDistance)\n{\nf = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n}\nelse\n{\nf = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\nf = pow(f, 0.1);\n}\nf *= f;\nf = clamp(f, 0.0, 1.0);\nreturn pow(f, 0.5);\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = toEye(v_textureCoordinates, depth);\nfloat d = computeDepthBlur(-posInCamera.z);\ngl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);\n}\n",DepthView="uniform sampler2D depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\ngl_FragColor = vec4(vec3(depth), 1.0);\n}\n",EdgeDetection="uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat directions[3];\ndirections[0] = -1.0;\ndirections[1] = 0.0;\ndirections[2] = 1.0;\nfloat scalars[3];\nscalars[0] = 3.0;\nscalars[1] = 10.0;\nscalars[2] = 3.0;\nfloat padx = czm_pixelRatio / czm_viewport.z;\nfloat pady = czm_pixelRatio / czm_viewport.w;\n#ifdef CZM_SELECTED_FEATURE\nbool selected = false;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nselected = selected || czm_selected(vec2(-padx, dir * pady));\nselected = selected || czm_selected(vec2(padx, dir * pady));\nselected = selected || czm_selected(vec2(dir * padx, -pady));\nselected = selected || czm_selected(vec2(dir * padx, pady));\nif (selected)\n{\nbreak;\n}\n}\nif (!selected)\n{\ngl_FragColor = vec4(color.rgb, 0.0);\nreturn;\n}\n#endif\nfloat horizEdge = 0.0;\nfloat vertEdge = 0.0;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nfloat scale = scalars[i];\nhorizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\nhorizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\nvertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\nvertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n}\nfloat len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\ngl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n",FilmicTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\nconst float A = 0.22;\nconst float B = 0.30;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.01;\nconst float F = 0.30;\nconst float white = 11.2;\nvec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\nfloat w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\nc = czm_inverseGamma(c / w);\ngl_FragColor = vec4(c, fragmentColor.a);\n}\n",FXAA="varying vec2 v_textureCoordinates;\nuniform sampler2D colorTexture;\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\nvoid main()\n{\nvec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\nvec4 color = FxaaPixelShader(\nv_textureCoordinates,\ncolorTexture,\nfxaaQualityRcpFrame,\nfxaaQualitySubpix,\nfxaaQualityEdgeThreshold,\nfxaaQualityEdgeThresholdMin);\nfloat alpha = texture2D(colorTexture, v_textureCoordinates).a;\ngl_FragColor = vec4(color.rgb, alpha);\n}\n",GaussianBlur1D="#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D colorTexture;\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\n#ifdef USE_STEP_SIZE\nvec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\nvec2 step = step;\n#endif\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(colorTexture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * step;\nresult += texture2D(colorTexture, st - offset) * g.x;\nresult += texture2D(colorTexture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n",LensFlare="uniform sampler2D colorTexture;\nuniform sampler2D dirtTexture;\nuniform sampler2D starTexture;\nuniform vec2 dirtTextureDimensions;\nuniform float distortion;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform float dirtAmount;\nuniform float earthRadius;\nuniform float intensity;\nvarying vec2 v_textureCoordinates;\n#define DISTANCE_TO_SPACE 6500000.0\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\nvec4 positionEC = czm_view * vec4(WC, 1.0);\npositionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nreturn czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\nvec2 NDC = texcoord * 2.0 - 1.0;\nvec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\nvec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\nNDC.xy -= earthPosSC.xy;\nfloat X = abs(NDC.x) * sceneSize.x;\nfloat Y = abs(NDC.y) * sceneSize.y;\nreturn clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\nvec2 sceneSize = czm_viewport.zw;\nvec3 color;\nif(isSpace)\n{\ncolor.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;\n}\nelse\n{\ncolor.r = texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = texture2D(tex, texcoord + direction * distortion.b).b;\n}\nreturn vec4(clamp(color, 0.0, 1.0), 0.0);\n}\nvoid main(void)\n{\nvec4 originalColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 rgb = originalColor.rgb;\nbool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\nvec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\nvec4 sunPositionEC = czm_view * sunPos;\nvec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\nsunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\nif(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n{\ngl_FragColor = originalColor;\nreturn;\n}\nvec2 texcoord = vec2(1.0) - v_textureCoordinates;\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nvec2 invPixelSize = 1.0 / pixelSize;\nvec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\nvec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\nvec3 direction = normalize(vec3(ghostVec, 0.0));\nvec4 result = vec4(0.0);\nvec4 ghost = vec4(0.0);\nfor (int i = 0; i < 4; ++i)\n{\nvec2 offset = fract(texcoord + ghostVec * float(i));\nghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n}\nresult += ghost;\nvec2 haloVec = normalize(ghostVec) * haloWidth;\nfloat weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\nweightForHalo = pow(1.0 - weightForHalo, 5.0);\nresult += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\nvec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\nif (dirtTexCoords.x > 1.0)\n{\ndirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);\n}\nif (dirtTexCoords.y > 1.0)\n{\ndirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);\n}\nresult += dirtAmount * texture2D(dirtTexture, dirtTexCoords);\nfloat camrot = czm_view[0].z + czm_view[1].y;\nfloat cosValue = cos(camrot);\nfloat sinValue = sin(camrot);\nmat3 rotation = mat3(\ncosValue, -sinValue, 0.0,\nsinValue, cosValue, 0.0,\n0.0, 0.0, 1.0\n);\nvec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\nvec3 st2 = vec3((rotation * st1).xy, 1.0);\nvec3 st3 = st2 * 0.5 + vec3(0.5);\nvec2 lensStarTexcoord = st3.xy;\nfloat weightForLensFlare = length(vec3(sunPos.xy, 0.0));\nfloat oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\nif (!isSpace)\n{\nresult *= oneMinusWeightForLensFlare * intensity * 0.2;\n}\nelse\n{\nresult *= oneMinusWeightForLensFlare * intensity;\nresult *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n}\nresult += texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = result;\n}\n",ModifiedReinhardTonemapping="uniform sampler2D colorTexture;\nuniform vec3 white;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = (color * (1.0 + color / white)) / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",NightVision="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nfloat rand(vec2 co)\n{\nreturn fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\nvoid main(void)\n{\nfloat noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 green = vec3(0.0, 1.0, 0.0);\ngl_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n",ReinhardTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = color / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",Silhouette="uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n",FXAA3_11="#if (FXAA_QUALITY_PRESET == 10)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 3.0\n#define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 3.0\n#define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 4.0\n#define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 4.0\n#define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 4.0\n#define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 2.0\n#define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 3.0\n#define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n#define FXAA_QUALITY_PS 9\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 4.0\n#define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n#define FXAA_QUALITY_PS 10\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 4.0\n#define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n#define FXAA_QUALITY_PS 11\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 4.0\n#define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.0\n#define FXAA_QUALITY_P2 1.0\n#define FXAA_QUALITY_P3 1.0\n#define FXAA_QUALITY_P4 1.0\n#define FXAA_QUALITY_P5 1.5\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\nFxaaFloat4 FxaaPixelShader(\nFxaaFloat2 pos,\nFxaaTex tex,\nFxaaFloat2 fxaaQualityRcpFrame,\nFxaaFloat fxaaQualitySubpix,\nFxaaFloat fxaaQualityEdgeThreshold,\nFxaaFloat fxaaQualityEdgeThresholdMin\n) {\nFxaaFloat2 posM;\nposM.x = pos.x;\nposM.y = pos.y;\nFxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n#define lumaM rgbyM.y\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat maxSM = max(lumaS, lumaM);\nFxaaFloat minSM = min(lumaS, lumaM);\nFxaaFloat maxESM = max(lumaE, maxSM);\nFxaaFloat minESM = min(lumaE, minSM);\nFxaaFloat maxWN = max(lumaN, lumaW);\nFxaaFloat minWN = min(lumaN, lumaW);\nFxaaFloat rangeMax = max(maxWN, maxESM);\nFxaaFloat rangeMin = min(minWN, minESM);\nFxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\nFxaaFloat range = rangeMax - rangeMin;\nFxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\nFxaaBool earlyExit = range < rangeMaxClamped;\nif(earlyExit)\nreturn rgbyM;\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNS = lumaN + lumaS;\nFxaaFloat lumaWE = lumaW + lumaE;\nFxaaFloat subpixRcpRange = 1.0/range;\nFxaaFloat subpixNSWE = lumaNS + lumaWE;\nFxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\nFxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\nFxaaFloat lumaNESE = lumaNE + lumaSE;\nFxaaFloat lumaNWNE = lumaNW + lumaNE;\nFxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\nFxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\nFxaaFloat lumaNWSW = lumaNW + lumaSW;\nFxaaFloat lumaSWSE = lumaSW + lumaSE;\nFxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\nFxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\nFxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\nFxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\nFxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\nFxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\nFxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\nFxaaFloat lengthSign = fxaaQualityRcpFrame.x;\nFxaaBool horzSpan = edgeHorz >= edgeVert;\nFxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\nif(!horzSpan) lumaN = lumaW;\nif(!horzSpan) lumaS = lumaE;\nif(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\nFxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\nFxaaFloat gradientN = lumaN - lumaM;\nFxaaFloat gradientS = lumaS - lumaM;\nFxaaFloat lumaNN = lumaN + lumaM;\nFxaaFloat lumaSS = lumaS + lumaM;\nFxaaBool pairN = abs(gradientN) >= abs(gradientS);\nFxaaFloat gradient = max(abs(gradientN), abs(gradientS));\nif(pairN) lengthSign = -lengthSign;\nFxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\nFxaaFloat2 posB;\nposB.x = posM.x;\nposB.y = posM.y;\nFxaaFloat2 offNP;\noffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\noffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\nif(!horzSpan) posB.x += lengthSign * 0.5;\nif( horzSpan) posB.y += lengthSign * 0.5;\nFxaaFloat2 posN;\nposN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\nposN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\nFxaaFloat2 posP;\nposP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\nposP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\nFxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\nFxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\nFxaaFloat subpixE = subpixC * subpixC;\nFxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\nif(!pairN) lumaNN = lumaSS;\nFxaaFloat gradientScaled = gradient * 1.0/4.0;\nFxaaFloat lumaMM = lumaM - lumaNN * 0.5;\nFxaaFloat subpixF = subpixD * subpixE;\nFxaaBool lumaMLTZero = lumaMM < 0.0;\nlumaEndN -= lumaNN * 0.5;\nlumaEndP -= lumaNN * 0.5;\nFxaaBool doneN = abs(lumaEndN) >= gradientScaled;\nFxaaBool doneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\nFxaaBool doneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n#if (FXAA_QUALITY_PS > 3)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n#if (FXAA_QUALITY_PS > 4)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n#if (FXAA_QUALITY_PS > 5)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n#if (FXAA_QUALITY_PS > 6)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n#if (FXAA_QUALITY_PS > 7)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n#if (FXAA_QUALITY_PS > 8)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n#if (FXAA_QUALITY_PS > 9)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n#if (FXAA_QUALITY_PS > 10)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n#if (FXAA_QUALITY_PS > 11)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n#if (FXAA_QUALITY_PS > 12)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\nFxaaFloat dstN = posM.x - posN.x;\nFxaaFloat dstP = posP.x - posM.x;\nif(!horzSpan) dstN = posM.y - posN.y;\nif(!horzSpan) dstP = posP.y - posM.y;\nFxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\nFxaaFloat spanLength = (dstP + dstN);\nFxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\nFxaaFloat spanLengthRcp = 1.0/spanLength;\nFxaaBool directionN = dstN < dstP;\nFxaaFloat dst = min(dstN, dstP);\nFxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\nFxaaFloat subpixG = subpixF * subpixF;\nFxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\nFxaaFloat subpixH = subpixG * fxaaQualitySubpix;\nFxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\nFxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\nif(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\nif( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\nreturn FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n";function PostProcessStageComposite(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=defaultValue(e.inputPreviousStageTexture,!0);let t=e.name;defined(t)||(t=createGuid()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}function isSelectedTextureDirty(e){let t=defined(e._selected)?e._selected.length:0;const n=defined(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return i}Object.defineProperties(PostProcessStageComposite.prototype,{ready:{get:function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}}),PostProcessStageComposite.prototype._isSupported=function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0},PostProcessStageComposite.prototype.get=function(e){return this._stages[e]},PostProcessStageComposite.prototype.update=function(e,t){this._selectedDirty=isSelectedTextureDirty(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let r=0;r<i;++r){const i=n[r];this._selectedDirty&&(i.parentSelected=this._combinedSelected),i.update(e,t)}},PostProcessStageComposite.prototype.isDestroyed=function(){return!1},PostProcessStageComposite.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return destroyObject(this)};const PostProcessStageLibrary={};function createBlur(e){const t="#define USE_STEP_SIZE\n"+GaussianBlur1D,n=new PostProcessStage({name:e+"_x_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:PostProcessStageSampleMode.LINEAR}),i=new PostProcessStage({name:e+"_y_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:PostProcessStageSampleMode.LINEAR}),r={};return Object.defineProperties(r,{delta:{get:function(){return n.uniforms.delta},set:function(e){const t=n.uniforms,r=i.uniforms;t.delta=r.delta=e}},sigma:{get:function(){return n.uniforms.sigma},set:function(e){const t=n.uniforms,r=i.uniforms;t.sigma=r.sigma=e}},stepSize:{get:function(){return n.uniforms.stepSize},set:function(e){const t=n.uniforms,r=i.uniforms;t.stepSize=r.stepSize=e}}}),new PostProcessStageComposite({name:e,stages:[n,i],uniforms:r})}function getSilhouetteEdgeDetection(e){if(!defined(e))return PostProcessStageLibrary.createEdgeDetectionStage();const t=new PostProcessStageComposite({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",r="";for(let t=0;t<e.length;++t)i+="uniform sampler2D edgeTexture"+t+"; \n",r+=" vec4 edge"+t+" = texture2D(edgeTexture"+t+", v_textureCoordinates); \n if (edge"+t+".a > 0.0) \n { \n color = edge"+t+"; \n break; \n } \n",n["edgeTexture"+t]=e[t].name;return new PostProcessStageComposite({name:"czm_edge_detection_composite",stages:[t,new PostProcessStage({name:"czm_edge_detection_combine",fragmentShader:i+"varying vec2 v_textureCoordinates; \nvoid main() { \n vec4 color = vec4(0.0); \n for (int i = 0; i < "+e.length+"; i++) \n { \n"+r+" } \n gl_FragColor = color; \n} \n",uniforms:n})]})}PostProcessStageLibrary.createBlurStage=function(){return createBlur("czm_blur")},PostProcessStageLibrary.createDepthOfFieldStage=function(){const e=createBlur("czm_depth_of_field_blur"),t=new PostProcessStage({name:"czm_depth_of_field_composite",fragmentShader:DepthOfField,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(e){t.uniforms.focalDistance=e}},delta:{get:function(){return e.uniforms.delta},set:function(t){e.uniforms.delta=t}},sigma:{get:function(){return e.uniforms.sigma},set:function(t){e.uniforms.sigma=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}}}),new PostProcessStageComposite({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})},PostProcessStageLibrary.isDepthOfFieldSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createEdgeDetectionStage=function(){return new PostProcessStage({name:"czm_edge_detection_"+createGuid(),fragmentShader:EdgeDetection,uniforms:{length:.25,color:Color.clone(Color.BLACK)}})},PostProcessStageLibrary.isEdgeDetectionSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createSilhouetteStage=function(e){const t=getSilhouetteEdgeDetection(e);return new PostProcessStageComposite({name:"czm_silhouette",stages:[t,new PostProcessStage({name:"czm_silhouette_color_edges",fragmentShader:Silhouette,uniforms:{silhouetteTexture:t.name}})],inputPreviousStageTexture:!1,uniforms:t.uniforms})},PostProcessStageLibrary.isSilhouetteSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createBloomStage=function(){const e=new PostProcessStage({name:"czm_bloom_contrast_bias",fragmentShader:ContrastBias,uniforms:{contrast:128,brightness:-.3}}),t=createBlur("czm_bloom_blur"),n=new PostProcessStageComposite({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new PostProcessStage({name:"czm_bloom_generate_composite",fragmentShader:BloomComposite,uniforms:{glowOnly:!1,bloomTexture:n.name}}),r={};return Object.defineProperties(r,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(e){i.uniforms.glowOnly=e}},contrast:{get:function(){return e.uniforms.contrast},set:function(t){e.uniforms.contrast=t}},brightness:{get:function(){return e.uniforms.brightness},set:function(t){e.uniforms.brightness=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}}}),new PostProcessStageComposite({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:r})},PostProcessStageLibrary.createAmbientOcclusionStage=function(){const e=new PostProcessStage({name:"czm_ambient_occlusion_generate",fragmentShader:AmbientOcclusionGenerate,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=createBlur("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new PostProcessStageComposite({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new PostProcessStage({name:"czm_ambient_occlusion_composite",fragmentShader:AmbientOcclusionModulate,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),r={};return Object.defineProperties(r,{intensity:{get:function(){return e.uniforms.intensity},set:function(t){e.uniforms.intensity=t}},bias:{get:function(){return e.uniforms.bias},set:function(t){e.uniforms.bias=t}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(t){e.uniforms.lengthCap=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(t){e.uniforms.frustumLength=t}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(t){e.uniforms.randomTexture=t}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(e){i.uniforms.ambientOcclusionOnly=e}}}),new PostProcessStageComposite({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:r})},PostProcessStageLibrary.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const fxaaFS="#define FXAA_QUALITY_PRESET 39 \n"+FXAA3_11+"\n"+FXAA;function PostProcessStageTextureCache(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function getLastStageName(e){for(;defined(e.length);)e=e.get(e.length-1);return e.name}function getStageDependencies(e,t,n,i,r){if(!i.enabled||!i._isSupported(t))return r;const o=n[i.name]={};if(defined(r)){o[getLastStageName(e.getStageByName(r))]=!0}const a=i.uniforms;if(defined(a)){const t=Object.getOwnPropertyNames(a),n=t.length;for(let i=0;i<n;++i){const n=a[t[i]];if("string"==typeof n){const t=e.getStageByName(n);defined(t)&&(o[getLastStageName(t)]=!0)}}}return i.name}function getCompositeDependencies(e,t,n,i,r){if(defined(i.enabled)&&!i.enabled||defined(i._isSupported)&&!i._isSupported(t))return r;const o=r,a=!defined(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let s=r;const c=i.length;for(let o=0;o<c;++o){const c=i.get(o);s=defined(c.length)?getCompositeDependencies(e,t,n,c,r):getStageDependencies(e,t,n,c,r),a&&(r=s)}let l,u;if(a)for(l=1;l<c;++l)u=getLastStageName(i.get(l)),defined(n[u])||(n[u]={}),n[u][o]=!0;else for(l=1;l<c;++l){u=getLastStageName(i.get(l));const e=n[u];for(let t=0;t<l;++t)e[getLastStageName(i.get(t))]=!0}return s}function getDependencies(e,t){const n={};if(defined(e.ambientOcclusion)){const i=e.ambientOcclusion,r=e.bloom,o=e._tonemapping,a=e.fxaa;let s=getCompositeDependencies(e,t,n,i,void 0);s=getCompositeDependencies(e,t,n,r,s),s=getStageDependencies(e,t,n,o,s),s=getCompositeDependencies(e,t,n,e,s),getStageDependencies(e,t,n,a,s)}else getCompositeDependencies(e,t,n,e,void 0);return n}function getFramebuffer(e,t,n){const i=e._collection.getStageByName(t),r=i._textureScale,o=i._forcePowerOfTwo,a=i._pixelFormat,s=i._pixelDatatype,c=i._clearColor;let l,u;const d=e._framebuffers,h=d.length;for(l=0;l<h;++l){if(u=d[l],r!==u.textureScale||o!==u.forcePowerOfTwo||a!==u.pixelFormat||s!==u.pixelDatatype||!Color.equals(c,u.clearColor))continue;const e=u.stages,t=e.length;let i=!1;for(let r=0;r<t;++r)if(n[e[r]]){i=!0;break}if(!i)break}return defined(u)&&l<h?(u.stages.push(t),u):(u={textureScale:r,forcePowerOfTwo:o,pixelFormat:a,pixelDatatype:s,clearColor:c,stages:[t],buffer:new FramebufferManager({pixelFormat:a,pixelDatatype:s}),clear:void 0},d.push(u),u)}function createFramebuffers(e,t){const n=getDependencies(e._collection,t);for(const t in n)n.hasOwnProperty(t)&&(e._stageNameToFramebuffer[t]=getFramebuffer(e,t,n[t]))}function releaseResources(e){const t=e._framebuffers,n=t.length;for(let e=0;e<n;++e){t[e].buffer.destroy()}}function updateFramebuffers(e,t){const n=e._width,i=e._height,r=e._framebuffers,o=r.length;for(let e=0;e<o;++e){const o=r[e],a=o.textureScale;let s=Math.ceil(n*a),c=Math.ceil(i*a),l=Math.min(s,c);o.forcePowerOfTwo&&(CesiumMath.isPowerOfTwo(l)||(l=CesiumMath.nextPowerOfTwo(l)),s=l,c=l),o.buffer.update(t,s,c),o.clear=new ClearCommand({color:o.clearColor,framebuffer:o.buffer.framebuffer})}}PostProcessStageLibrary.createFXAAStage=function(){return new PostProcessStage({name:"czm_FXAA",fragmentShader:fxaaFS,sampleMode:PostProcessStageSampleMode.LINEAR})},PostProcessStageLibrary.createAcesTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=AcesTonemapping,new PostProcessStage({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createFilmicTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=FilmicTonemapping,new PostProcessStage({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=ReinhardTonemapping,new PostProcessStage({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createModifiedReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+=ModifiedReinhardTonemapping,new PostProcessStage({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:Color.WHITE,autoExposure:void 0}})},PostProcessStageLibrary.createAutoExposureStage=function(){return new AutoExposure},PostProcessStageLibrary.createBlackAndWhiteStage=function(){return new PostProcessStage({name:"czm_black_and_white",fragmentShader:BlackAndWhite,uniforms:{gradations:5}})},PostProcessStageLibrary.createBrightnessStage=function(){return new PostProcessStage({name:"czm_brightness",fragmentShader:Brightness,uniforms:{brightness:.5}})},PostProcessStageLibrary.createNightVisionStage=function(){return new PostProcessStage({name:"czm_night_vision",fragmentShader:NightVision})},PostProcessStageLibrary.createDepthViewStage=function(){return new PostProcessStage({name:"czm_depth_view",fragmentShader:DepthView})},PostProcessStageLibrary.createLensFlareStage=function(){return new PostProcessStage({name:"czm_lens_flare",fragmentShader:LensFlare,uniforms:{dirtTexture:buildModuleUrl("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:buildModuleUrl("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:Ellipsoid.WGS84.maximumRadius}})},PostProcessStageTextureCache.prototype.updateDependencies=function(){this._updateDependencies=!0},PostProcessStageTextureCache.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=defined(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),r=defined(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),o=defined(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),a=defined(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),s=!defined(t._activeStages)||t._activeStages.length>0||i||r||o||a;if((n||!s&&this._framebuffers.length>0)&&(releaseResources(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!s)return;0===this._framebuffers.length&&createFramebuffers(this,e);const c=e.drawingBufferWidth,l=e.drawingBufferHeight,u=this._width!==c||this._height!==l;(n||u)&&(this._width=c,this._height=l,this._updateDependencies=!1,releaseResources(this),updateFramebuffers(this,e))},PostProcessStageTextureCache.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)},PostProcessStageTextureCache.prototype.getStageByName=function(e){return this._collection.getStageByName(e)},PostProcessStageTextureCache.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)},PostProcessStageTextureCache.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(defined(t))return t.buffer.framebuffer},PostProcessStageTextureCache.prototype.isDestroyed=function(){return!1},PostProcessStageTextureCache.prototype.destroy=function(){return releaseResources(this),destroyObject(this)};const Tonemapper={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Tonemapper.REINHARD||e===Tonemapper.MODIFIED_REINHARD||e===Tonemapper.FILMIC||e===Tonemapper.ACES}};var Tonemapper$1=Object.freeze(Tonemapper);const stackScratch=[];function PostProcessStageCollection(){const e=PostProcessStageLibrary.createFXAAStage(),t=PostProcessStageLibrary.createAmbientOcclusionStage(),n=PostProcessStageLibrary.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=PostProcessStageLibrary.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Tonemapper$1.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const r=new PostProcessStageTextureCache(this),o={},a=stackScratch;for(a.push(e,t,n,i);a.length>0;){const e=a.pop();o[e.name]=e,e._textureCache=r;const t=e.length;if(defined(t))for(let n=0;n<t;++n)a.push(e.get(n))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const s=this;t.uniforms.randomTexture=function(){return s._randomTexture},this._ao=t,this._bloom=n,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=o,this._textureCache=r}function removeStages(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let e=0,r=0;e<i;++e){const i=n[e];i&&(i._index=r++,t.push(i))}e._stages=t}function getOutputTexture(e){for(;defined(e.length);)e=e.get(e.length-1);return e.outputTexture}function execute(e,t,n,i,r){if(defined(e.execute))return void e.execute(t,n,i,r);const o=e.length;let a;if(e.inputPreviousStageTexture)for(execute(e.get(0),t,n,i,r),a=1;a<o;++a)execute(e.get(a),t,getOutputTexture(e.get(a-1)),i,r);else for(a=0;a<o;++a)execute(e.get(a),t,n,i,r)}function QuadtreeTileProvider(){DeveloperError.throwInstantiationError()}function SceneTransitioner(e){this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}Object.defineProperties(PostProcessStageCollection.prototype,{ready:{get:function(){let e=!1;const t=this._stages;for(let n=t.length-1;n>=0;--n){const i=t[n];e=e||i.ready&&i.enabled}const n=this._fxaa,i=this._ao,r=this._bloom,o=this._tonemapping;return e=e||n.ready&&n.enabled,e=e||i.ready&&i.enabled,e=e||r.ready&&r.enabled,e=e||o.ready&&o.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return removeStages(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages;for(let e=t.length-1;e>=0;--e){const n=t[e];if(defined(n)&&n.ready&&n.enabled)return this.getOutputTexture(n.name)}const n=this._tonemapping;if(n.enabled&&n.ready)return this.getOutputTexture(n.name);const i=this._bloom;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const r=this._ao;return r.enabled&&r.ready?this.getOutputTexture(r.name):void 0}},hasSelected:{get:function(){const e=arraySlice(this._stages);for(;e.length>0;){const t=e.pop();if(!defined(t))continue;if(defined(t.selected))return!0;const n=t.length;if(defined(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;defined(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case Tonemapper$1.REINHARD:n=PostProcessStageLibrary.createReinhardTonemappingStage(t);break;case Tonemapper$1.MODIFIED_REINHARD:n=PostProcessStageLibrary.createModifiedReinhardTonemappingStage(t);break;case Tonemapper$1.FILMIC:n=PostProcessStageLibrary.createFilmicTonemappingStage(t);break;default:n=PostProcessStageLibrary.createAcesTonemappingStage(t)}if(t){const e=this._autoExposure;n.uniforms.autoExposure=function(){return e.outputTexture}}this._tonemapper=e,this._tonemapping=n,defined(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}}),PostProcessStageCollection.prototype.add=function(e){const t=this._stageNames,n=stackScratch;for(n.push(e);n.length>0;){const e=n.pop();t[e.name]=e,e._textureCache=this._textureCache;const i=e.length;if(defined(i))for(let t=0;t<i;++t)n.push(e.get(t))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e},PostProcessStageCollection.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=stackScratch;for(n.push(e);n.length>0;){const e=n.pop();delete t[e.name];const i=e.length;if(defined(i))for(let t=0;t<i;++t)n.push(e.get(t))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0},PostProcessStageCollection.prototype.contains=function(e){return defined(e)&&defined(e._index)&&e._textureCache===this._textureCache},PostProcessStageCollection.prototype.get=function(e){removeStages(this);return this._stages[e]},PostProcessStageCollection.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0},PostProcessStageCollection.prototype.getStageByName=function(e){return this._stageNames[e]},PostProcessStageCollection.prototype.update=function(e,t,n){removeStages(this);const i=this._activeStages,r=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const o=this._stages;let a,s,c=r.length=o.length,l=0;for(a=0;a<c;++a)s=o[a],s.ready&&s.enabled&&s._isSupported(e)&&(r[l++]=s);r.length=l;let u=l!==i.length;if(!u)for(a=0;a<l;++a)if(r[a]!==i[a]){u=!0;break}const d=this._ao,h=this._bloom,p=this._autoExposure,f=this._tonemapping,m=this._fxaa;f.enabled=n;const g=d.enabled&&d._isSupported(e),_=h.enabled&&h._isSupported(e),y=f.enabled&&f._isSupported(e),C=m.enabled&&m._isSupported(e);if((u||this._textureCacheDirty||g!==this._aoEnabled||_!==this._bloomEnabled||y!==this._tonemappingEnabled||C!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=g,this._bloomEnabled=_,this._tonemappingEnabled=y,this._fxaaEnabled=C,this._textureCacheDirty=!1),defined(this._randomTexture)&&!g&&(this._randomTexture.destroy(),this._randomTexture=void 0),!defined(this._randomTexture)&&g){c=196608;const t=new Uint8Array(c);for(a=0;a<c;a+=3)t[a]=Math.floor(255*Math.random());this._randomTexture=new Texture({context:e,pixelFormat:PixelFormat$1.RGB,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:t,width:256,height:256},sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}for(this._textureCache.update(e),m.update(e,t),d.update(e,t),h.update(e,t),f.update(e,t),this._autoExposureEnabled&&p.update(e,t),c=o.length,a=0;a<c;++a)o[a].update(e,t);for(l=0,a=0;a<c;++a)s=o[a],s.ready&&s.enabled&&s._isSupported(e)&&l++;u=l!==r.length,u&&this.update(e,t,n)},PostProcessStageCollection.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)},PostProcessStageCollection.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(defined(t))return getOutputTexture(t)},PostProcessStageCollection.prototype.execute=function(e,t,n,i){const r=this._activeStages,o=r.length,a=this._fxaa,s=this._ao,c=this._bloom,l=this._autoExposure,u=this._tonemapping,d=s.enabled&&s._isSupported(e),h=c.enabled&&c._isSupported(e),p=this._autoExposureEnabled,f=u.enabled&&u._isSupported(e),m=a.enabled&&a._isSupported(e);if(!(m||d||h||f||0!==o))return;let g=t;d&&s.ready&&(execute(s,e,g,n,i),g=getOutputTexture(s)),h&&c.ready&&(execute(c,e,g,n,i),g=getOutputTexture(c)),p&&l.ready&&execute(l,e,g,n,i),f&&u.ready&&(execute(u,e,g,n,i),g=getOutputTexture(u));let _=g;if(o>0){execute(r[0],e,g,n,i);for(let t=1;t<o;++t)execute(r[t],e,getOutputTexture(r[t-1]),n,i);_=getOutputTexture(r[o-1])}m&&a.ready&&execute(a,e,_,n,i)},PostProcessStageCollection.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return t.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},PostProcessStageCollection.prototype.isDestroyed=function(){return!1},PostProcessStageCollection.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),destroyObject(this)},QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},Object.defineProperties(QuadtreeTileProvider.prototype,{quadtree:{get:DeveloperError.throwInstantiationError,set:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError}}),QuadtreeTileProvider.prototype.update=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.beginUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.endUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.loadTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeTileVisibility=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.showTileThisFrame=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeDistanceToTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.isDestroyed=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.destroy=DeveloperError.throwInstantiationError,SceneTransitioner.prototype.completeMorph=function(){defined(this._completeMorph)&&this._completeMorph()},SceneTransitioner.prototype.morphTo2D=function(e,t){defined(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof OrthographicFrustum,this._previousMode!==SceneMode$1.SCENE2D&&this._previousMode!==SceneMode$1.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE2D,!0),n._mode=SceneMode$1.MORPHING,n.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.COLUMBUS_VIEW?morphFromColumbusViewTo2D(this,e):morphFrom3DTo2D(this,e,t),0===e&&defined(this._completeMorph)&&this._completeMorph())};const scratchToCVPosition=new Cartesian3,scratchToCVDirection=new Cartesian3,scratchToCVUp=new Cartesian3,scratchToCVPosition2D=new Cartesian3,scratchToCVDirection2D=new Cartesian3,scratchToCVUp2D=new Cartesian3,scratchToCVSurfacePosition=new Cartesian3,scratchToCVCartographic=new Cartographic,scratchToCVToENU=new Matrix4,scratchToCVFrustumPerspective=new PerspectiveFrustum,scratchToCVFrustumOrthographic=new OrthographicFrustum,scratchToCVCamera={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};SceneTransitioner.prototype.morphToColumbusView=function(e,t){defined(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===SceneMode$1.COLUMBUS_VIEW||this._previousMode===SceneMode$1.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.COLUMBUS_VIEW,!0),n.camera._setTransform(Matrix4.IDENTITY);let i=scratchToCVPosition;const r=scratchToCVDirection,o=scratchToCVUp;if(e>0)i.x=0,i.y=-1,i.z=1,i=Cartesian3.multiplyByScalar(Cartesian3.normalize(i,i),5*t.maximumRadius,i),Cartesian3.negate(Cartesian3.normalize(i,r),r),Cartesian3.cross(Cartesian3.UNIT_X,r,o);else{const e=n.camera;if(this._previousMode===SceneMode$1.SCENE2D)Cartesian3.clone(e.position,i),i.z=e.frustum.right-e.frustum.left,Cartesian3.negate(Cartesian3.UNIT_Z,r),Cartesian3.clone(Cartesian3.UNIT_Y,o);else{Cartesian3.clone(e.positionWC,i),Cartesian3.clone(e.directionWC,r),Cartesian3.clone(e.upWC,o);const a=t.scaleToGeodeticSurface(i,scratchToCVSurfacePosition),s=Transforms.eastNorthUpToFixedFrame(a,t,scratchToCVToENU);Matrix4.inverseTransformation(s,s),n.mapProjection.project(t.cartesianToCartographic(i,scratchToCVCartographic),i),Matrix4.multiplyByPointAsVector(s,r,r),Matrix4.multiplyByPointAsVector(s,o,o)}}let a;this._morphToOrthographic?(a=scratchToCVFrustumOrthographic,a.width=n.camera.frustum.right-n.camera.frustum.left,a.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(a=scratchToCVFrustumPerspective,a.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,a.fov=CesiumMath.toRadians(60));const s=scratchToCVCamera;s.position=i,s.direction=r,s.up=o,s.frustum=a;const c=completeColumbusViewCallback(s);createMorphHandler(this,c),this._previousMode===SceneMode$1.SCENE2D?morphFrom2DToColumbusView(this,e,s,c):(s.position2D=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,i,scratchToCVPosition2D),s.direction2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,r,scratchToCVDirection2D),s.up2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,scratchToCVUp2D),n._mode=SceneMode$1.MORPHING,morphFrom3DToColumbusView(this,e,s,c)),0===e&&defined(this._completeMorph)&&this._completeMorph()};const scratchCVTo3DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch2DTo3DFrustumPersp=new PerspectiveFrustum;function createMorphHandler(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new ScreenSpaceEventHandler(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,ScreenSpaceEventType$1.LEFT_DOWN),e._morphHandler.setInputAction(n,ScreenSpaceEventType$1.MIDDLE_DOWN),e._morphHandler.setInputAction(n,ScreenSpaceEventType$1.RIGHT_DOWN),e._morphHandler.setInputAction(n,ScreenSpaceEventType$1.WHEEL)}}function destroyMorphHandler(e){const t=e._currentTweens;for(let e=0;e<t.length;++e)t[e].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}SceneTransitioner.prototype.morphTo3D=function(e,t){defined(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode!==SceneMode$1.SCENE3D&&this._previousMode!==SceneMode$1.MORPHING){if(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE3D,!0),n._mode=SceneMode$1.MORPHING,n.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.SCENE2D)morphFrom2DTo3D(this,e,t);else{let i,r;e>0?(i=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*t.maximumRadius,t,i.position),Cartesian3.negate(i.position,i.direction),Cartesian3.normalize(i.direction,i.direction),Cartesian3.clone(Cartesian3.UNIT_Z,i.up)):i=getColumbusViewTo3DCamera(this,t);const o=n.camera;o.frustum instanceof OrthographicFrustum?r=o.frustum.clone():(r=scratch2DTo3DFrustumPersp,r.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,r.fov=CesiumMath.toRadians(60)),i.frustum=r;const a=complete3DCallback(i);createMorphHandler(this,a),morphFromColumbusViewTo3D(this,e,i,a)}0===e&&defined(this._completeMorph)&&this._completeMorph()}},SceneTransitioner.prototype.isDestroyed=function(){return!1},SceneTransitioner.prototype.destroy=function(){return destroyMorphHandler(this),destroyObject(this)};const scratchCVTo3DCartographic=new Cartographic,scratchCVTo3DSurfacePoint=new Cartesian3,scratchCVTo3DFromENU=new Matrix4;function getColumbusViewTo3DCamera(e,t){const n=e._scene,i=n.camera,r=scratchCVTo3DCamera,o=r.position,a=r.direction,s=r.up,c=n.mapProjection.unproject(i.position,scratchCVTo3DCartographic);t.cartographicToCartesian(c,o);const l=t.scaleToGeodeticSurface(o,scratchCVTo3DSurfacePoint),u=Transforms.eastNorthUpToFixedFrame(l,t,scratchCVTo3DFromENU);return Matrix4.multiplyByPointAsVector(u,i.direction,a),Matrix4.multiplyByPointAsVector(u,i.up,s),r}const scratchCVTo3DStartPos=new Cartesian3,scratchCVTo3DStartDir=new Cartesian3,scratchCVTo3DStartUp=new Cartesian3,scratchCVTo3DEndPos=new Cartesian3,scratchCVTo3DEndDir=new Cartesian3,scratchCVTo3DEndUp=new Cartesian3;function morphFromColumbusViewTo3D(e,t,n,i){t*=.5;const r=e._scene,o=r.camera,a=Cartesian3.clone(o.position,scratchCVTo3DStartPos),s=Cartesian3.clone(o.direction,scratchCVTo3DStartDir),c=Cartesian3.clone(o.up,scratchCVTo3DStartUp),l=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,n.position,scratchCVTo3DEndPos),u=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,n.direction,scratchCVTo3DEndDir),d=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,n.up,scratchCVTo3DEndUp);const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(a,l,e.time,o.position),columbusViewMorph(s,u,e.time,o.direction),columbusViewMorph(c,d,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right)},complete:function(){addMorphTimeAnimations(e,r,0,1,t,i)}});e._currentTweens.push(h)}const scratch2DTo3DFrustumOrtho=new OrthographicFrustum,scratch3DToCVStartPos=new Cartesian3,scratch3DToCVStartDir=new Cartesian3,scratch3DToCVStartUp=new Cartesian3,scratch3DToCVEndPos=new Cartesian3,scratch3DToCVEndDir=new Cartesian3,scratch3DToCVEndUp=new Cartesian3;function morphFrom2DTo3D(e,t,n){t/=3;const i=e._scene,r=i.camera;let o,a;t>0?(o=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*n.maximumRadius,n,o.position),Cartesian3.negate(o.position,o.direction),Cartesian3.normalize(o.direction,o.direction),Cartesian3.clone(Cartesian3.UNIT_Z,o.up)):(r.position.z=r.frustum.right-r.frustum.left,o=getColumbusViewTo3DCamera(e,n)),e._morphToOrthographic?(a=scratch2DTo3DFrustumOrtho,a.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,a.width=r.frustum.right-r.frustum.left):(a=scratch2DTo3DFrustumPersp,a.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,a.fov=CesiumMath.toRadians(60)),o.frustum=a;const s=complete3DCallback(o);let c;createMorphHandler(e,s),c=e._morphToOrthographic?function(){morphFromColumbusViewTo3D(e,t,o,s)}:function(){morphOrthographicToPerspective(e,t,o,(function(){morphFromColumbusViewTo3D(e,t,o,s)}))},t>0?(i._mode=SceneMode$1.SCENE2D,r.flyTo({duration:t,destination:Cartesian3.fromDegrees(0,0,5*n.maximumRadius,n,scratch3DToCVEndPos),complete:function(){i._mode=SceneMode$1.MORPHING,c()}})):c()}function columbusViewMorph(e,t,n,i){return Cartesian3.lerp(e,t,n,i)}function morphPerspectiveToOrthographic(e,t,n,i,r){const o=e._scene,a=o.camera;if(a.frustum instanceof OrthographicFrustum)return;const s=a.frustum.fov,c=.5*CesiumMath.RADIANS_PER_DEGREE,l=n.position.z*Math.tan(.5*s);a.frustum.far=l/Math.tan(.5*c)+1e7;const u=o.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){a.frustum.fov=CesiumMath.lerp(s,c,e.time);const t=l/Math.tan(.5*a.frustum.fov);i(a,t)},complete:function(){a.frustum=n.frustum.clone(),r(e)}});e._currentTweens.push(u)}const scratchCVTo2DStartPos=new Cartesian3,scratchCVTo2DStartDir=new Cartesian3,scratchCVTo2DStartUp=new Cartesian3,scratchCVTo2DEndPos=new Cartesian3,scratchCVTo2DEndDir=new Cartesian3,scratchCVTo2DEndUp=new Cartesian3,scratchCVTo2DFrustum=new OrthographicOffCenterFrustum,scratchCVTo2DRay=new Ray,scratchCVTo2DPickPos=new Cartesian3,scratchCVTo2DCamera={position:void 0,direction:void 0,up:void 0,frustum:void 0};function morphFromColumbusViewTo2D(e,t){t*=.5;const n=e._scene,i=n.camera,r=Cartesian3.clone(i.position,scratchCVTo2DStartPos),o=Cartesian3.clone(i.direction,scratchCVTo2DStartDir),a=Cartesian3.clone(i.up,scratchCVTo2DStartUp),s=Cartesian3.negate(Cartesian3.UNIT_Z,scratchCVTo2DEndDir),c=Cartesian3.clone(Cartesian3.UNIT_Y,scratchCVTo2DEndUp),l=scratchCVTo2DEndPos;if(t>0)Cartesian3.clone(Cartesian3.ZERO,scratchCVTo2DEndPos),l.z=5*n.mapProjection.ellipsoid.maximumRadius;else{Cartesian3.clone(r,scratchCVTo2DEndPos);const e=scratchCVTo2DRay;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,r,e.origin),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,e.direction);const t=n.globe;if(defined(t)){const i=t.pickWorldCoordinates(e,n,!0,scratchCVTo2DPickPos);defined(i)&&(Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,i,l),l.z+=Cartesian3.distance(r,l))}}const u=scratchCVTo2DFrustum;u.right=.5*l.z,u.left=-u.right,u.top=u.right*(n.drawingBufferHeight/n.drawingBufferWidth),u.bottom=-u.top;const d=scratchCVTo2DCamera;d.position=l,d.direction=s,d.up=c,d.frustum=u;const h=complete2DCallback(d);function p(e,t){e.position.z=t}createMorphHandler(e,h);const f=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(r,l,e.time,i.position),columbusViewMorph(o,s,e.time,i.direction),columbusViewMorph(a,c,e.time,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)},complete:function(){morphPerspectiveToOrthographic(e,t,d,p,h)}});e._currentTweens.push(f)}const scratch3DTo2DCartographic=new Cartographic,scratch3DTo2DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,position2D:new Cartesian3,direction2D:new Cartesian3,up2D:new Cartesian3,frustum:new OrthographicOffCenterFrustum},scratch3DTo2DEndCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch3DTo2DPickPosition=new Cartesian3,scratch3DTo2DRay=new Ray,scratch3DTo2DToENU=new Matrix4,scratch3DTo2DSurfacePoint=new Cartesian3;function morphFrom3DTo2D(e,t,n){t*=.5;const i=e._scene,r=i.camera,o=scratch3DTo2DCamera;if(t>0)Cartesian3.clone(Cartesian3.ZERO,o.position),o.position.z=5*n.maximumRadius,Cartesian3.negate(Cartesian3.UNIT_Z,o.direction),Cartesian3.clone(Cartesian3.UNIT_Y,o.up);else{n.cartesianToCartographic(r.positionWC,scratch3DTo2DCartographic),i.mapProjection.project(scratch3DTo2DCartographic,o.position),Cartesian3.negate(Cartesian3.UNIT_Z,o.direction),Cartesian3.clone(Cartesian3.UNIT_Y,o.up);const e=scratch3DTo2DRay;Cartesian3.clone(o.position2D,e.origin);const t=Cartesian3.clone(r.directionWC,e.direction),a=n.scaleToGeodeticSurface(r.positionWC,scratch3DTo2DSurfacePoint),s=Transforms.eastNorthUpToFixedFrame(a,n,scratch3DTo2DToENU);Matrix4.inverseTransformation(s,s),Matrix4.multiplyByPointAsVector(s,t,t),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,t,t);const c=i.globe;if(defined(c)){const t=c.pickWorldCoordinates(e,i,!0,scratch3DTo2DPickPosition);if(defined(t)){const e=Cartesian3.distance(o.position2D,t);t.x+=e,Cartesian3.clone(t,o.position2D)}}}function a(e,t){e.position.x=t}Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,o.position,o.position2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o.direction,o.direction2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o.up,o.up2D);const s=o.frustum;s.right=.5*o.position.z,s.left=-s.right,s.top=s.right*(i.drawingBufferHeight/i.drawingBufferWidth),s.bottom=-s.top;const c=scratch3DTo2DEndCamera;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,o.position2D,c.position),Cartesian3.clone(o.direction,c.direction),Cartesian3.clone(o.up,c.up),c.frustum=s;const l=complete2DCallback(c);createMorphHandler(e,l),morphFrom3DToColumbusView(e,t,o,(function(){morphPerspectiveToOrthographic(e,t,o,a,l)}))}function morphOrthographicToPerspective(e,t,n,i){const r=e._scene,o=r.camera,a=o.frustum.right-o.frustum.left;o.frustum=n.frustum.clone();const s=o.frustum.fov,c=.5*CesiumMath.RADIANS_PER_DEGREE,l=a*Math.tan(.5*s);o.frustum.far=l/Math.tan(.5*c)+1e7,o.frustum.fov=c;const u=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){o.frustum.fov=CesiumMath.lerp(c,s,e.time),o.position.z=l/Math.tan(.5*o.frustum.fov)},complete:function(){i(e)}});e._currentTweens.push(u)}function morphFrom2DToColumbusView(e,t,n,i){t*=.5;const r=e._scene,o=r.camera,a=Cartesian3.clone(n.position,scratch3DToCVEndPos),s=Cartesian3.clone(n.direction,scratch3DToCVEndDir),c=Cartesian3.clone(n.up,scratch3DToCVEndUp);function l(){o.frustum=n.frustum.clone();const l=Cartesian3.clone(o.position,scratch3DToCVStartPos),u=Cartesian3.clone(o.direction,scratch3DToCVStartDir),d=Cartesian3.clone(o.up,scratch3DToCVStartUp);l.z=a.z;const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(l,a,e.time,o.position),columbusViewMorph(u,s,e.time,o.direction),columbusViewMorph(d,c,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right)},complete:function(){i(e)}});e._currentTweens.push(h)}r._mode=SceneMode$1.MORPHING,e._morphToOrthographic?l():morphOrthographicToPerspective(e,0,n,l)}function morphFrom3DToColumbusView(e,t,n,i){const r=e._scene,o=r.camera,a=Cartesian3.clone(o.position,scratch3DToCVStartPos),s=Cartesian3.clone(o.direction,scratch3DToCVStartDir),c=Cartesian3.clone(o.up,scratch3DToCVStartUp),l=Cartesian3.clone(n.position2D,scratch3DToCVEndPos),u=Cartesian3.clone(n.direction2D,scratch3DToCVEndDir),d=Cartesian3.clone(n.up2D,scratch3DToCVEndUp);const h=r.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(a,l,e.time,o.position),columbusViewMorph(s,u,e.time,o.direction),columbusViewMorph(c,d,e.time,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.right,o.right),o._adjustOrthographicFrustum(!0)},complete:function(){addMorphTimeAnimations(e,r,1,0,t,i)}});e._currentTweens.push(h)}function addMorphTimeAnimations(e,t,n,i,r,o){const a={object:t,property:"morphTime",startValue:n,stopValue:i,duration:r,easingFunction:EasingFunction$1.QUARTIC_OUT};defined(o)&&(a.complete=function(){o(e)});const s=t.tweens.addProperty(a);e._currentTweens.push(s)}function complete3DCallback(e){return function(t){const n=t._scene;n._mode=SceneMode$1.SCENE3D,n.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),destroyMorphHandler(t);const i=n.camera;(t._previousMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,i.position),Cartesian3.clone(e.direction,i.direction),Cartesian3.clone(e.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right),i.frustum=e.frustum.clone());const r=i.frustum;n.frameState.useLogDepth&&(r.near=.1,r.far=1e10);const o=defined(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE3D,o)}}function complete2DCallback(e){return function(t){const n=t._scene;n._mode=SceneMode$1.SCENE2D,n.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE2D),destroyMorphHandler(t);const i=n.camera;Cartesian3.clone(e.position,i.position),i.position.z=2*n.mapProjection.ellipsoid.maximumRadius,Cartesian3.clone(e.direction,i.direction),Cartesian3.clone(e.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right),i.frustum=e.frustum.clone();const r=defined(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.SCENE2D,r)}}function completeColumbusViewCallback(e){return function(t){const n=t._scene;n._mode=SceneMode$1.COLUMBUS_VIEW,n.morphTime=SceneMode$1.getMorphTime(SceneMode$1.COLUMBUS_VIEW),destroyMorphHandler(t);const i=n.camera;(t._previousModeMode!==SceneMode$1.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,Cartesian3.clone(e.position,i.position),Cartesian3.clone(e.direction,i.direction),Cartesian3.clone(e.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right));const r=i.frustum;n.frameState.useLogDepth&&(r.near=.1,r.far=1e10);const o=defined(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,SceneMode$1.COLUMBUS_VIEW,o)}}function Tween(e,t,n,i,r,o,a,s,c,l){this._tweens=e,this._tweenjs=t,this._startObject=clone$1(n),this._stopObject=clone$1(i),this._duration=r,this._delay=o,this._easingFunction=a,this._update=s,this._complete=c,this.cancel=l,this.needsStart=!0}function TweenCollection(){this._tweens=[]}function ScreenSpaceCameraController(e){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=CameraEventType$1.LEFT_DRAG,this.zoomEventTypes=[CameraEventType$1.RIGHT_DRAG,CameraEventType$1.WHEEL,CameraEventType$1.PINCH],this.rotateEventTypes=CameraEventType$1.LEFT_DRAG,this.tiltEventTypes=[CameraEventType$1.MIDDLE_DRAG,CameraEventType$1.PINCH,{eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.CTRL},{eventType:CameraEventType$1.RIGHT_DRAG,modifier:KeyboardEventModifier$1.CTRL}],this.lookEventTypes={eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.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=e,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new CameraEventAggregator(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new TweenCollection,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new Cartesian2(-1,-1),this._tiltCenter=new Cartesian3,this._rotateMousePosition=new Cartesian2(-1,-1),this._rotateStartPosition=new Cartesian3,this._strafeStartPosition=new Cartesian3,this._strafeMousePosition=new Cartesian2,this._strafeEndMousePosition=new Cartesian2,this._zoomMouseStart=new Cartesian2(-1,-1),this._zoomWorldPosition=new Cartesian3,this._useZoomWorldPosition=!1,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;const t=e.mapProjection;this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.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,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function decay(e,t){if(e<0)return 0;const n=25*(1-t);return Math.exp(-n*e)}function sameMousePosition(e){return Cartesian2.equalsEpsilon(e.startPosition,e.endPosition,CesiumMath.EPSILON14)}Object.defineProperties(Tween.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}}}),Tween.prototype.cancelTween=function(){this._tweens.remove(this)},Object.defineProperties(TweenCollection.prototype,{length:{get:function(){return this._tweens.length}}}),TweenCollection.prototype.add=function(e){if(0===(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).duration)return defined(e.complete)&&e.complete(),new Tween(this);const t=e.duration/TimeConstants$1.SECONDS_PER_MILLISECOND,n=defaultValue(e.delay,0),i=n/TimeConstants$1.SECONDS_PER_MILLISECOND,r=defaultValue(e.easingFunction,EasingFunction$1.LINEAR_NONE),o=e.startObject,a=new Tween$1.Tween(o);a.to(clone$1(e.stopObject),t),a.delay(i),a.easing(r),defined(e.update)&&a.onUpdate((function(){e.update(o)})),a.onComplete(defaultValue(e.complete,null)),a.repeat(defaultValue(e._repeat,0));const s=new Tween(this,a,e.startObject,e.stopObject,e.duration,n,r,e.update,e.complete,e.cancel);return this._tweens.push(s),s},TweenCollection.prototype.addProperty=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).object,n=e.property,i=e.startValue,r=e.stopValue;return this.add({startObject:{value:i},stopObject:{value:r},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){t[n]=e.value},complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},TweenCollection.prototype.addAlpha=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material,n=[];for(const e in t.uniforms)t.uniforms.hasOwnProperty(e)&&defined(t.uniforms[e])&&defined(t.uniforms[e].alpha)&&n.push(e);return this.add({startObject:{alpha:defaultValue(e.startValue,0)},stopObject:{alpha:defaultValue(e.stopValue,1)},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){const i=n.length;for(let r=0;r<i;++r)t.uniforms[n[r]].alpha=e.alpha},complete:e.complete,cancel:e.cancel})},TweenCollection.prototype.addOffsetIncrement=function(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material.uniforms;return this.addProperty({object:t,property:"offset",startValue:t.offset,stopValue:t.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},TweenCollection.prototype.remove=function(e){if(!defined(e))return!1;const t=this._tweens.indexOf(e);return-1!==t&&(e.tweenjs.stop(),defined(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0)},TweenCollection.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),defined(n.cancel)&&n.cancel()}e.length=0},TweenCollection.prototype.contains=function(e){return defined(e)&&-1!==this._tweens.indexOf(e)},TweenCollection.prototype.get=function(e){return this._tweens[e]},TweenCollection.prototype.update=function(e){const t=this._tweens;let n=0;for(e=defined(e)?e/TimeConstants$1.SECONDS_PER_MILLISECOND:getTimestamp$1();n<t.length;){const i=t[n],r=i.tweenjs;i.needsStart?(i.needsStart=!1,r.start(e)):r.update(e)?n++:(r.stop(),t.splice(n,1))}};const inertiaMaxClickTimeThreshold=.4;function maintainInertia(e,t,n,i,r,o,a){let s=o[a];defined(s)||(s=o[a]={startPosition:new Cartesian2,endPosition:new Cartesian2,motion:new Cartesian2,inertiaEnabled:!0});const c=e.getButtonPressTime(t,n),l=e.getButtonReleaseTime(t,n),u=c&&l&&(l.getTime()-c.getTime())/1e3,d=new Date,h=l&&(d.getTime()-l.getTime())/1e3;if(c&&l&&u<inertiaMaxClickTimeThreshold){const a=decay(h,i),c=e.getLastMovement(t,n);if(!defined(c)||sameMousePosition(c)||!s.inertiaEnabled)return;if(s.motion.x=.5*(c.endPosition.x-c.startPosition.x),s.motion.y=.5*(c.endPosition.y-c.startPosition.y),s.startPosition=Cartesian2.clone(c.startPosition,s.startPosition),s.endPosition=Cartesian2.multiplyByScalar(s.motion,a,s.endPosition),s.endPosition=Cartesian2.add(s.startPosition,s.endPosition,s.endPosition),isNaN(s.endPosition.x)||isNaN(s.endPosition.y)||Cartesian2.distance(s.startPosition,s.endPosition)<.5)return;if(!e.isButtonDown(t,n)){r(o,e.getStartMousePosition(t,n),s)}}}function activateInertia(e,t){if(defined(t)){let n=e[t];defined(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(defined(i)){const t=i.length;for(let r=0;r<t;++r)n=e[i[r]],defined(n)&&(n.inertiaEnabled=!1)}}}const scratchEventTypeArray=[];function reactToInput(e,t,n,i,r,o){if(!defined(n))return;const a=e._aggregator;Array.isArray(n)||(scratchEventTypeArray[0]=n,n=scratchEventTypeArray);const s=n.length;for(let c=0;c<s;++c){const s=n[c],l=defined(s.eventType)?s.eventType:s,u=s.modifier,d=a.isMoving(l,u)&&a.getMovement(l,u),h=a.getStartMousePosition(l,u);e.enableInputs&&t&&(d?(i(e,h,d),activateInertia(e,o)):r<1&&maintainInertia(a,l,u,r,i,e,o))}}const scratchZoomPickRay=new Ray,scratchPickCartesian$1=new Cartesian3,scratchZoomOffset=new Cartesian2,scratchZoomDirection=new Cartesian3,scratchCenterPixel=new Cartesian2,scratchCenterPosition=new Cartesian3,scratchPositionNormal=new Cartesian3,scratchPickNormal=new Cartesian3,scratchZoomAxis=new Cartesian3,scratchCameraPositionNormal=new Cartesian3,scratchTargetNormal=new Cartesian3,scratchCameraPosition=new Cartesian3,scratchCameraUpNormal=new Cartesian3,scratchCameraRightNormal=new Cartesian3,scratchForwardNormal=new Cartesian3,scratchPositionToTarget=new Cartesian3,scratchPositionToTargetNormal=new Cartesian3,scratchPan=new Cartesian3,scratchCenterMovement=new Cartesian3,scratchCenter=new Cartesian3,scratchCartesian=new Cartesian3,scratchCartesianTwo=new Cartesian3,scratchCartesianThree=new Cartesian3,scratchZoomViewOptions={orientation:new HeadingPitchRoll};function handleZoom(e,t,n,i,r,o){let a=1;defined(o)&&(a=CesiumMath.clamp(Math.abs(o),.25,1));const s=n.endPosition.y-n.startPosition.y,c=s>0?e.minimumZoomDistance*a:0,l=e.maximumZoomDistance;let u=i*(r-c);u=CesiumMath.clamp(u,e._minimumZoomRate,e._maximumZoomRate);let d=s/e._scene.canvas.clientHeight;d=Math.min(d,e.maximumMovementRatio);let h=u*d;if(e.enableCollisionDetection||0===e.minimumZoomDistance||!defined(e._globe)){if(h>0&&Math.abs(r-c)<1)return;if(h<0&&Math.abs(r-l)<1)return;r-h<c?h=r-c-1:r-h>l&&(h=r-l)}const p=e._scene,f=p.camera,m=p.mode,g=scratchZoomViewOptions.orientation;if(g.heading=f.heading,g.pitch=f.pitch,g.roll=f.roll,f.frustum instanceof OrthographicFrustum)return void(Math.abs(h)>0&&(f.zoomIn(h),f._adjustOrthographicFrustum()));const _=Cartesian2.equals(t,e._zoomMouseStart);let y,C=e._zoomingOnVector,T=e._rotatingZoom;if(_||(e._zoomMouseStart=Cartesian2.clone(t,e._zoomMouseStart),defined(e._globe)&&(m===SceneMode$1.SCENE2D?(y=f.getPickRay(t,scratchZoomPickRay).origin,y=Cartesian3.fromElements(y.y,y.z,y.x)):y=pickGlobe(e,t,scratchPickCartesian$1)),defined(y)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=Cartesian3.clone(y,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,C=e._zoomingOnVector=!1,T=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition)return void f.zoomIn(h);let S=m===SceneMode$1.COLUMBUS_VIEW;if(f.positionCartographic.height<2e6&&(T=!0),!_||T){if(m===SceneMode$1.SCENE2D){const n=e._zoomWorldPosition,i=f.position;if(!Cartesian3.equals(n,i)&&f.positionCartographic.height<2*e._maxCoord.x){const r=f.position.x,o=Cartesian3.subtract(n,i,scratchZoomDirection);Cartesian3.normalize(o,o);const a=Cartesian3.distance(n,i)*h/(.5*f.getMagnitude());f.move(o,.5*a),(f.position.x<0&&r>0||f.position.x>0&&r<0)&&(y=f.getPickRay(t,scratchZoomPickRay).origin,y=Cartesian3.fromElements(y.y,y.z,y.x),e._zoomWorldPosition=Cartesian3.clone(y,e._zoomWorldPosition))}}else if(m===SceneMode$1.SCENE3D){const t=Cartesian3.normalize(f.position,scratchCameraPositionNormal);if(e._cameraUnderground||e._zoomingUnderground||f.positionCartographic.height<3e3&&Math.abs(Cartesian3.dot(f.direction,t))<.6)S=!0;else{const n=p.canvas,i=scratchCenterPixel;i.x=n.clientWidth/2,i.y=n.clientHeight/2;const r=pickGlobe(e,i,scratchCenterPosition);if(defined(r))if(f.positionCartographic.height<1e6){if(!(Cartesian3.dot(f.direction,t)>=-.5)){const n=scratchCameraPosition;Cartesian3.clone(f.position,n);const i=e._zoomWorldPosition;let r=scratchTargetNormal;if(r=Cartesian3.normalize(i,r),Cartesian3.dot(r,t)<0)return;const o=scratchCenter,a=scratchForwardNormal;Cartesian3.clone(f.direction,a),Cartesian3.add(n,Cartesian3.multiplyByScalar(a,1e3,scratchCartesian),o);const s=scratchPositionToTarget,c=scratchPositionToTargetNormal;Cartesian3.subtract(i,n,s),Cartesian3.normalize(s,c);const l=Cartesian3.dot(t,c);if(l>=0)return void(e._zoomMouseStart.x=-1);const u=Math.acos(-l),d=Cartesian3.magnitude(n),p=Cartesian3.magnitude(i),m=d-h,g=Cartesian3.magnitude(s),_=Math.asin(CesiumMath.clamp(g/p*Math.sin(u),-1,1))-Math.asin(CesiumMath.clamp(m/p*Math.sin(u),-1,1))+u,y=scratchCameraUpNormal;Cartesian3.normalize(n,y);let C=scratchCameraRightNormal;C=Cartesian3.cross(c,y,C),C=Cartesian3.normalize(C,C),Cartesian3.normalize(Cartesian3.cross(y,C,scratchCartesian),a),Cartesian3.multiplyByScalar(Cartesian3.normalize(o,scratchCartesian),Cartesian3.magnitude(o)-h,o),Cartesian3.normalize(n,n),Cartesian3.multiplyByScalar(n,m,n);const T=scratchPan;Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(y,Math.cos(_)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(a,Math.sin(_),scratchCartesianThree),scratchCartesian),m,T),Cartesian3.add(n,T,n),Cartesian3.normalize(o,y),Cartesian3.normalize(Cartesian3.cross(y,C,scratchCartesian),a);const S=scratchCenterMovement;return Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(y,Math.cos(_)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(a,Math.sin(_),scratchCartesianThree),scratchCartesian),Cartesian3.magnitude(o),S),Cartesian3.add(o,S,o),Cartesian3.clone(n,f.position),Cartesian3.normalize(Cartesian3.subtract(o,n,scratchCartesian),f.direction),Cartesian3.clone(f.direction,f.direction),Cartesian3.cross(f.direction,f.up,f.right),Cartesian3.cross(f.right,f.direction,f.up),void f.setView(scratchZoomViewOptions)}S=!0}else{const t=Cartesian3.normalize(r,scratchPositionNormal),n=Cartesian3.normalize(e._zoomWorldPosition,scratchPickNormal),i=Cartesian3.dot(n,t);if(i>0&&i<1){const e=CesiumMath.acosClamped(i),r=Cartesian3.cross(n,t,scratchZoomAxis),o=h/(Math.abs(e)>CesiumMath.toRadians(20)?.75*f.positionCartographic.height:f.positionCartographic.height-h);f.rotate(r,e*o)}}else S=!0}}e._rotatingZoom=!S}if(!_&&S||C){let n;const i=SceneTransforms.wgs84ToWindowCoordinates(p,e._zoomWorldPosition,scratchZoomOffset);n=m!==SceneMode$1.COLUMBUS_VIEW&&Cartesian2.equals(t,e._zoomMouseStart)&&defined(i)?f.getPickRay(i,scratchZoomPickRay):f.getPickRay(t,scratchZoomPickRay);const r=n.direction;m!==SceneMode$1.COLUMBUS_VIEW&&m!==SceneMode$1.SCENE2D||Cartesian3.fromElements(r.y,r.z,r.x,r),f.move(r,h),e._zoomingOnVector=!0}else f.zoomIn(h);e._cameraUnderground||f.setView(scratchZoomViewOptions)}const translate2DStart=new Ray,translate2DEnd=new Ray,scratchTranslateP0=new Cartesian3;function translate2D(e,t,n){const i=e._scene.camera;let r=i.getPickRay(n.startPosition,translate2DStart).origin,o=i.getPickRay(n.endPosition,translate2DEnd).origin;r=Cartesian3.fromElements(r.y,r.z,r.x,r),o=Cartesian3.fromElements(o.y,o.z,o.x,o);const a=Cartesian3.subtract(r,o,scratchTranslateP0),s=Cartesian3.magnitude(a);s>0&&(Cartesian3.normalize(a,a),i.move(a,s))}function zoom2D(e,t,n){defined(n.distance)&&(n=n.distance);const i=e._scene.camera;handleZoom(e,t,n,e._zoomFactor,i.getMagnitude())}const twist2DStart=new Cartesian2,twist2DEnd=new Cartesian2;function twist2D(e,t,n){if(defined(n.angleAndHeight))return void singleAxisTwist2D(e,t,n.angleAndHeight);const i=e._scene,r=i.camera,o=i.canvas,a=o.clientWidth,s=o.clientHeight;let c=twist2DStart;c.x=2/a*n.startPosition.x-1,c.y=2/s*(s-n.startPosition.y)-1,c=Cartesian2.normalize(c,c);let l=twist2DEnd;l.x=2/a*n.endPosition.x-1,l.y=2/s*(s-n.endPosition.y)-1,l=Cartesian2.normalize(l,l);let u=CesiumMath.acosClamped(c.x);c.y<0&&(u=CesiumMath.TWO_PI-u);let d=CesiumMath.acosClamped(l.x);l.y<0&&(d=CesiumMath.TWO_PI-d);const h=d-u;r.twistRight(h)}function singleAxisTwist2D(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);const r=e._scene,o=r.camera,a=r.canvas;let s=(n.endPosition.x-n.startPosition.x)/a.clientWidth;s=Math.min(s,e.maximumMovementRatio);const c=i*s*Math.PI*4;o.twistRight(c)}function update2D(e){const t=e._scene.mapMode2D===MapMode2D$1.ROTATE;Matrix4.equals(Matrix4.IDENTITY,e._scene.camera.transform)?(reactToInput(e,e.enableTranslate,e.translateEventTypes,translate2D,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.tiltEventTypes,twist2D,e.inertiaSpin,"_lastInertiaTiltMovement")):(reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.translateEventTypes,twist2D,e.inertiaSpin,"_lastInertiaSpinMovement"))}const pickGlobeScratchRay=new Ray,scratchDepthIntersection=new Cartesian3,scratchRayIntersection=new Cartesian3;function pickGlobe(e,t,n){const i=e._scene,r=e._globe,o=i.camera;if(!defined(r))return;const a=!e._cameraUnderground;let s;i.pickPositionSupported&&(s=i.pickPositionWorldCoordinates(t,scratchDepthIntersection));const c=o.getPickRay(t,pickGlobeScratchRay),l=r.pickWorldCoordinates(c,i,a,scratchRayIntersection);return(defined(s)?Cartesian3.distance(s,o.positionWC):Number.POSITIVE_INFINITY)<(defined(l)?Cartesian3.distance(l,o.positionWC):Number.POSITIVE_INFINITY)?Cartesian3.clone(s,n):Cartesian3.clone(l,n)}const scratchDistanceCartographic=new Cartographic;function getDistanceFromSurface(e){const t=e._ellipsoid,n=e._scene,i=n.camera;let r=0;if(n.mode===SceneMode$1.SCENE3D){const e=t.cartesianToCartographic(i.position,scratchDistanceCartographic);defined(e)&&(r=e.height)}else r=i.position.z;const o=defaultValue(e._scene.globeHeight,0);return Math.abs(o-r)}const scratchSurfaceNormal=new Cartesian3;function getZoomDistanceUnderground(e,t){const n=t.origin,i=t.direction,r=getDistanceFromSurface(e),o=Cartesian3.normalize(n,scratchSurfaceNormal);let a=Math.abs(Cartesian3.dot(o,i));return a=2*Math.max(a,.5),r*a}function getTiltCenterUnderground(e,t,n,i){let r=Cartesian3.distance(t.origin,n);const o=getDistanceFromSurface(e);return r>CesiumMath.clamp(5*o,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance)&&(r=Math.min(r,o/5),r=Math.max(r,100)),Ray.getPoint(t,r,i)}function getStrafeStartPositionUnderground(e,t,n,i){let r;return defined(n)?(r=Cartesian3.distance(t.origin,n),r>e._maximumUndergroundPickDistance&&(r=getDistanceFromSurface(e))):r=getDistanceFromSurface(e),Ray.getPoint(t,r,i)}const scratchInertialDelta=new Cartesian2;function continueStrafing(e,t){const n=t.endPosition,i=Cartesian2.subtract(t.endPosition,t.startPosition,scratchInertialDelta),r=e._strafeEndMousePosition;Cartesian2.add(r,i,r),t.endPosition=r,strafe(e,t,e._strafeStartPosition),t.endPosition=n}const translateCVStartRay=new Ray,translateCVEndRay=new Ray,translateCVStartPos=new Cartesian3,translateCVEndPos=new Cartesian3,translateCVDifference=new Cartesian3,translateCVOrigin=new Cartesian3,translateCVPlane=new Plane(Cartesian3.UNIT_X,0),translateCVStartMouse=new Cartesian2,translateCVEndMouse=new Cartesian2;function translateCV(e,t,n){if(Cartesian3.equals(t,e._translateMousePosition)||(e._looking=!1),Cartesian3.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking)return void look3D(e,t,n);if(e._strafing)return void continueStrafing(e,n);const i=e._scene.camera,r=e._cameraUnderground,o=Cartesian2.clone(n.startPosition,translateCVStartMouse),a=Cartesian2.clone(n.endPosition,translateCVEndMouse);let s=i.getPickRay(o,translateCVStartRay);const c=Cartesian3.clone(Cartesian3.ZERO,translateCVOrigin),l=Cartesian3.UNIT_X;let u;if(i.position.z<e._minimumPickingTerrainHeight&&(u=pickGlobe(e,o,translateCVStartPos),defined(u)&&(c.x=u.x)),r||c.x>i.position.z&&defined(u)){let i=u;return r&&(i=getStrafeStartPositionUnderground(e,s,u,translateCVStartPos)),Cartesian2.clone(t,e._strafeMousePosition),Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(i,e._strafeStartPosition),e._strafing=!0,void strafe(e,n,e._strafeStartPosition)}const d=Plane.fromPointNormal(c,l,translateCVPlane);s=i.getPickRay(o,translateCVStartRay);const h=IntersectionTests.rayPlane(s,d,translateCVStartPos),p=i.getPickRay(a,translateCVEndRay),f=IntersectionTests.rayPlane(p,d,translateCVEndPos);if(!defined(h)||!defined(f))return e._looking=!0,look3D(e,t,n),void Cartesian2.clone(t,e._translateMousePosition);const m=Cartesian3.subtract(h,f,translateCVDifference),g=m.x;m.x=m.y,m.y=m.z,m.z=g;const _=Cartesian3.magnitude(m);_>CesiumMath.EPSILON6&&(Cartesian3.normalize(m,m),i.move(m,_))}const rotateCVWindowPos=new Cartesian2,rotateCVWindowRay=new Ray,rotateCVCenter=new Cartesian3,rotateCVVerticalCenter=new Cartesian3,rotateCVTransform=new Matrix4,rotateCVVerticalTransform=new Matrix4,rotateCVOrigin=new Cartesian3,rotateCVPlane=new Plane(Cartesian3.UNIT_X,0),rotateCVCartesian3=new Cartesian3,rotateCVCart=new Cartographic,rotateCVOldTransform=new Matrix4,rotateCVQuaternion=new Quaternion,rotateCVMatrix=new Matrix3,tilt3DCartesian3=new Cartesian3;function rotateCV(e,t,n){if(defined(n.angleAndHeight)&&(n=n.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking)return void look3D(e,t,n);const i=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(i.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,rotateCVOnPlane(e,t,n)):rotateCVOnTerrain(e,t,n)}function rotateCVOnPlane(e,t,n){const i=e._scene,r=i.camera,o=i.canvas,a=rotateCVWindowPos;a.x=o.clientWidth/2,a.y=o.clientHeight/2;const s=r.getPickRay(a,rotateCVWindowRay),c=Cartesian3.UNIT_X,l=s.origin,u=s.direction;let d;const h=Cartesian3.dot(c,u);if(Math.abs(h)>CesiumMath.EPSILON6&&(d=-Cartesian3.dot(c,l)/h),!defined(d)||d<=0)return e._looking=!0,look3D(e,t,n),void Cartesian2.clone(t,e._tiltCenterMousePosition);const p=Cartesian3.multiplyByScalar(u,d,rotateCVCenter);Cartesian3.add(l,p,p);const f=i.mapProjection,m=f.ellipsoid;Cartesian3.fromElements(p.y,p.z,p.x,p);const g=f.unproject(p,rotateCVCart);m.cartographicToCartesian(g,p);const _=Transforms.eastNorthUpToFixedFrame(p,m,rotateCVTransform),y=e._globe,C=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const T=Matrix4.clone(r.transform,rotateCVOldTransform);r._setTransform(_),rotate3D(e,t,n,Cartesian3.UNIT_Z),r._setTransform(T),e._globe=y,e._ellipsoid=C;const S=C.maximumRadius;e._rotateFactor=1/S,e._rotateRateRangeAdjustment=S}function rotateCVOnTerrain(e,t,n){const i=e._scene,r=i.camera,o=e._cameraUnderground;let a,s;const c=Cartesian3.UNIT_X;if(Cartesian2.equals(t,e._tiltCenterMousePosition))a=Cartesian3.clone(e._tiltCenter,rotateCVCenter);else{if(r.position.z<e._minimumPickingTerrainHeight&&(a=pickGlobe(e,t,rotateCVCenter)),!defined(a)){s=r.getPickRay(t,rotateCVWindowRay);const i=s.origin,o=s.direction;let l;const u=Cartesian3.dot(c,o);if(Math.abs(u)>CesiumMath.EPSILON6&&(l=-Cartesian3.dot(c,i)/u),!defined(l)||l<=0)return e._looking=!0,look3D(e,t,n),void Cartesian2.clone(t,e._tiltCenterMousePosition);a=Cartesian3.multiplyByScalar(o,l,rotateCVCenter),Cartesian3.add(i,a,a)}o&&(defined(s)||(s=r.getPickRay(t,rotateCVWindowRay)),getTiltCenterUnderground(e,s,a,a)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(a,e._tiltCenter)}const l=i.canvas,u=rotateCVWindowPos;u.x=l.clientWidth/2,u.y=e._tiltCenterMousePosition.y,s=r.getPickRay(u,rotateCVWindowRay);const d=Cartesian3.clone(Cartesian3.ZERO,rotateCVOrigin);d.x=a.x;const h=Plane.fromPointNormal(d,c,rotateCVPlane),p=IntersectionTests.rayPlane(s,h,rotateCVVerticalCenter),f=r._projection,m=f.ellipsoid;Cartesian3.fromElements(a.y,a.z,a.x,a);let g=f.unproject(a,rotateCVCart);m.cartographicToCartesian(g,a);const _=Transforms.eastNorthUpToFixedFrame(a,m,rotateCVTransform);let y;defined(p)?(Cartesian3.fromElements(p.y,p.z,p.x,p),g=f.unproject(p,rotateCVCart),m.cartographicToCartesian(g,p),y=Transforms.eastNorthUpToFixedFrame(p,m,rotateCVVerticalTransform)):y=_;const C=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=Cartesian3.UNIT_Z;const A=Matrix4.clone(r.transform,rotateCVOldTransform);r._setTransform(_);const v=Cartesian3.cross(Cartesian3.UNIT_Z,Cartesian3.normalize(r.position,rotateCVCartesian3),rotateCVCartesian3),E=Cartesian3.dot(r.right,v);if(rotate3D(e,t,n,S,!1,!0),r._setTransform(y),E<0){const i=n.startPosition.y-n.endPosition.y;(o&&i<0||!o&&i>0)&&(S=void 0);const a=r.constrainedAxis;r.constrainedAxis=void 0,rotate3D(e,t,n,S,!0,!1),r.constrainedAxis=a}else rotate3D(e,t,n,S,!0,!1);if(defined(r.constrainedAxis)){const e=Cartesian3.cross(r.direction,r.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(e,r.right)<0&&Cartesian3.negate(e,e),Cartesian3.cross(e,r.direction,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.up,r.up),Cartesian3.normalize(r.right,r.right))}r._setTransform(A),e._globe=C,e._ellipsoid=T;const b=T.maximumRadius;e._rotateFactor=1/b,e._rotateRateRangeAdjustment=b;const x=Cartesian3.clone(r.positionWC,rotateCVCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(r.positionWC,x)){r._setTransform(y),r.worldToCameraCoordinatesPoint(x,x);const e=Cartesian3.magnitudeSquared(x);Cartesian3.magnitudeSquared(r.position)>e&&(Cartesian3.normalize(r.position,r.position),Cartesian3.multiplyByScalar(r.position,Math.sqrt(e),r.position));const t=Cartesian3.angleBetween(x,r.position),n=Cartesian3.cross(x,r.position,x);Cartesian3.normalize(n,n);const i=Quaternion.fromAxisAngle(n,t,rotateCVQuaternion),o=Matrix3.fromQuaternion(i,rotateCVMatrix);Matrix3.multiplyByVector(o,r.direction,r.direction),Matrix3.multiplyByVector(o,r.up,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.cross(r.right,r.direction,r.up),r._setTransform(A)}}const zoomCVWindowPos=new Cartesian2,zoomCVWindowRay=new Ray,zoomCVIntersection=new Cartesian3;function zoomCV(e,t,n){defined(n.distance)&&(n=n.distance);const i=e._scene,r=i.camera,o=i.canvas,a=e._cameraUnderground;let s;a?s=t:(s=zoomCVWindowPos,s.x=o.clientWidth/2,s.y=o.clientHeight/2);const c=r.getPickRay(s,zoomCVWindowRay),l=c.origin,u=c.direction;let d,h;if(r.position.z<e._minimumPickingTerrainHeight&&(d=pickGlobe(e,s,zoomCVIntersection)),defined(d)&&(h=Cartesian3.distance(l,d)),a){const t=getZoomDistanceUnderground(e,c);h=defined(h)?Math.min(h,t):t}if(!defined(h)){const e=Cartesian3.UNIT_X;h=-Cartesian3.dot(e,l)/Cartesian3.dot(e,u)}handleZoom(e,t,n,e._zoomFactor,h)}function updateCV(e){const t=e._scene.camera;if(Matrix4.equals(Matrix4.IDENTITY,t.transform)){const n=e._tweens;if(e._aggregator.anyButtonDown&&n.removeAll(),reactToInput(e,e.enableTilt,e.tiltEventTypes,rotateCV,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableTranslate,e.translateEventTypes,translateCV,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoomCV,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D),!e._aggregator.anyButtonDown&&!n.contains(e._tween)){const i=t.createCorrectPositionTween(e.bounceAnimationTime);defined(i)&&(e._tween=n.add(i))}n.update()}else reactToInput(e,e.enableRotate,e.rotateEventTypes,rotate3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement")}const scratchStrafeRay=new Ray,scratchStrafePlane=new Plane(Cartesian3.UNIT_X,0),scratchStrafeIntersection=new Cartesian3,scratchStrafeDirection=new Cartesian3,scratchMousePos=new Cartesian3;function strafe(e,t,n){const i=e._scene,r=i.camera,o=r.getPickRay(t.endPosition,scratchStrafeRay);let a=Cartesian3.clone(r.direction,scratchStrafeDirection);i.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(a.z,a.x,a.y,a);const s=Plane.fromPointNormal(n,a,scratchStrafePlane),c=IntersectionTests.rayPlane(o,s,scratchStrafeIntersection);defined(c)&&(a=Cartesian3.subtract(n,c,a),i.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(a.y,a.z,a.x,a),Cartesian3.add(r.position,a,r.position))}const spin3DPick=new Cartesian3,scratchCartographic=new Cartographic,scratchRadii=new Cartesian3,scratchEllipsoid=new Ellipsoid,scratchLookUp=new Cartesian3,scratchNormal=new Cartesian3;function spin3D(e,t,n){const i=e._scene.camera,r=e._cameraUnderground;let o,a,s=e._ellipsoid;if(!Matrix4.equals(i.transform,Matrix4.IDENTITY))return void rotate3D(e,t,n);const c=s.geodeticSurfaceNormal(i.position,scratchLookUp);if(Cartesian2.equals(t,e._rotateMousePosition)){if(e._looking)look3D(e,t,n,c);else if(e._rotating)rotate3D(e,t,n);else if(e._strafing)continueStrafing(e,n);else{if(Cartesian3.magnitude(i.position)<Cartesian3.magnitude(e._rotateStartPosition))return;o=Cartesian3.magnitude(e._rotateStartPosition),a=scratchRadii,a.x=a.y=a.z=o,s=Ellipsoid.fromCartesian3(a,scratchEllipsoid),pan3D(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const l=s.cartesianToCartographic(i.positionWC,scratchCartographic).height;if(defined(e._globe)&&l<e._minimumPickingTerrainHeight){const l=pickGlobe(e,n.startPosition,scratchMousePos);if(defined(l)){let c=!1;const u=i.getPickRay(n.startPosition,pickGlobeScratchRay);if(r)c=!0,getStrafeStartPositionUnderground(e,u,l,l);else{const e=s.geodeticSurfaceNormal(l,scratchNormal);c=!!(Math.abs(Cartesian3.dot(u.direction,e))<.05)||Cartesian3.magnitude(i.position)<Cartesian3.magnitude(l)}c?(Cartesian2.clone(t,e._strafeEndMousePosition),Cartesian3.clone(l,e._strafeStartPosition),e._strafing=!0,strafe(e,n,e._strafeStartPosition)):(o=Cartesian3.magnitude(l),a=scratchRadii,a.x=a.y=a.z=o,s=Ellipsoid.fromCartesian3(a,scratchEllipsoid),pan3D(e,t,n,s),Cartesian3.clone(l,e._rotateStartPosition))}else e._looking=!0,look3D(e,t,n,c)}else defined(i.pickEllipsoid(n.startPosition,e._ellipsoid,spin3DPick))?(pan3D(e,t,n,e._ellipsoid),Cartesian3.clone(spin3DPick,e._rotateStartPosition)):l>e._minimumTrackBallHeight?(e._rotating=!0,rotate3D(e,t,n)):(e._looking=!0,look3D(e,t,n,c));Cartesian2.clone(t,e._rotateMousePosition)}function rotate3D(e,t,n,i,r,o){r=defaultValue(r,!1),o=defaultValue(o,!1);const a=e._scene,s=a.camera,c=a.canvas,l=s.constrainedAxis;defined(i)&&(s.constrainedAxis=i);const u=Cartesian3.magnitude(s.position);let d=e._rotateFactor*(u-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);let h=(n.startPosition.x-n.endPosition.x)/c.clientWidth,p=(n.startPosition.y-n.endPosition.y)/c.clientHeight;h=Math.min(h,e.maximumMovementRatio),p=Math.min(p,e.maximumMovementRatio);const f=d*h*Math.PI*2,m=d*p*Math.PI;r||s.rotateRight(f),o||s.rotateUp(m),s.constrainedAxis=l}const pan3DP0=Cartesian4.clone(Cartesian4.UNIT_W),pan3DP1=Cartesian4.clone(Cartesian4.UNIT_W),pan3DTemp0=new Cartesian3,pan3DTemp1=new Cartesian3,pan3DTemp2=new Cartesian3,pan3DTemp3=new Cartesian3,pan3DStartMousePosition=new Cartesian2,pan3DEndMousePosition=new Cartesian2;function pan3D(e,t,n,i){const r=e._scene.camera,o=Cartesian2.clone(n.startPosition,pan3DStartMousePosition),a=Cartesian2.clone(n.endPosition,pan3DEndMousePosition);let s=r.pickEllipsoid(o,i,pan3DP0),c=r.pickEllipsoid(a,i,pan3DP1);if(!defined(s)||!defined(c))return e._rotating=!0,void rotate3D(e,t,n);if(s=r.worldToCameraCoordinates(s,s),c=r.worldToCameraCoordinates(c,c),defined(r.constrainedAxis)){const e=r.constrainedAxis,t=Cartesian3.mostOrthogonalAxis(e,pan3DTemp0);Cartesian3.cross(t,e,t),Cartesian3.normalize(t,t);const n=Cartesian3.cross(e,t,pan3DTemp1),i=Cartesian3.magnitude(s),o=Cartesian3.dot(e,s),a=Math.acos(o/i),l=Cartesian3.multiplyByScalar(e,o,pan3DTemp2);Cartesian3.subtract(s,l,l),Cartesian3.normalize(l,l);const u=Cartesian3.magnitude(c),d=Cartesian3.dot(e,c),h=Math.acos(d/u),p=Cartesian3.multiplyByScalar(e,d,pan3DTemp3);Cartesian3.subtract(c,p,p),Cartesian3.normalize(p,p);let f=Math.acos(Cartesian3.dot(l,t));Cartesian3.dot(l,n)<0&&(f=CesiumMath.TWO_PI-f);let m=Math.acos(Cartesian3.dot(p,t));Cartesian3.dot(p,n)<0&&(m=CesiumMath.TWO_PI-m);const g=f-m;let _;_=Cartesian3.equalsEpsilon(e,r.position,CesiumMath.EPSILON2)?r.right:Cartesian3.cross(e,r.position,pan3DTemp0);const y=Cartesian3.cross(e,_,pan3DTemp0),C=Cartesian3.dot(y,Cartesian3.subtract(s,e,pan3DTemp1)),T=Cartesian3.dot(y,Cartesian3.subtract(c,e,pan3DTemp1));let S;S=C>0&&T>0?h-a:C>0&&T<=0?Cartesian3.dot(r.position,e)>0?-a-h:a+h:a-h,r.rotateRight(g),r.rotateUp(S)}else{Cartesian3.normalize(s,s),Cartesian3.normalize(c,c);const e=Cartesian3.dot(s,c),t=Cartesian3.cross(s,c,pan3DTemp0);if(e<1&&!Cartesian3.equalsEpsilon(t,Cartesian3.ZERO,CesiumMath.EPSILON14)){const n=Math.acos(e);r.rotate(t,n)}}}const zoom3DUnitPosition=new Cartesian3,zoom3DCartographic=new Cartographic;function zoom3D(e,t,n){defined(n.distance)&&(n=n.distance);const i=e._ellipsoid,r=e._scene,o=r.camera,a=r.canvas,s=e._cameraUnderground;let c;s?c=t:(c=zoomCVWindowPos,c.x=a.clientWidth/2,c.y=a.clientHeight/2);const l=o.getPickRay(c,zoomCVWindowRay);let u;const d=i.cartesianToCartographic(o.position,zoom3DCartographic).height;let h;if(d<e._minimumPickingTerrainHeight&&(u=pickGlobe(e,c,zoomCVIntersection)),defined(u)&&(h=Cartesian3.distance(l.origin,u)),s){const t=getZoomDistanceUnderground(e,l);h=defined(h)?Math.min(h,t):t}defined(h)||(h=d);const p=Cartesian3.normalize(o.position,zoom3DUnitPosition);handleZoom(e,t,n,e._zoomFactor,h,Cartesian3.dot(p,o.direction))}const tilt3DWindowPos=new Cartesian2,tilt3DRay=new Ray,tilt3DCenter=new Cartesian3,tilt3DVerticalCenter=new Cartesian3,tilt3DTransform=new Matrix4,tilt3DVerticalTransform=new Matrix4,tilt3DOldTransform=new Matrix4,tilt3DQuaternion=new Quaternion,tilt3DMatrix=new Matrix3,tilt3DCart=new Cartographic,tilt3DLookUp=new Cartesian3;function tilt3D(e,t,n){const i=e._scene.camera;if(!Matrix4.equals(i.transform,Matrix4.IDENTITY))return;if(defined(n.angleAndHeight)&&(n=n.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const r=e._ellipsoid.geodeticSurfaceNormal(i.position,tilt3DLookUp);return void look3D(e,t,n,r)}const r=e._ellipsoid.cartesianToCartographic(i.position,tilt3DCart);e._tiltOnEllipsoid||r.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,tilt3DOnEllipsoid(e,t,n)):tilt3DOnTerrain(e,t,n)}const tilt3DOnEllipsoidCartographic=new Cartographic;function tilt3DOnEllipsoid(e,t,n){const i=e._ellipsoid,r=e._scene,o=r.camera,a=.25*e.minimumZoomDistance,s=i.cartesianToCartographic(o.positionWC,tilt3DOnEllipsoidCartographic).height;if(s-a-1<CesiumMath.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const c=r.canvas,l=tilt3DWindowPos;l.x=c.clientWidth/2,l.y=c.clientHeight/2;const u=o.getPickRay(l,tilt3DRay);let d;const h=IntersectionTests.rayEllipsoid(u,i);if(defined(h))d=Ray.getPoint(u,h.start,tilt3DCenter);else{if(!(s>e._minimumTrackBallHeight)){e._looking=!0;const i=e._ellipsoid.geodeticSurfaceNormal(o.position,tilt3DLookUp);return look3D(e,t,n,i),void Cartesian2.clone(t,e._tiltCenterMousePosition)}{const e=IntersectionTests.grazingAltitudeLocation(u,i);if(!defined(e))return;const t=i.cartesianToCartographic(e,tilt3DCart);t.height=0,d=i.cartographicToCartesian(t,tilt3DCenter)}}const p=Transforms.eastNorthUpToFixedFrame(d,i,tilt3DTransform),f=e._globe,m=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const g=Matrix4.clone(o.transform,tilt3DOldTransform);o._setTransform(p),rotate3D(e,t,n,Cartesian3.UNIT_Z),o._setTransform(g),e._globe=f,e._ellipsoid=m;const _=m.maximumRadius;e._rotateFactor=1/_,e._rotateRateRangeAdjustment=_}function tilt3DOnTerrain(e,t,n){const i=e._ellipsoid,r=e._scene,o=r.camera,a=e._cameraUnderground;let s,c,l;if(Cartesian2.equals(t,e._tiltCenterMousePosition))s=Cartesian3.clone(e._tiltCenter,tilt3DCenter);else{if(s=pickGlobe(e,t,tilt3DCenter),!defined(s)){if(c=o.getPickRay(t,tilt3DRay),l=IntersectionTests.rayEllipsoid(c,i),!defined(l)){if(i.cartesianToCartographic(o.position,tilt3DCart).height<=e._minimumTrackBallHeight){e._looking=!0;const i=e._ellipsoid.geodeticSurfaceNormal(o.position,tilt3DLookUp);look3D(e,t,n,i),Cartesian2.clone(t,e._tiltCenterMousePosition)}return}s=Ray.getPoint(c,l.start,tilt3DCenter)}a&&(defined(c)||(c=o.getPickRay(t,tilt3DRay)),getTiltCenterUnderground(e,c,s,s)),Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(s,e._tiltCenter)}const u=r.canvas,d=tilt3DWindowPos;d.x=u.clientWidth/2,d.y=e._tiltCenterMousePosition.y,c=o.getPickRay(d,tilt3DRay);const h=Cartesian3.magnitude(s),p=Cartesian3.fromElements(h,h,h,scratchRadii),f=Ellipsoid.fromCartesian3(p,scratchEllipsoid);if(l=IntersectionTests.rayEllipsoid(c,f),!defined(l))return;const m=Cartesian3.magnitude(c.origin)>h?l.start:l.stop,g=Ray.getPoint(c,m,tilt3DVerticalCenter),_=Transforms.eastNorthUpToFixedFrame(s,i,tilt3DTransform),y=Transforms.eastNorthUpToFixedFrame(g,f,tilt3DVerticalTransform),C=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=Cartesian3.UNIT_Z;const A=Matrix4.clone(o.transform,tilt3DOldTransform);o._setTransform(y);const v=Cartesian3.cross(g,o.positionWC,tilt3DCartesian3);if(Cartesian3.dot(o.rightWC,v)<0){const i=n.startPosition.y-n.endPosition.y;(a&&i<0||!a&&i>0)&&(S=void 0);const r=o.constrainedAxis;o.constrainedAxis=void 0,rotate3D(e,t,n,S,!0,!1),o.constrainedAxis=r}else rotate3D(e,t,n,S,!0,!1);if(o._setTransform(_),rotate3D(e,t,n,S,!1,!0),defined(o.constrainedAxis)){const e=Cartesian3.cross(o.direction,o.constrainedAxis,tilt3DCartesian3);Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON6)||(Cartesian3.dot(e,o.right)<0&&Cartesian3.negate(e,e),Cartesian3.cross(e,o.direction,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.normalize(o.up,o.up),Cartesian3.normalize(o.right,o.right))}o._setTransform(A),e._globe=C,e._ellipsoid=T;const E=T.maximumRadius;e._rotateFactor=1/E,e._rotateRateRangeAdjustment=E;const b=Cartesian3.clone(o.positionWC,tilt3DCartesian3);if(e.enableCollisionDetection&&adjustHeightForTerrain(e),!Cartesian3.equals(o.positionWC,b)){o._setTransform(y),o.worldToCameraCoordinatesPoint(b,b);const e=Cartesian3.magnitudeSquared(b);Cartesian3.magnitudeSquared(o.position)>e&&(Cartesian3.normalize(o.position,o.position),Cartesian3.multiplyByScalar(o.position,Math.sqrt(e),o.position));const t=Cartesian3.angleBetween(b,o.position),n=Cartesian3.cross(b,o.position,b);Cartesian3.normalize(n,n);const i=Quaternion.fromAxisAngle(n,t,tilt3DQuaternion),r=Matrix3.fromQuaternion(i,tilt3DMatrix);Matrix3.multiplyByVector(r,o.direction,o.direction),Matrix3.multiplyByVector(r,o.up,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.cross(o.right,o.direction,o.up),o._setTransform(A)}}const look3DStartPos=new Cartesian2,look3DEndPos=new Cartesian2,look3DStartRay=new Ray,look3DEndRay=new Ray,look3DNegativeRot=new Cartesian3,look3DTan=new Cartesian3;function look3D(e,t,n,i){const r=e._scene.camera,o=look3DStartPos;o.x=n.startPosition.x,o.y=0;const a=look3DEndPos;a.x=n.endPosition.x,a.y=0;let s,c,l=r.getPickRay(o,look3DStartRay),u=r.getPickRay(a,look3DEndRay),d=0;r.frustum instanceof OrthographicFrustum?(s=l.origin,c=u.origin,Cartesian3.add(r.direction,s,s),Cartesian3.add(r.direction,c,c),Cartesian3.subtract(s,r.position,s),Cartesian3.subtract(c,r.position,c),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c)):(s=l.direction,c=u.direction);let h=Cartesian3.dot(s,c);h<1&&(d=Math.acos(h)),d=n.startPosition.x>n.endPosition.x?-d:d;const p=e._horizontalRotationAxis;if(defined(i)?r.look(i,-d):defined(p)?r.look(p,-d):r.lookLeft(d),o.x=0,o.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(o,look3DStartRay),u=r.getPickRay(a,look3DEndRay),d=0,r.frustum instanceof OrthographicFrustum?(s=l.origin,c=u.origin,Cartesian3.add(r.direction,s,s),Cartesian3.add(r.direction,c,c),Cartesian3.subtract(s,r.position,s),Cartesian3.subtract(c,r.position,c),Cartesian3.normalize(s,s),Cartesian3.normalize(c,c)):(s=l.direction,c=u.direction),h=Cartesian3.dot(s,c),h<1&&(d=Math.acos(h)),d=n.startPosition.y>n.endPosition.y?-d:d,defined(i=defaultValue(i,p))){const e=r.direction,t=Cartesian3.negate(i,look3DNegativeRot),n=Cartesian3.equalsEpsilon(e,i,CesiumMath.EPSILON2),o=Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON2);if(n||o)(n&&d<0||o&&d>0)&&r.look(r.right,-d);else{h=Cartesian3.dot(e,i);let n=CesiumMath.acosClamped(h);d>0&&d>n&&(d=n-CesiumMath.EPSILON4),h=Cartesian3.dot(e,t),n=CesiumMath.acosClamped(h),d<0&&-d>n&&(d=-n+CesiumMath.EPSILON4);const o=Cartesian3.cross(i,e,look3DTan);r.look(o,d)}}else r.lookUp(d)}function update3D(e){reactToInput(e,e.enableRotate,e.rotateEventTypes,spin3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableTilt,e.tiltEventTypes,tilt3D,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D)}const scratchAdjustHeightTransform=new Matrix4,scratchAdjustHeightCartographic=new Cartographic;function adjustHeightForTerrain(e){e._adjustedHeightForTerrain=!0;const t=e._scene,n=t.mode,i=t.globe;if(!defined(i)||n===SceneMode$1.SCENE2D||n===SceneMode$1.MORPHING)return;const r=t.camera,o=i.ellipsoid,a=t.mapProjection;let s,c;Matrix4.equals(r.transform,Matrix4.IDENTITY)||(s=Matrix4.clone(r.transform,scratchAdjustHeightTransform),c=Cartesian3.magnitude(r.position),r._setTransform(Matrix4.IDENTITY));const l=scratchAdjustHeightCartographic;n===SceneMode$1.SCENE3D?o.cartesianToCartographic(r.position,l):a.unproject(r.position,l);let u=!1;if(l.height<e._minimumCollisionTerrainHeight){const t=e._scene.globeHeight;if(defined(t)){const i=t+e.minimumZoomDistance;l.height<i&&(l.height=i,n===SceneMode$1.SCENE3D?o.cartographicToCartesian(l,r.position):a.project(l,r.position),u=!0)}}defined(s)&&(r._setTransform(s),u&&(Cartesian3.normalize(r.position,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.multiplyByScalar(r.position,Math.max(c,e.minimumZoomDistance),r.position),Cartesian3.normalize(r.direction,r.direction),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.cross(r.right,r.direction,r.up)))}ScreenSpaceCameraController.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t!==SceneMode$1.COLUMBUS_VIEW||Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0};const scratchPreviousPosition=new Cartesian3,scratchPreviousDirection=new Cartesian3;ScreenSpaceCameraController.prototype.update=function(){const e=this._scene,t=e.camera,n=e.globe,i=e.mode;Matrix4.equals(t.transform,Matrix4.IDENTITY)?(this._globe=n,this._ellipsoid=defined(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=Ellipsoid.UNIT_SPHERE);const r=defined(this._globe)?this._globe.terrainExaggeration:1,o=defined(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=TerrainExaggeration.getHeight(this.minimumCollisionTerrainHeight,r,o),this._minimumPickingTerrainHeight=TerrainExaggeration.getHeight(this.minimumPickingTerrainHeight,r,o),this._minimumTrackBallHeight=TerrainExaggeration.getHeight(this.minimumTrackBallHeight,r,o),this._cameraUnderground=e.cameraUnderground&&defined(this._globe);const a=this._ellipsoid.maximumRadius;this._rotateFactor=1/a,this._rotateRateRangeAdjustment=a,this._adjustedHeightForTerrain=!1;const s=Cartesian3.clone(t.positionWC,scratchPreviousPosition),c=Cartesian3.clone(t.directionWC,scratchPreviousDirection);if(i===SceneMode$1.SCENE2D?update2D(this):i===SceneMode$1.COLUMBUS_VIEW?(this._horizontalRotationAxis=Cartesian3.UNIT_Z,updateCV(this)):i===SceneMode$1.SCENE3D&&(this._horizontalRotationAxis=void 0,update3D(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){(!Cartesian3.equals(s,t.positionWC)||!Cartesian3.equals(c,t.directionWC))&&adjustHeightForTerrain(this)}this._aggregator.reset()},ScreenSpaceCameraController.prototype.isDestroyed=function(){return!1},ScreenSpaceCameraController.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),destroyObject(this)};var AdditiveBlend="uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\nuniform vec2 center;\nuniform float radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(colorTexture, v_textureCoordinates);\nvec4 color1 = texture2D(colorTexture2, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - center) / radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color1, t);\n}\n",BrightPass="uniform sampler2D colorTexture;\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(avgLuminance) * luminance / avgLuminance;\nfloat brightLum = max(scaledLum - threshold, 0.0);\nfloat brightness = brightLum / (offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n";function SunPostProcess(){this._sceneFramebuffer=new SceneFramebuffer;const e=.125,t=new Array(6);t[0]=new PostProcessStage({fragmentShader:PassThrough,textureScale:e,forcePowerOfTwo:!0,sampleMode:PostProcessStageSampleMode.LINEAR});const n=t[1]=new PostProcessStage({fragmentShader:BrightPass,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new Cartesian2,t[2]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new PostProcessStage({fragmentShader:PassThrough,sampleMode:PostProcessStageSampleMode.LINEAR}),this._uCenter=new Cartesian2,this._uRadius=void 0,t[5]=new PostProcessStage({fragmentShader:AdditiveBlend,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new PostProcessStageComposite({stages:t});const r=new PostProcessStageTextureCache(this),o=t.length;for(let e=0;e<o;++e)t[e]._textureCache=r;this._textureCache=r,this.length=t.length}SunPostProcess.prototype.get=function(e){return this._stages.get(e)},SunPostProcess.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const t=this._stages.get(n);if(t.name===e)return t}};const sunPositionECScratch=new Cartesian4,sunPositionWCScratch=new Cartesian2,sizeScratch=new Cartesian2,postProcessMatrix4Scratch=new Matrix4;function updateSunPosition(e,t,n){const i=t.uniformState,r=i.sunPositionWC,o=i.view,a=i.viewProjection,s=i.projection;let c=Matrix4.computeViewportTransformation(n,0,1,postProcessMatrix4Scratch);const l=Matrix4.multiplyByPoint(o,r,sunPositionECScratch);let u=Transforms.pointToGLWindowCoordinates(a,c,r,sunPositionWCScratch);l.x+=CesiumMath.SOLAR_RADIUS;const d=Transforms.pointToGLWindowCoordinates(s,c,l,l),h=30*Cartesian2.magnitude(Cartesian2.subtract(d,u,d))*2,p=sizeScratch;p.x=h,p.y=h,e._uCenter=Cartesian2.clone(u,e._uCenter),e._uRadius=.15*Math.max(p.x,p.y);const f=t.drawingBufferWidth,m=t.drawingBufferHeight,g=e._stages,_=g.get(0),y=_.outputTexture.width,C=_.outputTexture.height,T=new BoundingRectangle;T.width=y,T.height=C,c=Matrix4.computeViewportTransformation(T,0,1,postProcessMatrix4Scratch),u=Transforms.pointToGLWindowCoordinates(a,c,r,sunPositionWCScratch),p.x*=y/f,p.y*=C/m;const S=_.scissorRectangle;S.x=Math.max(u.x-.5*p.x,0),S.y=Math.max(u.y-.5*p.y,0),S.width=Math.min(p.x,f),S.height=Math.min(p.y,m);for(let e=1;e<4;++e)BoundingRectangle.clone(S,g.get(e).scissorRectangle)}SunPostProcess.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)},SunPostProcess.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const r=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),updateSunPosition(this,t,n),r},SunPostProcess.prototype.execute=function(e){const t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let t=1;t<i;++t)n.get(t).execute(e,n.get(t-1).outputTexture)},SunPostProcess.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return t._stages.get(t._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},SunPostProcess.prototype.isDestroyed=function(){return!1},SunPostProcess.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),destroyObject(this)};const requestRenderAfterFrame=function(e){return function(){e.frameState.afterRender.push((function(){e.requestRender()}))}};function Scene(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).canvas;let n=e.creditContainer,i=e.creditViewport,r=clone$1(e.contextOptions);defined(r)||(r={}),defined(r.webgl)||(r.webgl={}),r.webgl.powerPreference=defaultValue(r.webgl.powerPreference,"high-performance");const o=defined(n),a=new Context(t,r);o||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),defined(i)||(i=t.parentNode),this._id=createGuid(),this._jobScheduler=new JobScheduler,this._frameState=new FrameState(a,new CreditDisplay(n," • ",i),this._jobScheduler),this._frameState.scene3DOnly=defaultValue(e.scene3DOnly,!1),this._removeCreditContainer=!o,this._creditContainer=n,this._canvas=t,this._context=a,this._computeEngine=new ComputeEngine(a),this._globe=void 0,this._globeTranslucencyState=new GlobeTranslucencyState,this._primitives=new PrimitiveCollection,this._groundPrimitives=new PrimitiveCollection,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=a.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new TweenCollection,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=defaultValue(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new DepthPlane,this._clearColorCommand=new ClearCommand({color:new Color,stencil:0,owner:this}),this._depthClearCommand=new ClearCommand({depth:1,owner:this}),this._stencilClearCommand=new ClearCommand({stencil:0}),this._classificationStencilClearCommand=new ClearCommand({stencil:0,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new SceneTransitioner(this),this._preUpdate=new Event,this._postUpdate=new Event,this._renderError=new Event,this._preRender=new Event,this._postRender=new Event,this._minimumDisableDepthTestDistance=0,this._debugInspector=new DebugInspector,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Event,this.morphComplete=new Event,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=Color.clone(Color.BLACK),this._mode=SceneMode$1.SCENE3D,this._mapProjection=defined(e.mapProjection)?e.mapProjection:new GeographicProjection,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.fog=new Fog,this._shadowMapCamera=new Camera(this),this.shadowMap=new ShadowMap({context:a,lightCamera:this._shadowMapCamera,enabled:defaultValue(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=Color.clone(Color.WHITE),this._actualInvertClassificationColor=Color.clone(this._invertClassificationColor),this._invertClassification=new InvertClassification,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new PostProcessStageCollection,this._brdfLutGenerator=new BrdfLutGenerator,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new ScreenSpaceCameraController(this),this._cameraUnderground=!1,this._mapMode2D=defaultValue(e.mapMode2D,MapMode2D$1.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=defaultValue(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=defaultValue(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=RequestScheduler.requestCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeTaskProcessorListenerCallback=TaskProcessor.taskCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeGlobeCallbacks=[];const s=new BoundingRectangle(0,0,a.drawingBufferWidth,a.drawingBufferHeight),c=new Camera(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new Camera(this),this.preloadFlightCullingVolume=void 0,this._picking=new Picking(this),this._defaultView=new View(this,c,s),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new SunLight,updateFrameNumber(this,0,JulianDate.now()),this.updateFrameState(),this.initializeFrame()}function updateGlobeListeners(e,t){for(let t=0;t<e._removeGlobeCallbacks.length;++t)e._removeGlobeCallbacks[t]();e._removeGlobeCallbacks.length=0;const n=[];defined(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(e))),n.push(t.terrainProviderChanged.addEventListener(requestRenderAfterFrame(e)))),e._removeGlobeCallbacks=n}function updateDerivedCommands(e,t,n){const i=e._frameState,r=e._context,o=e._view.oit,a=i.shadowState.lightShadowMaps,s=i.shadowState.lightShadowsEnabled;let c=t.derivedCommands;defined(t.pickId)&&(c.picking=DerivedCommand.createPickDerivedCommand(e,t,r,c.picking)),t.pickOnly||(c.depth=DerivedCommand.createDepthOnlyDerivedCommand(e,t,r,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=DerivedCommand.createHdrCommand(t,r,c.hdr),c=(t=c.hdr.command).derivedCommands),s&&t.receiveShadows&&(c.shadows=ShadowMap.createReceiveDerivedCommand(a,t,n,r,c.shadows)),t.pass===Pass$1.TRANSLUCENT&&defined(o)&&o.isSupported()&&(s&&t.receiveShadows?(c.oit=defined(c.oit)?c.oit:{},c.oit.shadows=o.createDerivedCommands(c.shadows.receiveCommand,r,c.oit.shadows)):c.oit=o.createDerivedCommands(t,r,c.oit))}Object.defineProperties(Scene.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return ContextLimits.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return ContextLimits.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return OctahedralProjectedCubeMap.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,updateGlobeListeners(this,e)}},primitives:{get:function(){return this._primitives}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(defined(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(defined(this.globe))return this.globe.terrainProvider},set:function(e){defined(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(defined(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){e===SceneMode$1.SCENE2D?this.morphTo2D(0):e===SceneMode$1.SCENE3D?this.morphTo3D(0):e===SceneMode$1.COLUMBUS_VIEW&&this.morphToColumbusView(0),this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Camera(this),defined(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new DeviceOrientationCameraController(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},imagerySplitPosition:{get:function(){return this._frameState.imagerySplitPosition},set:function(e){this._frameState.imagerySplitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){const e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return.9999}},globeHeight:{get:function(){return this._globeHeight}}}),Scene.prototype.getCompressedTextureFormatSupported=function(e){const t=this.context;return("WEBGL_compressed_texture_s3tc"===e||"s3tc"===e)&&t.s3tc||("WEBGL_compressed_texture_pvrtc"===e||"pvrtc"===e)&&t.pvrtc||("WEBGL_compressed_texture_etc"===e||"etc"===e)&&t.etc||("WEBGL_compressed_texture_etc1"===e||"etc1"===e)&&t.etc1||("WEBGL_compressed_texture_astc"===e||"astc"===e)&&t.astc||("EXT_texture_compression_bptc"===e||"bc7"===e)&&t.bc7},Scene.prototype.updateDerivedCommands=function(e){if(!defined(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const r=t.shadowState.lastDirtyTime;e.lastDirtyTime!==r&&(e.lastDirtyTime=r,e.dirty=!0,i=!0);const o=t.useLogDepth,a=this._hdr,s=e.derivedCommands,c=defined(s.logDepth),l=defined(s.hdr),u=defined(s.originalCommand),d=o&&!c,h=a&&!l,p=!(o&&a||u);if(e.dirty=e.dirty||d||h||p,e.dirty){e.dirty=!1;const r=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(s.shadows=ShadowMap.createCastDerivedCommand(r,e,i,n,s.shadows)),(c||d)&&(s.logDepth=DerivedCommand.createLogDepthCommand(e,n,s.logDepth),updateDerivedCommands(this,s.logDepth.command,i)),(u||p)&&updateDerivedCommands(this,e,i)}};const renderTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.RENDER}),preloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD}),preloadFlightTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD_FLIGHT}),requestRenderModeDeferCheckPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK}),scratchOccluderBoundingSphere=new BoundingSphere;let scratchOccluder;function getOccluder(e){const t=e.globe;if(e._mode===SceneMode$1.SCENE3D&&defined(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return scratchOccluderBoundingSphere.radius=n.minimumRadius+i,scratchOccluder=Occluder.fromBoundingSphere(scratchOccluderBoundingSphere,e.camera.positionWC,scratchOccluder),scratchOccluder}}function updateFrameNumber(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=JulianDate.clone(n,i.time)}Scene.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1},Scene.prototype.updateFrameState=function(){const e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=getOccluder(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof OrthographicFrustum||this.camera.frustum instanceof OrthographicOffCenterFrustum),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,defined(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=Color.clone(this.invertClassificationColor,this._actualInvertClassificationColor),InvertClassification.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,defined(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0},Scene.prototype.isVisible=function(e,t,n){return defined(e)&&(!defined(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Intersect$1.OUTSIDE&&(!defined(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let transformFrom2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function debugShowBoundingVolume(e,t,n,i){const r=t._frameState,o=r.context,a=e.boundingVolume;let s;defined(t._debugVolume)&&t._debugVolume.destroy();let c=Cartesian3.clone(a.center);if(r.mode!==SceneMode$1.SCENE3D){c=Matrix4.multiplyByPoint(transformFrom2D,c,c);const e=r.mapProjection,t=e.unproject(c);c=e.ellipsoid.cartographicToCartesian(t)}if(defined(a.radius)){const e=a.radius;s=GeometryPipeline.toWireframe(EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(e,e,e),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$3({geometryInstances:new GeometryInstance({geometry:s,modelMatrix:Matrix4.fromTranslation(c),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}else{const e=a.halfAxes;s=GeometryPipeline.toWireframe(BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive$3({geometryInstances:new GeometryInstance({geometry:s,modelMatrix:Matrix4.fromRotationTranslation(e,c,new Matrix4),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}const l=r.commandList,u=r.commandList=[];if(t._debugVolume.update(r),e=u[0],r.useLogDepth){e=DerivedCommand.createLogDepthCommand(e,o).command}let d;defined(i)&&(d=n.framebuffer,n.framebuffer=i),e.execute(o,n),defined(d)&&(n.framebuffer=d),r.commandList=l}function executeCommand(e,t,n,i,r){const o=t._frameState;if(defined(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof ClearCommand)return void e.execute(n,i);e.debugShowBoundingVolume&&defined(e.boundingVolume)&&debugShowBoundingVolume(e,t,i,r),o.useLogDepth&&defined(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const a=o.passes;if(!a.pick&&!a.depth&&t._hdr&&defined(e.derivedCommands)&&defined(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),a.pick||a.depth){if(a.pick&&!a.depth&&defined(e.derivedCommands.picking))return void(e=e.derivedCommands.picking.pickCommand).execute(n,i);if(defined(e.derivedCommands.depth))return void(e=e.derivedCommands.depth.depthOnlyCommand).execute(n,i)}t.debugShowCommands||t.debugShowFrustums?t._debugInspector.executeDebugShowFrustumsCommand(t,e,i):o.shadowState.lightShadowsEnabled&&e.receiveShadows&&defined(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function executeIdCommand(e,t,n,i){const r=t._frameState;let o=e.derivedCommands;defined(o)&&(r.useLogDepth&&defined(o.logDepth)&&(e=o.logDepth.command),o=e.derivedCommands,defined(o.picking)?(e=o.picking.pickCommand).execute(n,i):defined(o.depth)&&(e=o.depth.depthOnlyCommand).execute(n,i))}function backToFront(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function frontToBack(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+CesiumMath.EPSILON12}function executeTranslucentCommandsBackToFront(e,t,n,i,r){const o=e.context;mergeSort(i,backToFront,e.camera.positionWC),defined(r)&&t(r.unclassifiedCommand,e,o,n);const a=i.length;for(let r=0;r<a;++r)t(i[r],e,o,n)}function executeTranslucentCommandsFrontToBack(e,t,n,i,r){const o=e.context;mergeSort(i,frontToBack,e.camera.positionWC),defined(r)&&t(r.unclassifiedCommand,e,o,n);const a=i.length;for(let r=0;r<a;++r)t(i[r],e,o,n)}transformFrom2D=Matrix4.inverseTransformation(transformFrom2D,transformFrom2D);const scratchPerspectiveFrustum=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum=new OrthographicFrustum,scratchOrthographicOffCenterFrustum=new OrthographicOffCenterFrustum;function executeCommands(e,t){const n=e.camera,i=e.context,r=e.frameState,o=i.uniformState;let a;o.updateCamera(n),a=defined(n.frustum.fov)?n.frustum.clone(scratchPerspectiveFrustum):defined(n.frustum.infiniteProjectionMatrix)?n.frustum.clone(scratchPerspectiveOffCenterFrustum):defined(n.frustum.width)?n.frustum.clone(scratchOrthographicFrustum):n.frustum.clone(scratchOrthographicOffCenterFrustum),a.near=n.frustum.near,a.far=n.frustum.far,o.updateFrustum(a),o.updatePass(Pass$1.ENVIRONMENT);const s=r.passes,c=s.pick,l=e._environmentState,u=e._view,d=l.renderTranslucentDepthForPick,h=l.useWebVR;if(!c){const n=l.skyBoxCommand;if(defined(n)&&executeCommand(n,e,i,t),l.isSkyAtmosphereVisible&&executeCommand(l.skyAtmosphereCommand,e,i,t),l.isSunVisible&&(l.sunDrawCommand.execute(i,t),e.sunBloom&&!h)){let n;n=l.useGlobeDepthFramebuffer?u.globeDepth.framebuffer:l.usePostProcess?u.sceneFramebuffer.framebuffer:l.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,n),t.framebuffer=n}l.isMoonVisible&&l.moonCommand.execute(i,t)}let p;l.useOIT?(defined(e._executeOITFunction)||(e._executeOITFunction=function(e,t,n,i,r){u.oit.executeCommands(e,t,n,i,r)}),p=e._executeOITFunction):p=s.render?executeTranslucentCommandsBackToFront:executeTranslucentCommandsFrontToBack;const f=u.frustumCommandsList,m=f.length,g=l.clearGlobeDepth,_=l.useDepthPlane,y=e._globeTranslucencyState,C=y.translucent,T=e._view.globeTranslucencyFramebuffer,S=e._depthClearCommand,A=e._stencilClearCommand,v=e._classificationStencilClearCommand,E=e._depthPlane,b=l.usePostProcessSelected,x=n.position.z;let P;for(let s=0;s<m;++s){const h=m-s-1,D=f[h];e.mode===SceneMode$1.SCENE2D?(n.position.z=x-D.near+1,a.far=Math.max(1,D.far-D.near),a.near=1,o.update(r),o.updateFrustum(a)):(a.near=0!==h?D.near*e.opaqueFrustumNearOffset:D.near,a.far=D.far,o.updateFrustum(a)),S.execute(i,t),i.stencilBuffer&&A.execute(i,t),o.updatePass(Pass$1.GLOBE);let w=D.commands[Pass$1.GLOBE],M=D.indices[Pass$1.GLOBE];if(C)y.executeGlobeCommands(D,executeCommand,T,e,t);else for(P=0;P<M;++P)executeCommand(w[P],e,i,t);const I=u.globeDepth;if(defined(I)&&l.useGlobeDepthFramebuffer&&I.executeCopyDepth(i,t),!l.renderTranslucentDepthForPick)if(o.updatePass(Pass$1.TERRAIN_CLASSIFICATION),w=D.commands[Pass$1.TERRAIN_CLASSIFICATION],M=D.indices[Pass$1.TERRAIN_CLASSIFICATION],C)y.executeGlobeClassificationCommands(D,executeCommand,T,e,t);else for(P=0;P<M;++P)executeCommand(w[P],e,i,t);if(g&&(S.execute(i,t),_&&E.execute(i,t)),!l.useInvertClassification||c||l.renderTranslucentDepthForPick){for(o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeCommand(w[P],e,i,t);if(M>0&&(defined(I)&&l.useGlobeDepthFramebuffer&&I.executeUpdateDepth(i,t,g),!l.renderTranslucentDepthForPick))for(o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],P=0;P<M;++P)executeCommand(w[P],e,i,t)}else{e._invertClassification.clear(i,t);const n=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeCommand(w[P],e,i,t);for(defined(I)&&l.useGlobeDepthFramebuffer&&I.executeUpdateDepth(i,t,g),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],P=0;P<M;++P)executeCommand(w[P],e,i,t);for(t.framebuffer=n,e._invertClassification.executeClassified(i,t),1===r.invertClassificationColor.alpha&&e._invertClassification.executeUnclassified(i,t),M>0&&i.stencilBuffer&&v.execute(i,t),o.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),w=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],P=0;P<M;++P)executeCommand(w[P],e,i,t)}for(M>0&&i.stencilBuffer&&A.execute(i,t),o.updatePass(Pass$1.OPAQUE),w=D.commands[Pass$1.OPAQUE],M=D.indices[Pass$1.OPAQUE],P=0;P<M;++P)executeCommand(w[P],e,i,t);let R;0!==h&&e.mode!==SceneMode$1.SCENE2D&&(a.near=D.near,o.updateFrustum(a)),!c&&l.useInvertClassification&&r.invertClassificationColor.alpha<1&&(R=e._invertClassification),o.updatePass(Pass$1.TRANSLUCENT),w=D.commands[Pass$1.TRANSLUCENT],w.length=D.indices[Pass$1.TRANSLUCENT],p(e,executeCommand,t,w,R);if(D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION]>0&&u.translucentTileClassification.isSupported()&&(u.translucentTileClassification.executeTranslucentCommands(e,executeCommand,t,w,I.framebuffer),u.translucentTileClassification.executeClassificationCommands(e,executeCommand,t,D)),i.depthTexture&&e.useDepthPicking&&(l.useGlobeDepthFramebuffer||d)){const n=d?t.framebuffer.depthStencilTexture:I.framebuffer.depthStencilTexture,r=e._picking.getPickDepth(e,h);r.update(i,n),r.executeCopyDepth(i,t)}if(c||!b)continue;const O=t.framebuffer;if(t.framebuffer=u.sceneFramebuffer.getIdFramebuffer(),a.near=0!==h?D.near*e.opaqueFrustumNearOffset:D.near,a.far=D.far,o.updateFrustum(a),o.updatePass(Pass$1.GLOBE),w=D.commands[Pass$1.GLOBE],M=D.indices[Pass$1.GLOBE],C)y.executeGlobeCommands(D,executeIdCommand,T,e,t);else for(P=0;P<M;++P)executeIdCommand(w[P],e,i,t);for(g&&(S.framebuffer=t.framebuffer,S.execute(i,t),S.framebuffer=void 0),g&&_&&E.execute(i,t),o.updatePass(Pass$1.CESIUM_3D_TILE),w=D.commands[Pass$1.CESIUM_3D_TILE],M=D.indices[Pass$1.CESIUM_3D_TILE],P=0;P<M;++P)executeIdCommand(w[P],e,i,t);for(o.updatePass(Pass$1.OPAQUE),w=D.commands[Pass$1.OPAQUE],M=D.indices[Pass$1.OPAQUE],P=0;P<M;++P)executeIdCommand(w[P],e,i,t);for(o.updatePass(Pass$1.TRANSLUCENT),w=D.commands[Pass$1.TRANSLUCENT],M=D.indices[Pass$1.TRANSLUCENT],P=0;P<M;++P)executeIdCommand(w[P],e,i,t);t.framebuffer=O}}function executeComputeCommands(e){e.context.uniformState.updatePass(Pass$1.COMPUTE);const t=e._environmentState.sunComputeCommand;defined(t)&&t.execute(e._computeEngine);const n=e._computeCommandList,i=n.length;for(let t=0;t<i;++t)n[t].execute(e._computeEngine)}function executeOverlayCommands(e,t){e.context.uniformState.updatePass(Pass$1.OVERLAY);const n=e.context,i=e._overlayCommandList,r=i.length;for(let e=0;e<r;++e)i[e].execute(n,t)}function insertShadowCastCommands(e,t,n){const i=n.shadowMapCullingVolume,r=n.isPointLight,o=n.passes,a=o.length,s=t.length;for(let n=0;n<s;++n){const s=t[n];if(e.updateDerivedCommands(s),s.castShadows&&(s.pass===Pass$1.GLOBE||s.pass===Pass$1.CESIUM_3D_TILE||s.pass===Pass$1.OPAQUE||s.pass===Pass$1.TRANSLUCENT)&&e.isVisible(s,i))if(r)for(let e=0;e<a;++e)o[e].commandList.push(s);else if(1===a)o[0].commandList.push(s);else{let t=!1;for(let n=a-1;n>=0;--n){const i=o[n].cullingVolume;if(e.isVisible(s,i))o[n].commandList.push(s),t=!0;else if(t)break}}}}function executeShadowMapCastCommands(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const r=e.context,o=r.uniformState;for(let t=0;t<i;++t){const i=n[t];if(i.outOfView)continue;const a=i.passes,s=a.length;for(let e=0;e<s;++e)a[e].commandList.length=0;insertShadowCastCommands(e,e.frameState.commandList,i);for(let n=0;n<s;++n){const a=i.passes[n];o.updateCamera(a.camera),i.updatePass(r,n);const s=a.commandList.length;for(let n=0;n<s;++n){const i=a.commandList[n];o.updatePass(i.pass),executeCommand(i.derivedCommands.shadows.castCommands[t],e,r,a.passState)}}}}const scratchEyeTranslation=new Cartesian3;function executeWebVRCommands(e,t,n){const i=e._view,r=i.camera,o=e._environmentState.renderTranslucentDepthForPick;updateAndClearFramebuffers(e,t,n),updateAndRenderPrimitives(e),i.createPotentiallyVisibleSet(e),executeComputeCommands(e),o||executeShadowMapCastCommands(e);const a=t.viewport;a.x=0,a.y=0,a.width=.5*a.width;const s=Camera.clone(r,e._cameraVR);s.frustum=r.frustum;const c=r.frustum.near,l=c*defaultValue(e.focalLength,5),u=defaultValue(e.eyeSeparation,l/30),d=Cartesian3.multiplyByScalar(s.right,.5*u,scratchEyeTranslation);r.frustum.aspectRatio=a.width/a.height;const h=.5*u*c/l;Cartesian3.add(s.position,d,r.position),r.frustum.xOffset=h,executeCommands(e,t),a.x=a.width,Cartesian3.subtract(s.position,d,r.position),r.frustum.xOffset=-h,executeCommands(e,t),Camera.clone(s,r)}Scene.prototype.updateAndExecuteCommands=function(e,t){const n=this._frameState.mode;this._environmentState.useWebVR?executeWebVRCommands(this,e,t):n!==SceneMode$1.SCENE2D||this._mapMode2D===MapMode2D$1.ROTATE?executeCommandsInViewport(!0,this,e,t):(updateAndClearFramebuffers(this,e,t),execute2DViewportCommands(this,e))};const scratch2DViewportCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratch2DViewportMaxCoord=new Cartesian3,scratch2DViewportSavedPosition=new Cartesian3,scratch2DViewportTransform=new Matrix4,scratch2DViewportCameraTransform=new Matrix4,scratch2DViewportEyePoint=new Cartesian3,scratch2DViewportWindowCoords=new Cartesian3,scratch2DViewport=new BoundingRectangle;function execute2DViewportCommands(e,t){const n=e.context,i=e.frameState,r=e.camera,o=t.viewport,a=BoundingRectangle.clone(o,scratch2DViewport);t.viewport=a;const s=scratch2DViewportCartographic,c=scratch2DViewportMaxCoord;e.mapProjection.project(s,c);const l=Cartesian3.clone(r.position,scratch2DViewportSavedPosition),u=Matrix4.clone(r.transform,scratch2DViewportCameraTransform),d=r.frustum.clone();r._setTransform(Matrix4.IDENTITY);const h=Matrix4.computeViewportTransformation(a,0,1,scratch2DViewportTransform),p=r.frustum.projectionMatrix,f=r.positionWC.y,m=Cartesian3.fromElements(CesiumMath.sign(f)*c.x-f,0,-r.positionWC.x,scratch2DViewportEyePoint),g=Transforms.pointToGLWindowCoordinates(p,h,m,scratch2DViewportWindowCoords);g.x=Math.floor(g.x);const _=a.x,y=a.width;if(0===f||g.x<=_||g.x>=_+y)executeCommandsInViewport(!0,e,t);else if(Math.abs(_+.5*y-g.x)<1)a.width=g.x-a.x,r.position.x*=CesiumMath.sign(r.position.x),r.frustum.right=0,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!0,e,t),a.x=g.x,r.position.x=-r.position.x,r.frustum.right=-r.frustum.left,r.frustum.left=0,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!1,e,t);else if(g.x>_+.5*y){a.width=g.x-_;const o=r.frustum.right;r.frustum.right=c.x-f,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!0,e,t),a.x=g.x,a.width=_+y-g.x,r.position.x=-r.position.x,r.frustum.left=-r.frustum.right,r.frustum.right=o-2*r.frustum.right,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!1,e,t)}else{a.x=g.x,a.width=_+y-g.x;const o=r.frustum.left;r.frustum.left=-c.x-f,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!0,e,t),a.x=_,a.width=g.x-_,r.position.x=-r.position.x,r.frustum.right=-r.frustum.left,r.frustum.left=o-2*r.frustum.left,i.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.uniformState.update(i),executeCommandsInViewport(!1,e,t)}r._setTransform(u),Cartesian3.clone(l,r.position),r.frustum=d.clone(),t.viewport=o}function executeCommandsInViewport(e,t,n,i){const r=t._environmentState,o=t._view,a=r.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),updateAndRenderPrimitives(t),o.createPotentiallyVisibleSet(t),e&&(defined(i)&&updateAndClearFramebuffers(t,n,i),executeComputeCommands(t),a||executeShadowMapCastCommands(t)),executeCommands(t,n)}const scratchCullingVolume=new CullingVolume;function updateDebugFrustumPlanes(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new DebugCameraPrimitive({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),defined(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function updateShadowMaps(e){const t=e._frameState,n=t.shadowMaps,i=n.length,r=i>0&&!t.passes.pick&&e.mode===SceneMode$1.SCENE3D;if(r!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=r),t.shadowState.lightShadowsEnabled=!1,r){for(let e=0;e<i;++e)if(n[e]!==t.shadowState.shadowMaps[e]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let e=0;e<i;++e){const i=n[e];i.update(t),t.shadowState.shadowMaps.push(i),i.fromLightSource&&(t.shadowState.lightShadowMaps.push(i),t.shadowState.lightShadowsEnabled=!0),i.dirty&&(++t.shadowState.lastDirtyTime,i.dirty=!1)}}}function updateAndRenderPrimitives(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),updateDebugFrustumPlanes(e),updateShadowMaps(e),e._globe&&e._globe.render(t)}function updateAndClearFramebuffers(e,t,n){const i=e._context,r=e._frameState,o=e._environmentState,a=e._view,s=e._frameState.passes.pick,c=o.useWebVR;o.originalFramebuffer=t.framebuffer,defined(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!c?e._sunPostProcess=new SunPostProcess:defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!defined(e.sun)&&defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const l=e._clearColorCommand;Color.clone(n,l.color),l.execute(i,t);const u=o.useGlobeDepthFramebuffer=defined(a.globeDepth);u&&(a.globeDepth.update(i,t,a.viewport,e._hdr,o.clearGlobeDepth),a.globeDepth.clear(i,t,n));const d=a.oit,h=o.useOIT=!s&&defined(d)&&d.isSupported();h&&(d.update(i,t,a.globeDepth.framebuffer,e._hdr),d.clear(i,t,n),o.useOIT=d.isSupported());const p=e.postProcessStages;let f=o.usePostProcess=!s&&(e._hdr||p.length>0||p.ambientOcclusion.enabled||p.fxaa.enabled||p.bloom.enabled);o.usePostProcessSelected=!1,f&&(a.sceneFramebuffer.update(i,a.viewport,e._hdr),a.sceneFramebuffer.clear(i,t,n),p.update(i,r.useLogDepth,e._hdr),p.clear(i),f=o.usePostProcess=p.ready,o.usePostProcessSelected=f&&p.hasSelected),o.isSunVisible&&e.sunBloom&&!c?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):u?t.framebuffer=a.globeDepth.framebuffer:f&&(t.framebuffer=a.sceneFramebuffer.framebuffer),defined(t.framebuffer)&&l.execute(i,t);if(o.useInvertClassification=!s&&defined(t.framebuffer)&&e.invertClassification){let n;if(1===e.frameState.invertClassificationColor.alpha&&o.useGlobeDepthFramebuffer&&(n=a.globeDepth.framebuffer),defined(n)||i.depthTexture){if(e._invertClassification.previousFramebuffer=n,e._invertClassification.update(i),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&h){const t=e._invertClassification.unclassifiedCommand,n=t.derivedCommands;n.oit=d.createDerivedCommands(t,i,n.oit)}}else o.useInvertClassification=!1}e._globeTranslucencyState.translucent&&a.globeTranslucencyFramebuffer.updateAndClear(e._hdr,a.viewport,i,t)}function callAfterRenderFunctions(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n](),e.requestRender();t.length=0}function getGlobeHeight(e){const t=e._globe,n=e.camera.positionCartographic;if(defined(t)&&t.show&&defined(n))return t.getHeight(n)}function isCameraUnderground(e){const t=e.camera,n=e._mode,i=e.globe,r=e._screenSpaceCameraController,o=t.positionCartographic;if(!defined(o))return!1;if(!r.onMap()&&o.height<0)return!0;if(!defined(i)||!i.show||n===SceneMode$1.SCENE2D||n===SceneMode$1.MORPHING)return!1;const a=e._globeHeight;return defined(a)&&o.height<a}function updateDebugShowFramesPerSecond(e,t){if(e.debugShowFramesPerSecond){if(!defined(e._performanceDisplay)){const t=document.createElement("div");t.className="cesium-performanceDisplay-defaultContainer";e._canvas.parentNode.appendChild(t);const n=new PerformanceDisplay({container:t});e._performanceDisplay=n,e._performanceContainer=t}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else defined(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function prePassesUpdate(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),defined(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function postPassesUpdate(e){const t=e._frameState;e.primitives.postPassesUpdate(t),RequestScheduler.update()}Scene.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,r=e.passes.offscreen,o=this.skyAtmosphere,a=this.globe,s=this._globeTranslucencyState;if(!i||this._mode!==SceneMode$1.SCENE2D&&t.camera.frustum instanceof OrthographicFrustum||!s.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{defined(o)?(defined(a)&&(o.setDynamicAtmosphereColor(a.enableLighting&&a.dynamicAtmosphereLighting,a.dynamicAtmosphereLightingFromSun),n.isReadyForAtmosphere=n.isReadyForAtmosphere||a._surface._tilesToRender.length>0),n.skyAtmosphereCommand=o.update(e,a),defined(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)):n.skyAtmosphereCommand=void 0,n.skyBoxCommand=defined(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const i=defined(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=defined(i)?i.drawCommand:void 0,n.sunComputeCommand=defined(i)?i.computeCommand:void 0,n.moonCommand=defined(this.moon)?this.moon.update(e):void 0}const c=n.clearGlobeDepth=defined(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===SceneMode$1.SCENE2D);(n.useDepthPlane=c&&this.mode===SceneMode$1.SCENE3D&&s.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==SceneMode$1.SCENE2D&&!r;const l=e.mode!==SceneMode$1.SCENE3D||s.sunVisibleThroughGlobe?void 0:e.occluder;let u=e.cullingVolume;const d=scratchCullingVolume.planes;for(let e=0;e<5;++e)d[e]=u.planes[e];u=scratchCullingVolume,n.isSkyAtmosphereVisible=defined(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,u,l),n.isMoonVisible=this.isVisible(n.moonCommand,u,l);const h=this.specularEnvironmentMaps;let p=this._specularEnvironmentMapAtlas;!defined(h)||defined(p)&&p.url===h?!defined(h)&&defined(p)&&(p.destroy(),this._specularEnvironmentMapAtlas=void 0):(p=p&&p.destroy(),this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(h)),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)},Scene.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,r=i.globeDepth,o=n.useOIT,a=n.useGlobeDepthFramebuffer,s=n.usePostProcess,c=n.originalFramebuffer,l=a?r.framebuffer:void 0,u=i.sceneFramebuffer.framebuffer,d=i.sceneFramebuffer.idFramebuffer;o&&(e.framebuffer=s?u:c,i.oit.execute(t,e));const h=i.translucentTileClassification;if(h.hasTranslucentDepth&&h.isSupported()&&h.execute(this,e),s){let e=u;a&&!o&&(e=l);const n=this.postProcessStages,i=e.getColorTexture(0),r=d.getColorTexture(0),s=defaultValue(l,u).depthStencilTexture;n.execute(t,i,s,r),n.copy(t,c)}o||s||!a||(e.framebuffer=c,r.executeCopyColor(t,e))},Scene.prototype.initializeFrame=function(){120==this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=getGlobeHeight(this),this._cameraUnderground=isCameraUnderground(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),defined(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};const scratchBackgroundColor=new Color;function render(e){const t=e._frameState,n=e.context,i=n.uniformState,r=e._defaultView;e._view=r,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=renderTilesetPassState;let o=defaultValue(e.backgroundColor,Color.BLACK);e._hdr&&(o=Color.clone(o,scratchBackgroundColor),o.red=Math.pow(o.red,e.gamma),o.green=Math.pow(o.green,e.gamma),o.blue=Math.pow(o.blue,e.gamma)),t.backgroundColor=o,e.fog.update(t),i.update(t);const a=e.shadowMap;defined(a)&&a.enabled&&(!defined(e.light)||e.light instanceof SunLight?Cartesian3.negate(i.sunDirectionWC,e._shadowMapCamera.direction):Cartesian3.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(a)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const s=r.viewport;s.x=0,s.y=0,s.width=n.drawingBufferWidth,s.height=n.drawingBufferHeight;const c=r.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=BoundingRectangle.clone(s,c.viewport),defined(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,o),e.resolveFramebuffers(c),c.framebuffer=void 0,executeOverlayCommands(e,c),defined(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function tryAndCatchError(e,t){try{t(e)}catch(t){if(e._renderError.raiseEvent(e,t),e.rethrowRenderErrors)throw t}}function updateMostDetailedRayPicks(e){return e._picking.updateMostDetailedRayPicks(e)}function updatePreloadPass(e){const t=e._frameState;preloadTilesetPassState.camera=t.camera,preloadTilesetPassState.cullingVolume=t.cullingVolume;e.primitives.updateForPass(t,preloadTilesetPassState)}function updatePreloadFlightPass(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;preloadFlightTilesetPassState.camera=e.preloadFlightCamera,preloadFlightTilesetPassState.cullingVolume=e.preloadFlightCullingVolume;e.primitives.updateForPass(t,preloadFlightTilesetPassState)}function updateRequestRenderModeDeferCheckPass(e){e.primitives.updateForPass(e._frameState,requestRenderModeDeferCheckPassState)}Scene.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,defined(e)||(e=JulianDate.now());const n=this._view.checkForCameraUpdates(this);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===SceneMode$1.MORPHING;if(!i&&defined(this.maximumRenderTimeChange)&&defined(this._lastRenderTime)){const t=Math.abs(JulianDate.secondsDifference(this._lastRenderTime,e));i=i||t>this.maximumRenderTimeChange}if(i){this._lastRenderTime=JulianDate.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;updateFrameNumber(this,CesiumMath.incrementWrap(t.frameNumber,15e6,1),e),t.newFrame=!0}tryAndCatchError(this,prePassesUpdate),this.primitives.show&&(tryAndCatchError(this,updateMostDetailedRayPicks),tryAndCatchError(this,updatePreloadPass),tryAndCatchError(this,updatePreloadFlightPass),i||tryAndCatchError(this,updateRequestRenderModeDeferCheckPass)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),tryAndCatchError(this,render)),updateDebugShowFramesPerSecond(this,i),tryAndCatchError(this,postPassesUpdate),callAfterRenderFunctions(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())},Scene.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)},Scene.prototype.requestRender=function(){this._renderRequested=!0},Scene.prototype.clampLineWidth=function(e){return Math.max(ContextLimits.minimumAliasedLineWidth,Math.min(e,ContextLimits.maximumAliasedLineWidth))},Scene.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)},Scene.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)},Scene.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)},Scene.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)},Scene.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)},Scene.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)},Scene.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)},Scene.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)},Scene.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)},Scene.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)},Scene.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)},Scene.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)},Scene.prototype.cartesianToCanvasCoordinates=function(e,t){return SceneTransforms.wgs84ToWindowCoordinates(this,e,t)},Scene.prototype.completeMorph=function(){this._transitioner.completeMorph()},Scene.prototype.morphTo2D=function(e){let t;const n=this.globe;t=defined(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo2D(e,t)},Scene.prototype.morphToColumbusView=function(e){let t;const n=this.globe;t=defined(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphToColumbusView(e,t)},Scene.prototype.morphTo3D=function(e){let t;const n=this.globe;t=defined(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo3D(e,t)},Scene.prototype.isDestroyed=function(){return!1},Scene.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),defined(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,destroyObject(this)};
/**
* @license
* Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the project nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Modifications made by Cesium GS, Inc.
*/
var SkyAtmosphereCommon="const float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * czm_pi;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * czm_pi;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 InvWavelength = vec3(\n5.60204474633241,\n9.473284437923038,\n19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nconst float g = -0.95;\nconst float g2 = g * g;\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\nuniform vec3 u_radiiAndDynamicAtmosphereColor;\nfloat scale(float cosAngle)\n{\nfloat x = 1.0 - cosAngle;\nreturn rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvec3 getLightDirection(vec3 positionWC)\n{\nfloat lightEnum = u_radiiAndDynamicAtmosphereColor.z;\nvec3 lightDirection =\npositionWC * float(lightEnum == 0.0) +\nczm_lightDirectionWC * float(lightEnum == 1.0) +\nczm_sunDirectionWC * float(lightEnum == 2.0);\nreturn normalize(lightDirection);\n}\nvoid calculateRayScatteringFromSpace(in vec3 positionWC, in vec3 ray, in float innerRadius, in float outerRadius, inout float far, out vec3 start, out float startOffset)\n{\nfloat cameraHeight = length(positionWC);\nfloat B = 2.0 * dot(positionWC, ray);\nfloat C = cameraHeight * cameraHeight - outerRadius * outerRadius;\nfloat det = max(0.0, B * B - 4.0 * C);\nfloat near = 0.5 * (-B - sqrt(det));\nstart = positionWC + ray * near;\nfar -= near;\nfloat startAngle = dot(ray, start) / outerRadius;\nfloat startDepth = exp(-1.0 / rayleighScaleDepth);\nstartOffset = startDepth * scale(startAngle);\n}\nvoid calculateRayScatteringFromGround(in vec3 positionWC, in vec3 ray, in float atmosphereScale, in float innerRadius, out vec3 start, out float startOffset)\n{\nfloat cameraHeight = length(positionWC);\nstart = positionWC;\nfloat height = length(start);\nfloat depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));\nfloat startAngle = dot(ray, start) / height;\nstartOffset = depth*scale(startAngle);\n}\nczm_raySegment rayEllipsoidIntersection(czm_ray ray, vec3 inverseRadii)\n{\nvec3 o = inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\nvec3 d = inverseRadii * (czm_inverseView * vec4(ray.direction, 0.0)).xyz;\nfloat a = dot(d, d);\nfloat b = dot(d, o);\nfloat c = dot(o, o) - 1.0;\nfloat discriminant = b * b - a * c;\nif (discriminant < 0.0)\n{\nreturn czm_emptyRaySegment;\n}\ndiscriminant = sqrt(discriminant);\nfloat t1 = (-b - discriminant) / a;\nfloat t2 = (-b + discriminant) / a;\nif (t1 < 0.0 && t2 < 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nif (t1 < 0.0 && t2 >= 0.0)\n{\nt1 = 0.0;\n}\nreturn czm_raySegment(t1, t2);\n}\nvec3 getAdjustedPosition(vec3 positionWC, float innerRadius)\n{\nfloat cameraHeight = czm_eyeHeight + innerRadius;\nreturn normalize(positionWC) * cameraHeight;\n}\nvec3 getTranslucentPosition(vec3 positionWC, vec3 outerPositionWC, float innerRadius, out bool intersectsEllipsoid)\n{\nvec3 directionWC = normalize(outerPositionWC - positionWC);\nvec3 directionEC = czm_viewRotation * directionWC;\nczm_ray viewRay = czm_ray(vec3(0.0), directionEC);\nczm_raySegment raySegment = rayEllipsoidIntersection(viewRay, czm_ellipsoidInverseRadii);\nintersectsEllipsoid = raySegment.start >= 0.0;\nif (intersectsEllipsoid)\n{\nreturn positionWC + raySegment.stop * directionWC;\n}\nreturn getAdjustedPosition(positionWC, innerRadius);\n}\nvoid calculateMieColorAndRayleighColor(vec3 outerPositionWC, out vec3 mieColor, out vec3 rayleighColor)\n{\nfloat outerRadius = u_radiiAndDynamicAtmosphereColor.x;\nfloat innerRadius = u_radiiAndDynamicAtmosphereColor.y;\n#ifdef GLOBE_TRANSLUCENT\nbool intersectsEllipsoid = false;\nvec3 startPositionWC = getTranslucentPosition(czm_viewerPositionWC, outerPositionWC, innerRadius, intersectsEllipsoid);\n#else\nvec3 startPositionWC = getAdjustedPosition(czm_viewerPositionWC, innerRadius);\n#endif\nvec3 lightDirection = getLightDirection(startPositionWC);\nvec3 ray = outerPositionWC - startPositionWC;\nfloat far = length(ray);\nray /= far;\nfloat atmosphereScale = 1.0 / (outerRadius - innerRadius);\nvec3 start;\nfloat startOffset;\n#ifdef SKY_FROM_SPACE\n#ifdef GLOBE_TRANSLUCENT\nif (intersectsEllipsoid)\n{\ncalculateRayScatteringFromGround(startPositionWC, ray, atmosphereScale, innerRadius, start, startOffset);\n}\nelse\n{\ncalculateRayScatteringFromSpace(startPositionWC, ray, innerRadius, outerRadius, far, start, startOffset);\n}\n#else\ncalculateRayScatteringFromSpace(startPositionWC, ray, innerRadius, outerRadius, far, start, startOffset);\n#endif\n#else\ncalculateRayScatteringFromGround(startPositionWC, ray, atmosphereScale, innerRadius, start, startOffset);\n#endif\nfloat sampleLength = far / fSamples;\nfloat scaledLength = sampleLength * atmosphereScale;\nvec3 sampleRay = ray * sampleLength;\nvec3 samplePoint = start + sampleRay * 0.5;\nvec3 frontColor = vec3(0.0, 0.0, 0.0);\nfor (int i = 0; i<nSamples; i++)\n{\nfloat height = length(samplePoint);\nfloat depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - height));\nfloat fLightAngle = dot(lightDirection, samplePoint) / height;\nfloat fCameraAngle = dot(ray, samplePoint) / height;\nfloat fScatter = (startOffset + depth*(scale(fLightAngle) - scale(fCameraAngle)));\nvec3 attenuate = exp(-fScatter * (InvWavelength * Kr4PI + Km4PI));\nfrontColor += attenuate * (depth * scaledLength);\nsamplePoint += sampleRay;\n}\nmieColor = frontColor * KmESun;\nrayleighColor = frontColor * (InvWavelength * KrESun);\nmieColor = min(mieColor, vec3(10000000.0));\nrayleighColor = min(rayleighColor, vec3(10000000.0));\n}\nvec4 calculateFinalColor(vec3 positionWC, vec3 toCamera, vec3 lightDirection, vec3 mieColor, vec3 rayleighColor)\n{\nfloat cosAngle = dot(lightDirection, normalize(toCamera)) / length(toCamera);\nfloat rayleighPhase = 0.75 * (1.0 + cosAngle * cosAngle);\nfloat miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cosAngle * cosAngle) / pow(1.0 + g2 - 2.0 * g * cosAngle, 1.5);\nvec3 rgb = rayleighPhase * rayleighColor + miePhase * mieColor;\nconst float exposure = 2.0;\nvec3 rgbExposure = vec3(1.0) - exp(-exposure * rgb);\n#ifndef HDR\nrgb = rgbExposure;\n#endif\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nfloat outerRadius = u_radiiAndDynamicAtmosphereColor.x;\nfloat innerRadius = u_radiiAndDynamicAtmosphereColor.y;\nfloat lightEnum = u_radiiAndDynamicAtmosphereColor.z;\nfloat cameraHeight = czm_eyeHeight + innerRadius;\nfloat atmosphereAlpha = clamp((outerRadius - cameraHeight) / (outerRadius - innerRadius), 0.0, 1.0);\nfloat nightAlpha = (lightEnum != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;\natmosphereAlpha *= pow(nightAlpha, 0.5);\nvec4 finalColor = vec4(rgb, mix(clamp(rgbExposure.b, 0.0, 1.0), 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime));\nif (mieColor.b > 1.0)\n{\nfloat strength = mieColor.b;\nfloat minDistance = outerRadius;\nfloat maxDistance = outerRadius * 3.0;\nfloat maxStrengthLerp = 1.0 - clamp((maxDistance - cameraHeight) / (maxDistance - minDistance), 0.0, 1.0);\nfloat maxStrength = mix(100.0, 10000.0, maxStrengthLerp);\nstrength = min(strength, maxStrength);\nfloat alpha = 1.0 - (strength / maxStrength);\nfinalColor.a = alpha;\n}\nreturn finalColor;\n}\n",SkyAtmosphereFS="varying vec3 v_outerPositionWC;\n#ifndef PER_FRAGMENT_ATMOSPHERE\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\n#endif\nvoid main (void)\n{\nvec3 toCamera = czm_viewerPositionWC - v_outerPositionWC;\nvec3 lightDirection = getLightDirection(czm_viewerPositionWC);\nvec3 mieColor;\nvec3 rayleighColor;\n#ifdef PER_FRAGMENT_ATMOSPHERE\ncalculateMieColorAndRayleighColor(v_outerPositionWC, mieColor, rayleighColor);\n#else\nmieColor = v_mieColor;\nrayleighColor = v_rayleighColor;\n#endif\ngl_FragColor = calculateFinalColor(czm_viewerPositionWC, toCamera, lightDirection, mieColor, rayleighColor);\n}\n",SkyAtmosphereVS="attribute vec4 position;\nvarying vec3 v_outerPositionWC;\n#ifndef PER_FRAGMENT_ATMOSPHERE\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\n#endif\nvoid main(void)\n{\nvec4 positionWC = czm_model * position;\n#ifndef PER_FRAGMENT_ATMOSPHERE\ncalculateMieColorAndRayleighColor(positionWC.xyz, v_mieColor, v_rayleighColor);\n#endif\nv_outerPositionWC = positionWC.xyz;\ngl_Position = czm_modelViewProjection * position;\n}\n";function SkyAtmosphere(e){e=defaultValue(e,Ellipsoid.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=Cartesian3.multiplyByScalar(e.radii,1.025,new Cartesian3);this._scaleMatrix=Matrix4.fromScale(t),this._modelMatrix=new Matrix4,this._command=new DrawCommand({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new Cartesian3;const n=new Cartesian3;n.x=1.025*e.maximumRadius,n.y=e.maximumRadius,n.z=0,this._radiiAndDynamicAtmosphereColor=n;const i=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return i._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return i._hueSaturationBrightness.x=i.hueShift,i._hueSaturationBrightness.y=i.saturationShift,i._hueSaturationBrightness.z=i.brightnessShift,i._hueSaturationBrightness}}}Object.defineProperties(SkyAtmosphere.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),SkyAtmosphere.prototype.setDynamicAtmosphereColor=function(e,t){const n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};const scratchModelMatrix$1=new Matrix4;function hasColorCorrection(e){return!(CesiumMath.equalsEpsilon(e.hueShift,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(e.saturationShift,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(e.brightnessShift,0,CesiumMath.EPSILON7))}SkyAtmosphere.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==SceneMode$1.SCENE3D&&n!==SceneMode$1.MORPHING)return;if(!e.passes.render)return;const i=Matrix4.fromRotationTranslation(e.context.uniformState.inverseViewRotation,Cartesian3.ZERO,scratchModelMatrix$1),r=Matrix4.multiplyTransformation(i,Axis$1.Y_UP_TO_Z_UP,scratchModelMatrix$1),o=Matrix4.multiply(this._scaleMatrix,r,scratchModelMatrix$1);Matrix4.clone(o,this._modelMatrix);const a=e.context,s=hasColorCorrection(this),c=e.globeTranslucencyState.translucent,l=this.perFragmentAtmosphere||c||!defined(t)||!t.show,u=this._command;if(!defined(u.vertexArray)){const e=EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:VertexFormat.POSITION_ONLY}));u.vertexArray=VertexArray.fromGeometry({context:a,geometry:e,attributeLocations:GeometryPipeline.createAttributeLocations(e),bufferUsage:BufferUsage$1.STATIC_DRAW}),u.renderState=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},blending:BlendingState$1.ALPHA_BLEND,depthMask:!1})}const d=s|l<<2|c<<3;if(d!==this._flags){this._flags=d;const e=[];s&&e.push("COLOR_CORRECT"),l&&e.push("PER_FRAGMENT_ATMOSPHERE"),c&&e.push("GLOBE_TRANSLUCENT");let t=new ShaderSource({defines:e.concat("SKY_FROM_SPACE"),sources:[SkyAtmosphereCommon,SkyAtmosphereVS]}),n=new ShaderSource({defines:e.concat("SKY_FROM_SPACE"),sources:[SkyAtmosphereCommon,SkyAtmosphereFS]});this._spSkyFromSpace=ShaderProgram.fromCache({context:a,vertexShaderSource:t,fragmentShaderSource:n}),t=new ShaderSource({defines:e.concat("SKY_FROM_ATMOSPHERE"),sources:[SkyAtmosphereCommon,SkyAtmosphereVS]}),n=new ShaderSource({defines:e.concat("SKY_FROM_ATMOSPHERE"),sources:[SkyAtmosphereCommon,SkyAtmosphereFS]}),this._spSkyFromAtmosphere=ShaderProgram.fromCache({context:a,vertexShaderSource:t,fragmentShaderSource:n})}const h=e.camera.positionWC;return Cartesian3.magnitude(h)>this._radiiAndDynamicAtmosphereColor.x?u.shaderProgram=this._spSkyFromSpace:u.shaderProgram=this._spSkyFromAtmosphere,u},SkyAtmosphere.prototype.isDestroyed=function(){return!1},SkyAtmosphere.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyFromSpace=this._spSkyFromSpace&&this._spSkyFromSpace.destroy(),this._spSkyFromAtmosphere=this._spSkyFromAtmosphere&&this._spSkyFromAtmosphere.destroy(),destroyObject(this)};var SkyBoxFS="uniform samplerCube u_cubeMap;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\ngl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}\n",SkyBoxVS="attribute vec3 position;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\ngl_Position = czm_projection * vec4(p, 1.0);\nv_texCoord = position.xyz;\n}\n";function SkyBox(e){this.sources=e.sources,this._sources=void 0,this.show=defaultValue(e.show,!0),this._command=new DrawCommand({modelMatrix:Matrix4.clone(Matrix4.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}function SphereEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}function StyleExpression(){}SkyBox.prototype.update=function(e,t){const n=this;if(!this.show)return;if(e.mode!==SceneMode$1.SCENE3D&&e.mode!==SceneMode$1.MORPHING)return;if(!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;"string"==typeof e.positiveX?loadCubeMap(i,this._sources).then((function(e){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=e})):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new CubeMap({context:i,source:e}))}const r=this._command;if(!defined(r.vertexArray)){r.uniformMap={u_cubeMap:function(){return n._cubeMap}};const e=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY})),t=this._attributeLocations=GeometryPipeline.createAttributeLocations(e);r.vertexArray=VertexArray.fromGeometry({context:i,geometry:e,attributeLocations:t,bufferUsage:BufferUsage$1.STATIC_DRAW}),r.renderState=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND})}if(!defined(r.shaderProgram)||this._useHdr!==t){const e=new ShaderSource({defines:[t?"HDR":""],sources:[SkyBoxFS]});r.shaderProgram=ShaderProgram.fromCache({context:i,vertexShaderSource:SkyBoxVS,fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return defined(this._cubeMap)?r:void 0},SkyBox.prototype.isDestroyed=function(){return!1},SkyBox.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),destroyObject(this)},Object.defineProperties(SphereEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),SphereEmitter.prototype.emit=function(e){const t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),n=CesiumMath.randomBetween(0,CesiumMath.PI),i=CesiumMath.randomBetween(0,this._radius),r=i*Math.cos(t)*Math.sin(n),o=i*Math.sin(t)*Math.sin(n),a=i*Math.cos(n);e.position=Cartesian3.fromElements(r,o,a,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)},StyleExpression.prototype.evaluate=function(e,t){DeveloperError.throwInstantiationError()},StyleExpression.prototype.evaluateColor=function(e,t){DeveloperError.throwInstantiationError()},StyleExpression.prototype.getShaderFunction=function(e,t,n,i){DeveloperError.throwInstantiationError()},StyleExpression.prototype.getVariables=function(){DeveloperError.throwInstantiationError()};var SunFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color = texture2D(u_texture, v_textureCoordinates);\ngl_FragColor = czm_gammaCorrect(color);\n}\n",SunTextureFS="uniform float u_radiusTS;\nvarying vec2 v_textureCoordinates;\nvec2 rotate(vec2 p, vec2 direction)\n{\nreturn vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);\n}\nvec4 addBurst(vec2 position, vec2 direction, float lengthScalar)\n{\nvec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);\nfloat radius = length(rotatedPosition) * lengthScalar;\nfloat burst = 1.0 - smoothstep(0.0, 0.55, radius);\nreturn vec4(burst);\n}\nvoid main()\n{\nfloat lengthScalar = 2.0 / sqrt(2.0);\nvec2 position = v_textureCoordinates - vec2(0.5);\nfloat radius = length(position) * lengthScalar;\nfloat surface = step(radius, u_radiusTS);\nvec4 color = vec4(vec2(1.0), surface + 0.2, surface);\nfloat glow = 1.0 - smoothstep(0.0, 0.55, radius);\ncolor.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;\nvec4 burst = vec4(0.0);\nburst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar);\nburst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar);\nburst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar);\ncolor += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;\ngl_FragColor = clamp(color, vec4(0.0), vec4(1.0));\n}\n",SunVS="attribute vec2 direction;\nuniform float u_size;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 position;\nif (czm_morphTime == 1.0)\n{\nposition = vec4(czm_sunPositionWC, 1.0);\n}\nelse\n{\nposition = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n}\nvec4 positionEC = czm_view * position;\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec2 halfSize = vec2(u_size * 0.5);\nhalfSize *= ((direction * 2.0) - 1.0);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\nv_textureCoordinates = direction;\n}\n";function Sun(){this.show=!0,this._drawCommand=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES,boundingVolume:new BoundingSphere,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new BoundingSphere,this._boundingVolume2D=new BoundingSphere,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;const e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(Sun.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const scratchPositionWC=new Cartesian2,scratchLimbWC=new Cartesian2,scratchPositionEC=new Cartesian4,scratchCartesian4=new Cartesian4;function TileBoundingVolume(){}function TileCoordinatesImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._color=defaultValue(e.color,Color.YELLOW),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._readyPromise=when.resolve(!0),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0}function TileDiscardPolicy(e){DeveloperError.throwInstantiationError()}Sun.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===SceneMode$1.SCENE2D||i===SceneMode$1.MORPHING)return;if(!e.passes.render)return;const r=e.context,o=t.viewport.width,a=t.viewport.height;if(!defined(this._texture)||o!==this._drawingBufferWidth||a!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=o,this._drawingBufferHeight=a,this._glowFactorDirty=!1,this._useHdr=n;let e=Math.max(o,a);e=Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))-2),e=Math.max(1,e);const t=n?r.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._texture=new Texture({context:r,width:e,height:e,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:t}),this._glowLengthTS=5*this._glowFactor,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const i=this,s={u_radiusTS:function(){return i._radiusTS}};this._commands.computeCommand=new ComputeCommand({fragmentShaderSource:SunTextureFS,outputTexture:this._texture,uniformMap:s,persists:!1,owner:this,postExecute:function(){i._commands.computeCommand=void 0}})}const s=this._drawCommand;if(!defined(s.vertexArray)){const e={direction:0},t=new Uint8Array(8);t[0]=0,t[1]=0,t[2]=255,t[3]=0,t[4]=255,t[5]=255,t[6]=0,t[7]=255;const n=Buffer$1.createVertexBuffer({context:r,typedArray:t,usage:BufferUsage$1.STATIC_DRAW}),i=[{index:e.direction,vertexBuffer:n,componentsPerAttribute:2,normalize:!0,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE}],o=Buffer$1.createIndexBuffer({context:r,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});s.vertexArray=new VertexArray({context:r,attributes:i,indexBuffer:o}),s.shaderProgram=ShaderProgram.fromCache({context:r,vertexShaderSource:SunVS,fragmentShaderSource:SunFS,attributeLocations:e}),s.renderState=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND}),s.uniformMap=this._uniformMap}const c=r.uniformState.sunPositionWC,l=r.uniformState.sunPositionColumbusView,u=this._boundingVolume,d=this._boundingVolume2D;Cartesian3.clone(c,u.center),d.center.x=l.z,d.center.y=l.x,d.center.z=l.y,u.radius=CesiumMath.SOLAR_RADIUS+CesiumMath.SOLAR_RADIUS*this._glowLengthTS,d.radius=u.radius,i===SceneMode$1.SCENE3D?BoundingSphere.clone(u,s.boundingVolume):i===SceneMode$1.COLUMBUS_VIEW&&BoundingSphere.clone(d,s.boundingVolume);const h=SceneTransforms.computeActualWgs84Position(e,c,scratchCartesian4),p=Cartesian3.magnitude(Cartesian3.subtract(h,e.camera.position,scratchCartesian4)),f=r.uniformState.projection,m=scratchPositionEC;m.x=0,m.y=0,m.z=-p,m.w=1;const g=Matrix4.multiplyByVector(f,m,scratchCartesian4),_=SceneTransforms.clipToGLWindowCoordinates(t.viewport,g,scratchPositionWC);m.x=CesiumMath.SOLAR_RADIUS;const y=Matrix4.multiplyByVector(f,m,scratchCartesian4),C=SceneTransforms.clipToGLWindowCoordinates(t.viewport,y,scratchLimbWC);return this._size=Cartesian2.magnitude(Cartesian2.subtract(C,_,scratchCartesian4)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands},Sun.prototype.isDestroyed=function(){return!1},Sun.prototype.destroy=function(){const e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),destroyObject(this)},TileBoundingVolume.prototype.boundingVolume=void 0,TileBoundingVolume.prototype.boundingSphere=void 0,TileBoundingVolume.prototype.distanceToCamera=function(e){DeveloperError.throwInstantiationError()},TileBoundingVolume.prototype.intersectPlane=function(e){DeveloperError.throwInstantiationError()},TileBoundingVolume.prototype.createDebugVolume=function(e){DeveloperError.throwInstantiationError()},Object.defineProperties(TileCoordinatesImageryProvider.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}}}),TileCoordinatesImageryProvider.prototype.getTileCredits=function(e,t,n){},TileCoordinatesImageryProvider.prototype.requestImage=function(e,t,n,i){const r=document.createElement("canvas");r.width=256,r.height=256;const o=r.getContext("2d"),a=this._color.toCssColorString();return o.strokeStyle=a,o.lineWidth=2,o.strokeRect(1,1,255,255),o.font="bold 25px Arial",o.textAlign="center",o.fillStyle=a,o.fillText("L: "+n,124,86),o.fillText("X: "+e,124,136),o.fillText("Y: "+t,124,186),r},TileCoordinatesImageryProvider.prototype.pickFeatures=function(e,t,n,i,r){},TileDiscardPolicy.prototype.isReady=DeveloperError.throwInstantiationError,TileDiscardPolicy.prototype.shouldDiscardImage=DeveloperError.throwInstantiationError;const TileState={START:0,LOADING:1,READY:2,UPSAMPLED_ONLY:3};var TileState$1=Object.freeze(TileState);function TimeDynamicPointCloud(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,256),this.shading=new PointCloudShading(e.shading),this.style=e.style,this.frameFailed=new Event,this.frameChanged=new Event,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,this._loadTimestamp=void 0,this._clippingPlanesState=0,this._styleDirty=!1,this._pickId=void 0,this._totalMemoryUsageInBytes=0,this._frames=[],this._previousInterval=void 0,this._nextInterval=void 0,this._lastRenderedFrame=void 0,this._clockMultiplier=0,this._readyPromise=when.defer(),this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=arrayFill(new Array(5),0),this._runningAverage=0}function getFragmentShaderLoaded(e){return"uniform vec4 czm_pickColor;\n"+e}function getUniformMapLoaded(e){return function(t){return combine$2(t,{czm_pickColor:function(){return e._pickId.color}})}}function getPickIdLoaded(){return"czm_pickColor"}Object.defineProperties(TimeDynamicPointCloud.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(defined(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}},readyPromise:{get:function(){return this._readyPromise.promise}}}),TimeDynamicPointCloud.prototype.makeStyleDirty=function(){this._styleDirty=!0},TimeDynamicPointCloud.prototype._getAverageLoadTime=function(){return 0===this._runningLength?.05:this._runningAverage};const scratchDate=new JulianDate;function getClockMultiplier(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function getIntervalIndex(e,t){return e._intervals.indexOf(t.start)}function getNextInterval(e,t){const n=e._intervals,i=e._clock,r=getClockMultiplier(e);if(0===r)return;const o=e._getAverageLoadTime(),a=JulianDate.addSeconds(i.currentTime,o*r,scratchDate);let s=n.indexOf(a);return s===getIntervalIndex(e,t)&&(r>=0?++s:--s),n.get(s)}function getCurrentInterval(e){const t=e._intervals,n=e._clock.currentTime,i=t.indexOf(n);return t.get(i)}function reachedInterval(e,t,n){const i=getClockMultiplier(e),r=getIntervalIndex(e,t),o=getIntervalIndex(e,n);return i>=0?r>=o:r<=o}function handleFrameFailure(e,t){return function(n){const i=defined(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0?e.frameFailed.raiseEvent({uri:t,message:i}):(console.log("A frame failed to load: "+t),console.log("Error: "+i))}}function requestFrame(e,t,n){const i=getIntervalIndex(e,t),r=e._frames;let o=r[i];if(!defined(o)){const a=t.data.transform,s=defined(a)?Matrix4.fromArray(a):void 0,c=t.data.uri;o={pointCloud:void 0,transform:s,timestamp:getTimestamp$1(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},r[i]=o,Resource.fetchArrayBuffer({url:c}).then((function(t){return o.pointCloud=new PointCloud({arrayBuffer:t,cull:!0,fragmentShaderLoaded:getFragmentShaderLoaded,uniformMapLoaded:getUniformMapLoaded(e),pickIdLoaded:getPickIdLoaded}),o.pointCloud.readyPromise})).otherwise(handleFrameFailure(e,c))}return o}function updateAverageLoadTime(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function prepareFrame(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const r=t.pointCloud;if(defined(r)&&!t.ready){const o=i.commandList,a=o.length;if(renderFrame(e,t,n,i),r.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=r.geometryByteLength,o.length=a,t.sequential)){updateAverageLoadTime(e,(getTimestamp$1()-t.timestamp)/1e3)}}t.touchedFrameNumber=i.frameNumber}const scratchModelMatrix=new Matrix4;function getGeometricError(e,t){const n=e.shading;return defined(n)&&defined(n.baseResolution)?n.baseResolution:defined(t.boundingSphere)?CesiumMath.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function getMaximumAttenuation(e){const t=e.shading;return defined(t)&&defined(t.maximumAttenuation)?t.maximumAttenuation:10}const defaultShading=new PointCloudShading;function renderFrame(e,t,n,i){const r=defaultValue(e.shading,defaultShading),o=t.pointCloud,a=defaultValue(t.transform,Matrix4.IDENTITY);o.modelMatrix=Matrix4.multiplyTransformation(e.modelMatrix,a,scratchModelMatrix),o.style=e.style,o.time=n.timeSinceLoad,o.shadows=e.shadows,o.clippingPlanes=e._clippingPlanes,o.isClipped=n.isClipped,o.attenuation=r.attenuation,o.backFaceCulling=r.backFaceCulling,o.normalShading=r.normalShading,o.geometricError=getGeometricError(e,o),o.geometricErrorScale=r.geometricErrorScale,o.maximumAttenuation=getMaximumAttenuation(e),o.update(i),t.touchedFrameNumber=i.frameNumber}function loadFrame(e,t,n,i){prepareFrame(e,requestFrame(e,t,i),n,i)}function getUnloadCondition(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function unloadFrames(e,t){const n=e._frames,i=n.length;for(let r=0;r<i;++r){const i=n[r];if(defined(i)&&(!defined(t)||t(i))){const t=i.pointCloud;i.ready&&(e._totalMemoryUsageInBytes-=t.geometryByteLength),defined(t)&&t.destroy(),i===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[r]=void 0}}}function getFrame(e,t){const n=getIntervalIndex(e,t),i=e._frames[n];if(defined(i)&&i.ready)return i}function updateInterval(e,t,n,i,r){return!!defined(n)&&(!!n.ready||(loadFrame(e,t,i,r),n.ready))}function getNearestReadyInterval(e,t,n,i,r){let o,a,s;const c=e._intervals,l=e._frames,u=getIntervalIndex(e,n),d=getIntervalIndex(e,t);if(u>=d){for(o=u;o>=d;--o)if(a=c.get(o),s=l[o],updateInterval(e,a,s,i,r))return a}else for(o=u;o<=d;++o)if(a=c.get(o),s=l[o],updateInterval(e,a,s,i,r))return a;return t}function setFramesDirty(e,t,n){const i=e._frames,r=i.length;for(let e=0;e<r;++e){const r=i[e];defined(r)&&defined(r.pointCloud)&&(r.pointCloud.clippingPlanesDirty=t,r.pointCloud.styleDirty=n)}}const updateState={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};TimeDynamicPointCloud.prototype.update=function(e){if(e.mode===SceneMode$1.MORPHING)return;if(!this.show)return;defined(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time));const t=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),n=this._clippingPlanes;let i=0,r=!1;const o=defined(n)&&n.enabled;o&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,r=!0);const a=this._styleDirty;this._styleDirty=!1,(r||a)&&setFramesDirty(this,r,a),updateState.timeSinceLoad=t,updateState.isClipped=o;const s=this.shading,c=this._pointCloudEyeDomeLighting,l=e.commandList,u=l.length;let d=this._previousInterval,h=this._nextInterval;const p=getCurrentInterval(this);if(!defined(p))return;let f=!1;const m=getClockMultiplier(this),g=0===m;m!==this._clockMultiplier&&(f=!0,this._clockMultiplier=m),defined(d)&&!g||(d=p),(!defined(h)||f||reachedInterval(this,p,h))&&(h=getNextInterval(this,p)),d=getNearestReadyInterval(this,d,p,updateState,e);let _=getFrame(this,d);defined(_)||(loadFrame(this,d,updateState,e),_=this._lastRenderedFrame),defined(_)&&renderFrame(this,_,updateState,e),defined(h)&&loadFrame(this,h,updateState,e);const y=this;defined(_)&&!defined(this._lastRenderedFrame)&&e.afterRender.push((function(){y._readyPromise.resolve(y)})),defined(_)&&_!==this._lastRenderedFrame&&y.frameChanged.numberOfListeners>0&&e.afterRender.push((function(){y.frameChanged.raiseEvent(y)})),this._previousInterval=d,this._nextInterval=h,this._lastRenderedFrame=_;this._totalMemoryUsageInBytes>1024*this.maximumMemoryUsage*1024&&unloadFrames(this,getUnloadCondition(e));const C=l.length-u;defined(s)&&s.attenuation&&s.eyeDomeLighting&&C>0&&c.update(e,u,s,this.boundingSphere)},TimeDynamicPointCloud.prototype.isDestroyed=function(){return!1},TimeDynamicPointCloud.prototype.destroy=function(){return unloadFrames(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),destroyObject(this)};var ViewportQuadFS="varying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_textureCoordinates.s;\nmaterialInput.st = v_textureCoordinates;\nmaterialInput.str = vec3(v_textureCoordinates, 0.0);\nmaterialInput.normalEC = vec3(0.0, 0.0, -1.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n",oldValue;function ViewportQuad(e,t){this.show=!0,defined(e)||(e=new BoundingRectangle),this.rectangle=BoundingRectangle.clone(e),defined(t)||(t=Material$4.fromType(Material$4.ColorType,{color:new Color(1,1,1,1)})),this.material=t,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0}ViewportQuad.prototype.update=function(e){if(!this.show)return;const t=this._rs;defined(t)&&BoundingRectangle.equals(t.viewport,this.rectangle)||(this._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,viewport:this.rectangle}));if(e.passes.render){const t=e.context;if(this._material!==this.material||!defined(this._overlayCommand)){this._material=this.material,defined(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();const e=new ShaderSource({sources:[this._material.shaderSource,ViewportQuadFS]});this._overlayCommand=t.createViewportQuadCommand(e,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=Pass$1.OVERLAY}this._material.update(t),this._overlayCommand.renderState=this._rs,this._overlayCommand.uniformMap=this._material._uniforms,e.commandList.push(this._overlayCommand)}},ViewportQuad.prototype.isDestroyed=function(){return!1},ViewportQuad.prototype.destroy=function(){return defined(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),destroyObject(this)},"undefined"!=typeof ko&&(oldValue=ko),function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,r=t.jQuery,o=t.JSON;r||"undefined"==typeof jQuery||(r=jQuery),function(e){e(t.ko={})}((function(a,s){function c(e,t){return(null===e||typeof e in m)&&e===t}function l(t,n){var i;return function(){i||(i=f.a.setTimeout((function(){i=e,t()}),n))}}function u(e,t){var n;return function(){clearTimeout(n),n=f.a.setTimeout(e,t)}}function d(e,t){t&&"change"!==t?"beforeChange"===t?this.pc(e):this.gb(e,t):this.qc(e)}function h(e,t){null!==t&&t.s&&t.s()}function p(e,t){var n=this.qd,i=n[T];i.ra||(this.Qb&&this.mb[t]?(n.uc(t,e,this.mb[t]),this.mb[t]=null,--this.Qb):i.I[t]||n.uc(t,e,i.J?{da:e}:n.$c(e)),e.Ja&&e.gd())}var f=void 0!==a?a:{};f.b=function(e,t){for(var n=e.split("."),i=f,r=0;r<n.length-1;r++)i=i[n[r]];i[n[n.length-1]]=t},f.L=function(e,t,n){e[t]=n},f.version="3.5.1",f.b("version",f.version),f.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},f.a=function(){function a(e,t){for(var n in e)u.call(e,n)&&t(n,e[n])}function s(e,t){if(t)for(var n in t)u.call(t,n)&&(e[n]=t[n]);return e}function c(e,t){return e.__proto__=t,e}function l(e,t,n,i){var r=e[t].match(C)||[];f.a.D(n.match(C),(function(e){f.a.Na(r,e,i)})),e[t]=r.join(" ")}var u=Object.prototype.hasOwnProperty,d={__proto__:[]}instanceof Array,h="function"==typeof Symbol,p={},m={};p[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],p.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),a(p,(function(e,t){if(t.length)for(var n=0,i=t.length;n<i;n++)m[t[n]]=e}));var g,_={propertychange:!0},y=n&&function(){for(var t=3,i=n.createElement("div"),r=i.getElementsByTagName("i");i.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",r[0];);return 4<t?t:e}(),C=/\S+/g;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(e,t,n){for(var i=0,r=e.length;i<r;i++)t.call(n,e[i],i,e)},A:"function"==typeof Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t)}:function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},Lb:function(t,n,i){for(var r=0,o=t.length;r<o;r++)if(n.call(i,t[r],r,t))return t[r];return e},Pa:function(e,t){var n=f.a.A(e,t);0<n?e.splice(n,1):0===n&&e.shift()},wc:function(e){var t=[];return e&&f.a.D(e,(function(e){0>f.a.A(t,e)&&t.push(e)})),t},Mb:function(e,t,n){var i=[];if(e)for(var r=0,o=e.length;r<o;r++)i.push(t.call(n,e[r],r));return i},jb:function(e,t,n){var i=[];if(e)for(var r=0,o=e.length;r<o;r++)t.call(n,e[r],r)&&i.push(e[r]);return i},Nb:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var n=0,i=t.length;n<i;n++)e.push(t[n]);return e},Na:function(e,t,n){var i=f.a.A(f.a.bc(e),t);0>i?n&&e.push(t):n||e.splice(i,1)},Ba:d,extend:s,setPrototypeOf:c,Ab:d?c:s,P:a,Ga:function(e,t,n){if(!e)return e;var i,r={};for(i in e)u.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r},Tb:function(e){for(;e.firstChild;)f.removeNode(e.firstChild)},Yb:function(e){for(var t=((e=f.a.la(e))[0]&&e[0].ownerDocument||n).createElement("div"),i=0,r=e.length;i<r;i++)t.appendChild(f.oa(e[i]));return t},Ca:function(e,t){for(var n=0,i=e.length,r=[];n<i;n++){var o=e[n].cloneNode(!0);r.push(t?f.oa(o):o)}return r},va:function(e,t){if(f.a.Tb(e),t)for(var n=0,i=t.length;n<i;n++)e.appendChild(t[n])},Xc:function(e,t){var n=e.nodeType?[e]:e;if(0<n.length){for(var i=n[0],r=i.parentNode,o=0,a=t.length;o<a;o++)r.insertBefore(t[o],i);for(o=0,a=n.length;o<a;o++)f.removeNode(n[o])}},Ua:function(e,t){if(e.length){for(t=8===t.nodeType&&t.parentNode||t;e.length&&e[0].parentNode!==t;)e.splice(0,1);for(;1<e.length&&e[e.length-1].parentNode!==t;)e.length--;if(1<e.length){var n=e[0],i=e[e.length-1];for(e.length=0;n!==i;)e.push(n),n=n.nextSibling;e.push(i)}}return e},Zc:function(e,t){7>y?e.setAttribute("selected",t):e.selected=t},Db:function(t){return null===t||t===e?"":t.trim?t.trim():t.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(e,t){return e=e||"",!(t.length>e.length)&&e.substring(0,t.length)===t},vd:function(e,t){if(e===t)return!0;if(11===e.nodeType)return!1;if(t.contains)return t.contains(1!==e.nodeType?e.parentNode:e);if(t.compareDocumentPosition)return 16==(16&t.compareDocumentPosition(e));for(;e&&e!=t;)e=e.parentNode;return!!e},Sb:function(e){return f.a.vd(e,e.ownerDocument.documentElement)},kd:function(e){return!!f.a.Lb(e,f.a.Sb)},R:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},Ac:function(e){return f.onError?function(){try{return e.apply(this,arguments)}catch(e){throw f.onError&&f.onError(e),e}}:e},setTimeout:function(e,t){return setTimeout(f.a.Ac(e),t)},Gc:function(e){setTimeout((function(){throw f.onError&&f.onError(e),e}),0)},B:function(e,t,n){var i=f.a.Ac(n);if(n=_[t],f.options.useOnlyNativeEvents||n||!r)if(n||"function"!=typeof e.addEventListener){if(void 0===e.attachEvent)throw Error("Browser doesn't support addEventListener or attachEvent");var o=function(t){i.call(e,t)},a="on"+t;e.attachEvent(a,o),f.a.K.za(e,(function(){e.detachEvent(a,o)}))}else e.addEventListener(t,i,!1);else g||(g="function"==typeof r(e).on?"on":"bind"),r(e)[g](t,i)},Fb:function(e,i){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var o;if(o=!("input"!==f.a.R(e)||!e.type||"click"!=i.toLowerCase()||"checkbox"!=(o=e.type)&&"radio"!=o),f.options.useOnlyNativeEvents||!r||o)if("function"==typeof n.createEvent){if("function"!=typeof e.dispatchEvent)throw Error("The supplied element doesn't support dispatchEvent");(o=n.createEvent(m[i]||"HTMLEvents")).initEvent(i,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(o)}else if(o&&e.click)e.click();else{if(void 0===e.fireEvent)throw Error("Browser doesn't support triggering events");e.fireEvent("on"+i)}else r(e).trigger(i)},f:function(e){return f.O(e)?e():e},bc:function(e){return f.O(e)?e.v():e},Eb:function(e,t,n){var i;t&&("object"==typeof e.classList?(i=e.classList[n?"add":"remove"],f.a.D(t.match(C),(function(t){i.call(e.classList,t)}))):"string"==typeof e.className.baseVal?l(e.className,"baseVal",t,n):l(e,"className",t,n))},Bb:function(t,n){var i=f.a.f(n);null!==i&&i!==e||(i="");var r=f.h.firstChild(t);!r||3!=r.nodeType||f.h.nextSibling(r)?f.h.va(t,[t.ownerDocument.createTextNode(i)]):r.data=i,f.a.Ad(t)},Yc:function(e,t){if(e.name=t,7>=y)try{var i=e.name.replace(/[&<>'"]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}));e.mergeAttributes(n.createElement("<input name='"+i+"'/>"),!1)}catch(e){}},Ad:function(e){9<=y&&(e=1==e.nodeType?e:e.parentNode).style&&(e.style.zoom=e.style.zoom)},wd:function(e){if(y){var t=e.style.width;e.style.width=0,e.style.width=t}},Pd:function(e,t){e=f.a.f(e),t=f.a.f(t);for(var n=[],i=e;i<=t;i++)n.push(i);return n},la:function(e){for(var t=[],n=0,i=e.length;n<i;n++)t.push(e[n]);return t},Da:function(e){return h?Symbol(e):e},Zd:6===y,$d:7===y,W:y,Lc:function(e,t){for(var n=f.a.la(e.getElementsByTagName("input")).concat(f.a.la(e.getElementsByTagName("textarea"))),i="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},r=[],o=n.length-1;0<=o;o--)i(n[o])&&r.push(n[o]);return r},Nd:function(e){return"string"==typeof e&&(e=f.a.Db(e))?o&&o.parse?o.parse(e):new Function("return "+e)():null},hc:function(e,t,n){if(!o||!o.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return o.stringify(f.a.f(e),t,n)},Od:function(e,t,i){var r=(i=i||{}).params||{},o=i.includeFields||this.Jc,s=e;if("object"==typeof e&&"form"===f.a.R(e)){s=e.action;for(var c=o.length-1;0<=c;c--)for(var l=f.a.Lc(e,o[c]),u=l.length-1;0<=u;u--)r[l[u].name]=l[u].value}t=f.a.f(t);var d=n.createElement("form");for(var h in d.style.display="none",d.action=s,d.method="post",t)(e=n.createElement("input")).type="hidden",e.name=h,e.value=f.a.hc(f.a.f(t[h])),d.appendChild(e);a(r,(function(e,t){var i=n.createElement("input");i.type="hidden",i.name=e,i.value=t,d.appendChild(i)})),n.body.appendChild(d),i.submitter?i.submitter(d):d.submit(),setTimeout((function(){d.parentNode.removeChild(d)}),0)}}}(),f.b("utils",f.a),f.b("utils.arrayForEach",f.a.D),f.b("utils.arrayFirst",f.a.Lb),f.b("utils.arrayFilter",f.a.jb),f.b("utils.arrayGetDistinctValues",f.a.wc),f.b("utils.arrayIndexOf",f.a.A),f.b("utils.arrayMap",f.a.Mb),f.b("utils.arrayPushAll",f.a.Nb),f.b("utils.arrayRemoveItem",f.a.Pa),f.b("utils.cloneNodes",f.a.Ca),f.b("utils.createSymbolOrString",f.a.Da),f.b("utils.extend",f.a.extend),f.b("utils.fieldsIncludedWithJsonPost",f.a.Jc),f.b("utils.getFormFields",f.a.Lc),f.b("utils.objectMap",f.a.Ga),f.b("utils.peekObservable",f.a.bc),f.b("utils.postJson",f.a.Od),f.b("utils.parseJson",f.a.Nd),f.b("utils.registerEventHandler",f.a.B),f.b("utils.stringifyJson",f.a.hc),f.b("utils.range",f.a.Pd),f.b("utils.toggleDomNodeCssClass",f.a.Eb),f.b("utils.triggerEvent",f.a.Fb),f.b("utils.unwrapObservable",f.a.f),f.b("utils.objectForEach",f.a.P),f.b("utils.addOrRemoveItem",f.a.Na),f.b("utils.setTextContent",f.a.Bb),f.b("unwrap",f.a.f),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(1===arguments.length)return function(){return t.apply(e,arguments)};var n=Array.prototype.slice.call(arguments,1);return function(){var i=n.slice(0);return i.push.apply(i,arguments),t.apply(e,i)}}),f.a.g=new function(){var t,n,i=0,r="__ko__"+(new Date).getTime(),o={};return f.a.W?(t=function(t,n){var a=t[r];if(!a||"null"===a||!o[a]){if(!n)return e;a=t[r]="ko"+i++,o[a]={}}return o[a]},n=function(e){var t=e[r];return!!t&&(delete o[t],e[r]=null,!0)}):(t=function(e,t){var n=e[r];return!n&&t&&(n=e[r]={}),n},n=function(e){return!!e[r]&&(delete e[r],!0)}),{get:function(e,n){var i=t(e,!1);return i&&i[n]},set:function(n,i,r){(n=t(n,r!==e))&&(n[i]=r)},Ub:function(e,n,i){return(e=t(e,!0))[n]||(e[n]=i)},clear:n,Z:function(){return i+++r}}},f.b("utils.domData",f.a.g),f.b("utils.domData.clear",f.a.g.clear),f.a.K=new function(){function t(t,n){var i=f.a.g.get(t,o);return i===e&&n&&(i=[],f.a.g.set(t,o,i)),i}function n(e){if(n=t(e,!1))for(var n=n.slice(0),r=0;r<n.length;r++)n[r](e);f.a.g.clear(e),f.a.K.cleanExternalData(e),s[e.nodeType]&&i(e.childNodes,!0)}function i(e,t){for(var i,r=[],o=0;o<e.length;o++)if((!t||8===e[o].nodeType)&&(n(r[r.length]=i=e[o]),e[o]!==i))for(;o--&&-1==f.a.A(r,e[o]););}var o=f.a.g.Z(),a={1:!0,8:!0,9:!0},s={1:!0,9:!0};return{za:function(e,n){if("function"!=typeof n)throw Error("Callback must be a function");t(e,!0).push(n)},yb:function(n,i){var r=t(n,!1);r&&(f.a.Pa(r,i),0==r.length&&f.a.g.set(n,o,e))},oa:function(e){return f.u.G((function(){a[e.nodeType]&&(n(e),s[e.nodeType]&&i(e.getElementsByTagName("*")))})),e},removeNode:function(e){f.oa(e),e.parentNode&&e.parentNode.removeChild(e)},cleanExternalData:function(e){r&&"function"==typeof r.cleanData&&r.cleanData([e])}}},f.oa=f.a.K.oa,f.removeNode=f.a.K.removeNode,f.b("cleanNode",f.oa),f.b("removeNode",f.removeNode),f.b("utils.domNodeDisposal",f.a.K),f.b("utils.domNodeDisposal.addDisposeCallback",f.a.K.za),f.b("utils.domNodeDisposal.removeDisposeCallback",f.a.K.yb),function(){var i=[0,"",""],o=[1,"<table>","</table>"],a=[3,"<table><tbody><tr>","</tr></tbody></table>"],s=[1,"<select multiple='multiple'>","</select>"],c={thead:o,tbody:o,tfoot:o,tr:[2,"<table><tbody>","</tbody></table>"],td:a,th:a,option:s,optgroup:s},l=8>=f.a.W;f.a.ua=function(e,o){var a;if(r){if(r.parseHTML)a=r.parseHTML(e,o)||[];else if((a=r.clean([e],o))&&a[0]){for(var s=a[0];s.parentNode&&11!==s.parentNode.nodeType;)s=s.parentNode;s.parentNode&&s.parentNode.removeChild(s)}}else{(a=o)||(a=n),s=a.parentWindow||a.defaultView||t;var u,d=f.a.Db(e).toLowerCase(),h=a.createElement("div");for(u=(d=d.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&c[d[1]]||i,d=u[0],u="ignored<div>"+u[1]+e+u[2]+"</div>","function"==typeof s.innerShiv?h.appendChild(s.innerShiv(u)):(l&&a.body.appendChild(h),h.innerHTML=u,l&&h.parentNode.removeChild(h));d--;)h=h.lastChild;a=f.a.la(h.lastChild.childNodes)}return a},f.a.Md=function(e,t){var n=f.a.ua(e,t);return n.length&&n[0].parentElement||f.a.Yb(n)},f.a.fc=function(t,n){if(f.a.Tb(t),null!==(n=f.a.f(n))&&n!==e)if("string"!=typeof n&&(n=n.toString()),r)r(t).html(n);else for(var i=f.a.ua(n,t.ownerDocument),o=0;o<i.length;o++)t.appendChild(i[o])}}(),f.b("utils.parseHtmlFragment",f.a.ua),f.b("utils.setHtml",f.a.fc),f.aa=function(){function t(e,n){if(e)if(8==e.nodeType)null!=(i=f.aa.Uc(e.nodeValue))&&n.push({ud:e,Kd:i});else if(1==e.nodeType)for(var i=0,r=e.childNodes,o=r.length;i<o;i++)t(r[i],n)}var n={};return{Xb:function(e){if("function"!=typeof e)throw Error("You can only pass a function to ko.memoization.memoize()");var t=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return n[t]=e,"\x3c!--[ko_memo:"+t+"]--\x3e"},bd:function(t,i){var r=n[t];if(r===e)throw Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized.");try{return r.apply(null,i||[]),!0}finally{delete n[t]}},cd:function(e,n){var i=[];t(e,i);for(var r=0,o=i.length;r<o;r++){var a=i[r].ud,s=[a];n&&f.a.Nb(s,n),f.aa.bd(i[r].Kd,s),a.nodeValue="",a.parentNode&&a.parentNode.removeChild(a)}},Uc:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}(),f.b("memoization",f.aa),f.b("memoization.memoize",f.aa.Xb),f.b("memoization.unmemoize",f.aa.bd),f.b("memoization.parseMemoText",f.aa.Uc),f.b("memoization.unmemoizeDomNodeAndDescendants",f.aa.cd),f.na=function(){function e(){if(a)for(var e,t=a,n=0;c<a;)if(e=o[c++]){if(c>t){if(5e3<=++n){c=a,f.a.Gc(Error("'Too much recursion' after processing "+n+" task groups."));break}t=a}try{e()}catch(e){f.a.Gc(e)}}}function i(){e(),c=a=o.length=0}var r,o=[],a=0,s=1,c=0;return r=t.MutationObserver?function(e){var t=n.createElement("div");return new MutationObserver(e).observe(t,{attributes:!0}),function(){t.classList.toggle("foo")}}(i):n&&"onreadystatechange"in n.createElement("script")?function(e){var t=n.createElement("script");t.onreadystatechange=function(){t.onreadystatechange=null,n.documentElement.removeChild(t),t=null,e()},n.documentElement.appendChild(t)}:function(e){setTimeout(e,0)},{scheduler:r,zb:function(e){return a||f.na.scheduler(i),o[a++]=e,s++},cancel:function(e){(e-=s-a)>=c&&e<a&&(o[e]=null)},resetForTesting:function(){var e=a-c;return c=a=o.length=0,e},Sd:e}}(),f.b("tasks",f.na),f.b("tasks.schedule",f.na.zb),f.b("tasks.runEarly",f.na.Sd),f.Ta={throttle:function(e,t){e.throttleEvaluation=t;var n=null;return f.$({read:e,write:function(i){clearTimeout(n),n=f.a.setTimeout((function(){e(i)}),t)}})},rateLimit:function(e,t){var n,i,r;"number"==typeof t?n=t:(n=t.timeout,i=t.method),e.Hb=!1,r="function"==typeof i?i:"notifyWhenChangesStop"==i?u:l,e.ub((function(e){return r(e,n,t)}))},deferred:function(t,n){if(!0!==n)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");t.Hb||(t.Hb=!0,t.ub((function(n){var i,r=!1;return function(){if(!r){f.na.cancel(i),i=f.na.zb(n);try{r=!0,t.notifySubscribers(e,"dirty")}finally{r=!1}}}})))},notify:function(e,t){e.equalityComparer="always"==t?null:c}};var m={undefined:1,boolean:1,number:1,string:1};f.b("extenders",f.Ta),f.ic=function(e,t,n){this.da=e,this.lc=t,this.mc=n,this.Ib=!1,this.fb=this.Jb=null,f.L(this,"dispose",this.s),f.L(this,"disposeWhenNodeIsRemoved",this.l)},f.ic.prototype.s=function(){this.Ib||(this.fb&&f.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},f.ic.prototype.l=function(e){this.Jb=e,f.a.K.za(e,this.fb=this.s.bind(this))},f.T=function(){f.a.Ab(this,g),g.qb(this)};var g={qb:function(e){e.U={change:[]},e.sc=1},subscribe:function(e,t,n){var i=this;n=n||"change";var r=new f.ic(i,t?e.bind(t):e,(function(){f.a.Pa(i.U[n],r),i.hb&&i.hb(n)}));return i.Qa&&i.Qa(n),i.U[n]||(i.U[n]=[]),i.U[n].push(r),r},notifySubscribers:function(e,t){if("change"===(t=t||"change")&&this.Gb(),this.Wa(t)){var n="change"===t&&this.ed||this.U[t].slice(0);try{f.u.xc();for(var i,r=0;i=n[r];++r)i.Ib||i.lc(e)}finally{f.u.end()}}},ob:function(){return this.sc},Dd:function(e){return this.ob()!==e},Gb:function(){++this.sc},ub:function(e){var t,n,i,r,o,a=this,s=f.O(a);a.gb||(a.gb=a.notifySubscribers,a.notifySubscribers=d);var c=e((function(){a.Ja=!1,s&&r===a&&(r=a.nc?a.nc():a());var e=n||o&&a.sb(i,r);o=n=t=!1,e&&a.gb(i=r)}));a.qc=function(e,n){n&&a.Ja||(o=!n),a.ed=a.U.change.slice(0),a.Ja=t=!0,r=e,c()},a.pc=function(e){t||(i=e,a.gb(e,"beforeChange"))},a.rc=function(){o=!0},a.gd=function(){a.sb(i,a.v(!0))&&(n=!0)}},Wa:function(e){return this.U[e]&&this.U[e].length},Bd:function(e){if(e)return this.U[e]&&this.U[e].length||0;var t=0;return f.a.P(this.U,(function(e,n){"dirty"!==e&&(t+=n.length)})),t},sb:function(e,t){return!this.equalityComparer||!this.equalityComparer(e,t)},toString:function(){return"[object Object]"},extend:function(e){var t=this;return e&&f.a.P(e,(function(e,n){var i=f.Ta[e];"function"==typeof i&&(t=i(t,n)||t)})),t}};f.L(g,"init",g.qb),f.L(g,"subscribe",g.subscribe),f.L(g,"extend",g.extend),f.L(g,"getSubscriptionsCount",g.Bd),f.a.Ba&&f.a.setPrototypeOf(g,Function.prototype),f.T.fn=g,f.Qc=function(e){return null!=e&&"function"==typeof e.subscribe&&"function"==typeof e.notifySubscribers},f.b("subscribable",f.T),f.b("isSubscribable",f.Qc),f.S=f.u=function(){function e(e){i.push(n),n=e}function t(){n=i.pop()}var n,i=[],r=0;return{xc:e,end:t,cc:function(e){if(n){if(!f.Qc(e))throw Error("Only subscribable things can act as dependencies");n.od.call(n.pd,e,e.fd||(e.fd=++r))}},G:function(n,i,r){try{return e(),n.apply(i,r||[])}finally{t()}},qa:function(){if(n)return n.o.qa()},Va:function(){if(n)return n.o.Va()},Ya:function(){if(n)return n.Ya},o:function(){if(n)return n.o}}}(),f.b("computedContext",f.S),f.b("computedContext.getDependenciesCount",f.S.qa),f.b("computedContext.getDependencies",f.S.Va),f.b("computedContext.isInitial",f.S.Ya),f.b("computedContext.registerDependency",f.S.cc),f.b("ignoreDependencies",f.Yd=f.u.G);var _=f.a.Da("_latestValue");f.ta=function(e){function t(){return 0<arguments.length?(t.sb(t[_],arguments[0])&&(t.ya(),t[_]=arguments[0],t.xa()),this):(f.u.cc(t),t[_])}return t[_]=e,f.a.Ba||f.a.extend(t,f.T.fn),f.T.fn.qb(t),f.a.Ab(t,y),f.options.deferUpdates&&f.Ta.deferred(t,!0),t};var y={equalityComparer:c,v:function(){return this[_]},xa:function(){this.notifySubscribers(this[_],"spectate"),this.notifySubscribers(this[_])},ya:function(){this.notifySubscribers(this[_],"beforeChange")}};f.a.Ba&&f.a.setPrototypeOf(y,f.T.fn);var C=f.ta.Ma="__ko_proto__";y[C]=f.ta,f.O=function(e){if((e="function"==typeof e&&e[C])&&e!==y[C]&&e!==f.o.fn[C])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!e},f.Za=function(e){return"function"==typeof e&&(e[C]===y[C]||e[C]===f.o.fn[C]&&e.Nc)},f.b("observable",f.ta),f.b("isObservable",f.O),f.b("isWriteableObservable",f.Za),f.b("isWritableObservable",f.Za),f.b("observable.fn",y),f.L(y,"peek",y.v),f.L(y,"valueHasMutated",y.xa),f.L(y,"valueWillMutate",y.ya),f.Ha=function(e){if("object"!=typeof(e=e||[])||!("length"in e))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return e=f.ta(e),f.a.Ab(e,f.Ha.fn),e.extend({trackArrayChanges:!0})},f.Ha.fn={remove:function(e){for(var t=this.v(),n=[],i="function"!=typeof e||f.O(e)?function(t){return t===e}:e,r=0;r<t.length;r++){var o=t[r];if(i(o)){if(0===n.length&&this.ya(),t[r]!==o)throw Error("Array modified during remove; cannot remove item");n.push(o),t.splice(r,1),r--}}return n.length&&this.xa(),n},removeAll:function(t){if(t===e){var n=this.v(),i=n.slice(0);return this.ya(),n.splice(0,n.length),this.xa(),i}return t?this.remove((function(e){return 0<=f.a.A(t,e)})):[]},destroy:function(e){var t=this.v(),n="function"!=typeof e||f.O(e)?function(t){return t===e}:e;this.ya();for(var i=t.length-1;0<=i;i--){var r=t[i];n(r)&&(r._destroy=!0)}this.xa()},destroyAll:function(t){return t===e?this.destroy((function(){return!0})):t?this.destroy((function(e){return 0<=f.a.A(t,e)})):[]},indexOf:function(e){var t=this();return f.a.A(t,e)},replace:function(e,t){var n=this.indexOf(e);0<=n&&(this.ya(),this.v()[n]=t,this.xa())},sorted:function(e){var t=this().slice(0);return e?t.sort(e):t.sort()},reversed:function(){return this().slice(0).reverse()}},f.a.Ba&&f.a.setPrototypeOf(f.Ha.fn,f.ta.fn),f.a.D("pop push reverse shift sort splice unshift".split(" "),(function(e){f.Ha.fn[e]=function(){var t=this.v();this.ya(),this.zc(t,e,arguments);var n=t[e].apply(t,arguments);return this.xa(),n===t?this:n}})),f.a.D(["slice"],(function(e){f.Ha.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}})),f.Pc=function(e){return f.O(e)&&"function"==typeof e.remove&&"function"==typeof e.push},f.b("observableArray",f.Ha),f.b("isObservableArray",f.Pc),f.Ta.trackArrayChanges=function(t,n){function i(){function e(){if(l){var e,n=[].concat(t.v()||[]);t.Wa("arrayChange")&&((!c||1<l)&&(c=f.a.Pb(a,n,t.Ob)),e=c),a=n,c=null,l=0,e&&e.length&&t.notifySubscribers(e,"arrayChange")}}s?e():(s=!0,o=t.subscribe((function(){++l}),null,"spectate"),a=[].concat(t.v()||[]),c=null,r=t.subscribe(e))}if(t.Ob={},n&&"object"==typeof n&&f.a.extend(t.Ob,n),t.Ob.sparse=!0,!t.zc){var r,o,a,s=!1,c=null,l=0,u=t.Qa,d=t.hb;t.Qa=function(e){u&&u.call(t,e),"arrayChange"===e&&i()},t.hb=function(n){d&&d.call(t,n),"arrayChange"!==n||t.Wa("arrayChange")||(r&&r.s(),o&&o.s(),o=r=null,s=!1,a=e)},t.zc=function(e,t,n){function i(e,t,n){return r[r.length]={status:e,value:t,index:n}}if(s&&!l){var r=[],o=e.length,a=n.length,u=0;switch(t){case"push":u=o;case"unshift":for(t=0;t<a;t++)i("added",n[t],u+t);break;case"pop":u=o-1;case"shift":o&&i("deleted",e[u],u);break;case"splice":t=Math.min(Math.max(0,0>n[0]?o+n[0]:n[0]),o),o=1===a?o:Math.min(t+(n[1]||0),o),a=t+a-2,u=Math.max(o,a);for(var d=[],h=[],p=2;t<u;++t,++p)t<o&&h.push(i("deleted",e[t],t)),t<a&&d.push(i("added",n[p],t));f.a.Kc(h,d);break;default:return}c=r}}}};var T=f.a.Da("_state");f.o=f.$=function(t,n,i){function r(){if(0<arguments.length){if("function"!=typeof o)throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return o.apply(a.nb,arguments),this}return a.ra||f.u.cc(r),(a.ka||a.J&&r.Xa())&&r.ha(),a.X}if("object"==typeof t?i=t:(i=i||{},t&&(i.read=t)),"function"!=typeof i.read)throw Error("Pass a function that returns the value of the ko.computed");var o=i.write,a={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:i.read,nb:n||i.owner,l:i.disposeWhenNodeIsRemoved||i.l||null,Sa:i.disposeWhen||i.Sa,Rb:null,I:{},V:0,Ic:null};return r[T]=a,r.Nc="function"==typeof o,f.a.Ba||f.a.extend(r,f.T.fn),f.T.fn.qb(r),f.a.Ab(r,S),i.pure?(a.wb=!0,a.J=!0,f.a.extend(r,A)):i.deferEvaluation&&f.a.extend(r,v),f.options.deferUpdates&&f.Ta.deferred(r,!0),a.l&&(a.jc=!0,a.l.nodeType||(a.l=null)),a.J||i.deferEvaluation||r.ha(),a.l&&r.ja()&&f.a.K.za(a.l,a.Rb=function(){r.s()}),r};var S={equalityComparer:c,qa:function(){return this[T].V},Va:function(){var e=[];return f.a.P(this[T].I,(function(t,n){e[n.Ka]=n.da})),e},Vb:function(e){if(!this[T].V)return!1;var t=this.Va();return-1!==f.a.A(t,e)||!!f.a.Lb(t,(function(t){return t.Vb&&t.Vb(e)}))},uc:function(e,t,n){if(this[T].wb&&t===this)throw Error("A 'pure' computed must not be called recursively");this[T].I[e]=n,n.Ka=this[T].V++,n.La=t.ob()},Xa:function(){var e,t,n=this[T].I;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e],this.Ia&&t.da.Ja||t.da.Dd(t.La)))return!0},Jd:function(){this.Ia&&!this[T].rb&&this.Ia(!1)},ja:function(){var e=this[T];return e.ka||0<e.V},Rd:function(){this.Ja?this[T].ka&&(this[T].sa=!0):this.Hc()},$c:function(e){if(e.Hb){var t=e.subscribe(this.Jd,this,"dirty"),n=e.subscribe(this.Rd,this);return{da:e,s:function(){t.s(),n.s()}}}return e.subscribe(this.Hc,this)},Hc:function(){var e=this,t=e.throttleEvaluation;t&&0<=t?(clearTimeout(this[T].Ic),this[T].Ic=f.a.setTimeout((function(){e.ha(!0)}),t)):e.Ia?e.Ia(!0):e.ha(!0)},ha:function(e){var t=this[T],n=t.Sa,i=!1;if(!t.rb&&!t.ra){if(t.l&&!f.a.Sb(t.l)||n&&n()){if(!t.jc)return void this.s()}else t.jc=!1;t.rb=!0;try{i=this.zd(e)}finally{t.rb=!1}return i}},zd:function(t){var n=this[T],i=!1,r=n.wb?e:!n.V;i={qd:this,mb:n.I,Qb:n.V},f.u.xc({pd:i,od:p,o:this,Ya:r}),n.I={},n.V=0;var o=this.yd(n,i);return n.V?i=this.sb(n.X,o):(this.s(),i=!0),i&&(n.J?this.Gb():this.notifySubscribers(n.X,"beforeChange"),n.X=o,this.notifySubscribers(n.X,"spectate"),!n.J&&t&&this.notifySubscribers(n.X),this.rc&&this.rc()),r&&this.notifySubscribers(n.X,"awake"),i},yd:function(e,t){try{var n=e.Wc;return e.nb?n.call(e.nb):n()}finally{f.u.end(),t.Qb&&!e.J&&f.a.P(t.mb,h),e.sa=e.ka=!1}},v:function(e){var t=this[T];return(t.ka&&(e||!t.V)||t.J&&this.Xa())&&this.ha(),t.X},ub:function(e){f.T.fn.ub.call(this,e),this.nc=function(){return this[T].J||(this[T].sa?this.ha():this[T].ka=!1),this[T].X},this.Ia=function(e){this.pc(this[T].X),this[T].ka=!0,e&&(this[T].sa=!0),this.qc(this,!e)}},s:function(){var t=this[T];!t.J&&t.I&&f.a.P(t.I,(function(e,t){t.s&&t.s()})),t.l&&t.Rb&&f.a.K.yb(t.l,t.Rb),t.I=e,t.V=0,t.ra=!0,t.sa=!1,t.ka=!1,t.J=!1,t.l=e,t.Sa=e,t.Wc=e,this.Nc||(t.nb=e)}},A={Qa:function(e){var t=this,n=t[T];if(!n.ra&&n.J&&"change"==e){if(n.J=!1,n.sa||t.Xa())n.I=null,n.V=0,t.ha()&&t.Gb();else{var i=[];f.a.P(n.I,(function(e,t){i[t.Ka]=e})),f.a.D(i,(function(e,i){var r=n.I[e],o=t.$c(r.da);o.Ka=i,o.La=r.La,n.I[e]=o})),t.Xa()&&t.ha()&&t.Gb()}n.ra||t.notifySubscribers(n.X,"awake")}},hb:function(t){var n=this[T];n.ra||"change"!=t||this.Wa("change")||(f.a.P(n.I,(function(e,t){t.s&&(n.I[e]={da:t.da,Ka:t.Ka,La:t.La},t.s())})),n.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var e=this[T];return e.J&&(e.sa||this.Xa())&&this.ha(),f.T.fn.ob.call(this)}},v={Qa:function(e){"change"!=e&&"beforeChange"!=e||this.v()}};f.a.Ba&&f.a.setPrototypeOf(S,f.T.fn);var E,b=f.ta.Ma;S[b]=f.o,f.Oc=function(e){return"function"==typeof e&&e[b]===S[b]},f.Fd=function(e){return f.Oc(e)&&e[T]&&e[T].wb},f.b("computed",f.o),f.b("dependentObservable",f.o),f.b("isComputed",f.Oc),f.b("isPureComputed",f.Fd),f.b("computed.fn",S),f.L(S,"peek",S.v),f.L(S,"dispose",S.s),f.L(S,"isActive",S.ja),f.L(S,"getDependenciesCount",S.qa),f.L(S,"getDependencies",S.Va),f.xb=function(e,t){return"function"==typeof e?f.o(e,t,{pure:!0}):((e=f.a.extend({},e)).pure=!0,f.o(e,t))},f.b("pureComputed",f.xb),function(){function t(i,r,o){if(o=o||new n,"object"!=typeof(i=r(i))||null===i||i===e||i instanceof RegExp||i instanceof Date||i instanceof String||i instanceof Number||i instanceof Boolean)return i;var a=i instanceof Array?[]:{};return o.save(i,a),function(e,t){if(e instanceof Array){for(var n=0;n<e.length;n++)t(n);"function"==typeof e.toJSON&&t("toJSON")}else for(n in e)t(n)}(i,(function(n){var s=r(i[n]);switch(typeof s){case"boolean":case"number":case"string":case"function":a[n]=s;break;case"object":case"undefined":var c=o.get(s);a[n]=c!==e?c:t(s,r,o)}})),a}function n(){this.keys=[],this.values=[]}f.ad=function(e){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return t(e,(function(e){for(var t=0;f.O(e)&&10>t;t++)e=e();return e}))},f.toJSON=function(e,t,n){return e=f.ad(e),f.a.hc(e,t,n)},n.prototype={constructor:n,save:function(e,t){var n=f.a.A(this.keys,e);0<=n?this.values[n]=t:(this.keys.push(e),this.values.push(t))},get:function(t){return 0<=(t=f.a.A(this.keys,t))?this.values[t]:e}}}(),f.b("toJS",f.ad),f.b("toJSON",f.toJSON),f.Wd=function(e,t,n){function i(t){var i=f.xb(e,n).extend({ma:"always"}),r=i.subscribe((function(e){e&&(r.s(),t(e))}));return i.notifySubscribers(i.v()),r}return"function"!=typeof Promise||t?i(t.bind(n)):new Promise(i)},f.b("when",f.Wd),f.w={M:function(t){switch(f.a.R(t)){case"option":return!0===t.__ko__hasDomDataOptionValue__?f.a.g.get(t,f.c.options.$b):7>=f.a.W?t.getAttributeNode("value")&&t.getAttributeNode("value").specified?t.value:t.text:t.value;case"select":return 0<=t.selectedIndex?f.w.M(t.options[t.selectedIndex]):e;default:return t.value}},cb:function(t,n,i){switch(f.a.R(t)){case"option":"string"==typeof n?(f.a.g.set(t,f.c.options.$b,e),"__ko__hasDomDataOptionValue__"in t&&delete t.__ko__hasDomDataOptionValue__,t.value=n):(f.a.g.set(t,f.c.options.$b,n),t.__ko__hasDomDataOptionValue__=!0,t.value="number"==typeof n?n:"");break;case"select":""!==n&&null!==n||(n=e);for(var r,o=-1,a=0,s=t.options.length;a<s;++a)if((r=f.w.M(t.options[a]))==n||""===r&&n===e){o=a;break}(i||0<=o||n===e&&1<t.size)&&(t.selectedIndex=o,6===f.a.W&&f.a.setTimeout((function(){t.selectedIndex=o}),0));break;default:null!==n&&n!==e||(n=""),t.value=n}}},f.b("selectExtensions",f.w),f.b("selectExtensions.readValue",f.w.M),f.b("selectExtensions.writeValue",f.w.cb),f.m=function(){function e(e){123===(e=f.a.Db(e)).charCodeAt(0)&&(e=e.slice(1,-1));var t,n=[],a=(e+="\n,").match(i),s=[],c=0;if(1<a.length){for(var l,u=0;l=a[u];++u){var d=l.charCodeAt(0);if(44===d){if(0>=c){n.push(t&&s.length?{key:t,value:s.join("")}:{unknown:t||s.join("")}),t=c=0,s=[];continue}}else if(58===d){if(!c&&!t&&1===s.length){t=s.pop();continue}}else{if(47===d&&1<l.length&&(47===l.charCodeAt(1)||42===l.charCodeAt(1)))continue;47===d&&u&&1<l.length?(d=a[u-1].match(r))&&!o[d[0]]&&(a=(e=e.substr(e.indexOf(l)+1)).match(i),u=-1,l="/"):40===d||123===d||91===d?++c:41===d||125===d||93===d?--c:t||s.length||34!==d&&39!==d||(l=l.slice(1,-1))}s.push(l)}if(0<c)throw Error("Unbalanced parentheses, braces, or brackets")}return n}var t=["true","false","null","undefined"],n=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,i=RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]","g"),r=/[\])"'A-Za-z0-9_$]+$/,o={in:1,return:1,typeof:1},a={};return{Ra:[],wa:a,ac:e,vb:function(i,r){function o(e,i){var r;if(!u){var d=f.getBindingHandler(e);if(d&&d.preprocess&&!(i=d.preprocess(i,e,o)))return;(d=a[e])&&(r=i,0<=f.a.A(t,r)?r=!1:(d=r.match(n),r=null!==d&&(d[1]?"Object("+d[1]+")"+d[2]:r)),d=r),d&&c.push("'"+("string"==typeof a[e]?a[e]:e)+"':function(_z){"+r+"=_z}")}l&&(i="function(){return "+i+" }"),s.push("'"+e+"':"+i)}var s=[],c=[],l=(r=r||{}).valueAccessors,u=r.bindingParams,d="string"==typeof i?e(i):i;return f.a.D(d,(function(e){o(e.key||e.unknown,e.value)})),c.length&&o("_ko_property_writers","{"+c.join(",")+" }"),s.join(",")},Id:function(e,t){for(var n=0;n<e.length;n++)if(e[n].key==t)return!0;return!1},eb:function(e,t,n,i,r){e&&f.O(e)?!f.Za(e)||r&&e.v()===i||e(i):(e=t.get("_ko_property_writers"))&&e[n]&&e[n](i)}}}(),f.b("expressionRewriting",f.m),f.b("expressionRewriting.bindingRewriteValidators",f.m.Ra),f.b("expressionRewriting.parseObjectLiteral",f.m.ac),f.b("expressionRewriting.preProcessBindings",f.m.vb),f.b("expressionRewriting._twoWayBindings",f.m.wa),f.b("jsonExpressionRewriting",f.m),f.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",f.m.vb),function(){function e(e){return 8==e.nodeType&&a.test(o?e.text:e.nodeValue)}function t(e){return 8==e.nodeType&&s.test(o?e.text:e.nodeValue)}function i(n,i){for(var r=n,o=1,a=[];r=r.nextSibling;){if(t(r)&&(f.a.g.set(r,l,!0),0==--o))return a;a.push(r),e(r)&&o++}if(!i)throw Error("Cannot find closing comment tag to match: "+n.nodeValue);return null}function r(e,t){var n=i(e,t);return n?0<n.length?n[n.length-1].nextSibling:e.nextSibling:null}var o=n&&"\x3c!--test--\x3e"===n.createComment("test").text,a=o?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,s=o?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,c={ul:!0,ol:!0},l="__ko_matchedEndComment__";f.h={ea:{},childNodes:function(t){return e(t)?i(t):t.childNodes},Ea:function(t){if(e(t))for(var n=0,i=(t=f.h.childNodes(t)).length;n<i;n++)f.removeNode(t[n]);else f.a.Tb(t)},va:function(t,n){if(e(t)){f.h.Ea(t);for(var i=t.nextSibling,r=0,o=n.length;r<o;r++)i.parentNode.insertBefore(n[r],i)}else f.a.va(t,n)},Vc:function(t,n){var i;e(t)?(i=t.nextSibling,t=t.parentNode):i=t.firstChild,i?n!==i&&t.insertBefore(n,i):t.appendChild(n)},Wb:function(t,n,i){i?(i=i.nextSibling,e(t)&&(t=t.parentNode),i?n!==i&&t.insertBefore(n,i):t.appendChild(n)):f.h.Vc(t,n)},firstChild:function(n){if(e(n))return!n.nextSibling||t(n.nextSibling)?null:n.nextSibling;if(n.firstChild&&t(n.firstChild))throw Error("Found invalid end comment, as the first child of "+n);return n.firstChild},nextSibling:function(n){if(e(n)&&(n=r(n)),n.nextSibling&&t(n.nextSibling)){var i=n.nextSibling;if(t(i)&&!f.a.g.get(i,l))throw Error("Found end comment without a matching opening comment, as child of "+n);return null}return n.nextSibling},Cd:e,Vd:function(e){return(e=(o?e.text:e.nodeValue).match(a))?e[1]:null},Sc:function(n){if(c[f.a.R(n)]){var i=n.firstChild;if(i)do{if(1===i.nodeType){var o,a=null;if(o=i.firstChild)do{if(a)a.push(o);else if(e(o)){var s=r(o,!0);s?o=s:a=[o]}else t(o)&&(a=[o])}while(o=o.nextSibling);if(o=a)for(a=i.nextSibling,s=0;s<o.length;s++)a?n.insertBefore(o[s],a):n.appendChild(o[s])}}while(i=i.nextSibling)}}}}(),f.b("virtualElements",f.h),f.b("virtualElements.allowedBindings",f.h.ea),f.b("virtualElements.emptyNode",f.h.Ea),f.b("virtualElements.insertAfter",f.h.Wb),f.b("virtualElements.prepend",f.h.Vc),f.b("virtualElements.setDomNodeChildren",f.h.va),f.ga=function(){this.nd={}},f.a.extend(f.ga.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind")||f.j.getComponentNameForNode(e);case 8:return f.h.Cd(e);default:return!1}},getBindings:function(e,t){var n=(n=this.getBindingsString(e,t))?this.parseBindingsString(n,t,e):null;return f.j.tc(n,e,t,!1)},getBindingAccessors:function(e,t){var n=(n=this.getBindingsString(e,t))?this.parseBindingsString(n,t,e,{valueAccessors:!0}):null;return f.j.tc(n,e,t,!0)},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return f.h.Vd(e);default:return null}},parseBindingsString:function(e,t,n,i){try{var r,o=this.nd,a=e+(i&&i.valueAccessors||"");if(!(r=o[a])){var s,c="with($context){with($data||{}){return{"+f.m.vb(e,i)+"}}}";s=new Function("$context","$element",c),r=o[a]=s}return r(t,n)}catch(t){throw t.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+t.message,t}}}),f.ga.instance=new f.ga,f.b("bindingProvider",f.ga),function(){function i(e){var t=(e=f.a.g.get(e,S))&&e.N;t&&(e.N=null,t.Tc())}function o(e,t,n){this.node=e,this.yc=t,this.kb=[],this.H=!1,t.N||f.a.K.za(e,i),n&&n.N&&(n.N.kb.push(e),this.Kb=n)}function a(e){return function(){return e}}function s(e){return e()}function c(e){return f.a.Ga(f.u.G(e),(function(t,n){return function(){return e()[n]}}))}function l(e,t,n){return"function"==typeof e?c(e.bind(null,t,n)):f.a.Ga(e,a)}function u(e,t){return c(this.getBindings.bind(this,e,t))}function d(e,t){var n=f.h.firstChild(t);if(n){var i,r=f.ga.instance,o=r.preprocessNode;if(o){for(;i=n;)n=f.h.nextSibling(i),o.call(r,i);n=f.h.firstChild(t)}for(;i=n;)n=f.h.nextSibling(i),h(e,i)}f.i.ma(t,f.i.H)}function h(e,t){var n=e,i=1===t.nodeType;i&&f.h.Sc(t),(i||f.ga.instance.nodeHasBindings(t))&&(n=p(t,null,e).bindingContextForDescendants),n&&!C[f.a.R(t)]&&d(n,t)}function p(t,n,i){var r,o=f.a.g.Ub(t,S,{}),a=o.hd;if(!n){if(a)throw Error("You cannot apply bindings multiple times to the same element.");o.hd=!0}if(a||(o.context=i),o.Zb||(o.Zb={}),n&&"function"!=typeof n)r=n;else{var c=f.ga.instance,l=c.getBindingAccessors||u,d=f.$((function(){return(r=n?n(i,t):l.call(c,t,i))&&(i[g]&&i[g](),i[y]&&i[y]()),r}),null,{l:t});r&&d.ja()||(d=null)}var h,p=i;if(r){var m=function(){return f.a.Ga(d?d():r,s)},_=d?function(e){return function(){return s(d()[e])}}:function(e){return r[e]};m.get=function(e){return r[e]&&s(_(e))},m.has=function(e){return e in r},f.i.H in r&&f.i.subscribe(t,f.i.H,(function(){var e=(0,r[f.i.H])();if(e){var n=f.h.childNodes(t);n.length&&e(n,f.Ec(n[0]))}})),f.i.pa in r&&(p=f.i.Cb(t,i),f.i.subscribe(t,f.i.pa,(function(){var e=(0,r[f.i.pa])();e&&f.h.firstChild(t)&&e(t)}))),o=function(e){var t=[],n={},i=[];return f.a.P(e,(function r(o){if(!n[o]){var a=f.getBindingHandler(o);a&&(a.after&&(i.push(o),f.a.D(a.after,(function(t){if(e[t]){if(-1!==f.a.A(i,t))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+i.join(", "));r(t)}})),i.length--),t.push({key:o,Mc:a})),n[o]=!0}})),t}(r),f.a.D(o,(function(n){var i=n.Mc.init,o=n.Mc.update,a=n.key;if(8===t.nodeType&&!f.h.ea[a])throw Error("The binding '"+a+"' cannot be used with virtual elements");try{"function"==typeof i&&f.u.G((function(){var n=i(t,_(a),m,p.$data,p);if(n&&n.controlsDescendantBindings){if(h!==e)throw Error("Multiple bindings ("+h+" and "+a+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");h=a}})),"function"==typeof o&&f.$((function(){o(t,_(a),m,p.$data,p)}),null,{l:t})}catch(e){throw e.message='Unable to process binding "'+a+": "+r[a]+'"\nMessage: '+e.message,e}}))}return{shouldBindDescendants:o=h===e,bindingContextForDescendants:o&&p}}function m(t,n){return t&&t instanceof f.fa?t:new f.fa(t,e,e,n)}var g=f.a.Da("_subscribable"),_=f.a.Da("_ancestorBindingInfo"),y=f.a.Da("_dataDependency");f.c={};var C={script:!0,textarea:!0,template:!0};f.getBindingHandler=function(e){return f.c[e]};var T={};f.fa=function(t,n,i,r,o){function a(){var e=d?u():u,t=f.a.f(e);return n?(f.a.extend(c,n),_ in n&&(c[_]=n[_])):(c.$parents=[],c.$root=t,c.ko=f),c[g]=s,l?t=c.$data:(c.$rawData=e,c.$data=t),i&&(c[i]=t),r&&r(c,n,t),n&&n[g]&&!f.S.o().Vb(n[g])&&n[g](),h&&(c[y]=h),c.$data}var s,c=this,l=t===T,u=l?e:t,d="function"==typeof u&&!f.O(u),h=o&&o.dataDependency;o&&o.exportDependencies?a():((s=f.xb(a)).v(),s.ja()?s.equalityComparer=null:c[g]=e)},f.fa.prototype.createChildContext=function(e,t,n,i){if(!i&&t&&"object"==typeof t&&(t=(i=t).as,n=i.extend),t&&i&&i.noChildContext){var r="function"==typeof e&&!f.O(e);return new f.fa(T,this,null,(function(i){n&&n(i),i[t]=r?e():e}),i)}return new f.fa(e,this,t,(function(e,t){e.$parentContext=t,e.$parent=t.$data,e.$parents=(t.$parents||[]).slice(0),e.$parents.unshift(e.$parent),n&&n(e)}),i)},f.fa.prototype.extend=function(e,t){return new f.fa(T,this,null,(function(t){f.a.extend(t,"function"==typeof e?e(t):e)}),t)};var S=f.a.g.Z();o.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},o.prototype.sd=function(e){f.a.Pa(this.kb,e),!this.kb.length&&this.H&&this.Cc()},o.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,f.a.K.yb(this.node,i),f.i.ma(this.node,f.i.pa),this.Tc())},f.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(e,t,n,i,r){var o=f.a.g.Ub(e,S,{});return o.Fa||(o.Fa=new f.T),r&&r.notifyImmediately&&o.Zb[t]&&f.u.G(n,i,[e]),o.Fa.subscribe(n,i,t)},ma:function(t,n){var i=f.a.g.get(t,S);if(i&&(i.Zb[n]=!0,i.Fa&&i.Fa.notifySubscribers(t,n),n==f.i.H))if(i.N)i.N.Cc();else if(i.N===e&&i.Fa&&i.Fa.Wa(f.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")},Cb:function(e,t){var n=f.a.g.Ub(e,S,{});return n.N||(n.N=new o(e,n,t[_])),t[_]==n?t:t.extend((function(e){e[_]=n}))}},f.Td=function(e){return(e=f.a.g.get(e,S))&&e.context},f.ib=function(e,t,n){return 1===e.nodeType&&f.h.Sc(e),p(e,t,m(n))},f.ld=function(e,t,n){return n=m(n),f.ib(e,l(t,n,e),n)},f.Oa=function(e,t){1!==t.nodeType&&8!==t.nodeType||d(m(e),t)},f.vc=function(e,i,o){if(!r&&t.jQuery&&(r=t.jQuery),2>arguments.length){if(!(i=n.body))throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!i||1!==i.nodeType&&8!==i.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");h(m(e,o),i)},f.Dc=function(t){return!t||1!==t.nodeType&&8!==t.nodeType?e:f.Td(t)},f.Ec=function(t){return(t=f.Dc(t))?t.$data:e},f.b("bindingHandlers",f.c),f.b("bindingEvent",f.i),f.b("bindingEvent.subscribe",f.i.subscribe),f.b("bindingEvent.startPossiblyAsyncContentBinding",f.i.Cb),f.b("applyBindings",f.vc),f.b("applyBindingsToDescendants",f.Oa),f.b("applyBindingAccessorsToNode",f.ib),f.b("applyBindingsToNode",f.ld),f.b("contextFor",f.Dc),f.b("dataFor",f.Ec)}(),function(e){function t(t,i){var a,s=Object.prototype.hasOwnProperty.call(r,t)?r[t]:e;s?s.subscribe(i):((s=r[t]=new f.T).subscribe(i),n(t,(function(e,n){var i=!(!n||!n.synchronous);o[t]={definition:e,Gd:i},delete r[t],a||i?s.notifySubscribers(e):f.na.zb((function(){s.notifySubscribers(e)}))})),a=!0)}function n(e,t){i("getConfig",[e],(function(n){n?i("loadComponent",[e,n],(function(e){t(e,n)})):t(null,null)}))}function i(t,n,r,o){o||(o=f.j.loaders.slice(0));var a=o.shift();if(a){var s=a[t];if(s){var c=!1;if(s.apply(a,n.concat((function(e){c?r(null):null!==e?r(e):i(t,n,r,o)})))!==e&&(c=!0,!a.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else i(t,n,r,o)}else r(null)}var r={},o={};f.j={get:function(n,i){var r=Object.prototype.hasOwnProperty.call(o,n)?o[n]:e;r?r.Gd?f.u.G((function(){i(r.definition)})):f.na.zb((function(){i(r.definition)})):t(n,i)},Bc:function(e){delete o[e]},oc:i},f.j.loaders=[],f.b("components",f.j),f.b("components.get",f.j.get),f.b("components.clearCachedDefinition",f.j.Bc)}(),function(){function e(e,t,n,i){function r(){0==--s&&i(o)}var o={},s=2,c=n.template;n=n.viewModel,c?a(t,c,(function(t){f.j.oc("loadTemplate",[e,t],(function(e){o.template=e,r()}))})):r(),n?a(t,n,(function(t){f.j.oc("loadViewModel",[e,t],(function(e){o[u]=e,r()}))})):r()}function i(e,t,n){if("function"==typeof t)n((function(e){return new t(e)}));else if("function"==typeof t[u])n(t[u]);else if("instance"in t){var r=t.instance;n((function(){return r}))}else"viewModel"in t?i(e,t.viewModel,n):e("Unknown viewModel value: "+t)}function r(e){switch(f.a.R(e)){case"script":return f.a.ua(e.text);case"textarea":return f.a.ua(e.value);case"template":if(o(e.content))return f.a.Ca(e.content.childNodes)}return f.a.Ca(e.childNodes)}function o(e){return t.DocumentFragment?e instanceof DocumentFragment:e&&11===e.nodeType}function a(e,n,i){"string"==typeof n.require?s||t.require?(s||t.require)([n.require],(function(e){e&&"object"==typeof e&&e.Xd&&e.default&&(e=e.default),i(e)})):e("Uses require, but no AMD loader is present"):i(n)}function c(e){return function(t){throw Error("Component '"+e+"': "+t)}}var l={};f.j.register=function(e,t){if(!t)throw Error("Invalid configuration for "+e);if(f.j.tb(e))throw Error("Component "+e+" is already registered");l[e]=t},f.j.tb=function(e){return Object.prototype.hasOwnProperty.call(l,e)},f.j.unregister=function(e){delete l[e],f.j.Bc(e)},f.j.Fc={getConfig:function(e,t){t(f.j.tb(e)?l[e]:null)},loadComponent:function(t,n,i){var r=c(t);a(r,n,(function(n){e(t,r,n,i)}))},loadTemplate:function(e,i,a){if(e=c(e),"string"==typeof i)a(f.a.ua(i));else if(i instanceof Array)a(i);else if(o(i))a(f.a.la(i.childNodes));else if(i.element)if(i=i.element,t.HTMLElement?i instanceof HTMLElement:i&&i.tagName&&1===i.nodeType)a(r(i));else if("string"==typeof i){var s=n.getElementById(i);s?a(r(s)):e("Cannot find element with ID "+i)}else e("Unknown element type: "+i);else e("Unknown template value: "+i)},loadViewModel:function(e,t,n){i(c(e),t,n)}};var u="createViewModel";f.b("components.register",f.j.register),f.b("components.isRegistered",f.j.tb),f.b("components.unregister",f.j.unregister),f.b("components.defaultLoader",f.j.Fc),f.j.loaders.push(f.j.Fc),f.j.dd=l}(),function(){function e(e,n){if(i=e.getAttribute("params")){var i=t.parseBindingsString(i,n,e,{valueAccessors:!0,bindingParams:!0}),r=(i=f.a.Ga(i,(function(t){return f.o(t,null,{l:e})})),f.a.Ga(i,(function(t){var n=t.v();return t.ja()?f.o({read:function(){return f.a.f(t())},write:f.Za(n)&&function(e){t()(e)},l:e}):n})));return Object.prototype.hasOwnProperty.call(r,"$raw")||(r.$raw=i),r}return{$raw:{}}}f.j.getComponentNameForNode=function(e){var t=f.a.R(e);if(f.j.tb(t)&&(-1!=t.indexOf("-")||"[object HTMLUnknownElement]"==""+e||8>=f.a.W&&e.tagName===t))return t},f.j.tc=function(t,n,i,r){if(1===n.nodeType){var o=f.j.getComponentNameForNode(n);if(o){if((t=t||{}).component)throw Error('Cannot use the "component" binding on a custom element matching a component');var a={name:o,params:e(n,i)};t.component=r?function(){return a}:a}}return t};var t=new f.ga;9>f.a.W&&(f.j.register=function(e){return function(t){return e.apply(this,arguments)}}(f.j.register),n.createDocumentFragment=function(e){return function(){var t=e();return f.j.dd,t}}(n.createDocumentFragment))}(),E=0,f.c.component={init:function(e,t,n,i,r){function o(){var e=a&&a.dispose;"function"==typeof e&&e.call(a),c&&c.s(),s=a=c=null}var a,s,c,l=f.a.la(f.h.childNodes(e));return f.h.Ea(e),f.a.K.za(e,o),f.o((function(){var n,i,u=f.a.f(t());if("string"==typeof u?n=u:(n=f.a.f(u.name),i=f.a.f(u.params)),!n)throw Error("No component name specified");var d=f.i.Cb(e,r),h=s=++E;f.j.get(n,(function(t){if(s===h){if(o(),!t)throw Error("Unknown component '"+n+"'");!function(e,t,n){if(!(t=t.template))throw Error("Component '"+e+"' has no template");e=f.a.Ca(t),f.h.va(n,e)}(n,t,e);var r=function(e,t,n){var i=e.createViewModel;return i?i.call(e,t,n):t}(t,i,{element:e,templateNodes:l});t=d.createChildContext(r,{extend:function(e){e.$component=r,e.$componentTemplateNodes=l}}),r&&r.koDescendantsComplete&&(c=f.i.subscribe(e,f.i.pa,r.koDescendantsComplete,r)),a=r,f.Oa(t,e)}}))}),null,{l:e}),{controlsDescendantBindings:!0}}},f.h.ea.component=!0;var x={class:"className",for:"htmlFor"};f.c.attr={update:function(t,n){var i=f.a.f(n())||{};f.a.P(i,(function(n,i){i=f.a.f(i);var r=n.indexOf(":"),o=(r="lookupNamespaceURI"in t&&0<r&&t.lookupNamespaceURI(n.substr(0,r)),!1===i||null===i||i===e);o?r?t.removeAttributeNS(r,n):t.removeAttribute(n):i=i.toString(),8>=f.a.W&&n in x?(n=x[n],o?t.removeAttribute(n):t[n]=i):o||(r?t.setAttributeNS(r,n,i):t.setAttribute(n,i)),"name"===n&&f.a.Yc(t,o?"":i)}))}},f.c.checked={after:["value","attr"],init:function(t,n,i){function r(){var r=t.checked,c=o();if(!f.S.Ya()&&(r||!s&&!f.S.qa())){var d=f.u.G(n);if(l){var p=u?d.v():d,m=h;h=c,m!==c?r&&(f.a.Na(p,c,!0),f.a.Na(p,m,!1)):f.a.Na(p,c,r),u&&f.Za(d)&&d(p)}else a&&(c===e?c=r:r||(c=e)),f.m.eb(d,i,"checked",c,!0)}}var o=f.xb((function(){return i.has("checkedValue")?f.a.f(i.get("checkedValue")):d?i.has("value")?f.a.f(i.get("value")):t.value:void 0})),a="checkbox"==t.type,s="radio"==t.type;if(a||s){var c=n(),l=a&&f.a.f(c)instanceof Array,u=!(l&&c.push&&c.splice),d=s||l,h=l?o():e;s&&!t.name&&f.c.uniqueName.init(t,(function(){return!0})),f.o(r,null,{l:t}),f.a.B(t,"click",r),f.o((function(){var i=f.a.f(n()),r=o();l?(t.checked=0<=f.a.A(i,r),h=r):t.checked=a&&r===e?!!i:o()===i}),null,{l:t}),c=e}}},f.m.wa.checked=!0,f.c.checkedValue={update:function(e,t){e.value=f.a.f(t())}},f.c.class={update:function(e,t){var n=f.a.Db(f.a.f(t()));f.a.Eb(e,e.__ko__cssValue,!1),e.__ko__cssValue=n,f.a.Eb(e,n,!0)}},f.c.css={update:function(e,t){var n=f.a.f(t());null!==n&&"object"==typeof n?f.a.P(n,(function(t,n){n=f.a.f(n),f.a.Eb(e,t,n)})):f.c.class.update(e,t)}},f.c.enable={update:function(e,t){var n=f.a.f(t());n&&e.disabled?e.removeAttribute("disabled"):n||e.disabled||(e.disabled=!0)}},f.c.disable={update:function(e,t){f.c.enable.update(e,(function(){return!f.a.f(t())}))}},f.c.event={init:function(e,t,n,i,r){var o=t()||{};f.a.P(o,(function(o){"string"==typeof o&&f.a.B(e,o,(function(e){var a,s=t()[o];if(s){try{var c=f.a.la(arguments);i=r.$data,c.unshift(i),a=s.apply(i,c)}finally{!0!==a&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===n.get(o+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}}))}))}},f.c.foreach={Rc:function(e){return function(){var t=e(),n=f.a.bc(t);return n&&"number"!=typeof n.length?(f.a.f(t),{foreach:n.data,as:n.as,noChildContext:n.noChildContext,includeDestroyed:n.includeDestroyed,afterAdd:n.afterAdd,beforeRemove:n.beforeRemove,afterRender:n.afterRender,beforeMove:n.beforeMove,afterMove:n.afterMove,templateEngine:f.ba.Ma}):{foreach:t,templateEngine:f.ba.Ma}}},init:function(e,t){return f.c.template.init(e,f.c.foreach.Rc(t))},update:function(e,t,n,i,r){return f.c.template.update(e,f.c.foreach.Rc(t),n,i,r)}},f.m.Ra.foreach=!1,f.h.ea.foreach=!0,f.c.hasfocus={init:function(e,t,n){function i(i){e.__ko_hasfocusUpdating=!0;var r=e.ownerDocument;if("activeElement"in r){var o;try{o=r.activeElement}catch(e){o=r.body}i=o===e}r=t(),f.m.eb(r,n,"hasfocus",i,!0),e.__ko_hasfocusLastValue=i,e.__ko_hasfocusUpdating=!1}var r=i.bind(null,!0),o=i.bind(null,!1);f.a.B(e,"focus",r),f.a.B(e,"focusin",r),f.a.B(e,"blur",o),f.a.B(e,"focusout",o),e.__ko_hasfocusLastValue=!1},update:function(e,t){var n=!!f.a.f(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===n||(n?e.focus():e.blur(),!n&&e.__ko_hasfocusLastValue&&e.ownerDocument.body.focus(),f.u.G(f.a.Fb,null,[e,n?"focusin":"focusout"]))}},f.m.wa.hasfocus=!0,f.c.hasFocus=f.c.hasfocus,f.m.wa.hasFocus="hasfocus",f.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){f.a.fc(e,t())}},function(){function e(e,t,n){f.c[e]={init:function(e,i,r,o,a){var s,c,l,u,d,h={};if(t){o=r.get("as");var p=r.get("noChildContext");h={as:o,noChildContext:p,exportDependencies:d=!(o&&p)}}return u=(l="render"==r.get("completeOn"))||r.has(f.i.pa),f.o((function(){var r,o=f.a.f(i()),p=!n!=!o,m=!c;(d||p!==s)&&(u&&(a=f.i.Cb(e,a)),p&&(t&&!d||(h.dataDependency=f.S.o()),r=t?a.createChildContext("function"==typeof o?o:i,h):f.S.qa()?a.extend(null,h):a),m&&f.S.qa()&&(c=f.a.Ca(f.h.childNodes(e),!0)),p?(m||f.h.va(e,f.a.Ca(c)),f.Oa(r,e)):(f.h.Ea(e),l||f.i.ma(e,f.i.H)),s=p)}),null,{l:e}),{controlsDescendantBindings:!0}}},f.m.Ra[e]=!1,f.h.ea[e]=!0}e("if"),e("ifnot",!1,!0),e("with",!0)}(),f.c.let={init:function(e,t,n,i,r){return t=r.extend(t),f.Oa(t,e),{controlsDescendantBindings:!0}}},f.h.ea.let=!0;var P,D={};f.c.options={init:function(e){if("select"!==f.a.R(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(t,n,i){function r(){return f.a.jb(t.options,(function(e){return e.selected}))}function o(e,t,n){var i=typeof t;return"function"==i?t(e):"string"==i?e[t]:n}function a(e,n){if(m&&u)f.i.ma(t,f.i.H);else if(p.length){var i=0<=f.a.A(p,f.w.M(n[0]));f.a.Zc(n[0],i),m&&!i&&f.u.G(f.a.Fb,null,[t,"change"])}}var s=t.multiple,c=0!=t.length&&s?t.scrollTop:null,l=f.a.f(n()),u=i.get("valueAllowUnset")&&i.has("value"),d=i.get("optionsIncludeDestroyed");n={};var h,p=[];u||(s?p=f.a.Mb(r(),f.w.M):0<=t.selectedIndex&&p.push(f.w.M(t.options[t.selectedIndex]))),l&&(void 0===l.length&&(l=[l]),h=f.a.jb(l,(function(t){return d||t===e||null===t||!f.a.f(t._destroy)})),i.has("optionsCaption")&&null!==(l=f.a.f(i.get("optionsCaption")))&&l!==e&&h.unshift(D));var m=!1;n.beforeRemove=function(e){t.removeChild(e)},l=a,i.has("optionsAfterRender")&&"function"==typeof i.get("optionsAfterRender")&&(l=function(t,n){a(0,n),f.u.G(i.get("optionsAfterRender"),null,[n[0],t!==D?t:e])}),f.a.ec(t,h,(function(n,r,a){return a.length&&(p=!u&&a[0].selected?[f.w.M(a[0])]:[],m=!0),r=t.ownerDocument.createElement("option"),n===D?(f.a.Bb(r,i.get("optionsCaption")),f.w.cb(r,e)):(a=o(n,i.get("optionsValue"),n),f.w.cb(r,f.a.f(a)),n=o(n,i.get("optionsText"),a),f.a.Bb(r,n)),[r]}),n,l),u||(s?p.length&&r().length<p.length:p.length&&0<=t.selectedIndex?f.w.M(t.options[t.selectedIndex])!==p[0]:p.length||0<=t.selectedIndex)&&f.u.G(f.a.Fb,null,[t,"change"]),(u||f.S.Ya())&&f.i.ma(t,f.i.H),f.a.wd(t),c&&20<Math.abs(c-t.scrollTop)&&(t.scrollTop=c)}},f.c.options.$b=f.a.g.Z(),f.c.selectedOptions={init:function(e,t,n){function i(){var i=t(),r=[];f.a.D(e.getElementsByTagName("option"),(function(e){e.selected&&r.push(f.w.M(e))})),f.m.eb(i,n,"selectedOptions",r)}function r(){var n=f.a.f(t()),i=e.scrollTop;n&&"number"==typeof n.length&&f.a.D(e.getElementsByTagName("option"),(function(e){var t=0<=f.a.A(n,f.w.M(e));e.selected!=t&&f.a.Zc(e,t)})),e.scrollTop=i}if("select"!=f.a.R(e))throw Error("selectedOptions binding applies only to SELECT elements");var o;f.i.subscribe(e,f.i.H,(function(){o?i():(f.a.B(e,"change",i),o=f.o(r,null,{l:e}))}),null,{notifyImmediately:!0})},update:function(){}},f.m.wa.selectedOptions=!0,f.c.style={update:function(t,n){var i=f.a.f(n()||{});f.a.P(i,(function(n,i){if(null!==(i=f.a.f(i))&&i!==e&&!1!==i||(i=""),r)r(t).css(n,i);else if(/^--/.test(n))t.style.setProperty(n,i);else{n=n.replace(/-(\w)/g,(function(e,t){return t.toUpperCase()}));var o=t.style[n];t.style[n]=i,i===o||t.style[n]!=o||isNaN(i)||(t.style[n]=i+"px")}}))}},f.c.submit={init:function(e,t,n,i,r){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");f.a.B(e,"submit",(function(n){var i,o=t();try{i=o.call(r.$data,e)}finally{!0!==i&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}}))}},f.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){f.a.Bb(e,t())}},f.h.ea.text=!0,function(){if(t&&t.navigator){var n,i,r,o,a,s=function(e){if(e)return parseFloat(e[1])},c=t.navigator.userAgent;(n=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(a=s(c.match(/Edge\/([^ ]+)$/)))||s(c.match(/Chrome\/([^ ]+)/))||(i=s(c.match(/Version\/([^ ]+) Safari/)))||(r=s(c.match(/Firefox\/([^ ]+)/)))||(o=f.a.W||s(c.match(/MSIE ([^ ]+)/)))||(o=s(c.match(/rv:([^ )]+)/)))}if(8<=o&&10>o)var l=f.a.g.Z(),u=f.a.g.Z(),d=function(e){var t=this.activeElement;(t=t&&f.a.g.get(t,u))&&t(e)},h=function(e,t){var n=e.ownerDocument;f.a.g.get(n,l)||(f.a.g.set(n,l,!0),f.a.B(n,"selectionchange",d)),f.a.g.set(e,u,t)};f.c.textInput={init:function(t,s,c){function l(e,n){f.a.B(t,e,n)}function u(){p||(m=t.value,p=f.a.setTimeout(d,4))}function d(){clearTimeout(p),m=p=e;var n=t.value;g!==n&&(g=n,f.m.eb(s(),c,"textInput",n))}var p,m,g=t.value,_=9==f.a.W?u:d,y=!1;o&&l("keypress",d),11>o&&l("propertychange",(function(e){y||"value"!==e.propertyName||_()})),8==o&&(l("keyup",d),l("keydown",d)),h&&(h(t,_),l("dragend",u)),(!o||9<=o)&&l("input",_),5>i&&"textarea"===f.a.R(t)?(l("keydown",u),l("paste",u),l("cut",u)):11>n?l("keydown",u):4>r?(l("DOMAutoComplete",d),l("dragdrop",d),l("drop",d)):a&&"number"===t.type&&l("keydown",u),l("change",d),l("blur",d),f.o((function n(){var i=f.a.f(s());null!==i&&i!==e||(i=""),m!==e&&i===m?f.a.setTimeout(n,4):t.value!==i&&(y=!0,t.value=i,y=!1,g=t.value)}),null,{l:t})}},f.m.wa.textInput=!0,f.c.textinput={preprocess:function(e,t,n){n("textInput",e)}}}(),f.c.uniqueName={init:function(e,t){if(t()){var n="ko_unique_"+ ++f.c.uniqueName.rd;f.a.Yc(e,n)}}},f.c.uniqueName.rd=0,f.c.using={init:function(e,t,n,i,r){var o;return n.has("as")&&(o={as:n.get("as"),noChildContext:n.get("noChildContext")}),t=r.createChildContext(t,o),f.Oa(t,e),{controlsDescendantBindings:!0}}},f.h.ea.using=!0,f.c.value={init:function(t,n,i){var r=f.a.R(t),o="input"==r;if(!o||"checkbox"!=t.type&&"radio"!=t.type){var a=[],s=i.get("valueUpdate"),c=!1,l=null;s&&(a="string"==typeof s?[s]:f.a.wc(s),f.a.Pa(a,"change"));var u,d,h=function(){l=null,c=!1;var e=n(),r=f.w.M(t);f.m.eb(e,i,"value",r)};!f.a.W||!o||"text"!=t.type||"off"==t.autocomplete||t.form&&"off"==t.form.autocomplete||-1!=f.a.A(a,"propertychange")||(f.a.B(t,"propertychange",(function(){c=!0})),f.a.B(t,"focus",(function(){c=!1})),f.a.B(t,"blur",(function(){c&&h()}))),f.a.D(a,(function(e){var n=h;f.a.Ud(e,"after")&&(n=function(){l=f.w.M(t),f.a.setTimeout(h,0)},e=e.substring(5)),f.a.B(t,e,n)})),u=o&&"file"==t.type?function(){var i=f.a.f(n());null===i||i===e||""===i?t.value="":f.u.G(h)}:function(){var o=f.a.f(n()),a=f.w.M(t);null!==l&&o===l?f.a.setTimeout(u,0):o===a&&a!==e||("select"===r?(a=i.get("valueAllowUnset"),f.w.cb(t,o,a),a||o===f.w.M(t)||f.u.G(h)):f.w.cb(t,o))},"select"===r?f.i.subscribe(t,f.i.H,(function(){d?i.get("valueAllowUnset")?u():h():(f.a.B(t,"change",h),d=f.o(u,null,{l:t}))}),null,{notifyImmediately:!0}):(f.a.B(t,"change",h),f.o(u,null,{l:t}))}else f.ib(t,{checkedValue:n})},update:function(){}},f.m.wa.value=!0,f.c.visible={update:function(e,t){var n=f.a.f(t()),i="none"!=e.style.display;n&&!i?e.style.display="":!n&&i&&(e.style.display="none")}},f.c.hidden={update:function(e,t){f.c.visible.update(e,(function(){return!f.a.f(t())}))}},P="click",f.c[P]={init:function(e,t,n,i,r){return f.c.event.init.call(this,e,(function(){var e={};return e[P]=t(),e}),n,i,r)}},f.ca=function(){},f.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},f.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},f.ca.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){var i=(t=t||n).getElementById(e);if(!i)throw Error("Cannot find template with ID "+e);return new f.C.F(i)}if(1==e.nodeType||8==e.nodeType)return new f.C.ia(e);throw Error("Unknown template type: "+e)},f.ca.prototype.renderTemplate=function(e,t,n,i){return e=this.makeTemplateSource(e,i),this.renderTemplateSource(e,t,n,i)},f.ca.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting||this.makeTemplateSource(e,t).data("isRewritten")},f.ca.prototype.rewriteTemplate=function(e,t,n){t=t((e=this.makeTemplateSource(e,n)).text()),e.text(t),e.data("isRewritten",!0)},f.b("templateEngine",f.ca),f.kc=function(){function e(e,t,n,i){e=f.m.ac(e);for(var r=f.m.Ra,o=0;o<e.length;o++){var a=e[o].key;if(Object.prototype.hasOwnProperty.call(r,a)){var s=r[a];if("function"==typeof s){if(a=s(e[o].value))throw Error(a)}else if(!s)throw Error("This template engine does not support the '"+a+"' binding within its templates")}}return n="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+f.m.vb(e,{valueAccessors:!0})+" } })()},'"+n.toLowerCase()+"')",i.createJavaScriptEvaluatorBlock(n)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,n=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(e,t,n){t.isTemplateRewritten(e,n)||t.rewriteTemplate(e,(function(e){return f.kc.Ld(e,t)}),n)},Ld:function(i,r){return i.replace(t,(function(t,n,i,o,a){return e(a,n,i,r)})).replace(n,(function(t,n){return e(n,"\x3c!-- ko --\x3e","#comment",r)}))},md:function(e,t){return f.aa.Xb((function(n,i){var r=n.nextSibling;r&&r.nodeName.toLowerCase()===t&&f.ib(r,e,i)}))}}}(),f.b("__tr_ambtns",f.kc.md),function(){f.C={},f.C.F=function(e){if(this.F=e){var t=f.a.R(e);this.ab="script"===t?1:"textarea"===t?2:"template"==t&&e.content&&11===e.content.nodeType?3:4}},f.C.F.prototype.text=function(){var e=1===this.ab?"text":2===this.ab?"value":"innerHTML";if(0==arguments.length)return this.F[e];var t=arguments[0];"innerHTML"===e?f.a.fc(this.F,t):this.F[e]=t};var t=f.a.g.Z()+"_";f.C.F.prototype.data=function(e){if(1===arguments.length)return f.a.g.get(this.F,t+e);f.a.g.set(this.F,t+e,arguments[1])};var n=f.a.g.Z();f.C.F.prototype.nodes=function(){var t=this.F;if(0==arguments.length){var i=f.a.g.get(t,n)||{},r=i.lb||(3===this.ab?t.content:4===this.ab?t:e);if(!r||i.jd){var o=this.text();o&&o!==i.bb&&(r=f.a.Md(o,t.ownerDocument),f.a.g.set(t,n,{lb:r,bb:o,jd:!0}))}return r}i=arguments[0],this.ab!==e&&this.text(""),f.a.g.set(t,n,{lb:i})},f.C.ia=function(e){this.F=e},f.C.ia.prototype=new f.C.F,f.C.ia.prototype.constructor=f.C.ia,f.C.ia.prototype.text=function(){if(0==arguments.length){var t=f.a.g.get(this.F,n)||{};return t.bb===e&&t.lb&&(t.bb=t.lb.innerHTML),t.bb}f.a.g.set(this.F,n,{bb:arguments[0]})},f.b("templateSources",f.C),f.b("templateSources.domElement",f.C.F),f.b("templateSources.anonymousTemplate",f.C.ia)}(),function(){function t(e,t,n){var i;for(t=f.h.nextSibling(t);e&&(i=e)!==t;)n(i,e=f.h.nextSibling(i))}function n(e,n){if(e.length){var i=e[0],r=e[e.length-1],o=i.parentNode,a=f.ga.instance,s=a.preprocessNode;if(s){if(t(i,r,(function(e,t){var n=e.previousSibling,o=s.call(a,e);o&&(e===i&&(i=o[0]||t),e===r&&(r=o[o.length-1]||n))})),e.length=0,!i)return;i===r?e.push(i):(e.push(i,r),f.a.Ua(e,o))}t(i,r,(function(e){1!==e.nodeType&&8!==e.nodeType||f.vc(n,e)})),t(i,r,(function(e){1!==e.nodeType&&8!==e.nodeType||f.aa.cd(e,[n])})),f.a.Ua(e,o)}}function i(e){return e.nodeType?e:0<e.length?e[0]:null}function r(e,t,r,o,s){s=s||{};var c=(e&&i(e)||r||{}).ownerDocument,l=s.templateEngine||a;if(f.kc.xd(r,l,c),"number"!=typeof(r=l.renderTemplate(r,o,s,c)).length||0<r.length&&"number"!=typeof r[0].nodeType)throw Error("Template engine must return an array of DOM nodes");switch(c=!1,t){case"replaceChildren":f.h.va(e,r),c=!0;break;case"replaceNode":f.a.Xc(e,r),c=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t)}return c&&(n(r,o),s.afterRender&&f.u.G(s.afterRender,null,[r,o[s.as||"$data"]]),"replaceChildren"==t&&f.i.ma(e,f.i.H)),r}function o(e,t,n){return f.O(e)?e():"function"==typeof e?e(t,n):e}var a;f.gc=function(t){if(t!=e&&!(t instanceof f.ca))throw Error("templateEngine must inherit from ko.templateEngine");a=t},f.dc=function(t,n,s,c,l){if(((s=s||{}).templateEngine||a)==e)throw Error("Set a template engine before calling renderTemplate");if(l=l||"replaceChildren",c){var u=i(c);return f.$((function(){var e=n&&n instanceof f.fa?n:new f.fa(n,null,null,null,{exportDependencies:!0}),a=o(t,e.$data,e);e=r(c,l,a,e,s),"replaceNode"==l&&(u=i(c=e))}),null,{Sa:function(){return!u||!f.a.Sb(u)},l:u&&"replaceNode"==l?u.parentNode:u})}return f.aa.Xb((function(e){f.dc(t,n,s,e,"replaceNode")}))},f.Qd=function(t,i,a,s,c){function l(e,t){f.u.G(f.a.ec,null,[s,e,d,a,u,t]),f.i.ma(s,f.i.H)}function u(e,t){n(t,h),a.afterRender&&a.afterRender(t,e),h=null}function d(e,n){h=c.createChildContext(e,{as:p,noChildContext:a.noChildContext,extend:function(e){e.$index=n,p&&(e[p+"Index"]=n)}});var i=o(t,e,h);return r(s,"ignoreTargetNode",i,h,a)}var h,p=a.as,m=!1===a.includeDestroyed||f.options.foreachHidesDestroyed&&!a.includeDestroyed;if(m||a.beforeRemove||!f.Pc(i))return f.$((function(){var t=f.a.f(i)||[];void 0===t.length&&(t=[t]),m&&(t=f.a.jb(t,(function(t){return t===e||null===t||!f.a.f(t._destroy)}))),l(t)}),null,{l:s});l(i.v());var g=i.subscribe((function(e){l(i(),e)}),null,"arrayChange");return g.l(s),g};var s=f.a.g.Z(),c=f.a.g.Z();f.c.template={init:function(e,t){var n=f.a.f(t());if("string"==typeof n||"name"in n)f.h.Ea(e);else if("nodes"in n){if(n=n.nodes||[],f.O(n))throw Error('The "nodes" option must be a plain, non-observable array.');var i=n[0]&&n[0].parentNode;i&&f.a.g.get(i,c)||(i=f.a.Yb(n),f.a.g.set(i,c,!0)),new f.C.ia(e).nodes(i)}else{if(!(0<(n=f.h.childNodes(e)).length))throw Error("Anonymous template defined, but no template content was provided");i=f.a.Yb(n),new f.C.ia(e).nodes(i)}return{controlsDescendantBindings:!0}},update:function(t,n,i,r,o){var a=n();i=!0,r=null,"string"==typeof(n=f.a.f(a))?n={}:(a="name"in n?n.name:t,"if"in n&&(i=f.a.f(n.if)),i&&"ifnot"in n&&(i=!f.a.f(n.ifnot)),i&&!a&&(i=!1)),"foreach"in n?r=f.Qd(a,i&&n.foreach||[],n,t,o):i?(i=o,"data"in n&&(i=o.createChildContext(n.data,{as:n.as,noChildContext:n.noChildContext,exportDependencies:!0})),r=f.dc(a,i,n,t)):f.h.Ea(t),o=r,(n=f.a.g.get(t,s))&&"function"==typeof n.s&&n.s(),f.a.g.set(t,s,!o||o.ja&&!o.ja()?e:o)}},f.m.Ra.template=function(e){return 1==(e=f.m.ac(e)).length&&e[0].unknown||f.m.Id(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"},f.h.ea.template=!0}(),f.b("setTemplateEngine",f.gc),f.b("renderTemplate",f.dc),f.a.Kc=function(e,t,n){var i,r,o,a,s;if(e.length&&t.length)for(i=r=0;(!n||i<n)&&(a=e[r]);++r){for(o=0;s=t[o];++o)if(a.value===s.value){a.moved=s.index,s.moved=a.index,t.splice(o,1),i=o=0;break}i+=o}},f.a.Pb=function(){function e(e,t,n,i,r){var o,a,s,c,l,u=Math.min,d=Math.max,h=[],p=e.length,m=t.length,g=m-p||1,_=p+m+1;for(o=0;o<=p;o++)for(c=s,h.push(s=[]),l=u(m,o+g),a=d(0,o-1);a<=l;a++)s[a]=a?o?e[o-1]===t[a-1]?c[a-1]:u(c[a]||_,s[a-1]||_)+1:a+1:o+1;for(u=[],d=[],g=[],o=p,a=m;o||a;)m=h[o][a]-1,a&&m===h[o][a-1]?d.push(u[u.length]={status:n,value:t[--a],index:a}):o&&m===h[o-1][a]?g.push(u[u.length]={status:i,value:e[--o],index:o}):(--a,--o,r.sparse||u.push({status:"retained",value:t[a]}));return f.a.Kc(g,d,!r.dontLimitMoves&&10*p),u.reverse()}return function(t,n,i){return i="boolean"==typeof i?{dontLimitMoves:i}:i||{},n=n||[],(t=t||[]).length<n.length?e(t,n,"added","deleted",i):e(n,t,"deleted","added",i)}}(),f.b("utils.compareArrays",f.a.Pb),function(){function t(t,n,i,r,o){var a=[],s=f.$((function(){var e=n(i,o,f.a.Ua(a,t))||[];0<a.length&&(f.a.Xc(a,e),r&&f.u.G(r,null,[i,e,o])),a.length=0,f.a.Nb(a,e)}),null,{l:t,Sa:function(){return!f.a.kd(a)}});return{Y:a,$:s.ja()?s:e}}var n=f.a.g.Z(),i=f.a.g.Z();f.a.ec=function(r,o,a,s,c,l){function u(e){p={Aa:e,pb:f.ta(A++)},T.push(p),C||P.push(p)}function d(e){p=y[e],A!==p.pb.v()&&x.push(p),p.pb(A++),f.a.Ua(p.Y,r),T.push(p)}function h(e,t){if(e)for(var n=0,i=t.length;n<i;n++)f.a.D(t[n].Y,(function(i){e(i,n,t[n].Aa)}))}void 0===(o=o||[]).length&&(o=[o]),s=s||{};var p,m,g,_,y=f.a.g.get(r,n),C=!y,T=[],S=0,A=0,v=[],E=[],b=[],x=[],P=[],D=0;if(C)f.a.D(o,u);else{if(!l||y&&y._countWaitingForRemove){var w=f.a.Mb(y,(function(e){return e.Aa}));l=f.a.Pb(w,o,{dontLimitMoves:s.dontLimitMoves,sparse:!0})}var M,I,R;for(w=0;M=l[w];w++)switch(I=M.moved,R=M.index,M.status){case"deleted":for(;S<R;)d(S++);I===e&&((p=y[S]).$&&(p.$.s(),p.$=e),f.a.Ua(p.Y,r).length&&(s.beforeRemove&&(T.push(p),D++,p.Aa===i?p=null:b.push(p)),p&&v.push.apply(v,p.Y))),S++;break;case"added":for(;A<R;)d(S++);I!==e?(E.push(T.length),d(I)):u(M.value)}for(;A<o.length;)d(S++);T._countWaitingForRemove=D}f.a.g.set(r,n,T),h(s.beforeMove,x),f.a.D(v,s.beforeRemove?f.oa:f.removeNode);try{_=r.ownerDocument.activeElement}catch(e){}if(E.length)for(;(w=E.shift())!=e;){for(p=T[w],m=e;w;)if((g=T[--w].Y)&&g.length){m=g[g.length-1];break}for(o=0;S=p.Y[o];m=S,o++)f.h.Wb(r,S,m)}for(w=0;p=T[w];w++){for(p.Y||f.a.extend(p,t(r,a,p.Aa,c,p.pb)),o=0;S=p.Y[o];m=S,o++)f.h.Wb(r,S,m);!p.Ed&&c&&(c(p.Aa,p.Y,p.pb),p.Ed=!0,m=p.Y[p.Y.length-1])}for(_&&r.ownerDocument.activeElement!=_&&_.focus(),h(s.beforeRemove,b),w=0;w<b.length;++w)b[w].Aa=i;h(s.afterMove,x),h(s.afterAdd,P)}}(),f.b("utils.setDomNodeChildrenFromArrayMapping",f.a.ec),f.ba=function(){this.allowTemplateRewriting=!1},f.ba.prototype=new f.ca,f.ba.prototype.constructor=f.ba,f.ba.prototype.renderTemplateSource=function(e,t,n,i){return(t=9>f.a.W||!e.nodes?null:e.nodes())?f.a.la(t.cloneNode(!0).childNodes):(e=e.text(),f.a.ua(e,i))},f.ba.Ma=new f.ba,f.gc(f.ba.Ma),f.b("nativeTemplateEngine",f.ba),function(){f.$a=function(){var e=this.Hd=function(){if(!r||!r.tmpl)return 0;try{if(0<=r.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(t,i,o,a){if(a=a||n,o=o||{},2>e)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var s=t.data("precompiled");return s||(s=t.text()||"",s=r.template(null,"{{ko_with $item.koBindingContext}}"+s+"{{/ko_with}}"),t.data("precompiled",s)),t=[i.$data],i=r.extend({koBindingContext:i},o.templateOptions),(i=r.tmpl(s,t,i)).appendTo(a.createElement("div")),r.fragments={},i},this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"},this.addTemplate=function(e,t){n.write("<script type='text/html' id='"+e+"'>"+t+"<\/script>")},0<e&&(r.tmpl.tag.ko_code={open:"__.push($1 || '');"},r.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},f.$a.prototype=new f.ca,f.$a.prototype.constructor=f.$a;var e=new f.$a;0<e.Hd&&f.gc(e),f.b("jqueryTmplTemplateEngine",f.$a)}()}))}();var knockout=ko;"undefined"!=typeof window?(ko=window.ko,void 0!==oldValue?window.ko=oldValue:delete window.ko):(ko=global.ko,void 0!==oldValue?global.ko=oldValue:delete global.ko)
/**
* @license
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
* Copyright (c) Steve Sanderson
* MIT license
*/;var OBSERVABLES_PROPERTY="__knockoutObservables",SUBSCRIBABLE_PROPERTY="__knockoutSubscribable";function track(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=getAllObservablesForObject(e,!0);return(t=t||Object.getOwnPropertyNames(e)).forEach((function(t){if(t!==OBSERVABLES_PROPERTY&&t!==SUBSCRIBABLE_PROPERTY&&!(t in i)){var r=e[t],o=r instanceof Array,a=n.isObservable(r)?r:o?n.observableArray(r):n.observable(r);Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[t]=a,o&&notifyWhenPresentOrFutureArrayValuesMutate(n,a)}})),e}function getAllObservablesForObject(e,t){var n=e[OBSERVABLES_PROPERTY];return!n&&t&&(n={},Object.defineProperty(e,OBSERVABLES_PROPERTY,{value:n})),n}function defineComputedProperty(e,t,n){var i={owner:e,deferEvaluation:!0};if("function"==typeof n)i.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if("function"!=typeof n.get)throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');i.read=n.get,i.write=n.set}return e[t]=this.computed(i),track.call(this,e,[t]),e}function notifyWhenPresentOrFutureArrayValuesMutate(e,t){var n=null;e.computed((function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=startWatchingArrayInstance(e,t,i))}))}function startWatchingArrayInstance(e,t,n){return getSubscribableForArray(e,n).subscribe(t)}function getSubscribableForArray(e,t){var n=t[SUBSCRIBABLE_PROPERTY];if(!n){n=new e.subscribable,Object.defineProperty(t,SUBSCRIBABLE_PROPERTY,{value:n});var i={};wrapStandardArrayMutators(t,n,i),addKnockoutArrayMutators(e,t,n,i)}return n}function wrapStandardArrayMutators(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach((function(i){var r=e[i];e[i]=function(){var e=r.apply(this,arguments);return!0!==n.pause&&t.notifySubscribers(this),e}}))}function addKnockoutArrayMutators(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach((function(r){Object.defineProperty(t,r,{enumerable:!1,value:function(){var o;i.pause=!0;try{o=e.observableArray.fn[r].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),o}})}))}function getObservable(e,t){if(!e)return null;var n=getAllObservablesForObject(e,!1);return n&&n[t]||null}function valueHasMutated(e,t){var n=getObservable(e,t);n&&n.valueHasMutated()}function attachToKo(e){e.track=track,e.getObservable=getObservable,e.valueHasMutated=valueHasMutated,e.defineProperty=defineComputedProperty}var knockout_es5={attachToKo:attachToKo};const svgNS$1="http://www.w3.org/2000/svg",svgClassName="cesium-svgPath-svg",SvgPathBindingHandler={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(svgNS$1,"svg:svg");i.setAttribute("class",svgClassName);const r=document.createElementNS(svgNS$1,"path");return i.appendChild(r),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const t=e.unwrap(n());r.setAttribute("d",e.unwrap(t.path));const o=e.unwrap(t.width),a=e.unwrap(t.height);i.setAttribute("width",o),i.setAttribute("height",a),i.setAttribute("viewBox","0 0 "+o+" "+a),t.css&&i.setAttribute("class",svgClassName+" "+e.unwrap(t.css))},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}};knockout_es5.attachToKo(knockout),SvgPathBindingHandler.register(knockout);const e=[171,75,84,88,32,50,48,187,13,10,26,10];var n,i,s,a,r,o,l,f,t;t=n||(n={}),t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(i||(i={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(s||(s={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(a||(a={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(r||(r={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(o||(o={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(l||(l={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(f||(f={}));class U{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=n.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:i.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:s.UNSPECIFIED,colorPrimaries:a.SRGB,transferFunction:a.SRGB,flags:o.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class c{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}function _(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function p(t){const n=new Uint8Array(t.buffer,t.byteOffset,e.length);if(n[0]!==e[0]||n[1]!==e[1]||n[2]!==e[2]||n[3]!==e[3]||n[4]!==e[4]||n[5]!==e[5]||n[6]!==e[6]||n[7]!==e[7]||n[8]!==e[8]||n[9]!==e[9]||n[10]!==e[10]||n[11]!==e[11])throw new Error("Missing KTX 2.0 identifier.");const i=new U,r=17*Uint32Array.BYTES_PER_ELEMENT,o=new c(t,e.length,r,!0);i.vkFormat=o._nextUint32(),i.typeSize=o._nextUint32(),i.pixelWidth=o._nextUint32(),i.pixelHeight=o._nextUint32(),i.pixelDepth=o._nextUint32(),i.layerCount=o._nextUint32(),i.faceCount=o._nextUint32();const a=o._nextUint32();i.supercompressionScheme=o._nextUint32();const s=o._nextUint32(),l=o._nextUint32(),u=o._nextUint32(),d=o._nextUint32(),h=o._nextUint64(),p=o._nextUint64(),f=new c(t,e.length+r,3*a*8,!0);for(let e=0;e<a;e++)i.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});const m=new c(t,s,l,!0),g={vendorId:m._skip(4)._nextUint16(),descriptorType:m._nextUint16(),versionNumber:m._nextUint16(),descriptorBlockSize:m._nextUint16(),colorModel:m._nextUint8(),colorPrimaries:m._nextUint8(),transferFunction:m._nextUint8(),flags:m._nextUint8(),texelBlockDimension:{x:m._nextUint8()+1,y:m._nextUint8()+1,z:m._nextUint8()+1,w:m._nextUint8()+1},bytesPlane:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],samples:[]},y=(g.descriptorBlockSize/4-6)/4;for(let e=0;e<y;e++)g.samples[e]={bitOffset:m._nextUint16(),bitLength:m._nextUint8(),channelID:m._nextUint8(),samplePosition:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],sampleLower:m._nextUint32(),sampleUpper:m._nextUint32()};i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(g);const C=new c(t,u,d,!0);for(;C._offset<d;){const e=C._nextUint32(),t=C._scan(e),n=_(t),r=C._scan(e-t.byteLength);i.keyValue[n]=n.match(/^ktx/i)?_(r):r,C._offset%4&&C._skip(4-C._offset%4)}if(p<=0)return i;const T=new c(t,h,p,!0),S=T._nextUint16(),A=T._nextUint16(),v=T._nextUint32(),E=T._nextUint32(),b=T._nextUint32(),x=T._nextUint32(),P=[];for(let e=0;e<a;e++)P.push({imageFlags:T._nextUint32(),rgbSliceByteOffset:T._nextUint32(),rgbSliceByteLength:T._nextUint32(),alphaSliceByteOffset:T._nextUint32(),alphaSliceByteLength:T._nextUint32()});const D=h+T._offset,w=D+v,M=w+E,I=M+b,R=new Uint8Array(t.buffer,t.byteOffset+D,v),O=new Uint8Array(t.buffer,t.byteOffset+w,E),B=new Uint8Array(t.buffer,t.byteOffset+M,b),L=new Uint8Array(t.buffer,t.byteOffset+I,x);return i.globalData={endpointCount:S,selectorCount:A,imageDescs:P,endpointsData:R,selectorsData:O,tablesData:B,extendedData:L},i}var LercDecode=createCommonjsModule((function(e){
/* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
!function(){var t=function(){var e={defaultNoDataValue:-34027999387901484e22,decode:function(o,a){var s=(a=a||{}).encodedMaskData||null===a.encodedMaskData,c=r(o,a.inputOffset||0,s),l=null!==a.noDataValue?a.noDataValue:e.defaultNoDataValue,u=t(c,a.pixelType||Float32Array,a.encodedMaskData,l,a.returnMask),d={width:c.width,height:c.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:c.pixels.maxValue,noDataValue:l};return u.resultMask&&(d.maskData=u.resultMask),a.returnEncodedMask&&c.mask&&(d.encodedMaskData=c.mask.bitset?c.mask.bitset:null),a.returnFileInfo&&(d.fileInfo=n(c),a.computeUsedBitDepths&&(d.fileInfo.bitDepths=i(c))),d}},t=function(e,t,n,i,r){var a,s,c,l=0,u=e.pixels.numBlocksX,d=e.pixels.numBlocksY,h=Math.floor(e.width/u),p=Math.floor(e.height/d),f=2*e.maxZError,m=Number.MAX_VALUE;n=n||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),r&&n&&(c=new Uint8Array(e.width*e.height));for(var g,_,y=new Float32Array(h*p),C=0;C<=d;C++){var T=C!==d?p:e.height%d;if(0!==T)for(var S=0;S<=u;S++){var A=S!==u?h:e.width%u;if(0!==A){var v,E,b,x,P=C*e.width*p+S*h,D=e.width-A,w=e.pixels.blocks[l];if(w.encoding<2?(0===w.encoding?v=w.rawData:(o(w.stuffedData,w.bitsPerPixel,w.numValidPixels,w.offset,f,y,e.pixels.maxValue),v=y),E=0):b=2===w.encoding?0:w.offset,n)for(_=0;_<T;_++){for(7&P&&(x=n[P>>3],x<<=7&P),g=0;g<A;g++)7&P||(x=n[P>>3]),128&x?(c&&(c[P]=1),m=m>(a=w.encoding<2?v[E++]:b)?a:m,s[P++]=a):(c&&(c[P]=0),s[P++]=i),x<<=1;P+=D}else if(w.encoding<2)for(_=0;_<T;_++){for(g=0;g<A;g++)m=m>(a=v[E++])?a:m,s[P++]=a;P+=D}else for(m=m>b?b:m,_=0;_<T;_++){for(g=0;g<A;g++)s[P++]=b;P+=D}if(1===w.encoding&&E!==w.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:c,minValue:m}},n=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},i=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,n={},i=0;i<t;i++){var r=e.pixels.blocks[i];0===r.encoding?n.float32=!0:1===r.encoding?n[r.bitsPerPixel]=!0:n[0]=!0}return Object.keys(n)},r=function(e,t,n){var i={},r=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,r),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var o=new DataView(e,t,24);if(i.fileVersion=o.getInt32(0,!0),i.imageType=o.getInt32(4,!0),i.height=o.getUint32(8,!0),i.width=o.getUint32(12,!0),i.maxZError=o.getFloat64(16,!0),t+=24,!n)if(o=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=o.getUint32(0,!0),i.mask.numBlocksX=o.getUint32(4,!0),i.mask.numBytes=o.getUint32(8,!0),i.mask.maxValue=o.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var a=new Uint8Array(Math.ceil(i.width*i.height/8)),s=(o=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),c=2,l=0;do{if(s>0)for(;s--;)a[l++]=o.getUint8(c++);else{var u=o.getUint8(c++);for(s=-s;s--;)a[l++]=u}s=o.getInt16(c,!0),c+=2}while(c<i.mask.numBytes);if(-32768!==s||l<a.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=a,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));o=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=o.getUint32(0,!0),i.pixels.numBlocksX=o.getUint32(4,!0),i.pixels.numBytes=o.getUint32(8,!0),i.pixels.maxValue=o.getFloat32(12,!0),t+=16;var d=i.pixels.numBlocksX,h=i.pixels.numBlocksY,p=d+(i.width%d>0?1:0),f=h+(i.height%h>0?1:0);i.pixels.blocks=new Array(p*f);for(var m=0,g=0;g<f;g++)for(var _=0;_<p;_++){var y=0,C=e.byteLength-t;o=new DataView(e,t,Math.min(10,C));var T={};i.pixels.blocks[m++]=T;var S=o.getUint8(0);if(y++,T.encoding=63&S,T.encoding>3)throw"Invalid block encoding ("+T.encoding+")";if(2!==T.encoding){if(0!==S&&2!==S){if(S>>=6,T.offsetType=S,2===S)T.offset=o.getInt8(1),y++;else if(1===S)T.offset=o.getInt16(1,!0),y+=2;else{if(0!==S)throw"Invalid block offset type";T.offset=o.getFloat32(1,!0),y+=4}if(1===T.encoding)if(S=o.getUint8(y),y++,T.bitsPerPixel=63&S,S>>=6,T.numValidPixelsType=S,2===S)T.numValidPixels=o.getUint8(y),y++;else if(1===S)T.numValidPixels=o.getUint16(y,!0),y+=2;else{if(0!==S)throw"Invalid valid pixel count type";T.numValidPixels=o.getUint32(y,!0),y+=4}}var A;if(t+=y,3!==T.encoding)if(0===T.encoding){var v=(i.pixels.numBytes-1)/4;if(v!==Math.floor(v))throw"uncompressed block has invalid length";A=new ArrayBuffer(4*v),new Uint8Array(A).set(new Uint8Array(e,t,4*v));var E=new Float32Array(A);T.rawData=E,t+=4*v}else if(1===T.encoding){var b=Math.ceil(T.numValidPixels*T.bitsPerPixel/8),x=Math.ceil(b/4);A=new ArrayBuffer(4*x),new Uint8Array(A).set(new Uint8Array(e,t,b)),T.stuffedData=new Uint32Array(A),t+=b}}else t++}return i.eofOffset=t,i},o=function(e,t,n,i,r,o,a){var s,c,l,u=(1<<t)-1,d=0,h=0,p=Math.ceil((a-i)/r),f=4*e.length-Math.ceil(t*n/8);for(e[e.length-1]<<=8*f,s=0;s<n;s++){if(0===h&&(l=e[d++],h=32),h>=t)c=l>>>h-t&u,h-=t;else{var m=t-h;c=(l&u)<<m&u,c+=(l=e[d++])>>>(h=32-m)}o[s]=c<p?i+c*r:a}return o};return e}(),n=function(){var e=function(e,t,n,i,r,o,a,s){var c,l,u,d,h,p=(1<<n)-1,f=0,m=0,g=4*e.length-Math.ceil(n*i/8);if(e[e.length-1]<<=8*g,r)for(c=0;c<i;c++)0===m&&(u=e[f++],m=32),m>=n?(l=u>>>m-n&p,m-=n):(l=(u&p)<<(d=n-m)&p,l+=(u=e[f++])>>>(m=32-d)),t[c]=r[l];else for(h=Math.ceil((s-o)/a),c=0;c<i;c++)0===m&&(u=e[f++],m=32),m>=n?(l=u>>>m-n&p,m-=n):(l=(u&p)<<(d=n-m)&p,l+=(u=e[f++])>>>(m=32-d)),t[c]=l<h?o+l*a:s},t=function(e,t,n,i,r,o){var a,s=(1<<t)-1,c=0,l=0,u=0,d=0,h=0,p=[],f=4*e.length-Math.ceil(t*n/8);e[e.length-1]<<=8*f;var m=Math.ceil((o-i)/r);for(l=0;l<n;l++)0===d&&(a=e[c++],d=32),d>=t?(h=a>>>d-t&s,d-=t):(h=(a&s)<<(u=t-d)&s,h+=(a=e[c++])>>>(d=32-u)),p[l]=h<m?i+h*r:o;return p.unshift(i),p},n=function(e,t,n,i,r,o,a,s){var c,l,u,d,h=(1<<n)-1,p=0,f=0,m=0;if(r)for(c=0;c<i;c++)0===f&&(u=e[p++],f=32,m=0),f>=n?(l=u>>>m&h,f-=n,m+=n):(l=u>>>m&h,f=32-(d=n-f),l|=((u=e[p++])&(1<<d)-1)<<n-d,m=d),t[c]=r[l];else{var g=Math.ceil((s-o)/a);for(c=0;c<i;c++)0===f&&(u=e[p++],f=32,m=0),f>=n?(l=u>>>m&h,f-=n,m+=n):(l=u>>>m&h,f=32-(d=n-f),l|=((u=e[p++])&(1<<d)-1)<<n-d,m=d),t[c]=l<g?o+l*a:s}return t},i=function(e,t,n,i,r,o){var a,s=(1<<t)-1,c=0,l=0,u=0,d=0,h=0,p=0,f=[],m=Math.ceil((o-i)/r);for(l=0;l<n;l++)0===d&&(a=e[c++],d=32,p=0),d>=t?(h=a>>>p&s,d-=t,p+=t):(h=a>>>p&s,d=32-(u=t-d),h|=((a=e[c++])&(1<<u)-1)<<t-u,p=u),f[l]=h<m?i+h*r:o;return f.unshift(i),f},r=function(e,t,n,i){var r,o,a,s,c=(1<<n)-1,l=0,u=0,d=4*e.length-Math.ceil(n*i/8);for(e[e.length-1]<<=8*d,r=0;r<i;r++)0===u&&(a=e[l++],u=32),u>=n?(o=a>>>u-n&c,u-=n):(o=(a&c)<<(s=n-u)&c,o+=(a=e[l++])>>>(u=32-s)),t[r]=o;return t},o=function(e,t,n,i){var r,o,a,s,c=(1<<n)-1,l=0,u=0,d=0;for(r=0;r<i;r++)0===u&&(a=e[l++],u=32,d=0),u>=n?(o=a>>>d&c,u-=n,d+=n):(o=a>>>d&c,u=32-(s=n-u),o|=((a=e[l++])&(1<<s)-1)<<n-s,d=s),t[r]=o;return t},a={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,n=65535,i=e.length,r=Math.floor(i/2),o=0;r;){var a=r>=359?359:r;r-=a;do{t+=e[o++]<<8,n+=t+=e[o++]}while(--a);t=(65535&t)+(t>>>16),n=(65535&n)+(n>>>16)}return 1&i&&(n+=t+=e[o]<<8),((n=(65535&n)+(n>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var n=t.ptr,i=new Uint8Array(e,n,6),r={};if(r.fileIdentifierString=String.fromCharCode.apply(null,i),0!==r.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+r.fileIdentifierString;n+=6;var o,a=new DataView(e,n,8),s=a.getInt32(0,!0);if(r.fileVersion=s,n+=4,s>=3&&(r.checksum=a.getUint32(4,!0),n+=4),a=new DataView(e,n,12),r.height=a.getUint32(0,!0),r.width=a.getUint32(4,!0),n+=8,s>=4?(r.numDims=a.getUint32(8,!0),n+=4):r.numDims=1,a=new DataView(e,n,40),r.numValidPixel=a.getUint32(0,!0),r.microBlockSize=a.getInt32(4,!0),r.blobSize=a.getInt32(8,!0),r.imageType=a.getInt32(12,!0),r.maxZError=a.getFloat64(16,!0),r.zMin=a.getFloat64(24,!0),r.zMax=a.getFloat64(32,!0),n+=40,t.headerInfo=r,t.ptr=n,s>=3&&(o=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,n-o,r.blobSize-14))!==r.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var n=t.headerInfo,i=this.getDataTypeArray(n.imageType),r=n.numDims*this.getDataTypeSize(n.imageType),o=this.readSubArray(e,t.ptr,i,r),a=this.readSubArray(e,t.ptr+r,i,r);t.ptr+=2*r;var s,c=!0;for(s=0;s<n.numDims;s++)if(o[s]!==a[s]){c=!1;break}return n.minValues=o,n.maxValues=a,c},readSubArray:function(e,t,n,i){var r;if(n===Uint8Array)r=new Uint8Array(e,t,i);else{var o=new ArrayBuffer(i);new Uint8Array(o).set(new Uint8Array(e,t,i)),r=new n(o)}return r},readMask:function(e,t){var n,i,r=t.ptr,o=t.headerInfo,a=o.width*o.height,s=o.numValidPixel,c=new DataView(e,r,4),l={};if(l.numBytes=c.getUint32(0,!0),r+=4,(0===s||a===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)n=new Uint8Array(Math.ceil(a/8)),l.bitset=n,i=new Uint8Array(a),t.pixels.resultMask=i,r+=l.numBytes;else if(l.numBytes>0){n=new Uint8Array(Math.ceil(a/8));var u=(c=new DataView(e,r,l.numBytes)).getInt16(0,!0),d=2,h=0,p=0;do{if(u>0)for(;u--;)n[h++]=c.getUint8(d++);else for(p=c.getUint8(d++),u=-u;u--;)n[h++]=p;u=c.getInt16(d,!0),d+=2}while(d<l.numBytes);if(-32768!==u||h<n.length)throw"Unexpected end of mask RLE encoding";i=new Uint8Array(a);var f=0,m=0;for(m=0;m<a;m++)7&m?(f=n[m>>3],f<<=7&m):f=n[m>>3],128&f&&(i[m]=1);t.pixels.resultMask=i,l.bitset=n,r+=l.numBytes}return t.ptr=r,t.mask=l,!0},readDataOneSweep:function(e,t,n){var i,r=t.ptr,o=t.headerInfo,s=o.numDims,c=o.width*o.height,l=o.imageType,u=o.numValidPixel*a.getDataTypeSize(l)*s,d=t.pixels.resultMask;if(n===Uint8Array)i=new Uint8Array(e,r,u);else{var h=new ArrayBuffer(u);new Uint8Array(h).set(new Uint8Array(e,r,u)),i=new n(h)}if(i.length===c*s)t.pixels.resultPixels=i;else{t.pixels.resultPixels=new n(c*s);var p=0,f=0,m=0,g=0;if(s>1)for(m=0;m<s;m++)for(g=m*c,f=0;f<c;f++)d[f]&&(t.pixels.resultPixels[g+f]=i[p++]);else for(f=0;f<c;f++)d[f]&&(t.pixels.resultPixels[f]=i[p++])}return r+=u,t.ptr=r,!0},readHuffmanTree:function(e,t){var n=this.HUFFMAN_LUT_BITS_MAX,i=new DataView(e,t.ptr,16);if(t.ptr+=16,i.getInt32(0,!0)<2)throw"unsupported Huffman version";var r=i.getInt32(4,!0),o=i.getInt32(8,!0),c=i.getInt32(12,!0);if(o>=c)return!1;var l=new Uint32Array(c-o);a.decodeBits(e,t,l);var u,d,h,p,f=[];for(u=o;u<c;u++)f[d=u-(u<r?0:r)]={first:l[u-o],second:null};var m=e.byteLength-t.ptr,g=Math.ceil(m/4),_=new ArrayBuffer(4*g);new Uint8Array(_).set(new Uint8Array(e,t.ptr,m));var y,C=new Uint32Array(_),T=0,S=0;for(y=C[0],u=o;u<c;u++)(p=f[d=u-(u<r?0:r)].first)>0&&(f[d].second=y<<T>>>32-p,32-T>=p?32===(T+=p)&&(T=0,y=C[++S]):(T+=p-32,y=C[++S],f[d].second|=y>>>32-T));var A=0,v=0,E=new s;for(u=0;u<f.length;u++)void 0!==f[u]&&(A=Math.max(A,f[u].first));v=A>=n?n:A,A>=30&&console.log("WARning, large NUM LUT BITS IS "+A);var b,x,P,D,w,M=[];for(u=o;u<c;u++)if((p=f[d=u-(u<r?0:r)].first)>0)if(b=[p,d],p<=v)for(x=f[d].second<<v-p,P=1<<v-p,h=0;h<P;h++)M[x|h]=b;else for(x=f[d].second,w=E,D=p-1;D>=0;D--)x>>>D&1?(w.right||(w.right=new s),w=w.right):(w.left||(w.left=new s),w=w.left),0!==D||w.val||(w.val=b[1]);return{decodeLut:M,numBitsLUTQick:v,numBitsLUT:A,tree:E,stuffedData:C,srcPtr:S,bitPos:T}},readHuffman:function(e,t,n){var i,r,o,a,s,c,l,u,d,h=t.headerInfo,p=h.numDims,f=t.headerInfo.height,m=t.headerInfo.width,g=m*f,_=this.readHuffmanTree(e,t),y=_.decodeLut,C=_.tree,T=_.stuffedData,S=_.srcPtr,A=_.bitPos,v=_.numBitsLUTQick,E=_.numBitsLUT,b=0===t.headerInfo.imageType?128:0,x=t.pixels.resultMask,P=0;A>0&&(S++,A=0);var D,w=T[S],M=1===t.encodeMode,I=new n(g*p),R=I;for(D=0;D<h.numDims;D++){if(p>1&&(R=new n(I.buffer,g*D,g),P=0),t.headerInfo.numValidPixel===m*f)for(u=0,c=0;c<f;c++)for(l=0;l<m;l++,u++){if(r=0,s=a=w<<A>>>32-v,32-A<v&&(s=a|=T[S+1]>>>64-A-v),y[s])r=y[s][1],A+=y[s][0];else for(s=a=w<<A>>>32-E,32-A<E&&(s=a|=T[S+1]>>>64-A-E),i=C,d=0;d<E;d++)if(!(i=a>>>E-d-1&1?i.right:i.left).left&&!i.right){r=i.val,A=A+d+1;break}A>=32&&(A-=32,w=T[++S]),o=r-b,M?(o+=l>0?P:c>0?R[u-m]:P,o&=255,R[u]=o,P=o):R[u]=o}else for(u=0,c=0;c<f;c++)for(l=0;l<m;l++,u++)if(x[u]){if(r=0,s=a=w<<A>>>32-v,32-A<v&&(s=a|=T[S+1]>>>64-A-v),y[s])r=y[s][1],A+=y[s][0];else for(s=a=w<<A>>>32-E,32-A<E&&(s=a|=T[S+1]>>>64-A-E),i=C,d=0;d<E;d++)if(!(i=a>>>E-d-1&1?i.right:i.left).left&&!i.right){r=i.val,A=A+d+1;break}A>=32&&(A-=32,w=T[++S]),o=r-b,M?(l>0&&x[u-1]?o+=P:c>0&&x[u-m]?o+=R[u-m]:o+=P,o&=255,R[u]=o,P=o):R[u]=o}t.ptr=t.ptr+4*(S+1)+(A>0?4:0)}t.pixels.resultPixels=I},decodeBits:function(a,s,c,l,u){var d=s.headerInfo,h=d.fileVersion,p=0,f=new DataView(a,s.ptr,5),m=f.getUint8(0);p++;var g=m>>6,_=0===g?4:3-g,y=(32&m)>0,C=31&m,T=0;if(1===_)T=f.getUint8(p),p++;else if(2===_)T=f.getUint16(p,!0),p+=2;else{if(4!==_)throw"Invalid valid pixel count type";T=f.getUint32(p,!0),p+=4}var S,A,v,E,b,x,P,D,w,M=2*d.maxZError,I=d.numDims>1?d.maxValues[u]:d.zMax;if(y){for(s.counter.lut++,D=f.getUint8(p),p++,E=Math.ceil((D-1)*C/8),b=Math.ceil(E/4),A=new ArrayBuffer(4*b),v=new Uint8Array(A),s.ptr+=p,v.set(new Uint8Array(a,s.ptr,E)),P=new Uint32Array(A),s.ptr+=E,w=0;D-1>>>w;)w++;E=Math.ceil(T*w/8),b=Math.ceil(E/4),A=new ArrayBuffer(4*b),(v=new Uint8Array(A)).set(new Uint8Array(a,s.ptr,E)),S=new Uint32Array(A),s.ptr+=E,x=h>=3?i(P,C,D-1,l,M,I):t(P,C,D-1,l,M,I),h>=3?n(S,c,w,T,x):e(S,c,w,T,x)}else s.counter.bitstuffer++,w=C,s.ptr+=p,w>0&&(E=Math.ceil(T*w/8),b=Math.ceil(E/4),A=new ArrayBuffer(4*b),(v=new Uint8Array(A)).set(new Uint8Array(a,s.ptr,E)),S=new Uint32Array(A),s.ptr+=E,h>=3?null==l?o(S,c,w,T):n(S,c,w,T,!1,l,M,I):null==l?r(S,c,w,T):e(S,c,w,T,!1,l,M,I))},readTiles:function(e,t,n){var i=t.headerInfo,r=i.width,o=i.height,s=i.microBlockSize,c=i.imageType,l=a.getDataTypeSize(c),u=Math.ceil(r/s),d=Math.ceil(o/s);t.pixels.numBlocksY=d,t.pixels.numBlocksX=u,t.pixels.ptr=0;var h,p,f,m,g,_,y,C,T=0,S=0,A=0,v=0,E=0,b=0,x=0,P=0,D=0,w=0,M=0,I=0,R=0,O=0,B=0,L=new n(s*s),F=o%s||s,N=r%s||s,V=i.numDims,k=t.pixels.resultMask,U=t.pixels.resultPixels;for(A=0;A<d;A++)for(E=A!==d-1?s:F,v=0;v<u;v++)for(w=A*r*s+v*s,M=r-(b=v!==u-1?s:N),C=0;C<V;C++){if(V>1&&(U=new n(t.pixels.resultPixels.buffer,r*o*C*l,r*o)),x=e.byteLength-t.ptr,p={},B=0,B++,D=(P=(h=new DataView(e,t.ptr,Math.min(10,x))).getUint8(0))>>6&255,(P>>2&15)!==(v*s>>3&15))throw"integrity issue";if((g=3&P)>3)throw t.ptr+=B,"Invalid block encoding ("+g+")";if(2!==g)if(0===g){if(t.counter.uncompressed++,t.ptr+=B,I=(I=E*b*l)<(R=e.byteLength-t.ptr)?I:R,f=new ArrayBuffer(I%l==0?I:I+l-I%l),new Uint8Array(f).set(new Uint8Array(e,t.ptr,I)),m=new n(f),O=0,k)for(T=0;T<E;T++){for(S=0;S<b;S++)k[w]&&(U[w]=m[O++]),w++;w+=M}else for(T=0;T<E;T++){for(S=0;S<b;S++)U[w++]=m[O++];w+=M}t.ptr+=O*l}else if(_=a.getDataTypeUsed(c,D),y=a.getOnePixel(p,B,_,h),B+=a.getDataTypeSize(_),3===g)if(t.ptr+=B,t.counter.constantoffset++,k)for(T=0;T<E;T++){for(S=0;S<b;S++)k[w]&&(U[w]=y),w++;w+=M}else for(T=0;T<E;T++){for(S=0;S<b;S++)U[w++]=y;w+=M}else if(t.ptr+=B,a.decodeBits(e,t,L,y,C),B=0,k)for(T=0;T<E;T++){for(S=0;S<b;S++)k[w]&&(U[w]=L[B++]),w++;w+=M}else for(T=0;T<E;T++){for(S=0;S<b;S++)U[w++]=L[B++];w+=M}else t.counter.constant++,t.ptr+=B}},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:a.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e){var t=e.headerInfo.zMax,n=e.headerInfo.numDims,i=e.headerInfo.height*e.headerInfo.width,r=i*n,o=0,a=0,s=0,c=e.pixels.resultMask;if(c)if(n>1)for(o=0;o<n;o++)for(s=o*i,a=0;a<i;a++)c[a]&&(e.pixels.resultPixels[s+a]=t);else for(a=0;a<i;a++)c[a]&&(e.pixels.resultPixels[a]=t);else if(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);else for(a=0;a<r;a++)e.pixels.resultPixels[a]=t},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var n;switch(e){case 0:n=t>=-128&&t<=127;break;case 1:n=t>=0&&t<=255;break;case 2:n=t>=-32768&&t<=32767;break;case 3:n=t>=0&&t<=65536;break;case 4:n=t>=-2147483648&&t<=2147483647;break;case 5:n=t>=0&&t<=4294967296;break;case 6:n=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:n=t>=5e-324&&t<=17976931348623157e292;break;default:n=!1}return n},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var n=e;switch(e){case 2:case 4:n=e-t;break;case 3:case 5:n=e-2*t;break;case 6:n=0===t?e:1===t?2:1;break;case 7:n=0===t?e:e-2*t+1;break;default:n=e}return n},getOnePixel:function(e,t,n,i){var r=0;switch(n){case 0:r=i.getInt8(t);break;case 1:r=i.getUint8(t);break;case 2:r=i.getInt16(t,!0);break;case 3:r=i.getUint16(t,!0);break;case 4:r=i.getInt32(t,!0);break;case 5:r=i.getUInt32(t,!0);break;case 6:r=i.getFloat32(t,!0);break;case 7:r=i.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return r}},s=function(e,t,n){this.val=e,this.left=t,this.right=n},c={decode:function(e,t){var n=(t=t||{}).noDataValue,i=0,r={};r.ptr=t.inputOffset||0,r.pixels={},a.readHeaderInfo(e,r);var o=r.headerInfo,s=o.fileVersion,c=a.getDataTypeArray(o.imageType);a.readMask(e,r),o.numValidPixel===o.width*o.height||r.pixels.resultMask||(r.pixels.resultMask=t.maskData);var l,u=o.width*o.height;if(r.pixels.resultPixels=new c(u*o.numDims),r.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==o.numValidPixel)if(o.zMax===o.zMin)a.constructConstantSurface(r);else if(s>=4&&a.checkMinMaxRanges(e,r))a.constructConstantSurface(r);else{var d=new DataView(e,r.ptr,2),h=d.getUint8(0);if(r.ptr++,h)a.readDataOneSweep(e,r,c);else if(s>1&&o.imageType<=1&&Math.abs(o.maxZError-.5)<1e-5){var p=d.getUint8(1);if(r.ptr++,r.encodeMode=p,p>2||s<4&&p>1)throw"Invalid Huffman flag "+p;p?a.readHuffman(e,r,c):a.readTiles(e,r,c)}else a.readTiles(e,r,c)}r.eofOffset=r.ptr,t.inputOffset?(l=r.headerInfo.blobSize+t.inputOffset-r.ptr,Math.abs(l)>=1&&(r.eofOffset=t.inputOffset+r.headerInfo.blobSize)):(l=r.headerInfo.blobSize-r.ptr,Math.abs(l)>=1&&(r.eofOffset=r.headerInfo.blobSize));var f={width:o.width,height:o.height,pixelData:r.pixels.resultPixels,minValue:o.zMin,maxValue:o.zMax,validPixelCount:o.numValidPixel,dimCount:o.numDims,dimStats:{minValues:o.minValues,maxValues:o.maxValues},maskData:r.pixels.resultMask};if(r.pixels.resultMask&&a.isValidPixelValue(o.imageType,n)){var m=r.pixels.resultMask;for(i=0;i<u;i++)m[i]||(f.pixelData[i]=n);f.noDataValue=n}return r.noDataValue=n,t.returnFileInfo&&(f.fileInfo=a.formatFileInfo(r)),f},getBandCount:function(e){for(var t=0,n=0,i={ptr:0,pixels:{}};n<e.byteLength-58;)a.readHeaderInfo(e,i),n+=i.headerInfo.blobSize,t++,i.ptr=n;return t}};return c}(),i=function(){var e=new ArrayBuffer(4),t=new Uint8Array(e);return new Uint32Array(e)[0]=1,1===t[0]}(),r={decode:function(e,r){if(!i)throw"Big endian system is not supported.";var o,a,s=(r=r||{}).inputOffset||0,c=new Uint8Array(e,s,10),l=String.fromCharCode.apply(null,c);if("CntZImage"===l.trim())o=t,a=1;else{if("Lerc2"!==l.substring(0,5))throw"Unexpected file identifier string: "+l;o=n,a=2}for(var u,d,h,p,f,m,g=0,_=e.byteLength-10,y=[],C={width:0,height:0,pixels:[],pixelType:r.pixelType,mask:null,statistics:[]};s<_;){var T=o.decode(e,{inputOffset:s,encodedMaskData:u,maskData:h,returnMask:0===g,returnEncodedMask:0===g,returnFileInfo:!0,pixelType:r.pixelType||null,noDataValue:r.noDataValue||null});s=T.fileInfo.eofOffset,0===g&&(u=T.encodedMaskData,h=T.maskData,C.width=T.width,C.height=T.height,C.dimCount=T.dimCount||1,C.pixelType=T.pixelType||T.fileInfo.pixelType,C.mask=T.maskData),a>1&&T.fileInfo.mask&&T.fileInfo.mask.numBytes>0&&y.push(T.maskData),g++,C.pixels.push(T.pixelData),C.statistics.push({minValue:T.minValue,maxValue:T.maxValue,noDataValue:T.noDataValue,dimStats:T.dimStats})}if(a>1&&y.length>1){for(m=C.width*C.height,C.bandMasks=y,(h=new Uint8Array(m)).set(y[0]),p=1;p<y.length;p++)for(d=y[p],f=0;f<m;f++)h[f]=h[f]&d[f];C.maskData=h}return C}};e.exports?e.exports=r:this.Lerc=r}()})),media={webm:"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",mp4:"data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="};const{webm:webm,mp4:mp4}=media,oldIOS="undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream;class NoSleep{constructor(){oldIOS?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("muted",""),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",webm),this._addSourceToVideo(this.noSleepVideo,"mp4",mp4),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,n){var i=document.createElement("source");i.src=n,i.type=`video/${t}`,e.appendChild(i)}enable(){oldIOS?(this.disable(),console.warn("\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n "),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3)):this.noSleepVideo.play()}disable(){oldIOS?this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}var src=NoSleep,common=createCommonjsModule((function(e,t){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),r);else for(var o=0;o<i;o++)e[r+o]=t[n+o]},flattenChunks:function(e){var t,n,i,r,o,a;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(a=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)o=e[t],a.set(o,r),r+=o.length;return a}},o={arraySet:function(e,t,n,i,r){for(var o=0;o<i;o++)e[r+o]=t[n+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(n)}));function adler32(e,t,n,i){for(var r=65535&e|0,o=e>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(r=r+t[i++]|0)|0}while(--a);r%=65521,o%=65521}return r|o<<16|0}var adler32_1=adler32;function makeTable(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var crcTable=makeTable();function crc32(e,t,n,i){var r=crcTable,o=i+n;e^=-1;for(var a=i;a<o;a++)e=e>>>8^r[255&(e^t[a])];return-1^e}var crc32_1=crc32,BAD$1=30,TYPE$1=12,inffast=function(e,t){var n,i,r,o,a,s,c,l,u,d,h,p,f,m,g,_,y,C,T,S,A,v,E,b,x;n=e.state,i=e.next_in,b=e.input,r=i+(e.avail_in-5),o=e.next_out,x=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=n.dmax,l=n.wsize,u=n.whave,d=n.wnext,h=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,_=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{f<15&&(p+=b[i++]<<f,f+=8,p+=b[i++]<<f,f+=8),C=m[p&_];t:for(;;){if(p>>>=T=C>>>24,f-=T,0===(T=C>>>16&255))x[o++]=65535&C;else{if(!(16&T)){if(0==(64&T)){C=m[(65535&C)+(p&(1<<T)-1)];continue t}if(32&T){n.mode=TYPE$1;break e}e.msg="invalid literal/length code",n.mode=BAD$1;break e}S=65535&C,(T&=15)&&(f<T&&(p+=b[i++]<<f,f+=8),S+=p&(1<<T)-1,p>>>=T,f-=T),f<15&&(p+=b[i++]<<f,f+=8,p+=b[i++]<<f,f+=8),C=g[p&y];n:for(;;){if(p>>>=T=C>>>24,f-=T,!(16&(T=C>>>16&255))){if(0==(64&T)){C=g[(65535&C)+(p&(1<<T)-1)];continue n}e.msg="invalid distance code",n.mode=BAD$1;break e}if(A=65535&C,f<(T&=15)&&(p+=b[i++]<<f,(f+=8)<T&&(p+=b[i++]<<f,f+=8)),(A+=p&(1<<T)-1)>c){e.msg="invalid distance too far back",n.mode=BAD$1;break e}if(p>>>=T,f-=T,A>(T=o-a)){if((T=A-T)>u&&n.sane){e.msg="invalid distance too far back",n.mode=BAD$1;break e}if(v=0,E=h,0===d){if(v+=l-T,T<S){S-=T;do{x[o++]=h[v++]}while(--T);v=o-A,E=x}}else if(d<T){if(v+=l+d-T,(T-=d)<S){S-=T;do{x[o++]=h[v++]}while(--T);if(v=0,d<S){S-=T=d;do{x[o++]=h[v++]}while(--T);v=o-A,E=x}}}else if(v+=d-T,T<S){S-=T;do{x[o++]=h[v++]}while(--T);v=o-A,E=x}for(;S>2;)x[o++]=E[v++],x[o++]=E[v++],x[o++]=E[v++],S-=3;S&&(x[o++]=E[v++],S>1&&(x[o++]=E[v++]))}else{v=o-A;do{x[o++]=x[v++],x[o++]=x[v++],x[o++]=x[v++],S-=3}while(S>2);S&&(x[o++]=x[v++],S>1&&(x[o++]=x[v++]))}break}}break}}while(i<r&&o<s);i-=S=f>>3,p&=(1<<(f-=S<<3))-1,e.next_in=i,e.next_out=o,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=o<s?s-o+257:257-(o-s),n.hold=p,n.bits=f},MAXBITS=15,ENOUGH_LENS$1=852,ENOUGH_DISTS$1=592,CODES$1=0,LENS$1=1,DISTS$1=2,lbase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],lext=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],dbase=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],dext=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],inftrees=function(e,t,n,i,r,o,a,s){var c,l,u,d,h,p,f,m,g,_=s.bits,y=0,C=0,T=0,S=0,A=0,v=0,E=0,b=0,x=0,P=0,D=null,w=0,M=new common.Buf16(MAXBITS+1),I=new common.Buf16(MAXBITS+1),R=null,O=0;for(y=0;y<=MAXBITS;y++)M[y]=0;for(C=0;C<i;C++)M[t[n+C]]++;for(A=_,S=MAXBITS;S>=1&&0===M[S];S--);if(A>S&&(A=S),0===S)return r[o++]=20971520,r[o++]=20971520,s.bits=1,0;for(T=1;T<S&&0===M[T];T++);for(A<T&&(A=T),b=1,y=1;y<=MAXBITS;y++)if(b<<=1,(b-=M[y])<0)return-1;if(b>0&&(e===CODES$1||1!==S))return-1;for(I[1]=0,y=1;y<MAXBITS;y++)I[y+1]=I[y]+M[y];for(C=0;C<i;C++)0!==t[n+C]&&(a[I[t[n+C]]++]=C);if(e===CODES$1?(D=R=a,p=19):e===LENS$1?(D=lbase,w-=257,R=lext,O-=257,p=256):(D=dbase,R=dext,p=-1),P=0,C=0,y=T,h=o,v=A,E=0,u=-1,d=(x=1<<A)-1,e===LENS$1&&x>ENOUGH_LENS$1||e===DISTS$1&&x>ENOUGH_DISTS$1)return 1;for(;;){f=y-E,a[C]<p?(m=0,g=a[C]):a[C]>p?(m=R[O+a[C]],g=D[w+a[C]]):(m=96,g=0),c=1<<y-E,T=l=1<<v;do{r[h+(P>>E)+(l-=c)]=f<<24|m<<16|g|0}while(0!==l);for(c=1<<y-1;P&c;)c>>=1;if(0!==c?(P&=c-1,P+=c):P=0,C++,0==--M[y]){if(y===S)break;y=t[n+a[C]]}if(y>A&&(P&d)!==u){for(0===E&&(E=A),h+=T,b=1<<(v=y-E);v+E<S&&!((b-=M[v+E])<=0);)v++,b<<=1;if(x+=1<<v,e===LENS$1&&x>ENOUGH_LENS$1||e===DISTS$1&&x>ENOUGH_DISTS$1)return 1;r[u=P&d]=A<<24|v<<16|h-o|0}}return 0!==P&&(r[h+P]=y-E<<24|64<<16|0),s.bits=A,0},CODES=0,LENS=1,DISTS=2,Z_FINISH=4,Z_BLOCK=5,Z_TREES=6,Z_OK=0,Z_STREAM_END=1,Z_NEED_DICT=2,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_MEM_ERROR=-4,Z_BUF_ERROR=-5,Z_DEFLATED=8,HEAD=1,FLAGS=2,TIME=3,OS=4,EXLEN=5,EXTRA=6,NAME=7,COMMENT=8,HCRC=9,DICTID=10,DICT=11,TYPE=12,TYPEDO=13,STORED=14,COPY_=15,COPY=16,TABLE=17,LENLENS=18,CODELENS=19,LEN_=20,LEN=21,LENEXT=22,DIST=23,DISTEXT=24,MATCH=25,LIT=26,CHECK=27,LENGTH=28,DONE=29,BAD=30,MEM=31,SYNC=32,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS;function zswap32(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new common.Buf16(320),this.work=new common.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function inflateResetKeep(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=HEAD,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new common.Buf32(ENOUGH_LENS),t.distcode=t.distdyn=new common.Buf32(ENOUGH_DISTS),t.sane=1,t.back=-1,Z_OK):Z_STREAM_ERROR}function inflateReset(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,inflateResetKeep(e)):Z_STREAM_ERROR}function inflateReset2(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Z_STREAM_ERROR:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,inflateReset(e))):Z_STREAM_ERROR}function inflateInit2(e,t){var n,i;return e?(i=new InflateState,e.state=i,i.window=null,(n=inflateReset2(e,t))!==Z_OK&&(e.state=null),n):Z_STREAM_ERROR}function inflateInit(e){return inflateInit2(e,DEF_WBITS)}var virgin=!0,lenfix,distfix;function fixedtables(e){if(virgin){var t;for(lenfix=new common.Buf32(512),distfix=new common.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(inftrees(LENS,e.lens,0,288,lenfix,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;inftrees(DISTS,e.lens,0,32,distfix,0,e.work,{bits:5}),virgin=!1}e.lencode=lenfix,e.lenbits=9,e.distcode=distfix,e.distbits=5}function updatewindow(e,t,n,i){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new common.Buf8(o.wsize)),i>=o.wsize?(common.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),common.arraySet(o.window,t,n-i,r,o.wnext),(i-=r)?(common.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}function inflate$1(e,t){var n,i,r,o,a,s,c,l,u,d,h,p,f,m,g,_,y,C,T,S,A,v,E,b,x=0,P=new common.Buf8(4),D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return Z_STREAM_ERROR;(n=e.state).mode===TYPE&&(n.mode=TYPEDO),a=e.next_out,r=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,h=c,v=Z_OK;e:for(;;)switch(n.mode){case HEAD:if(0===n.wrap){n.mode=TYPEDO;break}for(;u<16;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(2&n.wrap&&35615===l){n.check=0,P[0]=255&l,P[1]=l>>>8&255,n.check=crc32_1(n.check,P,2,0),l=0,u=0,n.mode=FLAGS;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",n.mode=BAD;break}if((15&l)!==Z_DEFLATED){e.msg="unknown compression method",n.mode=BAD;break}if(u-=4,A=8+(15&(l>>>=4)),0===n.wbits)n.wbits=A;else if(A>n.wbits){e.msg="invalid window size",n.mode=BAD;break}n.dmax=1<<A,e.adler=n.check=1,n.mode=512&l?DICTID:TYPE,l=0,u=0;break;case FLAGS:for(;u<16;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(n.flags=l,(255&n.flags)!==Z_DEFLATED){e.msg="unknown compression method",n.mode=BAD;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=BAD;break}n.head&&(n.head.text=l>>8&1),512&n.flags&&(P[0]=255&l,P[1]=l>>>8&255,n.check=crc32_1(n.check,P,2,0)),l=0,u=0,n.mode=TIME;case TIME:for(;u<32;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.head&&(n.head.time=l),512&n.flags&&(P[0]=255&l,P[1]=l>>>8&255,P[2]=l>>>16&255,P[3]=l>>>24&255,n.check=crc32_1(n.check,P,4,0)),l=0,u=0,n.mode=OS;case OS:for(;u<16;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.head&&(n.head.xflags=255&l,n.head.os=l>>8),512&n.flags&&(P[0]=255&l,P[1]=l>>>8&255,n.check=crc32_1(n.check,P,2,0)),l=0,u=0,n.mode=EXLEN;case EXLEN:if(1024&n.flags){for(;u<16;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),512&n.flags&&(P[0]=255&l,P[1]=l>>>8&255,n.check=crc32_1(n.check,P,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=EXTRA;case EXTRA:if(1024&n.flags&&((p=n.length)>s&&(p=s),p&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),common.arraySet(n.head.extra,i,o,p,A)),512&n.flags&&(n.check=crc32_1(n.check,i,p,o)),s-=p,o+=p,n.length-=p),n.length))break e;n.length=0,n.mode=NAME;case NAME:if(2048&n.flags){if(0===s)break e;p=0;do{A=i[o+p++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A))}while(A&&p<s);if(512&n.flags&&(n.check=crc32_1(n.check,i,p,o)),s-=p,o+=p,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=COMMENT;case COMMENT:if(4096&n.flags){if(0===s)break e;p=0;do{A=i[o+p++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A))}while(A&&p<s);if(512&n.flags&&(n.check=crc32_1(n.check,i,p,o)),s-=p,o+=p,A)break e}else n.head&&(n.head.comment=null);n.mode=HCRC;case HCRC:if(512&n.flags){for(;u<16;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(l!==(65535&n.check)){e.msg="header crc mismatch",n.mode=BAD;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=TYPE;break;case DICTID:for(;u<32;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}e.adler=n.check=zswap32(l),l=0,u=0,n.mode=DICT;case DICT:if(0===n.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=l,n.bits=u,Z_NEED_DICT;e.adler=n.check=1,n.mode=TYPE;case TYPE:if(t===Z_BLOCK||t===Z_TREES)break e;case TYPEDO:if(n.last){l>>>=7&u,u-=7&u,n.mode=CHECK;break}for(;u<3;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}switch(n.last=1&l,u-=1,3&(l>>>=1)){case 0:n.mode=STORED;break;case 1:if(fixedtables(n),n.mode=LEN_,t===Z_TREES){l>>>=2,u-=2;break e}break;case 2:n.mode=TABLE;break;case 3:e.msg="invalid block type",n.mode=BAD}l>>>=2,u-=2;break;case STORED:for(l>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",n.mode=BAD;break}if(n.length=65535&l,l=0,u=0,n.mode=COPY_,t===Z_TREES)break e;case COPY_:n.mode=COPY;case COPY:if(p=n.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;common.arraySet(r,i,o,p,a),s-=p,o+=p,c-=p,a+=p,n.length-=p;break}n.mode=TYPE;break;case TABLE:for(;u<14;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(n.nlen=257+(31&l),l>>>=5,u-=5,n.ndist=1+(31&l),l>>>=5,u-=5,n.ncode=4+(15&l),l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=BAD;break}n.have=0,n.mode=LENLENS;case LENLENS:for(;n.have<n.ncode;){for(;u<3;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.lens[D[n.have++]]=7&l,l>>>=3,u-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},v=inftrees(CODES,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,v){e.msg="invalid code lengths set",n.mode=BAD;break}n.have=0,n.mode=CODELENS;case CODELENS:for(;n.have<n.nlen+n.ndist;){for(;_=(x=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,y=65535&x,!((g=x>>>24)<=u);){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(y<16)l>>>=g,u-=g,n.lens[n.have++]=y;else{if(16===y){for(b=g+2;u<b;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(l>>>=g,u-=g,0===n.have){e.msg="invalid bit length repeat",n.mode=BAD;break}A=n.lens[n.have-1],p=3+(3&l),l>>>=2,u-=2}else if(17===y){for(b=g+3;u<b;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}u-=g,A=0,p=3+(7&(l>>>=g)),l>>>=3,u-=3}else{for(b=g+7;u<b;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}u-=g,A=0,p=11+(127&(l>>>=g)),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=BAD;break}for(;p--;)n.lens[n.have++]=A}}if(n.mode===BAD)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=BAD;break}if(n.lenbits=9,E={bits:n.lenbits},v=inftrees(LENS,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,v){e.msg="invalid literal/lengths set",n.mode=BAD;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},v=inftrees(DISTS,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,v){e.msg="invalid distances set",n.mode=BAD;break}if(n.mode=LEN_,t===Z_TREES)break e;case LEN_:n.mode=LEN;case LEN:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=l,n.bits=u,inffast(e,h),a=e.next_out,r=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===TYPE&&(n.back=-1);break}for(n.back=0;_=(x=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,y=65535&x,!((g=x>>>24)<=u);){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(_&&0==(240&_)){for(C=g,T=_,S=y;_=(x=n.lencode[S+((l&(1<<C+T)-1)>>C)])>>>16&255,y=65535&x,!(C+(g=x>>>24)<=u);){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}l>>>=C,u-=C,n.back+=C}if(l>>>=g,u-=g,n.back+=g,n.length=y,0===_){n.mode=LIT;break}if(32&_){n.back=-1,n.mode=TYPE;break}if(64&_){e.msg="invalid literal/length code",n.mode=BAD;break}n.extra=15&_,n.mode=LENEXT;case LENEXT:if(n.extra){for(b=n.extra;u<b;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=DIST;case DIST:for(;_=(x=n.distcode[l&(1<<n.distbits)-1])>>>16&255,y=65535&x,!((g=x>>>24)<=u);){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(0==(240&_)){for(C=g,T=_,S=y;_=(x=n.distcode[S+((l&(1<<C+T)-1)>>C)])>>>16&255,y=65535&x,!(C+(g=x>>>24)<=u);){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}l>>>=C,u-=C,n.back+=C}if(l>>>=g,u-=g,n.back+=g,64&_){e.msg="invalid distance code",n.mode=BAD;break}n.offset=y,n.extra=15&_,n.mode=DISTEXT;case DISTEXT:if(n.extra){for(b=n.extra;u<b;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=BAD;break}n.mode=MATCH;case MATCH:if(0===c)break e;if(p=h-c,n.offset>p){if((p=n.offset-p)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=BAD;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),m=n.window}else m=r,f=a-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do{r[a++]=m[f++]}while(--p);0===n.length&&(n.mode=LEN);break;case LIT:if(0===c)break e;r[a++]=n.length,c--,n.mode=LEN;break;case CHECK:if(n.wrap){for(;u<32;){if(0===s)break e;s--,l|=i[o++]<<u,u+=8}if(h-=c,e.total_out+=h,n.total+=h,h&&(e.adler=n.check=n.flags?crc32_1(n.check,r,h,a-h):adler32_1(n.check,r,h,a-h)),h=c,(n.flags?l:zswap32(l))!==n.check){e.msg="incorrect data check",n.mode=BAD;break}l=0,u=0}n.mode=LENGTH;case LENGTH:if(n.wrap&&n.flags){for(;u<32;){if(0===s)break e;s--,l+=i[o++]<<u,u+=8}if(l!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=BAD;break}l=0,u=0}n.mode=DONE;case DONE:v=Z_STREAM_END;break e;case BAD:v=Z_DATA_ERROR;break e;case MEM:return Z_MEM_ERROR;default:return Z_STREAM_ERROR}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||h!==e.avail_out&&n.mode<BAD&&(n.mode<CHECK||t!==Z_FINISH))&&updatewindow(e,e.output,e.next_out,h-e.avail_out),d-=e.avail_in,h-=e.avail_out,e.total_in+=d,e.total_out+=h,n.total+=h,n.wrap&&h&&(e.adler=n.check=n.flags?crc32_1(n.check,r,h,e.next_out-h):adler32_1(n.check,r,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===TYPE?128:0)+(n.mode===LEN_||n.mode===COPY_?256:0),(0===d&&0===h||t===Z_FINISH)&&v===Z_OK&&(v=Z_BUF_ERROR),v}function inflateEnd(e){if(!e||!e.state)return Z_STREAM_ERROR;var t=e.state;return t.window&&(t.window=null),e.state=null,Z_OK}function inflateGetHeader(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?Z_STREAM_ERROR:(n.head=t,t.done=!1,Z_OK):Z_STREAM_ERROR}function inflateSetDictionary(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&n.mode!==DICT?Z_STREAM_ERROR:n.mode===DICT&&adler32_1(1,t,i,0)!==n.check?Z_DATA_ERROR:updatewindow(e,t,i,i)?(n.mode=MEM,Z_MEM_ERROR):(n.havedict=1,Z_OK):Z_STREAM_ERROR}var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$1,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$1={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo:inflateInfo},STR_APPLY_OK=!0,STR_APPLY_UIA_OK=!0;try{String.fromCharCode.apply(null,[0])}catch(e){STR_APPLY_OK=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){STR_APPLY_UIA_OK=!1}for(var _utf8len=new common.Buf8(256),q=0;q<256;q++)_utf8len[q]=q>=252?6:q>=248?5:q>=240?4:q>=224?3:q>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=function(e){var t,n,i,r,o,a=e.length,s=0;for(r=0;r<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new common.Buf8(s),o=0,r=0;o<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t};function buf2binstring(e,t){if(t<65534&&(e.subarray&&STR_APPLY_UIA_OK||!e.subarray&&STR_APPLY_OK))return String.fromCharCode.apply(null,common.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}var buf2binstring_1=function(e){return buf2binstring(e,e.length)},binstring2buf=function(e){for(var t=new common.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},buf2string=function(e,t){var n,i,r,o,a=t||e.length,s=new Array(2*a);for(i=0,n=0;n<a;)if((r=e[n++])<128)s[i++]=r;else if((o=_utf8len[r])>4)s[i++]=65533,n+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&n<a;)r=r<<6|63&e[n++],o--;o>1?s[i++]=65533:r<65536?s[i++]=r:(r-=65536,s[i++]=55296|r>>10&1023,s[i++]=56320|1023&r)}return buf2binstring(s,i)},utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+_utf8len[e[n]]>t?n:t},strings={string2buf:string2buf,buf2binstring:buf2binstring_1,binstring2buf:binstring2buf,buf2string:buf2string,utf8border:utf8border},constants={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader,toString=Object.prototype.toString;function Inflate(e){if(!(this instanceof Inflate))return new Inflate(e);this.options=common.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;var n=inflate_1$1.inflateInit2(this.strm,t.windowBits);if(n!==constants.Z_OK)throw new Error(messages[n]);if(this.header=new gzheader,inflate_1$1.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=strings.string2buf(t.dictionary):"[object ArrayBuffer]"===toString.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=inflate_1$1.inflateSetDictionary(this.strm,t.dictionary))!==constants.Z_OK))throw new Error(messages[n])}function inflate(e,t){var n=new Inflate(t);if(n.push(e,!0),n.err)throw n.msg||messages[n.err];return n.result}function inflateRaw(e,t){return(t=t||{}).raw=!0,inflate(e,t)}Inflate.prototype.push=function(e,t){var n,i,r,o,a,s=this.strm,c=this.options.chunkSize,l=this.options.dictionary,u=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?constants.Z_FINISH:constants.Z_NO_FLUSH,"string"==typeof e?s.input=strings.binstring2buf(e):"[object ArrayBuffer]"===toString.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new common.Buf8(c),s.next_out=0,s.avail_out=c),(n=inflate_1$1.inflate(s,constants.Z_NO_FLUSH))===constants.Z_NEED_DICT&&l&&(n=inflate_1$1.inflateSetDictionary(this.strm,l)),n===constants.Z_BUF_ERROR&&!0===u&&(n=constants.Z_OK,u=!1),n!==constants.Z_STREAM_END&&n!==constants.Z_OK)return this.onEnd(n),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&n!==constants.Z_STREAM_END&&(0!==s.avail_in||i!==constants.Z_FINISH&&i!==constants.Z_SYNC_FLUSH)||("string"===this.options.to?(r=strings.utf8border(s.output,s.next_out),o=s.next_out-r,a=strings.buf2string(s.output,r),s.next_out=o,s.avail_out=c-o,o&&common.arraySet(s.output,s.output,r,o,0),this.onData(a)):this.onData(common.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(u=!0)}while((s.avail_in>0||0===s.avail_out)&&n!==constants.Z_STREAM_END);return n===constants.Z_STREAM_END&&(i=constants.Z_FINISH),i===constants.Z_FINISH?(n=inflate_1$1.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===constants.Z_OK):i!==constants.Z_SYNC_FLUSH||(this.onEnd(constants.Z_OK),s.avail_out=0,!0)},Inflate.prototype.onData=function(e){this.chunks.push(e)},Inflate.prototype.onEnd=function(e){e===constants.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Inflate_1=Inflate,inflate_2=inflate,inflateRaw_1=inflateRaw,ungzip=inflate,inflate_1={Inflate:Inflate_1,inflate:inflate_2,inflateRaw:inflateRaw_1,ungzip:ungzip};function ClockViewModel(e){defined(e)||(e=new Clock),this._clock=e,this._eventHelper=new EventHelper,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=knockout.observable(JulianDate.now()),this.systemTime.equalityComparer=JulianDate.equals,this.startTime=knockout.observable(e.startTime),this.startTime.equalityComparer=JulianDate.equals,this.startTime.subscribe((function(t){e.startTime=t,this.synchronize()}),this),this.stopTime=knockout.observable(e.stopTime),this.stopTime.equalityComparer=JulianDate.equals,this.stopTime.subscribe((function(t){e.stopTime=t,this.synchronize()}),this),this.currentTime=knockout.observable(e.currentTime),this.currentTime.equalityComparer=JulianDate.equals,this.currentTime.subscribe((function(t){e.currentTime=t,this.synchronize()}),this),this.multiplier=knockout.observable(e.multiplier),this.multiplier.subscribe((function(t){e.multiplier=t,this.synchronize()}),this),this.clockStep=knockout.observable(e.clockStep),this.clockStep.subscribe((function(t){e.clockStep=t,this.synchronize()}),this),this.clockRange=knockout.observable(e.clockRange),this.clockRange.subscribe((function(t){e.clockRange=t,this.synchronize()}),this),this.canAnimate=knockout.observable(e.canAnimate),this.canAnimate.subscribe((function(t){e.canAnimate=t,this.synchronize()}),this),this.shouldAnimate=knockout.observable(e.shouldAnimate),this.shouldAnimate.subscribe((function(t){e.shouldAnimate=t,this.synchronize()}),this),knockout.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}function Command(){this.canExecute=void 0,this.beforeExecute=void 0,this.afterExecute=void 0,DeveloperError.throwInstantiationError()}function createCommand(e,t){t=defaultValue(t,!0);const n=new Event,i=new Event;function r(){const t={args:arguments,cancel:!1};let r;return n.raiseEvent(t),t.cancel||(r=e.apply(null,arguments),i.raiseEvent(r)),r}return r.canExecute=t,knockout.track(r,["canExecute"]),Object.defineProperties(r,{beforeExecute:{value:n},afterExecute:{value:i}}),r}Object.defineProperties(ClockViewModel.prototype,{clock:{get:function(){return this._clock}}}),ClockViewModel.prototype.synchronize=function(){const e=this._clock;this.systemTime=JulianDate.now(),this.startTime=e.startTime,this.stopTime=e.stopTime,this.currentTime=e.currentTime,this.multiplier=e.multiplier,this.clockStep=e.clockStep,this.clockRange=e.clockRange,this.canAnimate=e.canAnimate,this.shouldAnimate=e.shouldAnimate},ClockViewModel.prototype.isDestroyed=function(){return!1},ClockViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};const InspectorShared={};function subscribeAndEvaluate(e,t,n,i,r){return n.call(i,e[t]),knockout.getObservable(e,t).subscribe(n,i,r)}function ToggleButtonViewModel(e,t){this._command=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this.toggled=defaultValue(t.toggled,!1),this.tooltip=defaultValue(t.tooltip,""),knockout.track(this,["toggled","tooltip"])}InspectorShared.createCheckbox=function(e,t,n){const i=document.createElement("div"),r=document.createElement("label"),o=document.createElement("input");o.type="checkbox";let a="checked: "+t;return defined(n)&&(a+=", enable: "+n),o.setAttribute("data-bind",a),r.appendChild(o),r.appendChild(document.createTextNode(e)),i.appendChild(r),i},InspectorShared.createSection=function(e,t,n,i){const r=document.createElement("div");r.className="cesium-cesiumInspector-section",r.setAttribute("data-bind",'css: { "cesium-cesiumInspector-section-collapsed": !'+n+" }"),e.appendChild(r);const o=document.createElement("h3");o.className="cesium-cesiumInspector-sectionHeader",o.appendChild(document.createTextNode(t)),o.setAttribute("data-bind","click: "+i),r.appendChild(o);const a=document.createElement("div");return a.className="cesium-cesiumInspector-sectionContent",r.appendChild(a),a},Object.defineProperties(ToggleButtonViewModel.prototype,{command:{get:function(){return this._command}}});const UniformType={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",MAT2:"mat2",MAT3:"mat2",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"};var UniformType$1=Object.freeze(UniformType);function TextureManager(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}function fetchTexture2D(e,t,n){n.resource.fetchImage().then((function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})})).otherwise((function(){const n=e._textures[t];defined(n)&&n!==e._defaultTexture&&n.destroy(),e._textures[t]=e._defaultTexture}))}function createTexture(e,t,n){const i=t.id,r=t.textureUniform,o=r.typedArray,a=r.sampler;let s;s=defined(o)?new Texture({context:n,pixelFormat:r.pixelFormat,pixelDatatype:r.pixelDatatype,source:{arrayBufferView:o,width:r.width,height:r.height},sampler:a,flipY:!1}):new Texture({context:n,source:t.image,sampler:a});const c=e._textures[i];defined(c)&&c!==n.defaultTexture&&c.destroy(),e._textures[i]=s}function CustomShader(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.mode=defaultValue(e.mode,CustomShaderMode$1.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=defaultValue(e.uniforms,defaultValue.EMPTY_OBJECT),this.varyings=defaultValue(e.varyings,defaultValue.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.isTranslucent=defaultValue(e.isTranslucent,!1),this._textureManager=new TextureManager,this._defaultTexture=void 0,this.uniformMap=buildUniformMap(this),this.usedVariablesVertex={attributeSet:{}},this.usedVariablesFragment={attributeSet:{},materialSet:{}},findUsedVariables(this),validateBuiltinVariables(this)}function buildUniformMap(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const r=t[i];r.type===UniformType$1.SAMPLER_2D?(e._textureManager.loadTexture2D(i,r.value),n[i]=createUniformTexture2DFunction(e,i)):n[i]=createUniformFunction(e,i)}return n}function createUniformTexture2DFunction(e,t){return function(){return defaultValue(e._textureManager.getTexture(t),e._defaultTexture)}}function createUniformFunction(e,t){return function(){return e.uniforms[t].value}}function getVariables(e,t,n){let i;for(;null!==(i=t.exec(e));){n[i[1]]=!0}}function findUsedVariables(e){const t=/[vf]sInput\.attributes\.(\w+)/g;let n;const i=e.vertexShaderText;defined(i)&&(n=e.usedVariablesVertex.attributeSet,getVariables(i,t,n));const r=e.fragmentShaderText;if(defined(r)){n=e.usedVariablesFragment.attributeSet,getVariables(r,t,n);getVariables(r,/material\.(\w+)/g,e.usedVariablesFragment.materialSet)}}function expandCoordinateAbbreviations(e){return/^.*MC$/.test(e)?e+" (model coordinates)":/^.*WC$/.test(e)?e+" (Cartesian world coordinates)":/^.*EC$/.test(e)?e+" (eye coordinates)":e}function validateVariableUsage(e,t,n,i){if(e.hasOwnProperty(t)){throw new DeveloperError(expandCoordinateAbbreviations(t)+" is not available in the "+i+" shader. Did you mean "+expandCoordinateAbbreviations(n)+" instead?")}}function validateBuiltinVariables(e){const t=e.usedVariablesVertex.attributeSet;validateVariableUsage(t,"position","positionMC","vertex"),validateVariableUsage(t,"normal","normalMC","vertex"),validateVariableUsage(t,"tangent","tangentMC","vertex"),validateVariableUsage(t,"bitangent","bitangentMC","vertex"),validateVariableUsage(t,"positionWC","positionMC","vertex"),validateVariableUsage(t,"positionEC","positionMC","vertex"),validateVariableUsage(t,"normalEC","normalMC","vertex"),validateVariableUsage(t,"tangentEC","tangentMC","vertex"),validateVariableUsage(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;validateVariableUsage(n,"position","positionEC","fragment"),validateVariableUsage(n,"normal","normalEC","fragment"),validateVariableUsage(n,"tangent","tangentEC","fragment"),validateVariableUsage(n,"bitangent","bitangentEC","fragment"),validateVariableUsage(n,"normalMC","normalEC","fragment"),validateVariableUsage(n,"tangentMC","tangentEC","fragment"),validateVariableUsage(n,"bitangentMC","bitangentEC","fragment")}function TextureUniform(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.typedArray=e.typedArray,this.width=e.width,this.height=e.height,this.pixelFormat=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),this.pixelDatatype=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE);let t=e.url;"string"==typeof t&&(t=Resource.createIfNeeded(t)),this.resource=t;const n=defaultValue(e.repeat,!0)?TextureWrap$1.REPEAT:TextureWrap$1.CLAMP_TO_EDGE;this.sampler=new Sampler({wrapS:n,wrapT:n,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy})}TextureManager.prototype.getTexture=function(e){return this._textures[e]},TextureManager.prototype.loadTexture2D=function(e,t){defined(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):fetchTexture2D(this,e,t)},TextureManager.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;const t=e.context;this._defaultTexture=t.defaultTexture;const n=this._loadedImages;for(let e=0;e<n.length;e++){createTexture(this,n[e],t)}n.length=0},TextureManager.prototype.isDestroyed=function(){return!1},TextureManager.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}return destroyObject(this)},CustomShader.prototype.setUniform=function(e,t){const n=this.uniforms[e];n.type===UniformType$1.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):defined(t.clone)?n.value=t.clone(n.value):n.value=t},CustomShader.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)},CustomShader.prototype.isDestroyed=function(){return!1},CustomShader.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),destroyObject(this)};const VaryingType={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",MAT2:"mat2",MAT3:"mat2",MAT4:"mat4"};var VaryingType$1=Object.freeze(VaryingType),DepthViewPacked="uniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat z_window = czm_unpackDepth(texture2D(u_depthTexture, v_textureCoordinates));\nz_window = czm_reverseLogDepth(z_window);\nfloat n_range = czm_depthRange.near;\nfloat f_range = czm_depthRange.far;\nfloat z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\nfloat scale = pow(z_ndc * 0.5 + 0.5, 8.0);\ngl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";const svgNS="http://www.w3.org/2000/svg",xlinkNS="http://www.w3.org/1999/xlink";let widgetForDrag;const gradientEnabledColor0=Color.fromCssColorString("rgba(247,250,255,0.384)"),gradientEnabledColor1=Color.fromCssColorString("rgba(143,191,255,0.216)"),gradientEnabledColor2=Color.fromCssColorString("rgba(153,197,255,0.098)"),gradientEnabledColor3=Color.fromCssColorString("rgba(255,255,255,0.086)"),gradientDisabledColor0=Color.fromCssColorString("rgba(255,255,255,0.267)"),gradientDisabledColor1=Color.fromCssColorString("rgba(255,255,255,0)"),gradientKnobColor=Color.fromCssColorString("rgba(66,67,68,0.3)"),gradientPointerColor=Color.fromCssColorString("rgba(0,0,0,0.5)");function getElementColor(e){return Color.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const svgIconsById={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"},animation_pathPointer:{tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},animation_pathSwooshFX:{tagName:"path",d:"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"}};function svgFromObject(e){const t=document.createElementNS(svgNS,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&"tagName"!==n)if("children"===n){const n=e.children.length;for(let i=0;i<n;++i)t.appendChild(svgFromObject(e.children[i]))}else 0===n.indexOf("xlink:")?t.setAttributeNS(xlinkNS,n.substring(6),e[n]):"textContent"===n?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function svgText(e,t,n){const i=document.createElementNS(svgNS,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const r=document.createElementNS(svgNS,"tspan");return r.textContent=n,i.appendChild(r),i}function setShuttleRingPointer(e,t,n){e.setAttribute("transform","translate(100,100) rotate("+n+")"),t.setAttribute("transform","rotate("+n+")")}const makeColorStringScratch=new Color;function makeColorString(e,t){const n=t.alpha,i=1-n;return makeColorStringScratch.red=e.red*i+t.red*n,makeColorStringScratch.green=e.green*i+t.green*n,makeColorStringScratch.blue=e.blue*i+t.blue*n,makeColorStringScratch.toCssColorString()}function rectButton(e,t,n){const i=svgIconsById[n];return svgFromObject({tagName:"g",class:"cesium-animation-rectButton",transform:"translate("+e+","+t+")",children:[{tagName:"rect",class:"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect",class:"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]})}function wingButton(e,t,n){const i=svgIconsById[n],r=svgIconsById.animation_pathWingButton;return svgFromObject({tagName:"g",class:"cesium-animation-rectButton",transform:"translate("+e+","+t+")",children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:r.tagName,d:r.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:r.tagName,d:r.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]})}function setShuttleRingFromMouseOrTouch(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!i||widgetForDrag===e)if("mousedown"===t.type||i&&"mousemove"===t.type||"touchstart"===t.type&&1===t.touches.length||i&&"touchmove"===t.type&&1===t.touches.length){const r=e._centerX,o=e._centerY,a=e._svgNode.getBoundingClientRect();let s,c;if("touchstart"===t.type||"touchmove"===t.type?(s=t.touches[0].clientX,c=t.touches[0].clientY):(s=t.clientX,c=t.clientY),!i&&(s>a.right||s<a.left||c<a.top||c>a.bottom))return;const l=e._shuttleRingPointer.getBoundingClientRect(),u=s-r-a.left,d=c-o-a.top;let h=180*Math.atan2(d,u)/Math.PI+90;h>180&&(h-=360);const p=n.shuttleRingAngle;i||s<l.right&&s>l.left&&c>l.top&&c<l.bottom?(widgetForDrag=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=h):h<p?n.slower():h>p&&n.faster(),t.preventDefault()}else e===widgetForDrag&&(widgetForDrag=void 0),n.shuttleRingDragging=!1}function SvgButton(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const e=n._viewModel.command;e.canExecute&&e()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[subscribeAndEvaluate(t,"toggled",this.setToggled,this),subscribeAndEvaluate(t,"tooltip",this.setTooltip,this),subscribeAndEvaluate(t.command,"canExecute",this.setEnabled,this)]}function Animation(e,t){e=getElement(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;const n=e.ownerDocument,i=document.createElement("style");i.textContent=".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }",n.head.insertBefore(i,n.head.childNodes[0]);const r=document.createElement("div");r.className="cesium-animation-theme",r.innerHTML='<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>',this._theme=r,this._themeNormal=r.childNodes[0],this._themeHover=r.childNodes[1],this._themeSelect=r.childNodes[2],this._themeDisabled=r.childNodes[3],this._themeKnob=r.childNodes[4],this._themePointer=r.childNodes[5],this._themeSwoosh=r.childNodes[6],this._themeSwooshHover=r.childNodes[7];const o=document.createElementNS(svgNS,"svg:svg");this._svgNode=o,o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",xlinkNS);const a=document.createElementNS(svgNS,"g");this._topG=a,this._realtimeSVG=new SvgButton(wingButton(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new SvgButton(rectButton(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new SvgButton(rectButton(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new SvgButton(rectButton(84,99,"animation_pathPause"),t.pauseViewModel);const s=document.createElementNS(svgNS,"g");s.appendChild(this._realtimeSVG.svgElement),s.appendChild(this._playReverseSVG.svgElement),s.appendChild(this._playForwardSVG.svgElement),s.appendChild(this._pauseSVG.svgElement);const c=svgFromObject({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;const l=svgIconsById.animation_pathSwooshFX,u=svgIconsById.animation_pathPointer,d=svgFromObject({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:l.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:l.d},{tagName:l.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:l.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=d,this._shuttleRingPointer=svgFromObject({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:u.tagName,d:u.d});const h=svgFromObject({tagName:"g",transform:"translate(100,100)"});this._knobOuter=svgFromObject({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const p=svgFromObject({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:61});this._knobDate=svgText(0,-24,""),this._knobTime=svgText(0,-7,""),this._knobStatus=svgText(0,-41,"");const f=svgFromObject({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:61}),m=document.createElementNS(svgNS,"g");m.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(r),a.appendChild(m),a.appendChild(h),a.appendChild(s),m.appendChild(c),m.appendChild(d),m.appendChild(this._shuttleRingPointer),h.appendChild(this._knobOuter),h.appendChild(p),h.appendChild(this._knobDate),h.appendChild(this._knobTime),h.appendChild(this._knobStatus),h.appendChild(f),o.appendChild(a),e.appendChild(o);const g=this;function _(e){setShuttleRingFromMouseOrTouch(g,e)}this._mouseCallback=_,c.addEventListener("mousedown",_,!0),c.addEventListener("touchstart",_,!0),d.addEventListener("mousedown",_,!0),d.addEventListener("touchstart",_,!0),n.addEventListener("mousemove",_,!0),n.addEventListener("touchmove",_,!0),n.addEventListener("mouseup",_,!0),n.addEventListener("touchend",_,!0),n.addEventListener("touchcancel",_,!0),this._shuttleRingPointer.addEventListener("mousedown",_,!0),this._shuttleRingPointer.addEventListener("touchstart",_,!0),this._knobOuter.addEventListener("mousedown",_,!0),this._knobOuter.addEventListener("touchstart",_,!0);const y=this._knobTime.childNodes[0],C=this._knobDate.childNodes[0],T=this._knobStatus.childNodes[0];let S;this._subscriptions=[subscribeAndEvaluate(t.pauseViewModel,"toggled",(function(e){S!==e&&(S=e,S?g._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):g._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))})),subscribeAndEvaluate(t,"shuttleRingAngle",(function(e){setShuttleRingPointer(g._shuttleRingPointer,g._knobOuter,e)})),subscribeAndEvaluate(t,"dateLabel",(function(e){C.textContent!==e&&(C.textContent=e)})),subscribeAndEvaluate(t,"timeLabel",(function(e){y.textContent!==e&&(y.textContent=e)})),subscribeAndEvaluate(t,"multiplierLabel",(function(e){T.textContent!==e&&(T.textContent=e)}))],this.applyThemeChanges(),this.resize()}SvgButton.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);const e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();destroyObject(this)},SvgButton.prototype.isDestroyed=function(){return!1},SvgButton.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e)return void this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");if(this._toggled)return void this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");this.svgElement.setAttribute("class","cesium-animation-rectButton")}},SvgButton.prototype.setToggled=function(e){this._toggled!==e&&(this._toggled=e,this._enabled&&(e?this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"):this.svgElement.setAttribute("class","cesium-animation-rectButton")))},SvgButton.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e},Object.defineProperties(Animation.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),Animation.prototype.isDestroyed=function(){return!1},Animation.prototype.destroy=function(){defined(this._observer)&&(this._observer.disconnect(),this._observer=void 0);const e=this._container.ownerDocument,t=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",t,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",t,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",t,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",t,!0),e.removeEventListener("mousemove",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("mouseup",t,!0),e.removeEventListener("touchend",t,!0),e.removeEventListener("touchcancel",t,!0),this._shuttleRingPointer.removeEventListener("mousedown",t,!0),this._shuttleRingPointer.removeEventListener("touchstart",t,!0),this._knobOuter.removeEventListener("mousedown",t,!0),this._knobOuter.removeEventListener("touchstart",t,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();const n=this._subscriptions;for(let e=0,t=n.length;e<t;e++)n[e].dispose();return destroyObject(this)},Animation.prototype.resize=function(){const e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;const n=this._svgNode,i=200,r=132;let o=e,a=t;0===e&&0===t?(o=i,a=r):0===e?(a=t,o=i*(t/r)):0===t&&(o=e,a=r*(e/i));const s=o/i,c=a/r;n.style.cssText="width: "+o+"px; height: "+a+"px; position: absolute; bottom: 0; left: 0; overflow: hidden;",n.setAttribute("width",o),n.setAttribute("height",a),n.setAttribute("viewBox","0 0 "+o+" "+a),this._topG.setAttribute("transform","scale("+s+","+c+")"),this._centerX=Math.max(1,100*s),this._centerY=Math.max(1,100*c),this._lastHeight=e,this._lastWidth=t},Animation.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(defined(this._observer))return;const t=this;return t._observer=new MutationObserver((function(){e.body.contains(t._container)&&(t._observer.disconnect(),t._observer=void 0,t.applyThemeChanges())})),void t._observer.observe(e,{childList:!0,subtree:!0})}const t=getElementColor(this._themeNormal),n=getElementColor(this._themeHover),i=getElementColor(this._themeSelect),r=getElementColor(this._themeDisabled),o=getElementColor(this._themeKnob),a=getElementColor(this._themePointer),s=getElementColor(this._themeSwoosh),c=getElementColor(this._themeSwooshHover),l=svgFromObject({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(t,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(t,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(t,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(t,gradientEnabledColor3)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(n,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(n,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(n,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(n,gradientEnabledColor3)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(i,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(i,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(i,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(i,gradientEnabledColor3)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(r,gradientDisabledColor0)},{tagName:"stop",offset:"75%","stop-color":makeColorString(r,gradientDisabledColor1)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,in:"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":s.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":s.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":s.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":c.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":a.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":a.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":makeColorString(a,gradientPointerColor)},{tagName:"stop",offset:"100%","stop-color":makeColorString(a,gradientPointerColor)}]},{id:"animation_shuttleRingPointerPaused",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":"#CCC"},{tagName:"stop",offset:"40%","stop-color":"#CCC"},{tagName:"stop",offset:"60%","stop-color":"#555"},{tagName:"stop",offset:"100%","stop-color":"#555"}]},{id:"animation_knobOuter",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":makeColorString(o,gradientEnabledColor0)},{tagName:"stop",offset:"60%","stop-color":makeColorString(o,gradientKnobColor)},{tagName:"stop",offset:"85%","stop-color":makeColorString(o,gradientEnabledColor1)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":makeColorString(o,gradientKnobColor)},{tagName:"stop",offset:"60%","stop-color":makeColorString(o,gradientEnabledColor0)},{tagName:"stop",offset:"85%","stop-color":makeColorString(o,gradientEnabledColor3)}]}]});defined(this._defsElement)?this._svgNode.replaceChild(l,this._defsElement):this._svgNode.appendChild(l),this._defsElement=l};const monthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],realtimeShuttleRingAngle=15,maxShuttleRingAngle=105;function numberComparator(e,t){return e-t}function getTypicalMultiplierIndex(e,t){const n=binarySearch(t,e,numberComparator);return n<0?~n:n}function angleToMultiplier(e,t){if(Math.abs(e)<=realtimeShuttleRingAngle)return e/realtimeShuttleRingAngle;const n=realtimeShuttleRingAngle,i=maxShuttleRingAngle;let r;let o;return e>0?(r=Math.log(t[t.length-1]),o=(r-0)/(i-n),Math.exp(0+o*(e-n))):(r=Math.log(-t[0]),o=(r-0)/(i-n),-Math.exp(0+o*(Math.abs(e)-n)))}function multiplierToAngle(e,t,n){if(n.clockStep===ClockStep$1.SYSTEM_CLOCK)return realtimeShuttleRingAngle;if(Math.abs(e)<=1)return e*realtimeShuttleRingAngle;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const r=realtimeShuttleRingAngle,o=maxShuttleRingAngle;let a;let s;return e>0?(a=Math.log(i),s=(a-0)/(o-r),(Math.log(e)-0)/s+r):(a=Math.log(-t[0]),s=(a-0)/(o-r),-((Math.log(Math.abs(e))-0)/s+r))}function AnimationViewModel(e){const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=AnimationViewModel.defaultDateFormatter,this._timeFormatter=AnimationViewModel.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,knockout.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(AnimationViewModel.defaultTicks),this.timeLabel=void 0,knockout.defineProperty(this,"timeLabel",(function(){return t._timeFormatter(t._clockViewModel.currentTime,t)})),this.dateLabel=void 0,knockout.defineProperty(this,"dateLabel",(function(){return t._dateFormatter(t._clockViewModel.currentTime,t)})),this.multiplierLabel=void 0,knockout.defineProperty(this,"multiplierLabel",(function(){const e=t._clockViewModel;if(e.clockStep===ClockStep$1.SYSTEM_CLOCK)return"Today";const n=e.multiplier;return n%1==0?n.toFixed(0)+"x":n.toFixed(3).replace(/0{0,3}$/,"")+"x"})),this.shuttleRingAngle=void 0,knockout.defineProperty(this,"shuttleRingAngle",{get:function(){return multiplierToAngle(e.multiplier,t._allShuttleRingTicks,e)},set:function(e){e=Math.max(Math.min(e,maxShuttleRingAngle),-maxShuttleRingAngle);const n=t._allShuttleRingTicks,i=t._clockViewModel;if(i.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,Math.abs(e)===maxShuttleRingAngle)return void(i.multiplier=e>0?n[n.length-1]:n[0]);let r=angleToMultiplier(e,n);if(t.snapToTicks)r=n[getTypicalMultiplierIndex(r,n)];else if(0!==r){const e=Math.abs(r);if(e>100){const t=e.toFixed(0).length-2,n=Math.pow(10,t);r=Math.round(r/n)*n|0}else e>realtimeShuttleRingAngle?r=Math.round(r):e>1?r=+r.toFixed(1):e>0&&(r=+r.toFixed(2))}i.multiplier=r}}),this._canAnimate=void 0,knockout.defineProperty(this,"_canAnimate",(function(){const e=t._clockViewModel,n=e.clockRange;if(t.shuttleRingDragging||n===ClockRange$1.UNBOUNDED)return!0;const i=e.multiplier,r=e.currentTime,o=e.startTime;let a=!1;if(n===ClockRange$1.LOOP_STOP)a=JulianDate.greaterThan(r,o)||r.equals(o)&&i>0;else{const t=e.stopTime;a=JulianDate.greaterThan(r,o)&&JulianDate.lessThan(r,t)||r.equals(o)&&i>0||r.equals(t)&&i<0}return a||(e.shouldAnimate=!1),a})),this._isSystemTimeAvailable=void 0,knockout.defineProperty(this,"_isSystemTimeAvailable",(function(){const e=t._clockViewModel;if(e.clockRange===ClockRange$1.UNBOUNDED)return!0;const n=e.systemTime;return JulianDate.greaterThanOrEquals(n,e.startTime)&&JulianDate.lessThanOrEquals(n,e.stopTime)})),this._isAnimating=void 0,knockout.defineProperty(this,"_isAnimating",(function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)}));const n=createCommand((function(){const e=t._clockViewModel;e.shouldAnimate?e.shouldAnimate=!1:t._canAnimate&&(e.shouldAnimate=!0)}));this._pauseViewModel=new ToggleButtonViewModel(n,{toggled:knockout.computed((function(){return!t._isAnimating})),tooltip:"Pause"});const i=createCommand((function(){const e=t._clockViewModel,n=e.multiplier;n>0&&(e.multiplier=-n),e.shouldAnimate=!0}));this._playReverseViewModel=new ToggleButtonViewModel(i,{toggled:knockout.computed((function(){return t._isAnimating&&e.multiplier<0})),tooltip:"Play Reverse"});const r=createCommand((function(){const e=t._clockViewModel,n=e.multiplier;n<0&&(e.multiplier=-n),e.shouldAnimate=!0}));this._playForwardViewModel=new ToggleButtonViewModel(r,{toggled:knockout.computed((function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==ClockStep$1.SYSTEM_CLOCK})),tooltip:"Play Forward"});const o=createCommand((function(){t._clockViewModel.clockStep=ClockStep$1.SYSTEM_CLOCK}),knockout.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new ToggleButtonViewModel(o,{toggled:knockout.computed((function(){return e.clockStep===ClockStep$1.SYSTEM_CLOCK})),tooltip:knockout.computed((function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"}))}),this._slower=createCommand((function(){const e=t._clockViewModel,n=t._allShuttleRingTicks,i=getTypicalMultiplierIndex(e.multiplier,n)-1;i>=0&&(e.multiplier=n[i])})),this._faster=createCommand((function(){const e=t._clockViewModel,n=t._allShuttleRingTicks,i=getTypicalMultiplierIndex(e.multiplier,n)+1;i<n.length&&(e.multiplier=n[i])}))}function BaseLayerPickerViewModel(e){const t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).globe,n=defaultValue(e.imageryProviderViewModels,[]),i=defaultValue(e.terrainProviderViewModels,[]);this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,knockout.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const r=knockout.getObservable(this,"imageryProviderViewModels"),o=knockout.pureComputed((function(){const e=r(),t={};let n;for(n=0;n<e.length;n++){const i=e[n],r=i.category;defined(t[r])?t[r].push(i):t[r]=[i]}const i=Object.keys(t),o=[];for(n=0;n<i.length;n++){const e=i[n];o.push({name:e,providers:t[e]})}return o}));this._imageryProviders=o;const a=knockout.getObservable(this,"terrainProviderViewModels"),s=knockout.pureComputed((function(){const e=a(),t={};let n;for(n=0;n<e.length;n++){const i=e[n],r=i.category;defined(t[r])?t[r].push(i):t[r]=[i]}const i=Object.keys(t),r=[];for(n=0;n<i.length;n++){const e=i[n];r.push({name:e,providers:t[e]})}return r}));this._terrainProviders=s,this.buttonTooltip=void 0,knockout.defineProperty(this,"buttonTooltip",(function(){const e=this.selectedImagery,t=this.selectedTerrain,n=defined(e)?e.name:void 0,i=defined(t)?t.name:void 0;return defined(n)&&defined(i)?n+"\n"+i:defined(n)?n:i})),this.buttonImageUrl=void 0,knockout.defineProperty(this,"buttonImageUrl",(function(){const e=this.selectedImagery;if(defined(e))return e.iconUrl})),this.selectedImagery=void 0;const c=knockout.observable();this._currentImageryProviders=[],knockout.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(e){if(c()===e)return void(this.dropDownVisible=!1);let t;const n=this._currentImageryProviders,i=n.length,r=this._globe.imageryLayers;let o=!1;for(t=0;t<i;t++){const e=r.length;for(let i=0;i<e;i++){const e=r.get(i);if(e.imageryProvider===n[t]){r.remove(e),o=!0;break}}}if(defined(e)){const n=e.creationCommand();if(Array.isArray(n)){for(t=n.length-1;t>=0;t--)r.addImageryProvider(n[t],0);this._currentImageryProviders=n.slice(0)}else if(this._currentImageryProviders=[n],o)r.addImageryProvider(n,0);else{const e=r.get(0);defined(e)&&r.remove(e),r.addImageryProvider(n,0)}}c(e),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const l=knockout.observable();knockout.defineProperty(this,"selectedTerrain",{get:function(){return l()},set:function(e){if(l()===e)return void(this.dropDownVisible=!1);let t;defined(e)&&(t=e.creationCommand()),this._globe.depthTestAgainstTerrain=!(t instanceof EllipsoidTerrainProvider),this._globe.terrainProvider=t,l(e),this.dropDownVisible=!1}});const u=this;this._toggleDropDown=createCommand((function(){u.dropDownVisible=!u.dropDownVisible})),this.selectedImagery=defaultValue(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=defaultValue(e.selectedTerrainProviderViewModel,i[0])}function BaseLayerPicker(e,t){e=getElement(e);const n=new BaseLayerPickerViewModel(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);const r=document.createElement("img");r.setAttribute("draggable","false"),r.className="cesium-baseLayerPicker-selected",r.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(r);const o=document.createElement("div");o.className="cesium-baseLayerPicker-dropDown",o.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(o);const a=document.createElement("div");a.className="cesium-baseLayerPicker-sectionTitle",a.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),a.innerHTML="Imagery",o.appendChild(a);const s=document.createElement("div");s.className="cesium-baseLayerPicker-section",s.setAttribute("data-bind","foreach: _imageryProviders"),o.appendChild(s);const c=document.createElement("div");c.className="cesium-baseLayerPicker-category",s.appendChild(c);const l=document.createElement("div");l.className="cesium-baseLayerPicker-categoryTitle",l.setAttribute("data-bind","text: name"),c.appendChild(l);const u=document.createElement("div");u.className="cesium-baseLayerPicker-choices",u.setAttribute("data-bind","foreach: providers"),c.appendChild(u);const d=document.createElement("div");d.className="cesium-baseLayerPicker-item",d.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),u.appendChild(d);const h=document.createElement("img");h.className="cesium-baseLayerPicker-itemIcon",h.setAttribute("data-bind","attr: { src: iconUrl }"),h.setAttribute("draggable","false"),d.appendChild(h);const p=document.createElement("div");p.className="cesium-baseLayerPicker-itemLabel",p.setAttribute("data-bind","text: name"),d.appendChild(p);const f=document.createElement("div");f.className="cesium-baseLayerPicker-sectionTitle",f.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),f.innerHTML="Terrain",o.appendChild(f);const m=document.createElement("div");m.className="cesium-baseLayerPicker-section",m.setAttribute("data-bind","foreach: _terrainProviders"),o.appendChild(m);const g=document.createElement("div");g.className="cesium-baseLayerPicker-category",m.appendChild(g);const _=document.createElement("div");_.className="cesium-baseLayerPicker-categoryTitle",_.setAttribute("data-bind","text: name"),g.appendChild(_);const y=document.createElement("div");y.className="cesium-baseLayerPicker-choices",y.setAttribute("data-bind","foreach: providers"),g.appendChild(y);const C=document.createElement("div");C.className="cesium-baseLayerPicker-item",C.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),y.appendChild(C);const T=document.createElement("img");T.className="cesium-baseLayerPicker-itemIcon",T.setAttribute("data-bind","attr: { src: iconUrl }"),T.setAttribute("draggable","false"),C.appendChild(T);const S=document.createElement("div");S.className="cesium-baseLayerPicker-itemLabel",S.setAttribute("data-bind","text: name"),C.appendChild(S),knockout.applyBindings(n,i),knockout.applyBindings(n,o),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=o,this._closeDropDown=function(e){i.contains(e.target)||o.contains(e.target)||(n.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function ProviderViewModel(e){let t=e.creationFunction;defined(t.canExecute)||(t=createCommand(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=defaultValue(e.category,""),knockout.track(this,["name","tooltip","iconUrl"])}function createDefaultImageryProviderViewModels(){const e=[];return e.push(new ProviderViewModel({name:"Bing Maps Aerial",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return createWorldImagery({style:IonWorldImageryStyle$1.AERIAL})}})),e.push(new ProviderViewModel({name:"Bing Maps Aerial with Labels",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return createWorldImagery({style:IonWorldImageryStyle$1.AERIAL_WITH_LABELS})}})),e.push(new ProviderViewModel({name:"Bing Maps Roads",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return createWorldImagery({style:IonWorldImageryStyle$1.ROAD})}})),e.push(new ProviderViewModel({name:"ESRI World Imagery",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/esriWorldImagery.png"),tooltip:"World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been contributed by the GIS User Community.\nhttp://www.esri.com",category:"Other",creationFunction:function(){return new ArcGisMapServerImageryProvider({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new ProviderViewModel({name:"ESRI World Street Map",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"),tooltip:"This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.\nhttp://www.esri.com",category:"Other",creationFunction:function(){return new ArcGisMapServerImageryProvider({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new ProviderViewModel({name:"ESRI National Geographic",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/esriNationalGeographic.png"),tooltip:"This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.\nhttp://www.esri.com",category:"Other",creationFunction:function(){return new ArcGisMapServerImageryProvider({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new ProviderViewModel({name:"Open­Street­Map",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:"OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org",category:"Other",creationFunction:function(){return new OpenStreetMapImageryProvider({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new ProviderViewModel({name:"Stamen Watercolor",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:"Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.\nhttp://maps.stamen.com",category:"Other",creationFunction:function(){return new OpenStreetMapImageryProvider({url:"https://stamen-tiles.a.ssl.fastly.net/watercolor/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ProviderViewModel({name:"Stamen Toner",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:"A high contrast black and white map.\nhttp://maps.stamen.com",category:"Other",creationFunction:function(){return new OpenStreetMapImageryProvider({url:"https://stamen-tiles.a.ssl.fastly.net/toner/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ProviderViewModel({name:"Sentinel-2",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return new IonImageryProvider({assetId:3954})}})),e.push(new ProviderViewModel({name:"Blue Marble",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new IonImageryProvider({assetId:3845})}})),e.push(new ProviderViewModel({name:"Earth at night",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return new IonImageryProvider({assetId:3812})}})),e.push(new ProviderViewModel({name:"Natural Earth II",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:"Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/",category:"Cesium ion",creationFunction:function(){return new TileMapServiceImageryProvider({url:buildModuleUrl("Assets/Textures/NaturalEarthII")})}})),e}function createDefaultTerrainProviderViewModels(){const e=[];return e.push(new ProviderViewModel({name:"WGS84 Ellipsoid",iconUrl:buildModuleUrl("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new EllipsoidTerrainProvider}})),e.push(new ProviderViewModel({name:"Cesium World Terrain",iconUrl:buildModuleUrl("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return createWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0})}})),e}function getPickTileset(e){return function(t){const n=e._scene.pick(t.position);defined(n)&&n.primitive instanceof Cesium3DTileset&&(e.tileset=n.primitive),e.pickActive=!1}}function selectTilesetOnHover(e,t){t?e._eventHandler.setInputAction((function(t){const n=e._scene.pick(t.endPosition);defined(n)&&n.primitive instanceof Cesium3DTileset&&(e.tileset=n.primitive)}),ScreenSpaceEventType$1.MOUSE_MOVE):(e._eventHandler.removeInputAction(ScreenSpaceEventType$1.MOUSE_MOVE),e.picking=e.picking)}AnimationViewModel.defaultDateFormatter=function(e,t){const n=JulianDate.toGregorianDate(e);return monthNames[n.month-1]+" "+n.day+" "+n.year},AnimationViewModel.defaultTicks=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800],AnimationViewModel.defaultTimeFormatter=function(e,t){const n=JulianDate.toGregorianDate(e),i=Math.round(n.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?n.hour.toString().padStart(2,"0")+":"+n.minute.toString().padStart(2,"0")+":"+n.second.toString().padStart(2,"0")+"."+i.toString().padStart(3,"0"):n.hour.toString().padStart(2,"0")+":"+n.minute.toString().padStart(2,"0")+":"+n.second.toString().padStart(2,"0")+" UTC"},AnimationViewModel.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)},AnimationViewModel.prototype.setShuttleRingTicks=function(e){let t,n,i;const r={},o=this._sortedFilteredPositiveTicks;for(o.length=0,t=0,n=e.length;t<n;++t)i=e[t],r.hasOwnProperty(i)||(r[i]=!0,o.push(i));o.sort(numberComparator);const a=[];for(n=o.length,t=n-1;t>=0;--t)i=o[t],0!==i&&a.push(-i);Array.prototype.push.apply(a,o),this._allShuttleRingTicks=a},Object.defineProperties(AnimationViewModel.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){this._timeFormatter=e}}}),AnimationViewModel._maxShuttleRingAngle=maxShuttleRingAngle,AnimationViewModel._realtimeShuttleRingAngle=realtimeShuttleRingAngle,Object.defineProperties(BaseLayerPickerViewModel.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}}),Object.defineProperties(BaseLayerPicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),BaseLayerPicker.prototype.isDestroyed=function(){return!1},BaseLayerPicker.prototype.destroy=function(){return FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._element),knockout.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),destroyObject(this)},Object.defineProperties(ProviderViewModel.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});const stringOptions={maximumFractionDigits:3};function formatMemoryString(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions):Math.round(t).toLocaleString()}function getStatistics(e,t){if(!defined(e))return"";const n=t?e._statisticsPerPass[Cesium3DTilePass$1.PICK]:e._statisticsPerPass[Cesium3DTilePass$1.RENDER];let i='<ul class="cesium-cesiumInspector-statistics">';return i+="<li><strong>Visited: </strong>"+n.visited.toLocaleString()+"</li><li><strong>Selected: </strong>"+n.selected.toLocaleString()+"</li><li><strong>Commands: </strong>"+n.numberOfCommands.toLocaleString()+"</li>",i+="</ul>",t||(i+='<ul class="cesium-cesiumInspector-statistics">',i+="<li><strong>Requests: </strong>"+n.numberOfPendingRequests.toLocaleString()+"</li><li><strong>Attempted: </strong>"+n.numberOfAttemptedRequests.toLocaleString()+"</li><li><strong>Processing: </strong>"+n.numberOfTilesProcessing.toLocaleString()+"</li><li><strong>Content Ready: </strong>"+n.numberOfTilesWithContentReady.toLocaleString()+"</li><li><strong>Total: </strong>"+n.numberOfTilesTotal.toLocaleString()+"</li>",i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+="<li><strong>Features Selected: </strong>"+n.numberOfFeaturesSelected.toLocaleString()+"</li><li><strong>Features Loaded: </strong>"+n.numberOfFeaturesLoaded.toLocaleString()+"</li><li><strong>Points Selected: </strong>"+n.numberOfPointsSelected.toLocaleString()+"</li><li><strong>Points Loaded: </strong>"+n.numberOfPointsLoaded.toLocaleString()+"</li><li><strong>Triangles Selected: </strong>"+n.numberOfTrianglesSelected.toLocaleString()+"</li>",i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+="<li><strong>Tiles styled: </strong>"+n.numberOfTilesStyled.toLocaleString()+"</li><li><strong>Features styled: </strong>"+n.numberOfFeaturesStyled.toLocaleString()+"</li>",i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+="<li><strong>Children Union Culled: </strong>"+n.numberOfTilesCulledWithChildrenUnion.toLocaleString()+"</li>",i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+="<li><strong>Geometry Memory (MB): </strong>"+formatMemoryString(n.geometryByteLength)+"</li><li><strong>Texture Memory (MB): </strong>"+formatMemoryString(n.texturesByteLength)+"</li><li><strong>Batch Table Memory (MB): </strong>"+formatMemoryString(n.batchTableByteLength)+"</li>",i+="</ul>"),i}const colorBlendModes=[{text:"Highlight",value:Cesium3DTileColorBlendMode$1.HIGHLIGHT},{text:"Replace",value:Cesium3DTileColorBlendMode$1.REPLACE},{text:"Mix",value:Cesium3DTileColorBlendMode$1.MIX}],highlightColor=new Color(1,1,0,.4),scratchColor=new Color,oldColor=new Color;function Cesium3DTilesInspectorViewModel(e,t){const n=this,i=e.canvas;this._eventHandler=new ScreenSpaceEventHandler(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new PerformanceDisplay({container:t}),this._statisticsText="",this._pickStatisticsText="",this._editorError="",this.performance=!1,this.showStatistics=!0,this.showPickStatistics=!0,this.inspectorVisible=!0,this.tilesetVisible=!1,this.displayVisible=!1,this.updateVisible=!1,this.loggingVisible=!1,this.styleVisible=!1,this.tileDebugLabelsVisible=!1,this.optimizationVisible=!1,this.styleString="{}",this._tileset=void 0,this._feature=void 0,this._tile=void 0,knockout.track(this,["performance","inspectorVisible","_statisticsText","_pickStatisticsText","_editorError","showPickStatistics","showStatistics","tilesetVisible","displayVisible","updateVisible","loggingVisible","styleVisible","optimizationVisible","tileDebugLabelsVisible","styleString","_feature","_tile"]),this._properties=knockout.observable({}),this.properties=[],knockout.defineProperty(this,"properties",(function(){const e=[],t=n._properties();for(const n in t)t.hasOwnProperty(n)&&e.push(n);return e}));const r=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return r()},set:function(e){r(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceError=e)}}),this.dynamicScreenSpaceError=!1;const o=knockout.observable();knockout.defineProperty(this,"colorBlendMode",{get:function(){return o()},set:function(e){o(e),defined(n._tileset)&&(n._tileset.colorBlendMode=e,n._scene.requestRender())}}),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT;const a=knockout.observable(),s=knockout.observable();knockout.defineProperty(this,"picking",{get:function(){return s()},set:function(t){s(t),t?n._eventHandler.setInputAction((function(t){const i=e.pick(t.endPosition);if(i instanceof Cesium3DTileFeature?(n.feature=i,n.tile=i.content.tile):defined(i)&&defined(i.content)?(n.feature=void 0,n.tile=i.content.tile):(n.feature=void 0,n.tile=void 0),defined(n._tileset)){if(a&&defined(i)&&defined(i.content)){let r;e.pickPositionSupported&&(r=e.pickPosition(t.endPosition),defined(r)&&(n._tileset.debugPickPosition=r)),n._tileset.debugPickedTile=i.content.tile}else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}}),ScreenSpaceEventType$1.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(ScreenSpaceEventType$1.MOUSE_MOVE))}}),this.picking=!0;const c=knockout.observable();knockout.defineProperty(this,"colorize",{get:function(){return c()},set:function(e){c(e),defined(n._tileset)&&(n._tileset.debugColorizeTiles=e,n._scene.requestRender())}}),this.colorize=!1;const l=knockout.observable();knockout.defineProperty(this,"wireframe",{get:function(){return l()},set:function(e){l(e),defined(n._tileset)&&(n._tileset.debugWireframe=e,n._scene.requestRender())}}),this.wireframe=!1;const u=knockout.observable();knockout.defineProperty(this,"showBoundingVolumes",{get:function(){return u()},set:function(e){u(e),defined(n._tileset)&&(n._tileset.debugShowBoundingVolume=e,n._scene.requestRender())}}),this.showBoundingVolumes=!1;const d=knockout.observable();knockout.defineProperty(this,"showContentBoundingVolumes",{get:function(){return d()},set:function(e){d(e),defined(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=e,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;const h=knockout.observable();knockout.defineProperty(this,"showRequestVolumes",{get:function(){return h()},set:function(e){h(e),defined(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=e,n._scene.requestRender())}}),this.showRequestVolumes=!1;const p=knockout.observable();knockout.defineProperty(this,"freezeFrame",{get:function(){return p()},set:function(e){p(e),defined(n._tileset)&&(n._tileset.debugFreezeFrame=e,n._scene.debugShowFrustumPlanes=e,n._scene.requestRender())}}),this.freezeFrame=!1,knockout.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return a()},set:function(e){a(e),defined(n._tileset)&&(n._tileset.debugPickedTileLabelOnly=e,n._scene.requestRender())}}),this.showOnlyPickedTileDebugLabel=!1;const f=knockout.observable();knockout.defineProperty(this,"showGeometricError",{get:function(){return f()},set:function(e){f(e),defined(n._tileset)&&(n._tileset.debugShowGeometricError=e,n._scene.requestRender())}}),this.showGeometricError=!1;const m=knockout.observable();knockout.defineProperty(this,"showRenderingStatistics",{get:function(){return m()},set:function(e){m(e),defined(n._tileset)&&(n._tileset.debugShowRenderingStatistics=e,n._scene.requestRender())}}),this.showRenderingStatistics=!1;const g=knockout.observable();knockout.defineProperty(this,"showMemoryUsage",{get:function(){return g()},set:function(e){g(e),defined(n._tileset)&&(n._tileset.debugShowMemoryUsage=e,n._scene.requestRender())}}),this.showMemoryUsage=!1;const _=knockout.observable();knockout.defineProperty(this,"showUrl",{get:function(){return _()},set:function(e){_(e),defined(n._tileset)&&(n._tileset.debugShowUrl=e,n._scene.requestRender())}}),this.showUrl=!1;const y=knockout.observable();knockout.defineProperty(this,"maximumScreenSpaceError",{get:function(){return y()},set:function(e){e=Number(e),isNaN(e)||(y(e),defined(n._tileset)&&(n._tileset.maximumScreenSpaceError=e))}}),this.maximumScreenSpaceError=16;const C=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceErrorDensity",{get:function(){return C()},set:function(e){e=Number(e),isNaN(e)||(C(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorDensity=e))}}),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorDensitySliderValue=void 0,knockout.defineProperty(this,"dynamicScreenSpaceErrorDensitySliderValue",{get:function(){return Math.pow(C(),1/6)},set:function(e){C(Math.pow(e,6))}});const T=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceErrorFactor",{get:function(){return T()},set:function(e){e=Number(e),isNaN(e)||(T(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorFactor=e))}}),this.dynamicScreenSpaceErrorFactor=4;const S=getPickTileset(this),A=knockout.observable();knockout.defineProperty(this,"pickActive",{get:function(){return A()},set:function(e){A(e),e?n._eventHandler.setInputAction(S,ScreenSpaceEventType$1.LEFT_CLICK):n._eventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)}});const v=knockout.observable();knockout.defineProperty(this,"pointCloudShading",{get:function(){return v()},set:function(e){v(e),defined(n._tileset)&&(n._tileset.pointCloudShading.attenuation=e)}}),this.pointCloudShading=!1;const E=knockout.observable();knockout.defineProperty(this,"geometricErrorScale",{get:function(){return E()},set:function(e){e=Number(e),isNaN(e)||(E(e),defined(n._tileset)&&(n._tileset.pointCloudShading.geometricErrorScale=e))}}),this.geometricErrorScale=1;const b=knockout.observable();knockout.defineProperty(this,"maximumAttenuation",{get:function(){return b()},set:function(e){e=Number(e),isNaN(e)||(b(e),defined(n._tileset)&&(n._tileset.pointCloudShading.maximumAttenuation=0===e?void 0:e))}}),this.maximumAttenuation=0;const x=knockout.observable();knockout.defineProperty(this,"baseResolution",{get:function(){return x()},set:function(e){e=Number(e),isNaN(e)||(x(e),defined(n._tileset)&&(n._tileset.pointCloudShading.baseResolution=0===e?void 0:e))}}),this.baseResolution=0;const P=knockout.observable();knockout.defineProperty(this,"eyeDomeLighting",{get:function(){return P()},set:function(e){P(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLighting=e)}}),this.eyeDomeLighting=!1;const D=knockout.observable();knockout.defineProperty(this,"eyeDomeLightingStrength",{get:function(){return D()},set:function(e){e=Number(e),isNaN(e)||(D(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingStrength=e))}}),this.eyeDomeLightingStrength=1;const w=knockout.observable();knockout.defineProperty(this,"eyeDomeLightingRadius",{get:function(){return w()},set:function(e){e=Number(e),isNaN(e)||(w(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingRadius=e))}}),this.eyeDomeLightingRadius=1,this.pickActive=!1;const M=knockout.observable();knockout.defineProperty(this,"skipLevelOfDetail",{get:function(){return M()},set:function(e){M(e),defined(n._tileset)&&(n._tileset.skipLevelOfDetail=e)}}),this.skipLevelOfDetail=!0;const I=knockout.observable();knockout.defineProperty(this,"skipScreenSpaceErrorFactor",{get:function(){return I()},set:function(e){e=Number(e),isNaN(e)||(I(e),defined(n._tileset)&&(n._tileset.skipScreenSpaceErrorFactor=e))}}),this.skipScreenSpaceErrorFactor=16;const R=knockout.observable();knockout.defineProperty(this,"baseScreenSpaceError",{get:function(){return R()},set:function(e){e=Number(e),isNaN(e)||(R(e),defined(n._tileset)&&(n._tileset.baseScreenSpaceError=e))}}),this.baseScreenSpaceError=1024;const O=knockout.observable();knockout.defineProperty(this,"skipLevels",{get:function(){return O()},set:function(e){e=Number(e),isNaN(e)||(O(e),defined(n._tileset)&&(n._tileset.skipLevels=e))}}),this.skipLevels=1;const B=knockout.observable();knockout.defineProperty(this,"immediatelyLoadDesiredLevelOfDetail",{get:function(){return B()},set:function(e){B(e),defined(n._tileset)&&(n._tileset.immediatelyLoadDesiredLevelOfDetail=e)}}),this.immediatelyLoadDesiredLevelOfDetail=!1;const L=knockout.observable();knockout.defineProperty(this,"loadSiblings",{get:function(){return L()},set:function(e){L(e),defined(n._tileset)&&(n._tileset.loadSiblings=e)}}),this.loadSiblings=!1,this._style=void 0,this._shouldStyle=!1,this._definedProperties=["properties","dynamicScreenSpaceError","colorBlendMode","picking","colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","maximumScreenSpaceError","dynamicScreenSpaceErrorDensity","baseScreenSpaceError","skipScreenSpaceErrorFactor","skipLevelOfDetail","skipLevels","immediatelyLoadDesiredLevelOfDetail","loadSiblings","dynamicScreenSpaceErrorDensitySliderValue","dynamicScreenSpaceErrorFactor","pickActive","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl","pointCloudShading","geometricErrorScale","maximumAttenuation","baseResolution","eyeDomeLighting","eyeDomeLightingStrength","eyeDomeLightingRadius"],this._removePostRenderEvent=e.postRender.addEventListener((function(){n._update()})),defined(this._tileset)||selectTilesetOnHover(this,!0)}function hasFeatures(e){if(e.featuresLength>0)return!0;const t=e.innerContents;if(defined(t)){const e=t.length;for(let n=0;n<e;++n)if(!hasFeatures(t[n]))return!1;return!0}return!1}function Cesium3DTilesInspector(e,t){e=getElement(e);const n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");const r=new Cesium3DTilesInspectorViewModel(t,i);this._viewModel=r,this._container=e,this._element=n;const o=document.createElement("div");o.textContent="3D Tiles Inspector",o.className="cesium-cesiumInspector-button",o.setAttribute("data-bind","click: toggleInspector"),n.appendChild(o),n.className="cesium-cesiumInspector cesium-3DTilesInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(n);const a=document.createElement("div");this._panel=a,a.className="cesium-cesiumInspector-dropDown",n.appendChild(a);const s=InspectorShared.createSection,c=InspectorShared.createCheckbox,l=s(a,"Tileset","tilesetVisible","toggleTileset"),u=s(a,"Display","displayVisible","toggleDisplay"),d=s(a,"Update","updateVisible","toggleUpdate"),h=s(a,"Logging","loggingVisible","toggleLogging"),p=s(a,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),f=s(a,"Style","styleVisible","toggleStyle"),m=s(a,"Optimization","optimizationVisible","toggleOptimization"),g=document.createElement("div");g.className="field-group";const _=document.createElement("label");_.className="field-label",_.appendChild(document.createTextNode("Properties: "));const y=document.createElement("div");y.setAttribute("data-bind","text: properties"),g.appendChild(_),g.appendChild(y),l.appendChild(g),l.appendChild(makeButton("togglePickTileset","Pick Tileset","pickActive")),l.appendChild(makeButton("trimTilesCache","Trim Tiles Cache")),l.appendChild(c("Enable Picking","picking")),u.appendChild(c("Colorize","colorize")),u.appendChild(c("Wireframe","wireframe")),u.appendChild(c("Bounding Volumes","showBoundingVolumes")),u.appendChild(c("Content Volumes","showContentBoundingVolumes")),u.appendChild(c("Request Volumes","showRequestVolumes")),u.appendChild(c("Point Cloud Shading","pointCloudShading"));const C=document.createElement("div");C.setAttribute("data-bind","visible: pointCloudShading"),C.appendChild(makeRangeInput("geometricErrorScale",0,2,.01,"Geometric Error Scale")),C.appendChild(makeRangeInput("maximumAttenuation",0,32,1,"Maximum Attenuation")),C.appendChild(makeRangeInput("baseResolution",0,1,.01,"Base Resolution")),C.appendChild(c("Eye Dome Lighting (EDL)","eyeDomeLighting")),u.appendChild(C);const T=document.createElement("div");T.setAttribute("data-bind","visible: eyeDomeLighting"),T.appendChild(makeRangeInput("eyeDomeLightingStrength",0,2,.1,"EDL Strength")),T.appendChild(makeRangeInput("eyeDomeLightingRadius",0,4,.1,"EDL Radius")),C.appendChild(T),d.appendChild(c("Freeze Frame","freezeFrame")),d.appendChild(c("Dynamic Screen Space Error","dynamicScreenSpaceError"));const S=document.createElement("div");S.appendChild(makeRangeInput("maximumScreenSpaceError",0,128,1,"Maximum Screen Space Error")),d.appendChild(S);const A=document.createElement("div");A.setAttribute("data-bind","visible: dynamicScreenSpaceError"),A.appendChild(makeRangeInput("dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"Screen Space Error Density","dynamicScreenSpaceErrorDensity")),A.appendChild(makeRangeInput("dynamicScreenSpaceErrorFactor",1,10,.1,"Screen Space Error Factor")),d.appendChild(A),h.appendChild(c("Performance","performance")),h.appendChild(i),h.appendChild(c("Statistics","showStatistics"));const v=document.createElement("div");v.className="cesium-3dTilesInspector-statistics",v.setAttribute("data-bind","html: statisticsText, visible: showStatistics"),h.appendChild(v),h.appendChild(c("Pick Statistics","showPickStatistics"));const E=document.createElement("div");E.className="cesium-3dTilesInspector-statistics",E.setAttribute("data-bind","html: pickStatisticsText, visible: showPickStatistics"),h.appendChild(E);const b=document.createElement("div");f.appendChild(b),b.appendChild(document.createTextNode("Color Blend Mode: "));const x=document.createElement("select");x.setAttribute("data-bind",'options: colorBlendModes, optionsText: "text", optionsValue: "value", value: colorBlendMode'),b.appendChild(x);const P=document.createElement("textarea");P.setAttribute("data-bind","textInput: styleString, event: { keydown: styleEditorKeyPress }"),b.className="cesium-cesiumInspector-styleEditor",b.appendChild(P);const D=makeButton("compileStyle","Compile (Ctrl+Enter)");b.appendChild(D);const w=document.createElement("div");w.className="cesium-cesiumInspector-error",w.setAttribute("data-bind","text: editorError"),b.appendChild(w),p.appendChild(c("Show Picked Only","showOnlyPickedTileDebugLabel")),p.appendChild(c("Geometric Error","showGeometricError")),p.appendChild(c("Rendering Statistics","showRenderingStatistics")),p.appendChild(c("Memory Usage (MB)","showMemoryUsage")),p.appendChild(c("Url","showUrl")),m.appendChild(c("Skip Tile LODs","skipLevelOfDetail"));const M=document.createElement("div");M.appendChild(makeRangeInput("skipScreenSpaceErrorFactor",1,50,1,"Skip SSE Factor")),m.appendChild(M);const I=document.createElement("div");I.appendChild(makeRangeInput("baseScreenSpaceError",0,4096,1,"SSE before skipping LOD")),m.appendChild(I);const R=document.createElement("div");R.appendChild(makeRangeInput("skipLevels",0,10,1,"Min. levels to skip")),m.appendChild(R),m.appendChild(c("Load only tiles that meet the max SSE.","immediatelyLoadDesiredLevelOfDetail")),m.appendChild(c("Load siblings of visible tiles","loadSiblings")),knockout.applyBindings(r,n)}function makeRangeInput(e,t,n,i,r,o){o=defaultValue(o,e);const a=document.createElement("input");a.setAttribute("data-bind","value: "+o),a.type="number";const s=document.createElement("input");s.type="range",s.min=t,s.max=n,s.step=i,s.setAttribute("data-bind",'valueUpdate: "input", value: '+e);const c=document.createElement("div");c.appendChild(s);const l=document.createElement("div");return l.className="cesium-cesiumInspector-slider",l.appendChild(document.createTextNode(r)),l.appendChild(a),l.appendChild(c),l}function makeButton(e,t,n){const i=document.createElement("button");i.type="button",i.textContent=t,i.className="cesium-cesiumInspector-pickButton";let r="click: "+e;return defined(n)&&(r+=', css: {"cesium-cesiumInspector-pickButtonHighlight" : '+n+"}"),i.setAttribute("data-bind",r),i}function frustumStatisticsToString(e){let t;if(defined(e)){t="Command Statistics";const n=e.commandsInFrustums;for(const e in n)if(n.hasOwnProperty(e)){let i,r=parseInt(e,10);if(7===r)i="1, 2 and 3";else{const e=[];for(let t=2;t>=0;t--){const n=Math.pow(2,t);r>=n&&(e.push(t+1),r-=n)}i=e.reverse().join(" and ")}t+="<br>&nbsp;&nbsp;&nbsp;&nbsp;"+n[e]+" in frustum "+i}t+="<br>Total: "+e.totalCommands}return t}function boundDepthFrustum(e,t,n){let i=Math.min(n,t);return i=Math.max(i,e),i}Object.defineProperties(Cesium3DTilesInspectorViewModel.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},statisticsText:{get:function(){return this._statisticsText}},pickStatisticsText:{get:function(){return this._pickStatisticsText}},colorBlendModes:{get:function(){return colorBlendModes}},editorError:{get:function(){return this._editorError}},tileset:{get:function(){return this._tileset},set:function(e){if(this._tileset=e,this._style=void 0,this.styleString="{}",this.feature=void 0,this.tile=void 0,defined(e)){const t=this;e.readyPromise.then((function(e){t.isDestroyed()||t._properties(e.properties)}));const n=["colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl"],i=n.length;for(let e=0;e<i;++e){const t=n[e];this[t]=this[t]}this.maximumScreenSpaceError=e.maximumScreenSpaceError,this.dynamicScreenSpaceError=e.dynamicScreenSpaceError,this.dynamicScreenSpaceErrorDensity=e.dynamicScreenSpaceErrorDensity,this.dynamicScreenSpaceErrorFactor=e.dynamicScreenSpaceErrorFactor,this.colorBlendMode=e.colorBlendMode,this.skipLevelOfDetail=e.skipLevelOfDetail,this.skipScreenSpaceErrorFactor=e.skipScreenSpaceErrorFactor,this.baseScreenSpaceError=e.baseScreenSpaceError,this.skipLevels=e.skipLevels,this.immediatelyLoadDesiredLevelOfDetail=e.immediatelyLoadDesiredLevelOfDetail,this.loadSiblings=e.loadSiblings;const r=e.pointCloudShading;this.pointCloudShading=r.attenuation,this.geometricErrorScale=r.geometricErrorScale,this.maximumAttenuation=r.maximumAttenuation?r.maximumAttenuation:0,this.baseResolution=r.baseResolution?r.baseResolution:0,this.eyeDomeLighting=r.eyeDomeLighting,this.eyeDomeLightingStrength=r.eyeDomeLightingStrength,this.eyeDomeLightingRadius=r.eyeDomeLightingRadius,this._scene.requestRender()}else this._properties({});this._statisticsText=getStatistics(e,!1),this._pickStatisticsText=getStatistics(e,!0),selectTilesetOnHover(this,!1)}},feature:{get:function(){return this._feature},set:function(e){if(this._feature===e)return;const t=this._feature;defined(t)&&!t.content.isDestroyed()&&(!this.colorize&&defined(this._style)?t.color=defined(this._style.color)?this._style.color.evaluateColor(t,scratchColor):Color.WHITE:t.color=oldColor,this._scene.requestRender()),defined(e)&&(Color.clone(e.color,oldColor),e.color=highlightColor,this._scene.requestRender()),this._feature=e}},tile:{get:function(){return this._tile},set:function(e){if(this._tile===e)return;const t=this._tile;!defined(t)||t.isDestroyed()||hasFeatures(t.content)||(t.color=oldColor,this._scene.requestRender()),defined(e)&&!hasFeatures(e.content)&&(Color.clone(e.color,oldColor),e.color=highlightColor,this._scene.requestRender()),this._tile=e}}}),Cesium3DTilesInspectorViewModel.prototype.togglePickTileset=function(){this.pickActive=!this.pickActive},Cesium3DTilesInspectorViewModel.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible},Cesium3DTilesInspectorViewModel.prototype.toggleTileset=function(){this.tilesetVisible=!this.tilesetVisible},Cesium3DTilesInspectorViewModel.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible},Cesium3DTilesInspectorViewModel.prototype.toggleUpdate=function(){this.updateVisible=!this.updateVisible},Cesium3DTilesInspectorViewModel.prototype.toggleLogging=function(){this.loggingVisible=!this.loggingVisible},Cesium3DTilesInspectorViewModel.prototype.toggleStyle=function(){this.styleVisible=!this.styleVisible},Cesium3DTilesInspectorViewModel.prototype.toggleTileDebugLabels=function(){this.tileDebugLabelsVisible=!this.tileDebugLabelsVisible},Cesium3DTilesInspectorViewModel.prototype.toggleOptimization=function(){this.optimizationVisible=!this.optimizationVisible},Cesium3DTilesInspectorViewModel.prototype.trimTilesCache=function(){defined(this._tileset)&&this._tileset.trimLoadedTiles()},Cesium3DTilesInspectorViewModel.prototype.compileStyle=function(){const e=this._tileset;if(defined(e)&&this.styleString!==JSON.stringify(e.style)){this._editorError="";try{0===this.styleString.length&&(this.styleString="{}"),this._style=new Cesium3DTileStyle(JSON.parse(this.styleString)),this._shouldStyle=!0,this._scene.requestRender()}catch(e){this._editorError=e.toString()}this.feature=this._feature,this.tile=this._tile}},Cesium3DTilesInspectorViewModel.prototype.styleEditorKeyPress=function(e,t){if(9===t.keyCode){t.preventDefault();const e=t.target,n=e.selectionStart,i=e.selectionEnd;let r=i;const o=e.value.slice(n,i).split("\n"),a=o.length;let s;if(t.shiftKey)for(s=0;s<a;++s)" "===o[s][0]&&(" "===o[s][1]?(o[s]=o[s].substr(2),r-=2):(o[s]=o[s].substr(1),r-=1));else for(s=0;s<a;++s)o[s]=" "+o[s],r+=2;const c=o.join("\n");e.value=e.value.slice(0,n)+c+e.value.slice(i),e.selectionStart=n!==i?n:r,e.selectionEnd=r}else!t.ctrlKey||10!==t.keyCode&&13!==t.keyCode||this.compileStyle();return!0},Cesium3DTilesInspectorViewModel.prototype._update=function(){const e=this._tileset;if(this.performance&&this._performanceDisplay.update(),defined(e)){if(e.isDestroyed())return this.tile=void 0,this.feature=void 0,void(this.tileset=void 0);const t=e.style;this._style!==e.style&&(this._shouldStyle?(e.style=this._style,this._shouldStyle=!1):(this._style=t,this.styleString=JSON.stringify(t.style,null," ")))}this.showStatistics&&(this._statisticsText=getStatistics(e,!1),this._pickStatisticsText=getStatistics(e,!0))},Cesium3DTilesInspectorViewModel.prototype.isDestroyed=function(){return!1},Cesium3DTilesInspectorViewModel.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();const e=this;return this._definedProperties.forEach((function(t){knockout.getObservable(e,t).dispose()})),destroyObject(this)},Cesium3DTilesInspectorViewModel.getStatistics=getStatistics,Object.defineProperties(Cesium3DTilesInspector.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),Cesium3DTilesInspector.prototype.isDestroyed=function(){return!1},Cesium3DTilesInspector.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),destroyObject(this)};const scratchPickRay=new Ray,scratchPickCartesian=new Cartesian3;function CesiumInspectorViewModel(e,t){const n=this,i=e.canvas,r=new ScreenSpaceEventHandler(i);this._eventHandler=r,this._scene=e,this._canvas=i,this._primitive=void 0,this._tile=void 0,this._modelMatrixPrimitive=void 0,this._performanceDisplay=void 0,this._performanceContainer=t;const o=this._scene.globe;let a;function s(e){const t=n._scene.pick({x:e.position.x,y:e.position.y});defined(t)&&(n.primitive=defined(t.collection)?t.collection:t.primitive),n._scene.requestRender(),n.pickPrimitiveActive=!1}function c(e){let t;const i=o.ellipsoid,r=n._scene.camera.getPickRay(e.position,scratchPickRay),a=o.pick(r,n._scene,scratchPickCartesian);if(defined(a)){const e=i.cartesianToCartographic(a),n=o._surface.tileProvider._tilesToRenderByTextureCount;for(let i=0;!t&&i<n.length;++i){const r=n[i];if(defined(r))for(let n=0;!t&&n<r.length;++n){const i=r[n];Rectangle.contains(i.rectangle,e)&&(t=i)}}}n.tile=t,n.pickTileActive=!1}o.depthTestAgainstTerrain=!0,this.frustums=!1,this.frustumPlanes=!1,this.performance=!1,this.shaderCacheText="",this.primitiveBoundingSphere=!1,this.primitiveReferenceFrame=!1,this.filterPrimitive=!1,this.tileBoundingSphere=!1,this.filterTile=!1,this.wireframe=!1,this.depthFrustum=1,this._numberOfFrustums=1,this.suspendUpdates=!1,this.tileCoordinates=!1,this.frustumStatisticText=!1,this.tileText="",this.hasPickedPrimitive=!1,this.hasPickedTile=!1,this.pickPrimitiveActive=!1,this.pickTileActive=!1,this.dropDownVisible=!0,this.generalVisible=!0,this.primitivesVisible=!1,this.terrainVisible=!1,this.depthFrustumText="",knockout.track(this,["frustums","frustumPlanes","performance","shaderCacheText","primitiveBoundingSphere","primitiveReferenceFrame","filterPrimitive","tileBoundingSphere","filterTile","wireframe","depthFrustum","suspendUpdates","tileCoordinates","frustumStatisticText","tileText","hasPickedPrimitive","hasPickedTile","pickPrimitiveActive","pickTileActive","dropDownVisible","generalVisible","primitivesVisible","terrainVisible","depthFrustumText"]),this._toggleDropDown=createCommand((function(){n.dropDownVisible=!n.dropDownVisible})),this._toggleGeneral=createCommand((function(){n.generalVisible=!n.generalVisible})),this._togglePrimitives=createCommand((function(){n.primitivesVisible=!n.primitivesVisible})),this._toggleTerrain=createCommand((function(){n.terrainVisible=!n.terrainVisible})),this._frustumsSubscription=knockout.getObservable(this,"frustums").subscribe((function(e){n._scene.debugShowFrustums=e,n._scene.requestRender()})),this._frustumPlanesSubscription=knockout.getObservable(this,"frustumPlanes").subscribe((function(e){n._scene.debugShowFrustumPlanes=e,n._scene.requestRender()})),this._performanceSubscription=knockout.getObservable(this,"performance").subscribe((function(e){e?n._performanceDisplay=new PerformanceDisplay({container:n._performanceContainer}):n._performanceContainer.innerHTML=""})),this._showPrimitiveBoundingSphere=createCommand((function(){return n._primitive.debugShowBoundingVolume=n.primitiveBoundingSphere,n._scene.requestRender(),!0})),this._primitiveBoundingSphereSubscription=knockout.getObservable(this,"primitiveBoundingSphere").subscribe((function(){n._showPrimitiveBoundingSphere()})),this._showPrimitiveReferenceFrame=createCommand((function(){if(n.primitiveReferenceFrame){const e=n._primitive.modelMatrix;n._modelMatrixPrimitive=new DebugModelMatrixPrimitive({modelMatrix:e}),n._scene.primitives.add(n._modelMatrixPrimitive)}else defined(n._modelMatrixPrimitive)&&(n._scene.primitives.remove(n._modelMatrixPrimitive),n._modelMatrixPrimitive=void 0);return n._scene.requestRender(),!0})),this._primitiveReferenceFrameSubscription=knockout.getObservable(this,"primitiveReferenceFrame").subscribe((function(){n._showPrimitiveReferenceFrame()})),this._doFilterPrimitive=createCommand((function(){return n.filterPrimitive?n._scene.debugCommandFilter=function(e){return!(!defined(n._modelMatrixPrimitive)||e.owner!==n._modelMatrixPrimitive._primitive)||!!defined(n._primitive)&&(e.owner===n._primitive||e.owner===n._primitive._billboardCollection||e.owner.primitive===n._primitive)}:n._scene.debugCommandFilter=void 0,!0})),this._filterPrimitiveSubscription=knockout.getObservable(this,"filterPrimitive").subscribe((function(){n._doFilterPrimitive(),n._scene.requestRender()})),this._wireframeSubscription=knockout.getObservable(this,"wireframe").subscribe((function(e){o._surface.tileProvider._debug.wireframe=e,n._scene.requestRender()})),this._depthFrustumSubscription=knockout.getObservable(this,"depthFrustum").subscribe((function(e){n._scene.debugShowDepthFrustum=e,n._scene.requestRender()})),this._incrementDepthFrustum=createCommand((function(){const e=n.depthFrustum+1;return n.depthFrustum=boundDepthFrustum(1,n._numberOfFrustums,e),n._scene.requestRender(),!0})),this._decrementDepthFrustum=createCommand((function(){const e=n.depthFrustum-1;return n.depthFrustum=boundDepthFrustum(1,n._numberOfFrustums,e),n._scene.requestRender(),!0})),this._suspendUpdatesSubscription=knockout.getObservable(this,"suspendUpdates").subscribe((function(e){o._surface._debug.suspendLodUpdate=e,e||(n.filterTile=!1)})),this._showTileCoordinates=createCommand((function(){return n.tileCoordinates&&!defined(a)?a=e.imageryLayers.addImageryProvider(new TileCoordinatesImageryProvider({tilingScheme:e.terrainProvider.tilingScheme})):!n.tileCoordinates&&defined(a)&&(e.imageryLayers.remove(a),a=void 0),!0})),this._tileCoordinatesSubscription=knockout.getObservable(this,"tileCoordinates").subscribe((function(){n._showTileCoordinates(),n._scene.requestRender()})),this._tileBoundingSphereSubscription=knockout.getObservable(this,"tileBoundingSphere").subscribe((function(){n._showTileBoundingSphere(),n._scene.requestRender()})),this._showTileBoundingSphere=createCommand((function(){return n.tileBoundingSphere?o._surface.tileProvider._debug.boundingSphereTile=n._tile:o._surface.tileProvider._debug.boundingSphereTile=void 0,n._scene.requestRender(),!0})),this._doFilterTile=createCommand((function(){return n.filterTile?(n.suspendUpdates=!0,o._surface._tilesToRender=[],defined(n._tile)&&n._tile.renderable&&o._surface._tilesToRender.push(n._tile)):n.suspendUpdates=!1,!0})),this._filterTileSubscription=knockout.getObservable(this,"filterTile").subscribe((function(){n.doFilterTile(),n._scene.requestRender()})),this._pickPrimitive=createCommand((function(){n.pickPrimitiveActive=!n.pickPrimitiveActive})),this._pickPrimitiveActiveSubscription=knockout.getObservable(this,"pickPrimitiveActive").subscribe((function(e){e?r.setInputAction(s,ScreenSpaceEventType$1.LEFT_CLICK):r.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)})),this._pickTile=createCommand((function(){n.pickTileActive=!n.pickTileActive})),this._pickTileActiveSubscription=knockout.getObservable(this,"pickTileActive").subscribe((function(e){e?r.setInputAction(c,ScreenSpaceEventType$1.LEFT_CLICK):r.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)})),this._removePostRenderEvent=e.postRender.addEventListener((function(){n._update()}))}function CesiumInspector(e,t){e=getElement(e);const n=document.createElement("div"),i=new CesiumInspectorViewModel(t,n);this._viewModel=i,this._container=e;const r=document.createElement("div");this._element=r;const o=document.createElement("div");o.textContent="Cesium Inspector",o.className="cesium-cesiumInspector-button",o.setAttribute("data-bind","click: toggleDropDown"),r.appendChild(o),r.className="cesium-cesiumInspector",r.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }'),e.appendChild(this._element);const a=document.createElement("div");this._panel=a,a.className="cesium-cesiumInspector-dropDown",r.appendChild(a);const s=InspectorShared.createSection,c=InspectorShared.createCheckbox,l=s(a,"General","generalVisible","toggleGeneral"),u=c("Show Frustums","frustums"),d=document.createElement("div");d.className="cesium-cesiumInspector-frustumStatistics",d.setAttribute("data-bind","visible: frustums, html: frustumStatisticText"),u.appendChild(d),l.appendChild(u),l.appendChild(c("Show Frustum Planes","frustumPlanes")),l.appendChild(c("Performance Display","performance")),n.className="cesium-cesiumInspector-performanceDisplay",l.appendChild(n);const h=document.createElement("div");h.className="cesium-cesiumInspector-shaderCache",h.setAttribute("data-bind","html: shaderCacheText"),l.appendChild(h);const p=document.createElement("div");l.appendChild(p);const f=document.createElement("span");f.setAttribute("data-bind",'html: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frustum:"'),p.appendChild(f);const m=document.createElement("span");m.setAttribute("data-bind","text: depthFrustumText"),p.appendChild(m);const g=document.createElement("input");g.type="button",g.value="-",g.className="cesium-cesiumInspector-pickButton",g.setAttribute("data-bind","click: decrementDepthFrustum"),p.appendChild(g);const _=document.createElement("input");_.type="button",_.value="+",_.className="cesium-cesiumInspector-pickButton",_.setAttribute("data-bind","click: incrementDepthFrustum"),p.appendChild(_);const y=s(a,"Primitives","primitivesVisible","togglePrimitives"),C=document.createElement("div");C.className="cesium-cesiumInspector-pickSection",y.appendChild(C);const T=document.createElement("input");T.type="button",T.value="Pick a primitive",T.className="cesium-cesiumInspector-pickButton",T.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');let S=document.createElement("div");S.className="cesium-cesiumInspector-center",S.appendChild(T),C.appendChild(S),C.appendChild(c("Show bounding sphere","primitiveBoundingSphere","hasPickedPrimitive")),C.appendChild(c("Show reference frame","primitiveReferenceFrame","hasPickedPrimitive")),this._primitiveOnly=c("Show only selected","filterPrimitive","hasPickedPrimitive"),C.appendChild(this._primitiveOnly);const A=s(a,"Terrain","terrainVisible","toggleTerrain"),v=document.createElement("div");v.className="cesium-cesiumInspector-pickSection",A.appendChild(v);const E=document.createElement("input");E.type="button",E.value="Pick a tile",E.className="cesium-cesiumInspector-pickButton",E.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'),S=document.createElement("div"),S.appendChild(E),S.className="cesium-cesiumInspector-center",v.appendChild(S);const b=document.createElement("div");v.appendChild(b);const x=document.createElement("input");x.type="button",x.value="Parent",x.className="cesium-cesiumInspector-pickButton",x.setAttribute("data-bind","click: selectParent");const P=document.createElement("input");P.type="button",P.value="NW",P.className="cesium-cesiumInspector-pickButton",P.setAttribute("data-bind","click: selectNW");const D=document.createElement("input");D.type="button",D.value="NE",D.className="cesium-cesiumInspector-pickButton",D.setAttribute("data-bind","click: selectNE");const w=document.createElement("input");w.type="button",w.value="SW",w.className="cesium-cesiumInspector-pickButton",w.setAttribute("data-bind","click: selectSW");const M=document.createElement("input");M.type="button",M.value="SE",M.className="cesium-cesiumInspector-pickButton",M.setAttribute("data-bind","click: selectSE");const I=document.createElement("div");I.className="cesium-cesiumInspector-tileText",b.className="cesium-cesiumInspector-frustumStatistics",b.appendChild(I),b.setAttribute("data-bind","visible: hasPickedTile"),I.setAttribute("data-bind","html: tileText");const R=document.createElement("div");R.className="cesium-cesiumInspector-relativeText",R.textContent="Select relative:",b.appendChild(R);const O=document.createElement("table"),B=document.createElement("tr"),L=document.createElement("tr"),F=document.createElement("td");F.appendChild(x);const N=document.createElement("td");N.appendChild(P);const V=document.createElement("td");V.appendChild(D),B.appendChild(F),B.appendChild(N),B.appendChild(V);const k=document.createElement("td"),U=document.createElement("td");U.appendChild(w);const G=document.createElement("td");G.appendChild(M),L.appendChild(k),L.appendChild(U),L.appendChild(G),O.appendChild(B),O.appendChild(L),b.appendChild(O),v.appendChild(c("Show bounding volume","tileBoundingSphere","hasPickedTile")),v.appendChild(c("Show only selected","filterTile","hasPickedTile")),A.appendChild(c("Wireframe","wireframe")),A.appendChild(c("Suspend LOD update","suspendUpdates")),A.appendChild(c("Show tile coordinates","tileCoordinates")),knockout.applyBindings(i,this._element)}function getDefaultSkyBoxUrl(e){return buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_"+e+".jpg")}function startRenderLoop(e){e._renderLoopRunning=!0;let t=0;requestAnimationFramePolyFill((function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const r=e._targetFrameRate;if(defined(r)){const o=1e3/r,a=i-t;a>o&&(e.resize(),e.render(),t=i-a%o),requestAnimationFramePolyFill(n)}else e.resize(),e.render(),requestAnimationFramePolyFill(n)}catch(t){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){const n="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(n,void 0,t)}}else e._renderLoopRunning=!1}))}function configurePixelRatio(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,defined(e._scene)&&(e._scene.pixelRatio=t),t}function configureCanvasSize(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const r=configurePixelRatio(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=r,i*=r,t.width=n,t.height=i,e._canRender=0!==n&&0!==i,e._lastDevicePixelRatio=window.devicePixelRatio}function configureCameraFrustum(e){const t=e._canvas,n=t.width,i=t.height;if(0!==n&&0!==i){const t=e._scene.camera.frustum;defined(t.aspectRatio)?t.aspectRatio=n/i:(t.top=t.right*(i/n),t.bottom=-t.top)}}function CesiumWidget(e,t){e=getElement(e),t=defaultValue(t,defaultValue.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),r=FeatureDetection.supportsImageRenderingPixelated();function o(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}this._supportsImageRenderingPixelated=r,r&&(i.style.imageRendering=FeatureDetection.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1},i.addEventListener("mousedown",o),i.addEventListener("pointerdown",o),n.appendChild(i);const a=document.createElement("div");a.className="cesium-widget-credits";const s=defined(t.creditContainer)?getElement(t.creditContainer):n;s.appendChild(a);const c=defined(t.creditViewport)?getElement(t.creditViewport):n,l=defaultValue(t.showRenderLoopErrors,!0),u=defaultValue(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=c,this._creditContainer=s,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=l,this._resolutionScale=1,this._useBrowserRecommendedResolution=u,this._forceResize=!1,this._clock=defined(t.clock)?t.clock:new Clock,configureCanvasSize(this);try{const e=new Scene({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:c,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:defaultValue(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange});this._scene=e,e.camera.constrainedAxis=Cartesian3.UNIT_Z,configurePixelRatio(this),configureCameraFrustum(this);const n=defaultValue(e.mapProjection.ellipsoid,Ellipsoid.WGS84);let r=t.globe;defined(r)||(r=new Globe(n)),!1!==r&&(e.globe=r,e.globe.shadows=defaultValue(t.terrainShadows,ShadowMode$1.RECEIVE_ONLY));let o=t.skyBox;defined(o)||(o=new SkyBox({sources:{positiveX:getDefaultSkyBoxUrl("px"),negativeX:getDefaultSkyBoxUrl("mx"),positiveY:getDefaultSkyBoxUrl("py"),negativeY:getDefaultSkyBoxUrl("my"),positiveZ:getDefaultSkyBoxUrl("pz"),negativeZ:getDefaultSkyBoxUrl("mz")}})),!1!==o&&(e.skyBox=o,e.sun=new Sun,e.moon=new Moon);let s=t.skyAtmosphere;defined(s)||(s=new SkyAtmosphere(n)),!1!==s&&(e.skyAtmosphere=s);let l=!1!==t.globe&&t.imageryProvider;defined(l)||(l=createWorldImagery()),!1!==l&&e.imageryLayers.addImageryProvider(l),defined(t.terrainProvider)&&!1!==t.globe&&(e.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new ScreenSpaceEventHandler(i),defined(t.sceneMode)&&(t.sceneMode===SceneMode$1.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===SceneMode$1.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=defaultValue(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const u=this;this._onRenderError=function(e,t){if(u._useDefaultRenderLoop=!1,u._renderLoopRunning=!1,u._showRenderLoopErrors){const e="An error occurred while rendering. Rendering has stopped.";u.showErrorPanel(e,void 0,t)}},e.renderError.addEventListener(this._onRenderError)}catch(e){if(l){const t="Error constructing CesiumWidget.",n='Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:';this.showErrorPanel(t,n,e)}throw e}}function FullscreenButtonViewModel(e,t){defined(t)||(t=document.body),t=getElement(t);const n=this,i=knockout.observable(Fullscreen.fullscreen),r=knockout.observable(Fullscreen.enabled),o=t.ownerDocument;this.isFullscreen=void 0,knockout.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,knockout.defineProperty(this,"isFullscreenEnabled",{get:function(){return r()},set:function(e){r(e&&Fullscreen.enabled)}}),this.tooltip=void 0,knockout.defineProperty(this,"tooltip",(function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"})),this._command=createCommand((function(){Fullscreen.fullscreen?Fullscreen.exitFullscreen():Fullscreen.requestFullscreen(n._fullscreenElement)}),knockout.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=defaultValue(getElement(e),o.body),this._callback=function(){i(Fullscreen.fullscreen)},o.addEventListener(Fullscreen.changeEventName,this._callback)}Object.defineProperties(CesiumInspectorViewModel.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},toggleDropDown:{get:function(){return this._toggleDropDown}},showPrimitiveBoundingSphere:{get:function(){return this._showPrimitiveBoundingSphere}},showPrimitiveReferenceFrame:{get:function(){return this._showPrimitiveReferenceFrame}},doFilterPrimitive:{get:function(){return this._doFilterPrimitive}},incrementDepthFrustum:{get:function(){return this._incrementDepthFrustum}},decrementDepthFrustum:{get:function(){return this._decrementDepthFrustum}},showTileCoordinates:{get:function(){return this._showTileCoordinates}},showTileBoundingSphere:{get:function(){return this._showTileBoundingSphere}},doFilterTile:{get:function(){return this._doFilterTile}},toggleGeneral:{get:function(){return this._toggleGeneral}},togglePrimitives:{get:function(){return this._togglePrimitives}},toggleTerrain:{get:function(){return this._toggleTerrain}},pickPrimitive:{get:function(){return this._pickPrimitive}},pickTile:{get:function(){return this._pickTile}},selectParent:{get:function(){const e=this;return createCommand((function(){e.tile=e.tile.parent}))}},selectNW:{get:function(){const e=this;return createCommand((function(){e.tile=e.tile.northwestChild}))}},selectNE:{get:function(){const e=this;return createCommand((function(){e.tile=e.tile.northeastChild}))}},selectSW:{get:function(){const e=this;return createCommand((function(){e.tile=e.tile.southwestChild}))}},selectSE:{get:function(){const e=this;return createCommand((function(){e.tile=e.tile.southeastChild}))}},primitive:{get:function(){return this._primitive},set:function(e){const t=this._primitive;e!==t&&(this.hasPickedPrimitive=!0,defined(t)&&(t.debugShowBoundingVolume=!1),this._scene.debugCommandFilter=void 0,defined(this._modelMatrixPrimitive)&&(this._scene.primitives.remove(this._modelMatrixPrimitive),this._modelMatrixPrimitive=void 0),this._primitive=e,e.show=!1,setTimeout((function(){e.show=!0}),50),this.showPrimitiveBoundingSphere(),this.showPrimitiveReferenceFrame(),this.doFilterPrimitive())}},tile:{get:function(){return this._tile},set:function(e){if(defined(e)){this.hasPickedTile=!0;if(e!==this._tile){this.tileText="L: "+e.level+" X: "+e.x+" Y: "+e.y,this.tileText+="<br>SW corner: "+e.rectangle.west+", "+e.rectangle.south,this.tileText+="<br>NE corner: "+e.rectangle.east+", "+e.rectangle.north;const t=e.data;defined(t)&&defined(t.tileBoundingRegion)?this.tileText+="<br>Min: "+t.tileBoundingRegion.minimumHeight+" Max: "+t.tileBoundingRegion.maximumHeight:this.tileText+="<br>(Tile is not loaded)"}this._tile=e,this.showTileBoundingSphere(),this.doFilterTile()}else this.hasPickedTile=!1,this._tile=void 0}}}),CesiumInspectorViewModel.prototype._update=function(){this.frustums&&(this.frustumStatisticText=frustumStatisticsToString(this._scene.debugFrustumStatistics));const e=this._scene.numberOfFrustums;this._numberOfFrustums=e,this.depthFrustum=boundDepthFrustum(1,e,this.depthFrustum),this.depthFrustumText=this.depthFrustum+" of "+e,this.performance&&this._performanceDisplay.update(),this.primitiveReferenceFrame&&(this._modelMatrixPrimitive.modelMatrix=this._primitive.modelMatrix),this.shaderCacheText="Cached shaders: "+this._scene.context.shaderCache.numberOfShaders},CesiumInspectorViewModel.prototype.isDestroyed=function(){return!1},CesiumInspectorViewModel.prototype.destroy=function(){return this._eventHandler.destroy(),this._removePostRenderEvent(),this._frustumsSubscription.dispose(),this._frustumPlanesSubscription.dispose(),this._performanceSubscription.dispose(),this._primitiveBoundingSphereSubscription.dispose(),this._primitiveReferenceFrameSubscription.dispose(),this._filterPrimitiveSubscription.dispose(),this._wireframeSubscription.dispose(),this._depthFrustumSubscription.dispose(),this._suspendUpdatesSubscription.dispose(),this._tileCoordinatesSubscription.dispose(),this._tileBoundingSphereSubscription.dispose(),this._filterTileSubscription.dispose(),this._pickPrimitiveActiveSubscription.dispose(),this._pickTileActiveSubscription.dispose(),destroyObject(this)},Object.defineProperties(CesiumInspector.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),CesiumInspector.prototype.isDestroyed=function(){return!1},CesiumInspector.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),destroyObject(this)},Object.defineProperties(CesiumWidget.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},creditViewport:{get:function(){return this._creditViewport}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&startRenderLoop(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}}}),CesiumWidget.prototype.showErrorPanel=function(e,t,n){const i=this._element,r=document.createElement("div");r.className="cesium-widget-errorPanel";const o=document.createElement("div");o.className="cesium-widget-errorPanel-content",r.appendChild(o);const a=document.createElement("div");a.className="cesium-widget-errorPanel-header",a.appendChild(document.createTextNode(e)),o.appendChild(a);const s=document.createElement("div");function c(){s.style.maxHeight=Math.max(Math.round(.9*i.clientHeight-100),30)+"px"}s.className="cesium-widget-errorPanel-scroll",o.appendChild(s),c(),defined(window.addEventListener)&&window.addEventListener("resize",c,!1);const l=defined(t),u=defined(n);if(l||u){const i=document.createElement("div");if(i.className="cesium-widget-errorPanel-message",s.appendChild(i),u){let i=formatError(n);l||("string"==typeof n&&(n=new Error(n)),t=formatError({name:n.name,message:n.message}),i=n.stack),"undefined"!=typeof console&&console.error(e+"\n"+t+"\n"+i);const r=document.createElement("div");r.className="cesium-widget-errorPanel-message-details collapsed";const a=document.createElement("span");a.className="cesium-widget-errorPanel-more-details",a.appendChild(document.createTextNode("See more...")),r.appendChild(a),r.onclick=function(e){r.removeChild(a),r.appendChild(document.createTextNode(i)),r.className="cesium-widget-errorPanel-message-details",o.className="cesium-widget-errorPanel-content expanded",r.onclick=void 0},s.appendChild(r)}i.innerHTML="<p>"+t+"</p>"}const d=document.createElement("div");d.className="cesium-widget-errorPanel-buttonPanel",o.appendChild(d);const h=document.createElement("button");h.setAttribute("type","button"),h.className="cesium-button",h.appendChild(document.createTextNode("OK")),h.onclick=function(){defined(c)&&defined(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(r)},d.appendChild(h),i.appendChild(r)},CesiumWidget.prototype.isDestroyed=function(){return!1},CesiumWidget.prototype.destroy=function(){defined(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),destroyObject(this)},CesiumWidget.prototype.resize=function(){const e=this._canvas;(this._forceResize||this._canvasClientWidth!==e.clientWidth||this._canvasClientHeight!==e.clientHeight||this._lastDevicePixelRatio!==window.devicePixelRatio)&&(this._forceResize=!1,configureCanvasSize(this),configureCameraFrustum(this),this._scene.requestRender())},CesiumWidget.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()},Object.defineProperties(FullscreenButtonViewModel.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}}),FullscreenButtonViewModel.prototype.isDestroyed=function(){return!1},FullscreenButtonViewModel.prototype.destroy=function(){document.removeEventListener(Fullscreen.changeEventName,this._callback),destroyObject(this)};const enterFullScreenPath="M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z",exitFullScreenPath="M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";function FullscreenButton(e,t){const n=new FullscreenButtonViewModel(t,e=getElement(e));n._exitFullScreenPath=exitFullScreenPath,n._enterFullScreenPath=enterFullScreenPath;const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-fullscreenButton",i.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(i),knockout.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(FullscreenButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),FullscreenButton.prototype.isDestroyed=function(){return!1},FullscreenButton.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};const DEFAULT_HEIGHT=1e3;function GeocoderViewModel(e){defined(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new CartographicGeocoderService,new IonGeocoderService({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._geocodePromise=void 0,this._complete=new Event,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=handleArrowDown,this._handleArrowUp=handleArrowUp;const t=this;this._suggestionsVisible=knockout.pureComputed((function(){const e=knockout.getObservable(t,"_suggestions")().length>0,n=knockout.getObservable(t,"_showSuggestions")();return e&&n})),this._searchCommand=createCommand((function(e){if(e=defaultValue(e,GeocodeType$1.SEARCH),t._focusTextbox=!1,defined(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;t.hideSuggestions(),t.isSearchInProgress?cancelGeocode(t):geocode(t,t._geocoderServices,e)})),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(e,t){const n="ArrowDown"===t.key||"Down"===t.key||40===t.keyCode,i="ArrowUp"===t.key||"Up"===t.key||38===t.keyCode;return(n||i)&&t.preventDefault(),!0},this.handleKeyUp=function(e,n){const i="ArrowDown"===n.key||"Down"===n.key||40===n.keyCode,r="ArrowUp"===n.key||"Up"===n.key||38===n.keyCode,o="Enter"===n.key||13===n.keyCode;return r?handleArrowUp(t):i?handleArrowDown(t):o&&t._searchCommand(),!0},this.activateSuggestion=function(e){t.hideSuggestions(),t._searchText=e.displayName;const n=e.destination;clearSuggestions(t),t.destinationFound(t,n)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(e,n){e!==t._selectedSuggestion&&(t._selectedSuggestion=e)},this.keepExpanded=!1,this.autoComplete=defaultValue(e.autocomplete,!0),this.destinationFound=defaultValue(e.destinationFound,GeocoderViewModel.flyToDestination),this._focusTextbox=!1,knockout.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=knockout.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe((function(){GeocoderViewModel._updateSearchSuggestions(t)})),this.isSearchInProgress=void 0,knockout.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,knockout.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(e){this._searchText=e}}),this.flightDuration=void 0,knockout.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(e){this._flightDuration=e}})}function handleArrowUp(e){if(0===e._suggestions.length)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(-1===t||0===t)return void(e._selectedSuggestion=void 0);const n=t-1;e._selectedSuggestion=e._suggestions[n],GeocoderViewModel._adjustSuggestionsScroll(e,n)}function handleArrowDown(e){if(0===e._suggestions.length)return;const t=e._suggestions.length,n=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[n],GeocoderViewModel._adjustSuggestionsScroll(e,n)}function computeFlyToLocationForCartographic(e,t){const n=defined(t)?t.availability:void 0;return defined(n)?sampleTerrainMostDetailed(t,[e]).then((function(t){return(e=t[0]).height+=DEFAULT_HEIGHT,e})):(e.height+=DEFAULT_HEIGHT,when.resolve(e))}function flyToDestination(e,t){const n=e._scene,i=n.mapProjection.ellipsoid,r=n.camera,o=n.terrainProvider;let a,s=t;t instanceof Rectangle?CesiumMath.equalsEpsilon(t.south,t.north,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(t.east,t.west,CesiumMath.EPSILON7)?t=Rectangle.center(t):a=computeFlyToLocationForRectangle(t,n):t=i.cartesianToCartographic(t),defined(a)||(a=computeFlyToLocationForCartographic(t,o)),a.then((function(e){s=i.cartographicToCartesian(e)})).always((function(){r.flyTo({destination:s,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:Matrix4.IDENTITY})}))}function chainPromise(e,t,n,i){return e.then((function(e){if(defined(e)&&"fulfilled"===e.state&&e.value.length>0)return e;const r=t.geocode(n,i).then((function(e){return{state:"fulfilled",value:e}})).otherwise((function(e){return{state:"rejected",reason:e}}));return r}))}function geocode(e,t,n){const i=e._searchText;if(hasOnlyWhitespace(i))return void e.showSuggestions();e._isSearchInProgress=!0;let r=when.resolve();for(let e=0;e<t.length;e++)r=chainPromise(r,t[e],i,n);e._geocodePromise=r,r.then((function(t){if(r.cancel)return;e._isSearchInProgress=!1;const n=t.value;if("fulfilled"===t.state&&defined(n)&&n.length>0)return e._searchText=n[0].displayName,void e.destinationFound(e,n[0].destination);e._searchText=i+" (not found)"}))}function adjustSuggestionsScroll(e,t){const n=getElement(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(0===t)return void(i.scrollTop=0);const o=r.offsetTop;o+r.clientHeight>i.clientHeight?i.scrollTop=o+r.clientHeight:o<i.scrollTop&&(i.scrollTop=o)}function cancelGeocode(e){e._isSearchInProgress=!1,defined(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function hasOnlyWhitespace(e){return/^\s*$/.test(e)}function clearSuggestions(e){knockout.getObservable(e,"_suggestions").removeAll()}function updateSearchSuggestions(e){if(!e.autoComplete)return;const t=e._searchText;if(clearSuggestions(e),hasOnlyWhitespace(t))return;let n=when.resolve([]);e._geocoderServices.forEach((function(e){n=n.then((function(n){return n.length>=5?n:e.geocode(t,GeocodeType$1.AUTOCOMPLETE).then((function(e){return n=n.concat(e)}))}))})),n.then((function(t){const n=e._suggestions;for(let e=0;e<t.length;e++)n.push(t[e])}))}Object.defineProperties(GeocoderViewModel.prototype,{complete:{get:function(){return this._complete}},scene:{get:function(){return this._scene}},search:{get:function(){return this._searchCommand}},selectedSuggestion:{get:function(){return this._selectedSuggestion}},suggestions:{get:function(){return this._suggestions}}}),GeocoderViewModel.prototype.destroy=function(){this._suggestionSubscription.dispose()},GeocoderViewModel.flyToDestination=flyToDestination,GeocoderViewModel._updateSearchSuggestions=updateSearchSuggestions,GeocoderViewModel._adjustSuggestionsScroll=adjustSuggestionsScroll;const startSearchPath="M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z",stopSearchPath="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z";function Geocoder(e){const t=getElement(e.container),n=new GeocoderViewModel(e);n._startSearchPath=startSearchPath,n._stopSearchPath=stopSearchPath;const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const r=document.createElement("input");r.type="search",r.className="cesium-geocoder-input",r.setAttribute("placeholder","Enter an address or landmark..."),r.setAttribute("data-bind",'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'),this._onTextBoxFocus=function(){setTimeout((function(){r.select()}),0)},r.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(r),this._textBox=r;const o=document.createElement("span");o.className="cesium-geocoder-searchButton",o.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(o),t.appendChild(i);const a=document.createElement("div");a.className="search-results",a.setAttribute("data-bind","visible: _suggestionsVisible");const s=document.createElement("ul");s.setAttribute("data-bind","foreach: _suggestions");const c=document.createElement("li");s.appendChild(c),c.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),a.appendChild(s),t.appendChild(a),knockout.applyBindings(n,i),knockout.applyBindings(n,a),this._container=t,this._searchSuggestionsContainer=a,this._viewModel=n,this._form=i,this._onInputBegin=function(e){let i=e.target;"function"==typeof e.composedPath&&(i=e.composedPath()[0]),t.contains(i)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(e){n._focusTextbox=!0,n.showSuggestions()},FeatureDetection.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),t.addEventListener("pointerup",this._onInputEnd,!0),t.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),t.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),t.addEventListener("touchend",this._onInputEnd,!0),t.addEventListener("touchcancel",this._onInputEnd,!0))}function HomeButtonViewModel(e,t){this._scene=e,this._duration=t;const n=this;this._command=createCommand((function(){n._scene.camera.flyHome(n._duration)})),this.tooltip="View Home",knockout.track(this,["tooltip"])}function HomeButton(e,t,n){e=getElement(e);const i=new HomeButtonViewModel(t,n);i._svgPath="M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-home-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(r),knockout.applyBindings(i,r),this._container=e,this._viewModel=i,this._element=r}Object.defineProperties(Geocoder.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}}),Geocoder.prototype.isDestroyed=function(){return!1},Geocoder.prototype.destroy=function(){const e=this._container;return FeatureDetection.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),e.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),e.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),e.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),knockout.cleanNode(this._form),knockout.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),destroyObject(this)},Object.defineProperties(HomeButtonViewModel.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}}}),Object.defineProperties(HomeButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),HomeButton.prototype.isDestroyed=function(){return!1},HomeButton.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};const cameraEnabledPath="M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z",cameraDisabledPath="M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";function InfoBoxViewModel(){this._cameraClicked=new Event,this._closeClicked=new Event,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",knockout.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,knockout.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?cameraDisabledPath:cameraEnabledPath}}),knockout.defineProperty(this,"_bodyless",{get:function(){return!defined(this.description)||0===this.description.length}})}function InfoBox(e){e=getElement(e);const t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);const n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);const r=document.createElement("button");r.type="button",r.className="cesium-infoBox-close",r.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),r.innerHTML="&times;",t.appendChild(r);const o=document.createElement("iframe");o.className="cesium-infoBox-iframe",o.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),o.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),o.setAttribute("allowfullscreen",!0),t.appendChild(o);const a=new InfoBoxViewModel;knockout.applyBindings(a,t),this._container=e,this._element=t,this._frame=o,this._viewModel=a,this._descriptionSubscription=void 0;const s=this;o.addEventListener("load",(function(){const e=o.contentDocument,n=e.createElement("link");n.href=buildModuleUrl("Widgets/InfoBox/InfoBoxDescription.css"),n.rel="stylesheet",n.type="text/css";const i=e.createElement("div");i.className="cesium-infoBox-description",e.head.appendChild(n),e.body.appendChild(i),s._descriptionSubscription=subscribeAndEvaluate(a,"description",(function(e){o.style.height="5px",i.innerHTML=e;let n=null;const r=i.firstElementChild;if(null!==r&&1===i.childNodes.length){const e=window.getComputedStyle(r);if(null!==e){const t=e["background-color"],i=Color.fromCssColorString(t);defined(i)&&0!==i.alpha&&(n=e["background-color"])}}t.style["background-color"]=n;const a=i.getBoundingClientRect().height;o.style.height=a+"px"}))})),o.setAttribute("src","about:blank")}function NavigationHelpButtonViewModel(){this.showInstructions=!1;const e=this;this._command=createCommand((function(){e.showInstructions=!e.showInstructions})),this._showClick=createCommand((function(){e._touch=!1})),this._showTouch=createCommand((function(){e._touch=!0})),this._touch=!1,this.tooltip="Navigation Instructions",knockout.track(this,["tooltip","showInstructions","_touch"])}function NavigationHelpButton(e){const t=getElement(e.container),n=new NavigationHelpButtonViewModel,i=defaultValue(e.instructionsInitiallyVisible,!1);n.showInstructions=i,n._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";const r=document.createElement("span");r.className="cesium-navigationHelpButton-wrapper",t.appendChild(r);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),r.appendChild(o);const a=document.createElement("div");a.className="cesium-navigation-help",a.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),r.appendChild(a);const s=document.createElement("button");s.type="button",s.className="cesium-navigation-button cesium-navigation-button-left",s.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const c=document.createElement("img");c.src=buildModuleUrl("Widgets/Images/NavigationHelp/Mouse.svg"),c.className="cesium-navigation-button-icon",c.style.width="25px",c.style.height="25px",s.appendChild(c),s.appendChild(document.createTextNode("Mouse"));const l=document.createElement("button");l.type="button",l.className="cesium-navigation-button cesium-navigation-button-right",l.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const u=document.createElement("img");u.src=buildModuleUrl("Widgets/Images/NavigationHelp/Touch.svg"),u.className="cesium-navigation-button-icon",u.style.width="25px",u.style.height="25px",l.appendChild(u),l.appendChild(document.createTextNode("Touch")),a.appendChild(s),a.appendChild(l);const d=document.createElement("div");d.className="cesium-click-navigation-help cesium-navigation-help-instructions",d.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),d.innerHTML=' <table> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseLeft.svg")+'" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">Left click + drag</div> </td> </tr> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseRight.svg")+'" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Right click + drag, or</div> <div class="cesium-navigation-help-details">Mouse wheel scroll</div> </td> </tr> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseMiddle.svg")+'" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>',a.appendChild(d);const h=document.createElement("div");h.className="cesium-touch-navigation-help cesium-navigation-help-instructions",h.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),h.innerHTML=' <table> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchDrag.svg")+'" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">One finger drag</div> </td> </tr> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchZoom.svg")+'" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Two finger pinch</div> </td> </tr> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchTilt.svg")+'" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Tilt view</div> <div class="cesium-navigation-help-details">Two finger drag, same direction</div> </td> </tr> <tr> <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchRotate.svg")+'" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-tilt">Rotate view</div> <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div> </td> </tr> </table>',a.appendChild(h),knockout.applyBindings(n,r),this._container=t,this._viewModel=n,this._wrapper=r,this._closeInstructions=function(e){r.contains(e.target)||(n.showInstructions=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}function PerformanceWatchdogViewModel(e){this._scene=e.scene,this.lowFrameRateMessage=defaultValue(e.lowFrameRateMessage,"This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers."),this.lowFrameRateMessageDismissed=!1,this.showingLowFrameRateMessage=!1,knockout.track(this,["lowFrameRateMessage","lowFrameRateMessageDismissed","showingLowFrameRateMessage"]);const t=this;this._dismissMessage=createCommand((function(){t.showingLowFrameRateMessage=!1,t.lowFrameRateMessageDismissed=!0}));const n=FrameRateMonitor.fromScene(e.scene);this._unsubscribeLowFrameRate=n.lowFrameRate.addEventListener((function(){t.lowFrameRateMessageDismissed||(t.showingLowFrameRateMessage=!0)})),this._unsubscribeNominalFrameRate=n.nominalFrameRate.addEventListener((function(){t.showingLowFrameRateMessage=!1}))}function PerformanceWatchdog(e){const t=getElement(e.container),n=new PerformanceWatchdogViewModel(e),i=document.createElement("div");i.className="cesium-performance-watchdog-message-area",i.setAttribute("data-bind","visible: showingLowFrameRateMessage");const r=document.createElement("button");r.setAttribute("type","button"),r.className="cesium-performance-watchdog-message-dismiss",r.innerHTML="&times;",r.setAttribute("data-bind","click: dismissMessage"),i.appendChild(r);const o=document.createElement("div");o.className="cesium-performance-watchdog-message",o.setAttribute("data-bind","html: lowFrameRateMessage"),i.appendChild(o),t.appendChild(i),knockout.applyBindings(n,i),this._container=t,this._viewModel=n,this._element=i}function ProjectionPickerViewModel(e){this._scene=e,this._orthographic=e.camera.frustum instanceof OrthographicFrustum,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,knockout.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;knockout.defineProperty(this,"selectedTooltip",(function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective})),this._toggleDropDown=createCommand((function(){t.sceneMode===SceneMode$1.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)})),this._eventHelper=new EventHelper,this._eventHelper.add(e.morphComplete,(function(e,n,i,r){t.sceneMode=i,t._orthographic=i===SceneMode$1.SCENE2D||t._scene.camera.frustum instanceof OrthographicFrustum})),this._eventHelper.add(e.preRender,(function(){t._flightInProgress=defined(e.camera._currentFlight)})),this._switchToPerspective=createCommand((function(){t.sceneMode!==SceneMode$1.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)})),this._switchToOrthographic=createCommand((function(){t.sceneMode!==SceneMode$1.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)})),this._sceneMode=SceneMode$1}InfoBoxViewModel.prototype.maxHeightOffset=function(e){return this.maxHeight-e+"px"},Object.defineProperties(InfoBoxViewModel.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}}),Object.defineProperties(InfoBox.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}}),InfoBox.prototype.isDestroyed=function(){return!1},InfoBox.prototype.destroy=function(){const e=this._container;return knockout.cleanNode(this._element),e.removeChild(this._element),defined(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),destroyObject(this)},Object.defineProperties(NavigationHelpButtonViewModel.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}}),Object.defineProperties(NavigationHelpButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),NavigationHelpButton.prototype.isDestroyed=function(){return!1},NavigationHelpButton.prototype.destroy=function(){return FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)},Object.defineProperties(PerformanceWatchdogViewModel.prototype,{scene:{get:function(){return this._scene}},dismissMessage:{get:function(){return this._dismissMessage}}}),PerformanceWatchdogViewModel.prototype.destroy=function(){return this._unsubscribeLowFrameRate(),this._unsubscribeNominalFrameRate(),destroyObject(this)},Object.defineProperties(PerformanceWatchdog.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),PerformanceWatchdog.prototype.isDestroyed=function(){return!1},PerformanceWatchdog.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)},Object.defineProperties(ProjectionPickerViewModel.prototype,{scene:{get:function(){return this._scene}},toggleDropDown:{get:function(){return this._toggleDropDown}},switchToPerspective:{get:function(){return this._switchToPerspective}},switchToOrthographic:{get:function(){return this._switchToOrthographic}},isOrthographicProjection:{get:function(){return this._orthographic}}}),ProjectionPickerViewModel.prototype.isDestroyed=function(){return!1},ProjectionPickerViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};const perspectivePath="M 28.15625,10.4375 9.125,13.21875 13.75,43.25 41.75,55.09375 50.8125,37 54.5,11.9375 z m 0.125,3 19.976451,0.394265 L 43.03125,16.875 22.6875,14.28125 z M 50.971746,15.705477 47.90625,36.03125 42.53125,46 44.84375,19.3125 z M 12.625,16.03125 l 29.15625,3.6875 -2.65625,31 L 16.4375,41.125 z",orthographicPath="m 31.560594,6.5254438 -20.75,12.4687502 0.1875,24.5625 22.28125,11.8125 19.5,-12 0.65625,-0.375 0,-0.75 0.0312,-23.21875 z m 0.0625,3.125 16.65625,9.5000002 -16.125,10.28125 -17.34375,-9.71875 z m 18.96875,11.1875002 0.15625,20.65625 -17.46875,10.59375 0.15625,-20.28125 z m -37.0625,1.25 17.21875,9.625 -0.15625,19.21875 -16.9375,-9 z";function ProjectionPicker(e,t){e=getElement(e);const n=new ProjectionPickerViewModel(t);n._perspectivePath=perspectivePath,n._orthographicPath=orthographicPath;const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind",'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic, "cesium-projectionPicker-buttonOrthographic": _orthographic, "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress, "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),r.innerHTML='\x3c!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --\x3e\x3c!-- /ko --\x3e',i.appendChild(r);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",o.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic), "cesium-projectionPicker-none" : !_orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'),i.appendChild(o);const a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic), "cesium-projectionPicker-none" : _orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'),i.appendChild(a),knockout.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(e){i.contains(e.target)||(n.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function SceneModePickerViewModel(e,t){this._scene=e;const n=this;this._eventHelper=new EventHelper,this._eventHelper.add(e.morphStart,(function(e,t,i,r){n.sceneMode=i,n.dropDownVisible=!1})),this._duration=defaultValue(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",knockout.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,knockout.defineProperty(this,"selectedTooltip",(function(){const e=n.sceneMode;return e===SceneMode$1.SCENE2D?n.tooltip2D:e===SceneMode$1.SCENE3D?n.tooltip3D:n.tooltipColumbusView})),this._toggleDropDown=createCommand((function(){n.dropDownVisible=!n.dropDownVisible})),this._morphTo2D=createCommand((function(){e.morphTo2D(n._duration)})),this._morphTo3D=createCommand((function(){e.morphTo3D(n._duration)})),this._morphToColumbusView=createCommand((function(){e.morphToColumbusView(n._duration)})),this._sceneMode=SceneMode$1}Object.defineProperties(ProjectionPicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),ProjectionPicker.prototype.isDestroyed=function(){return!1},ProjectionPicker.prototype.destroy=function(){return this._viewModel.destroy(),FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)},Object.defineProperties(SceneModePickerViewModel.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}}),SceneModePickerViewModel.prototype.isDestroyed=function(){return!1},SceneModePickerViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};const globePath="m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z",flatMapPath="m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z",columbusViewPath="m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z";function SceneModePicker(e,t,n){e=getElement(e);const i=new SceneModePickerViewModel(t,n);i._globePath=globePath,i._flatMapPath=flatMapPath,i._columbusViewPath=columbusViewPath;const r=document.createElement("span");r.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(r);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.setAttribute("data-bind",'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),o.innerHTML='\x3c!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --\x3e\x3c!-- /ko --\x3e',r.appendChild(o);const a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'),r.appendChild(a);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),r.appendChild(s);const c=document.createElement("button");c.type="button",c.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",c.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'),r.appendChild(c),knockout.applyBindings(i,r),this._viewModel=i,this._container=e,this._wrapper=r,this._closeDropDown=function(e){r.contains(e.target)||(i.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(SceneModePicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),SceneModePicker.prototype.isDestroyed=function(){return!1},SceneModePicker.prototype.destroy=function(){return this._viewModel.destroy(),FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)};const screenSpacePos=new Cartesian2,offScreen="-1000px";function SelectionIndicatorViewModel(e,t,n){this._scene=e,this._screenPositionX=offScreen,this._screenPositionY=offScreen,this._tweens=e.tweens,this._container=defaultValue(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,knockout.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,knockout.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&defined(this.position)}}),knockout.defineProperty(this,"_transform",{get:function(){return"scale("+this._scale+")"}}),this.computeScreenSpacePosition=function(t,n){return SceneTransforms.wgs84ToWindowCoordinates(e,t,n)}}function SelectionIndicator(e,t){e=getElement(e),this._container=e;const n=document.createElement("div");n.className="cesium-selection-wrapper",n.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(n),this._element=n;const i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg:svg");r.setAttribute("width",160),r.setAttribute("height",160),r.setAttribute("viewBox","0 0 160 160");const o=document.createElementNS(i,"g");o.setAttribute("transform","translate(80,80)"),r.appendChild(o);const a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d","M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z"),o.appendChild(a),n.appendChild(r);const s=new SelectionIndicatorViewModel(t,this._element,this._container);this._viewModel=s,knockout.applyBindings(this._viewModel,this._element)}function TimelineHighlightRange(e,t,n){this._color=e,this._height=t,this._base=defaultValue(n,0)}function TimelineTrack(e,t,n,i){this.interval=e,this.height=t,this.color=n||new Color(.5,.5,.5,1),this.backgroundColor=i||new Color(0,0,0,0)}SelectionIndicatorViewModel.prototype.update=function(){if(this.showSelection&&defined(this.position)){const e=this.computeScreenSpacePosition(this.position,screenSpacePos);if(defined(e)){const t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,r=this._selectionIndicatorElement.clientWidth,o=.5*r;e.x=Math.min(Math.max(e.x,-r),n+r)-o,e.y=Math.min(Math.max(e.y,-r),i+r)-o,this._screenPositionX=Math.floor(e.x+.25)+"px",this._screenPositionY=Math.floor(e.y+.25)+"px"}else this._screenPositionX=offScreen,this._screenPositionY=offScreen}},SelectionIndicatorViewModel.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:EasingFunction$1.EXPONENTIAL_OUT})},SelectionIndicatorViewModel.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:EasingFunction$1.EXPONENTIAL_OUT})},Object.defineProperties(SelectionIndicatorViewModel.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}}),Object.defineProperties(SelectionIndicator.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),SelectionIndicator.prototype.isDestroyed=function(){return!1},SelectionIndicator.prototype.destroy=function(){const e=this._container;return knockout.cleanNode(this._element),e.removeChild(this._element),destroyObject(this)},TimelineHighlightRange.prototype.getHeight=function(){return this._height},TimelineHighlightRange.prototype.getBase=function(){return this._base},TimelineHighlightRange.prototype.getStartTime=function(){return this._start},TimelineHighlightRange.prototype.getStopTime=function(){return this._stop},TimelineHighlightRange.prototype.setRange=function(e,t){this._start=e,this._stop=t},TimelineHighlightRange.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=JulianDate.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const r=JulianDate.secondsDifference(this._stop,e.epochJulian);let o=Math.round(e.timeBarWidth*e.getAlpha(r))-i;i<0&&(o+=i,i=0),i+o>e.timeBarWidth&&(o=e.timeBarWidth-i),o>0&&(t='<span class="cesium-timeline-highlight" style="left: '+i.toString()+"px; width: "+o.toString()+"px; bottom: "+this._base.toString()+"px; height: "+this._height+"px; background-color: "+this._color+';"></span>')}return t},TimelineTrack.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,r=t.startJulian,o=JulianDate.addSeconds(t.startJulian,t.duration,new JulianDate);if(JulianDate.lessThan(n,r)&&JulianDate.greaterThan(i,o))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(JulianDate.lessThanOrEquals(n,o)&&JulianDate.greaterThanOrEquals(i,r)){let r,o,a;for(r=0;r<t.timeBarWidth;++r){const e=JulianDate.addSeconds(t.startJulian,r/t.timeBarWidth*t.duration,new JulianDate);!defined(o)&&JulianDate.greaterThanOrEquals(e,n)?o=r:!defined(a)&&JulianDate.greaterThanOrEquals(e,i)&&(a=r)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),defined(o)&&(defined(a)||(a=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(o,t.y,Math.max(a-o,1),this.height))}};let timelineWheelDelta=1e12;const timelineMouseMode={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},timelineTouchMode={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},timelineTicScales=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],timelineMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Timeline(e,t){const n=(e=getElement(e)).ownerDocument;this.container=e;const i=n.createElement("div");i.className="cesium-timeline-main",e.appendChild(i),this._topDiv=i,this._endJulian=void 0,this._epochJulian=void 0,this._lastXPos=void 0,this._scrubElement=void 0,this._startJulian=void 0,this._timeBarSecondsSpan=void 0,this._clock=t,this._scrubJulian=t.currentTime,this._mainTicSpan=-1,this._mouseMode=timelineMouseMode.none,this._touchMode=timelineTouchMode.none,this._touchState={centerX:0,spanX:0},this._mouseX=0,this._timelineDrag=0,this._timelineDragLocation=void 0,this._lastHeight=void 0,this._lastWidth=void 0,this._topDiv.innerHTML='<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>',this._timeBarEle=this._topDiv.childNodes[0],this._trackContainer=this._topDiv.childNodes[1],this._trackListEle=this._topDiv.childNodes[1].childNodes[0],this._needleEle=this._topDiv.childNodes[2],this._rulerEle=this._topDiv.childNodes[3],this._context=this._trackListEle.getContext("2d"),this._trackList=[],this._highlightRanges=[],this.zoomTo(t.startTime,t.stopTime),this._onMouseDown=createMouseDownCallback(this),this._onMouseUp=createMouseUpCallback(this),this._onMouseMove=createMouseMoveCallback(this),this._onMouseWheel=createMouseWheelCallback(this),this._onTouchStart=createTouchStartCallback(this),this._onTouchMove=createTouchMoveCallback(this),this._onTouchEnd=createTouchEndCallback(this);const r=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.addEventListener("mousemove",this._onMouseMove,!1),r.addEventListener("mousedown",this._onMouseDown,!1),r.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),r.addEventListener("mousewheel",this._onMouseWheel,!1),r.addEventListener("touchstart",this._onTouchStart,!1),r.addEventListener("touchmove",this._onTouchMove,!1),r.addEventListener("touchend",this._onTouchEnd,!1),r.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}function twoDigits(e){return e<10?"0"+e.toString():e.toString()}function createMouseDownCallback(e){return function(t){e._mouseMode!==timelineMouseMode.touchOnly&&(0===t.button?(e._mouseMode=timelineMouseMode.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,2===t.button?e._mouseMode=timelineMouseMode.zoom:e._mouseMode=timelineMouseMode.slide)),t.preventDefault()}}function createMouseUpCallback(e){return function(t){e._mouseMode=timelineMouseMode.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function createMouseMoveCallback(e){return function(t){let n;if(e._mouseMode===timelineMouseMode.scrub){t.preventDefault();const n=t.clientX-e._topDiv.getBoundingClientRect().left;n<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):n>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(n,n*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===timelineMouseMode.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==n){const t=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(JulianDate.addSeconds(e._startJulian,t,new JulianDate),JulianDate.addSeconds(e._endJulian,t,new JulianDate))}}else e._mouseMode===timelineMouseMode.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==n&&e.zoomFrom(Math.pow(1.01,n)))}}function createMouseWheelCallback(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;timelineWheelDelta=Math.max(Math.min(Math.abs(n),timelineWheelDelta),1),n/=timelineWheelDelta,e.zoomFrom(Math.pow(1.05,-n))}}function createTouchStartCallback(e){return function(t){const n=t.touches.length;let i,r;const o=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=timelineMouseMode.touchOnly,1===n?(i=JulianDate.secondsDifference(e._scrubJulian,e._startJulian),r=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+o),Math.abs(t.touches[0].clientX-r)<50?(e._touchMode=timelineTouchMode.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=1===n?"-16px 0":"0 0")):(e._touchMode=timelineTouchMode.singleTap,e._touchState.centerX=t.touches[0].clientX-o)):2===n?(e._touchMode=timelineTouchMode.slideZoom,e._touchState.centerX=.5*(t.touches[0].clientX+t.touches[1].clientX)-o,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=timelineTouchMode.ignore}}function createTouchEndCallback(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===timelineTouchMode.singleTap?(e._touchMode=timelineTouchMode.scrub,e._onTouchMove(t)):e._touchMode===timelineTouchMode.scrub&&e._onTouchMove(t),e._mouseMode=timelineMouseMode.touchOnly,1!==n?e._touchMode=n>0?timelineTouchMode.ignore:timelineTouchMode.none:e._touchMode===timelineTouchMode.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function createTouchMoveCallback(e){return function(t){let n,i,r,o,a,s,c=1;const l=e._topDiv.getBoundingClientRect().left;e._touchMode===timelineTouchMode.singleTap&&(e._touchMode=timelineTouchMode.slideZoom),e._mouseMode=timelineMouseMode.touchOnly,e._touchMode===timelineTouchMode.scrub?(t.preventDefault(),1===t.changedTouches.length&&(i=t.changedTouches[0].clientX-l,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===timelineTouchMode.slideZoom&&(r=t.touches.length,2===r?(o=.5*(t.touches[0].clientX+t.touches[1].clientX)-l,a=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):1===r&&(o=t.touches[0].clientX-l,a=0),defined(o)&&(a>0&&e._touchState.spanX>0?(c=e._touchState.spanX/a,s=JulianDate.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-o*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new JulianDate)):(n=e._touchState.centerX-o,s=JulianDate.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new JulianDate)),e.zoomTo(s,JulianDate.addSeconds(s,e._timeBarSecondsSpan*c,new JulianDate)),e._touchState.centerX=o,e._touchState.spanX=a))}}function lockScreen(e){let t=!1;const n=window.screen;return defined(n)&&(defined(n.lockOrientation)?t=n.lockOrientation(e):defined(n.mozLockOrientation)?t=n.mozLockOrientation(e):defined(n.msLockOrientation)?t=n.msLockOrientation(e):defined(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function unlockScreen(){const e=window.screen;defined(e)&&(defined(e.unlockOrientation)?e.unlockOrientation():defined(e.mozUnlockOrientation)?e.mozUnlockOrientation():defined(e.msUnlockOrientation)?e.msUnlockOrientation():defined(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function toggleVR(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(unlockScreen(),e._locked=!1),e._noSleep.disable(),Fullscreen.exitFullscreen(),n(!1)):(Fullscreen.fullscreen||Fullscreen.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=lockScreen("landscape")),t.useWebVR=!0,n(!0)))}function VRButtonViewModel(e,t){const n=this,i=knockout.observable(Fullscreen.enabled),r=knockout.observable(!1);this.isVRMode=void 0,knockout.defineProperty(this,"isVRMode",{get:function(){return r()}}),this.isVREnabled=void 0,knockout.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(e){i(e&&Fullscreen.enabled)}}),this.tooltip=void 0,knockout.defineProperty(this,"tooltip",(function(){return i()?r()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"}));const o=knockout.observable(!1);this._isOrthographic=void 0,knockout.defineProperty(this,"_isOrthographic",{get:function(){return o()}}),this._eventHelper=new EventHelper,this._eventHelper.add(e.preRender,(function(){o(e.camera.frustum instanceof OrthographicFrustum)})),this._locked=!1,this._noSleep=new src,this._command=createCommand((function(){toggleVR(n,e,r,o)}),knockout.getObservable(this,"isVREnabled")),this._vrElement=defaultValue(getElement(t),document.body),this._callback=function(){!Fullscreen.fullscreen&&r()&&(e.useWebVR=!1,n._locked&&(unlockScreen(),n._locked=!1),n._noSleep.disable(),r(!1))},document.addEventListener(Fullscreen.changeEventName,this._callback)}Timeline.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)},Timeline.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)},Timeline.prototype.isDestroyed=function(){return!1},Timeline.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);const e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);const t=this._timeBarEle;t.removeEventListener("mousedown",this._onMouseDown,!1),t.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),t.removeEventListener("mousewheel",this._onMouseWheel,!1),t.removeEventListener("touchstart",this._onTouchStart,!1),t.removeEventListener("touchmove",this._onTouchMove,!1),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),destroyObject(this)},Timeline.prototype.addHighlightRange=function(e,t,n){const i=new TimelineHighlightRange(e,t,n);return this._highlightRanges.push(i),this.resize(),i},Timeline.prototype.addTrack=function(e,t,n,i){const r=new TimelineTrack(e,t,n,i);return this._trackList.push(r),this._lastHeight=void 0,this.resize(),r},Timeline.prototype.zoomTo=function(e,t){if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=JulianDate.secondsDifference(t,e),this._clock&&this._clock.clockRange!==ClockRange$1.UNBOUNDED){const e=this._clock.startTime,t=this._clock.stopTime,n=JulianDate.secondsDifference(t,e),i=JulianDate.secondsDifference(e,this._startJulian),r=JulianDate.secondsDifference(t,this._endJulian);this._timeBarSecondsSpan>=n?(this._timeBarSecondsSpan=n,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):i>0?(this._endJulian=JulianDate.addSeconds(this._endJulian,i,new JulianDate),this._startJulian=e,this._timeBarSecondsSpan=JulianDate.secondsDifference(this._endJulian,this._startJulian)):r<0&&(this._startJulian=JulianDate.addSeconds(this._startJulian,r,new JulianDate),this._endJulian=t,this._timeBarSecondsSpan=JulianDate.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();const n=document.createEvent("Event");n.initEvent("setzoom",!0,!0),n.startJulian=this._startJulian,n.endJulian=this._endJulian,n.epochJulian=this._epochJulian,n.totalSpan=this._timeBarSecondsSpan,n.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(n)},Timeline.prototype.zoomFrom=function(e){let t=JulianDate.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=.5*this._timeBarSecondsSpan:t+=t-.5*this._timeBarSecondsSpan;const n=this._timeBarSecondsSpan-t;this.zoomTo(JulianDate.addSeconds(this._startJulian,t-t*e,new JulianDate),JulianDate.addSeconds(this._endJulian,n*e-n,new JulianDate))},Timeline.prototype.makeLabel=function(e){const t=JulianDate.toGregorianDate(e),n=t.millisecond;let i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i="0"+i;i="."+i}return timelineMonthNames[t.month-1]+" "+t.day+" "+t.year+" "+twoDigits(t.hour)+":"+twoDigits(t.minute)+":"+twoDigits(t.second)+i},Timeline.prototype.smallestTicInPixels=7,Timeline.prototype._makeTics=function(){const e=this._timeBarEle,t=JulianDate.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let r;const o=this;this._needleEle.style.left=n.toString()+"px";let a="";const s=.01,c=31536e6,l=1e-10;let u=0,d=this._timeBarSecondsSpan;d<s?(d=s,this._timeBarSecondsSpan=s,this._endJulian=JulianDate.addSeconds(this._startJulian,s,new JulianDate)):d>c&&(d=c,this._timeBarSecondsSpan=c,this._endJulian=JulianDate.addSeconds(this._startJulian,c,new JulianDate));let h=this._timeBarEle.clientWidth;h<10&&(h=10);const p=this._startJulian,f=Math.min(d/h*1e-5,.4);let m;const g=JulianDate.toGregorianDate(p);m=d>31536e4?JulianDate.fromDate(new Date(Date.UTC(100*Math.floor(g.year/100),0))):d>31536e3?JulianDate.fromDate(new Date(Date.UTC(10*Math.floor(g.year/10),0))):d>86400?JulianDate.fromDate(new Date(Date.UTC(g.year,0))):JulianDate.fromDate(new Date(Date.UTC(g.year,g.month,g.day)));const _=JulianDate.secondsDifference(this._startJulian,JulianDate.addSeconds(m,f,new JulianDate));let y=_+d;function C(e){return Math.floor(_/e)*e}function T(e,t){return Math.ceil(e/t+.5)*t}function S(e){return(e-_)/d}function A(e,t){return e-t*Math.round(e/t)}this._epochJulian=m,this._rulerEle.innerHTML=this.makeLabel(JulianDate.addSeconds(this._endJulian,-.01,new JulianDate));let v=this._rulerEle.offsetWidth+20;v<30&&(v=180);const E=u;u-=l;const b={startTime:_,startJulian:p,epochJulian:m,duration:d,timeBarWidth:h,getAlpha:S};this._highlightRanges.forEach((function(e){a+=e.render(b)}));let x=0,P=0,D=0,w=v/h;w>1&&(w=1),w*=this._timeBarSecondsSpan;let M=-1,I=-1;const R=timelineTicScales.length;let O;for(O=0;O<R;++O){const e=timelineTicScales[O];if(++M,x=e,e>w&&e>u)break;I<0&&h*(e/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(I=M)}if(M>0){for(;M>0;)if(--M,Math.abs(A(x,timelineTicScales[M]))<1e-5){timelineTicScales[M]>=u&&(P=timelineTicScales[M]);break}if(I>=0)for(;I<M;){if(Math.abs(A(P,timelineTicScales[I]))<1e-5&&timelineTicScales[I]>=u){D=timelineTicScales[I];break}++I}}u=E,u>l&&D<1e-5&&Math.abs(u-x)>l&&(D=u,u<=x+l&&(P=0));let B,L=-999999;if(h*(D/this._timeBarSecondsSpan)>=3)for(r=C(D);r<=y;r=T(r,D))a+='<span class="cesium-timeline-ticTiny" style="left: '+Math.round(h*S(r)).toString()+'px;"></span>';if(h*(P/this._timeBarSecondsSpan)>=3)for(r=C(P);r<=y;r=T(r,P))a+='<span class="cesium-timeline-ticSub" style="left: '+Math.round(h*S(r)).toString()+'px;"></span>';if(h*(x/this._timeBarSecondsSpan)>=2){this._mainTicSpan=x,y+=x,r=C(x);const e=JulianDate.computeTaiMinusUtc(m);for(;r<=y;){let t=JulianDate.addSeconds(p,r-_,new JulianDate);if(x>2.1){const n=JulianDate.computeTaiMinusUtc(t);Math.abs(n-e)>.1&&(r+=n-e,t=JulianDate.addSeconds(p,r-_,new JulianDate))}const n=Math.round(h*S(r)),i=this.makeLabel(t);this._rulerEle.innerHTML=i,B=this._rulerEle.offsetWidth,B<10&&(B=v);const o=n-(B/2-1);o>L?(L=o+B+5,a+='<span class="cesium-timeline-ticMain" style="left: '+n.toString()+'px;"></span><span class="cesium-timeline-ticLabel" style="left: '+o.toString()+'px;">'+i+"</span>"):a+='<span class="cesium-timeline-ticSub" style="left: '+n.toString()+'px;"></span>',r=T(r,x)}}else this._mainTicSpan=-1;a+='<span class="cesium-timeline-icon16" style="left:'+i+'px;bottom:0;background-position: 0 0;"></span>',e.innerHTML=a,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),b.y=0,this._trackList.forEach((function(e){e.render(o._context,b),b.y+=e.height}))},Timeline.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(defined(this._scrubElement)){const t=JulianDate.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==n&&(this._lastXPos=n,e.style.left=n-8+"px",this._needleEle.style.left=n+"px")}defined(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(JulianDate.addSeconds(this._startJulian,this._timelineDrag,new JulianDate),JulianDate.addSeconds(this._endJulian,this._timelineDrag,new JulianDate)))},Timeline.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=JulianDate.addSeconds(this._startJulian,t,new JulianDate),this._scrubElement){const t=e-8;this._scrubElement.style.left=t.toString()+"px",this._needleEle.style.left=e.toString()+"px"}const n=document.createEvent("Event");n.initEvent("settime",!0,!0),n.clientX=e,n.timeSeconds=t,n.timeJulian=this._scrubJulian,n.clock=this._clock,this._topDiv.dispatchEvent(n)},Timeline.prototype.resize=function(){const e=this.container.clientWidth,t=this.container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;this._trackContainer.style.height=t+"px";let n=1;this._trackList.forEach((function(e){n+=e.height})),this._trackListEle.style.height=n.toString()+"px",this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=n,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t},Object.defineProperties(VRButtonViewModel.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){this._vrElement=e}},command:{get:function(){return this._command}}}),VRButtonViewModel.prototype.isDestroyed=function(){return!1},VRButtonViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Fullscreen.changeEventName,this._callback),destroyObject(this)};const enterVRPath="M 5.3125 6.375 C 4.008126 6.375 2.96875 7.4141499 2.96875 8.71875 L 2.96875 19.5 C 2.96875 20.8043 4.008126 21.875 5.3125 21.875 L 13.65625 21.875 C 13.71832 20.0547 14.845166 18.59375 16.21875 18.59375 C 17.592088 18.59375 18.71881 20.0552 18.78125 21.875 L 27.09375 21.875 C 28.398125 21.875 29.4375 20.8043 29.4375 19.5 L 29.4375 8.71875 C 29.4375 7.4141499 28.398125 6.375 27.09375 6.375 L 5.3125 6.375 z M 9.625 10.4375 C 11.55989 10.4375 13.125 12.03385 13.125 13.96875 C 13.125 15.90365 11.55989 17.46875 9.625 17.46875 C 7.69011 17.46875 6.125 15.90365 6.125 13.96875 C 6.125 12.03385 7.69011 10.4375 9.625 10.4375 z M 22.46875 10.4375 C 24.40364 10.4375 25.96875 12.03385 25.96875 13.96875 C 25.96875 15.90365 24.40364 17.46875 22.46875 17.46875 C 20.53386 17.46875 18.96875 15.90365 18.96875 13.96875 C 18.96875 12.03385 20.53386 10.4375 22.46875 10.4375 z",exitVRPath="M 25.770585,2.4552065 C 15.72282,13.962707 10.699956,19.704407 8.1768352,22.580207 c -1.261561,1.4379 -1.902282,2.1427 -2.21875,2.5 -0.141624,0.1599 -0.208984,0.2355 -0.25,0.2813 l 0.6875,0.75 c 10e-5,-10e-5 0.679191,0.727 0.6875,0.7187 0.01662,-0.016 0.02451,-0.024 0.03125,-0.031 0.01348,-0.014 0.04013,-0.038 0.0625,-0.062 0.04474,-0.05 0.120921,-0.1315 0.28125,-0.3126 0.320657,-0.3619 0.956139,-1.0921 2.2187499,-2.5312 2.5252219,-2.8781 7.5454589,-8.6169 17.5937499,-20.1250005 l -1.5,-1.3125 z m -20.5624998,3.9063 c -1.304375,0 -2.34375,1.0391 -2.34375,2.3437 l 0,10.8125005 c 0,1.3043 1.039375,2.375 2.34375,2.375 l 2.25,0 c 1.9518039,-2.2246 7.4710958,-8.5584 13.5624998,-15.5312005 l -15.8124998,0 z m 21.1249998,0 c -1.855467,2.1245 -2.114296,2.4005 -3.59375,4.0936995 1.767282,0.1815 3.15625,1.685301 3.15625,3.500001 0,1.9349 -1.56511,3.5 -3.5,3.5 -1.658043,0 -3.043426,-1.1411 -3.40625,-2.6875 -1.089617,1.2461 -2.647139,2.9988 -3.46875,3.9375 0.191501,-0.062 0.388502,-0.094 0.59375,-0.094 1.373338,0 2.50006,1.4614 2.5625,3.2812 l 8.3125,0 c 1.304375,0 2.34375,-1.0707 2.34375,-2.375 l 0,-10.8125005 c 0,-1.3046 -1.039375,-2.3437 -2.34375,-2.3437 l -0.65625,0 z M 9.5518351,10.423906 c 1.9348899,0 3.4999999,1.596401 3.4999999,3.531301 0,1.9349 -1.56511,3.5 -3.4999999,3.5 -1.9348899,0 -3.4999999,-1.5651 -3.4999999,-3.5 0,-1.9349 1.56511,-3.531301 3.4999999,-3.531301 z m 4.2187499,10.312601 c -0.206517,0.2356 -0.844218,0.9428 -1.03125,1.1562 l 0.8125,0 c 0.01392,-0.4081 0.107026,-0.7968 0.21875,-1.1562 z";function VRButton(e,t,n){e=getElement(e);const i=new VRButtonViewModel(t,n);i._exitVRPath=exitVRPath,i._enterVRPath=enterVRPath;const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-vrButton",r.setAttribute("data-bind",'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'),e.appendChild(r),knockout.applyBindings(i,r),this._container=e,this._viewModel=i,this._element=r}Object.defineProperties(VRButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),VRButton.prototype.isDestroyed=function(){return!1},VRButton.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};const boundingSphereScratch=new BoundingSphere;function onTimelineScrubfunction(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function getCesium3DTileFeatureDescription(e){const t=e.getPropertyNames();let n="";return t.forEach((function(t){const i=e.getProperty(t);defined(i)&&(n+="<tr><th>"+t+"</th><td>"+i+"</td></tr>")})),n.length>0&&(n='<table class="cesium-infoBox-defaultTable"><tbody>'+n+"</tbody></table>"),n}function getCesium3DTileFeatureName(e){let t;const n=[],i=e.getPropertyNames();for(t=0;t<i.length;t++){const r=i[t];/^name$/i.test(r)?n[0]=e.getProperty(r):/name/i.test(r)?n[1]=e.getProperty(r):/^title$/i.test(r)?n[2]=e.getProperty(r):/^(id|identifier)$/i.test(r)?n[3]=e.getProperty(r):/element/i.test(r)?n[4]=e.getProperty(r):/(id|identifier)$/i.test(r)&&(n[5]=e.getProperty(r))}const r=n.length;for(t=0;t<r;t++){const e=n[t];if(defined(e)&&""!==e)return e}return"Unnamed Feature"}function pickEntity(e,t){const n=e.scene.pick(t.position);if(defined(n)){const e=defaultValue(n.id,n.primitive.id);if(e instanceof Entity)return e;if(n instanceof Cesium3DTileFeature)return new Entity({name:getCesium3DTileFeatureName(n),description:getCesium3DTileFeatureDescription(n),feature:n})}if(defined(e.scene.globe))return pickImageryLayerFeature(e,t.position)}const scratchStopTime=new JulianDate;function trackDataSourceClock(e,t,n){if(defined(n)){const i=n.clock;if(defined(i)&&(i.getValue(t),defined(e))){const t=i.startTime;let n=i.stopTime;JulianDate.equals(t,n)&&(n=JulianDate.addSeconds(t,CesiumMath.EPSILON2,scratchStopTime)),e.updateFromClock(),e.zoomTo(t,n)}}}const cartesian3Scratch=new Cartesian3;function pickImageryLayerFeature(e,t){const n=e.scene,i=n.camera.getPickRay(t),r=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!defined(r))return;const o=new Entity({id:"Loading...",description:"Loading feature information..."});return when(r,(function(t){if(e.selectedEntity!==o)return;if(!defined(t)||0===t.length)return void(e.selectedEntity=createNoFeaturesEntity());const n=t[0],i=new Entity({id:n.name,description:n.description});if(defined(n.position)){const t=e.scene.globe.ellipsoid.cartographicToCartesian(n.position,cartesian3Scratch);i.position=new ConstantPositionProperty(t)}e.selectedEntity=i}),(function(){e.selectedEntity===o&&(e.selectedEntity=createNoFeaturesEntity())})),o}function createNoFeaturesEntity(){return new Entity({id:"None",description:"No features found."})}function enableVRUI(e,t){const n=e._geocoder,i=e._homeButton,r=e._sceneModePicker,o=e._projectionPicker,a=e._baseLayerPicker,s=e._animation,c=e._timeline,l=e._fullscreenButton,u=e._infoBox,d=e._selectionIndicator,h=t?"hidden":"visible";if(defined(n)&&(n.container.style.visibility=h),defined(i)&&(i.container.style.visibility=h),defined(r)&&(r.container.style.visibility=h),defined(o)&&(o.container.style.visibility=h),defined(a)&&(a.container.style.visibility=h),defined(s)&&(s.container.style.visibility=h),defined(c)&&(c.container.style.visibility=h),defined(l)&&l.viewModel.isFullscreenEnabled&&(l.container.style.visibility=h),defined(u)&&(u.container.style.visibility=h),defined(d)&&(d.container.style.visibility=h),e._container){const n=t||!defined(l)?0:l.container.clientWidth;e._vrButton.container.style.right=n+"px",e.forceResize()}}function Viewer(e,t){e=getElement(e);const n=!(defined((t=defaultValue(t,defaultValue.EMPTY_OBJECT)).globe)&&!1===t.globe||defined(t.baseLayerPicker)&&!1===t.baseLayerPicker),i=this,r=document.createElement("div");r.className="cesium-viewer",e.appendChild(r);const o=document.createElement("div");o.className="cesium-viewer-cesiumWidgetContainer",r.appendChild(o);const a=document.createElement("div");a.className="cesium-viewer-bottom",r.appendChild(a);const s=defaultValue(t.scene3DOnly,!1);let c,l,u=!1;defined(t.clockViewModel)?(l=t.clockViewModel,c=l.clock):(c=new Clock,l=new ClockViewModel(c),u=!0),defined(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);const d=new CesiumWidget(o,{imageryProvider:!n&&!defined(t.imageryProvider)&&void 0,clock:c,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,useBrowserRecommendedResolution:t.useBrowserRecommendedResolution,creditContainer:defined(t.creditContainer)?t.creditContainer:a,creditViewport:t.creditViewport,scene3DOnly:s,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange});let h=t.dataSources,p=!1;defined(h)||(h=new DataSourceCollection,p=!0);const f=d.scene,m=new DataSourceDisplay({scene:f,dataSourceCollection:h}),g=new EventHelper;let _,y;if(g.add(c.onTick,Viewer.prototype._onTick,this),g.add(f.morphStart,Viewer.prototype._clearTrackedObject,this),!defined(t.selectionIndicator)||!1!==t.selectionIndicator){const e=document.createElement("div");e.className="cesium-viewer-selectionIndicatorContainer",r.appendChild(e),_=new SelectionIndicator(e,f)}if(!defined(t.infoBox)||!1!==t.infoBox){const e=document.createElement("div");e.className="cesium-viewer-infoBoxContainer",r.appendChild(e),y=new InfoBox(e);const t=y.viewModel;g.add(t.cameraClicked,Viewer.prototype._onInfoBoxCameraClicked,this),g.add(t.closeClicked,Viewer.prototype._onInfoBoxClockClicked,this)}const C=document.createElement("div");let T,S,A,v,E,b,x,P,D,w,M,I,R,O,B;if(C.className="cesium-viewer-toolbar",r.appendChild(C),!defined(t.geocoder)||!1!==t.geocoder){const e=document.createElement("div");let n;e.className="cesium-viewer-geocoderContainer",C.appendChild(e),defined(t.geocoder)&&"boolean"!=typeof t.geocoder&&(n=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),T=new Geocoder({container:e,geocoderServices:n,scene:f}),g.add(T.viewModel.search.beforeExecute,Viewer.prototype._clearObjects,this)}if(defined(t.homeButton)&&!1===t.homeButton||(S=new HomeButton(C,f),defined(T)&&g.add(S.viewModel.command.afterExecute,(function(){const e=T.viewModel;e.searchText="",e.isSearchInProgress&&e.search()})),g.add(S.viewModel.command.beforeExecute,Viewer.prototype._clearTrackedObject,this)),s||defined(t.sceneModePicker)&&!1===t.sceneModePicker||(A=new SceneModePicker(C,f)),t.projectionPicker&&(v=new ProjectionPicker(C,f)),n){const e=defaultValue(t.imageryProviderViewModels,createDefaultImageryProviderViewModels()),n=defaultValue(t.terrainProviderViewModels,createDefaultTerrainProviderViewModels());E=new BaseLayerPicker(C,{globe:f.globe,imageryProviderViewModels:e,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:n,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel});b=C.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(defined(t.imageryProvider)&&!1!==t.imageryProvider&&(n&&(E.viewModel.selectedImagery=void 0),f.imageryLayers.removeAll(),f.imageryLayers.addImageryProvider(t.imageryProvider)),defined(t.terrainProvider)&&(n&&(E.viewModel.selectedTerrain=void 0),f.terrainProvider=t.terrainProvider),!defined(t.navigationHelpButton)||!1!==t.navigationHelpButton){let e=!0;try{if(defined(window.localStorage)){const t=window.localStorage.getItem("cesium-hasSeenNavHelp");defined(t)&&Boolean(t)?e=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch(e){}x=new NavigationHelpButton({container:C,instructionsInitiallyVisible:defaultValue(t.navigationInstructionsInitiallyVisible,e)})}if(!defined(t.animation)||!1!==t.animation){const e=document.createElement("div");e.className="cesium-viewer-animationContainer",r.appendChild(e),P=new Animation(e,new AnimationViewModel(l))}if(!defined(t.timeline)||!1!==t.timeline){const e=document.createElement("div");e.className="cesium-viewer-timelineContainer",r.appendChild(e),D=new Timeline(e,c),D.addEventListener("settime",onTimelineScrubfunction,!1),D.zoomTo(c.startTime,c.stopTime)}if(defined(t.fullscreenButton)&&!1===t.fullscreenButton||(I=document.createElement("div"),I.className="cesium-viewer-fullscreenContainer",r.appendChild(I),w=new FullscreenButton(I,t.fullscreenElement),M=subscribeAndEvaluate(w.viewModel,"isFullscreenEnabled",(function(e){I.style.display=e?"block":"none",defined(D)&&(D.container.style.right=I.clientWidth+"px",D.resize())}))),t.vrButton){const e=document.createElement("div");e.className="cesium-viewer-vrContainer",r.appendChild(e),R=new VRButton(e,f,t.fullScreenElement),O=subscribeAndEvaluate(R.viewModel,"isVREnabled",(function(t){e.style.display=t?"block":"none",defined(w)&&(e.style.right=I.clientWidth+"px"),defined(D)&&(D.container.style.right=e.clientWidth+"px",D.resize())})),B=subscribeAndEvaluate(R.viewModel,"isVRMode",(function(e){enableVRUI(i,e)}))}this._baseLayerPickerDropDown=b,this._fullscreenSubscription=M,this._vrSubscription=O,this._vrModeSubscription=B,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=defaultValue(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=a,this._element=r,this._cesiumWidget=d,this._selectionIndicator=_,this._infoBox=y,this._dataSourceCollection=h,this._destroyDataSourceCollection=p,this._dataSourceDisplay=m,this._clockViewModel=l,this._destroyClockViewModel=u,this._toolbar=C,this._homeButton=S,this._sceneModePicker=A,this._projectionPicker=v,this._baseLayerPicker=E,this._navigationHelpButton=x,this._animation=P,this._timeline=D,this._fullscreenButton=w,this._vrButton=R,this._geocoder=T,this._eventHelper=g,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=defined(y)||defined(_),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._clockTrackedDataSource=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new Event,this._trackedEntityChanged=new Event,knockout.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),g.add(h.dataSourceAdded,Viewer.prototype._onDataSourceAdded,this),g.add(h.dataSourceRemoved,Viewer.prototype._onDataSourceRemoved,this),g.add(f.postUpdate,Viewer.prototype.resize,this),g.add(f.postRender,Viewer.prototype._postRender,this);const L=h.length;for(let e=0;e<L;e++)this._dataSourceAdded(h,h.get(e));this._dataSourceAdded(void 0,m.defaultDataSource),g.add(h.dataSourceAdded,Viewer.prototype._dataSourceAdded,this),g.add(h.dataSourceRemoved,Viewer.prototype._dataSourceRemoved,this),d.screenSpaceEventHandler.setInputAction((function(e){i.selectedEntity=pickEntity(i,e)}),ScreenSpaceEventType$1.LEFT_CLICK),d.screenSpaceEventHandler.setInputAction((function(e){const t=pickEntity(i,e);defined(t)?Property.getValueOrUndefined(t.position,i.clock.currentTime)?i.trackedEntity=t:i.zoomTo(t):defined(i.trackedEntity)&&(i.trackedEntity=void 0)}),ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK)}function zoomToOrFly(e,t,n,i){cancelZoom(e);const r=when.defer();return e._zoomPromise=r,e._zoomIsFlight=i,e._zoomOptions=n,when(t,(function(t){if(e._zoomPromise===r)if(t instanceof ImageryLayer)t.getViewableRectangle().then((function(t){return computeFlyToLocationForRectangle(t,e.scene)})).then((function(t){e._zoomPromise===r&&(e._zoomTarget=t)}));else if(t instanceof Cesium3DTileset)e._zoomTarget=t;else if(t instanceof TimeDynamicPointCloud)e._zoomTarget=t;else if(t.isLoading&&defined(t.loadingEvent)){const n=t.loadingEvent.addEventListener((function(){n(),e._zoomPromise===r&&(e._zoomTarget=t.entities.values.slice(0))}))}else Array.isArray(t)?e._zoomTarget=t.slice(0):(defined((t=defaultValue(t.values,t)).entities)&&(t=t.entities.values),Array.isArray(t)?e._zoomTarget=t.slice(0):e._zoomTarget=[t])})),e.scene.requestRender(),r.promise}function clearZoom(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function cancelZoom(e){const t=e._zoomPromise;defined(t)&&(clearZoom(e),t.resolve(!1))}function updateZoomTarget(e){const t=e._zoomTarget;if(!defined(t)||e.scene.mode===SceneMode$1.MORPHING)return;const n=e.scene,i=n.camera,r=e._zoomPromise,o=defaultValue(e._zoomOptions,{});let a;if(t instanceof Cesium3DTileset)return t.readyPromise.then((function(){const n=t.boundingSphere;defined(o.offset)||(o.offset=new HeadingPitchRange(0,-.5,n.radius)),a={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){r.resolve(!0)},cancel:function(){r.resolve(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,a):(i.viewBoundingSphere(n,o.offset),i.lookAtTransform(Matrix4.IDENTITY),r.resolve(!0)),clearZoom(e)}));if(t instanceof TimeDynamicPointCloud)return t.readyPromise.then((function(){const n=t.boundingSphere;defined(o.offset)||(o.offset=new HeadingPitchRange(0,-.5,n.radius)),a={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){r.resolve(!0)},cancel:function(){r.resolve(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(n,a):(i.viewBoundingSphere(n,o.offset),i.lookAtTransform(Matrix4.IDENTITY),r.resolve(!0)),clearZoom(e)}));if(t instanceof Cartographic)return a={destination:n.mapProjection.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){r.resolve(!0)},cancel:function(){r.resolve(!1)}},e._zoomIsFlight?i.flyTo(a):(i.setView(a),r.resolve(!0)),void clearZoom(e);const s=t,c=[];for(let t=0,n=s.length;t<n;t++){const n=e._dataSourceDisplay.getBoundingSphere(s[t],!1,boundingSphereScratch);if(n===BoundingSphereState$1.PENDING)return;n!==BoundingSphereState$1.FAILED&&c.push(BoundingSphere.clone(boundingSphereScratch))}if(0===c.length)return void cancelZoom(e);e.trackedEntity=void 0;const l=BoundingSphere.fromBoundingSpheres(c);e._zoomIsFlight?(clearZoom(e),i.flyToBoundingSphere(l,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){r.resolve(!0)},cancel:function(){r.resolve(!1)},offset:o.offset})):(i.viewBoundingSphere(l,o.offset),i.lookAtTransform(Matrix4.IDENTITY),clearZoom(e),r.resolve(!0))}function updateTrackedEntity(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime;if(!defined(Property.getValueOrUndefined(t.position,n)))return;const i=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,boundingSphereScratch);if(r===BoundingSphereState$1.PENDING)return;const o=i.mode;o!==SceneMode$1.COLUMBUS_VIEW&&o!==SceneMode$1.SCENE2D||(i.screenSpaceCameraController.enableTranslate=!1),o!==SceneMode$1.COLUMBUS_VIEW&&o!==SceneMode$1.SCENE3D||(i.screenSpaceCameraController.enableTilt=!1);const a=r!==BoundingSphereState$1.FAILED?boundingSphereScratch:void 0;e._entityView=new EntityView(t,i,i.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}function viewerCesium3DTilesInspectorMixin(e){const t=document.createElement("div");t.className="cesium-viewer-cesium3DTilesInspectorContainer",e.container.appendChild(t);const n=new Cesium3DTilesInspector(t,e.scene);Object.defineProperties(e,{cesium3DTilesInspector:{get:function(){return n}}})}function viewerCesiumInspectorMixin(e){const t=document.createElement("div");t.className="cesium-viewer-cesiumInspectorContainer",e.container.appendChild(t);const n=new CesiumInspector(t,e.scene);Object.defineProperties(e,{cesiumInspector:{get:function(){return n}}})}function viewerDragDropMixin(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);let n=!0,i=defaultValue(t.flyToOnDrop,!0);const r=new Event;let o=defaultValue(t.clearOnDrop,!0),a=defaultValue(t.dropTarget,e.container),s=defaultValue(t.clampToGround,!0),c=t.proxy;function l(t){stop(t),o&&(e.entities.removeAll(),e.dataSources.removeAll());const n=t.dataTransfer.files,i=n.length;for(let t=0;t<i;t++){const i=n[t],r=new FileReader;r.onload=createOnLoadCallback(e,i,c,s),r.onerror=createDropErrorCallback(e,i),r.readAsText(i)}}a=getElement(a),Object.defineProperties(e,{dropTarget:{get:function(){return a},set:function(e){unsubscribe(a,l),a=e,subscribe(a,l)}},dropEnabled:{get:function(){return n},set:function(e){e!==n&&(e?subscribe(a,l):unsubscribe(a,l),n=e)}},dropError:{get:function(){return r}},clearOnDrop:{get:function(){return o},set:function(e){o=e}},flyToOnDrop:{get:function(){return i},set:function(e){i=e}},proxy:{get:function(){return c},set:function(e){c=e}},clampToGround:{get:function(){return s},set:function(e){s=e}}}),subscribe(a,l),e.destroy=wrapFunction(e,e.destroy,(function(){e.dropEnabled=!1})),e._handleDrop=l}function stop(e){e.stopPropagation(),e.preventDefault()}function unsubscribe(e,t){const n=e;defined(n)&&(n.removeEventListener("drop",t,!1),n.removeEventListener("dragenter",stop,!1),n.removeEventListener("dragover",stop,!1),n.removeEventListener("dragexit",stop,!1))}function subscribe(e,t){e.addEventListener("drop",t,!1),e.addEventListener("dragenter",stop,!1),e.addEventListener("dragover",stop,!1),e.addEventListener("dragexit",stop,!1)}function createOnLoadCallback(e,t,n,i){const r=e.scene;return function(o){const a=t.name;try{let s;if(/\.czml$/i.test(a))s=CzmlDataSource.load(JSON.parse(o.target.result),{sourceUri:a});else if(/\.geojson$/i.test(a)||/\.json$/i.test(a)||/\.topojson$/i.test(a))s=GeoJsonDataSource.load(JSON.parse(o.target.result),{sourceUri:a,clampToGround:i});else{if(!/\.(kml|kmz)$/i.test(a))return void e.dropError.raiseEvent(e,a,"Unrecognized file: "+a);s=KmlDataSource.load(t,{sourceUri:a,proxy:n,camera:r.camera,canvas:r.canvas,clampToGround:i,screenOverlayContainer:e.container})}defined(s)&&e.dataSources.add(s).then((function(t){e.flyToOnDrop&&e.flyTo(t)})).otherwise((function(t){e.dropError.raiseEvent(e,a,t)}))}catch(t){e.dropError.raiseEvent(e,a,t)}}}function createDropErrorCallback(e,t){return function(n){e.dropError.raiseEvent(e,t.name,n.target.error)}}function viewerPerformanceWatchdogMixin(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);const n=new PerformanceWatchdog({scene:e.scene,container:e.bottomContainer,lowFrameRateMessage:t.lowFrameRateMessage});Object.defineProperties(e,{performanceWatchdog:{get:function(){return n}}})}function callAndWrap(e,t,n){let i;try{return i=e(t,n),i}catch(e){return when.reject(e)}}function createTaskProcessorWorker(e){let t;return function(n){const i=n.data,r=[],o={id:i.id,result:void 0,error:void 0};return when(callAndWrap(e,i.parameters,r)).then((function(e){o.result=e})).otherwise((function(e){e instanceof Error?o.error={name:e.name,message:e.message,stack:e.stack}:o.error=e})).always((function(){defined(t)||(t=defaultValue(self.webkitPostMessage,self.postMessage)),i.canTransferArrayBuffer||(r.length=0);try{t(o,r)}catch(e){o.result=void 0,o.error="postMessage failed with error: "+formatError(e)+"\n with responseMessage: "+JSON.stringify(o),t(o)}}))}}Object.defineProperties(Viewer.prototype,{container:{get:function(){return this._container}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},projectionPicker:{get:function(){return this._projectionPicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},navigationHelpButton:{get:function(){return this._navigationHelpButton}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},vrButton:{get:function(){return this._vrButton}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},canvas:{get:function(){return this._cesiumWidget.canvas}},scene:{get:function(){return this._cesiumWidget.scene}},shadows:{get:function(){return this.scene.shadowMap.enabled},set:function(e){this.scene.shadowMap.enabled=e}},terrainShadows:{get:function(){return this.scene.globe.shadows},set:function(e){this.scene.globe.shadows=e}},shadowMap:{get:function(){return this.scene.shadowMap}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},postProcessStages:{get:function(){return this.scene.postProcessStages}},clock:{get:function(){return this._clockViewModel.clock}},clockViewModel:{get:function(){return this._clockViewModel}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e}},useBrowserRecommendedResolution:{get:function(){return this._cesiumWidget.useBrowserRecommendedResolution},set:function(e){this._cesiumWidget.useBrowserRecommendedResolution=e}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,cancelZoom(this);const t=this.scene,n=t.mode;defined(e)&&defined(e.position)?this._needTrackedEntityUpdate=!0:(this._needTrackedEntityUpdate=!1,n!==SceneMode$1.COLUMBUS_VIEW&&n!==SceneMode$1.SCENE2D||(t.screenSpaceCameraController.enableTranslate=!0),n!==SceneMode$1.COLUMBUS_VIEW&&n!==SceneMode$1.SCENE3D||(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(Matrix4.IDENTITY)),this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;const t=defined(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;defined(e)?defined(t)&&t.animateAppear():defined(t)&&t.animateDepart(),this._selectedEntityChanged.raiseEvent(e)}}},selectedEntityChanged:{get:function(){return this._selectedEntityChanged}},trackedEntityChanged:{get:function(){return this._trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,trackDataSourceClock(this._timeline,this.clock,e))}}}),Viewer.prototype.extend=function(e,t){e(this,t)},Viewer.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,r=defined(this._animation),o=defined(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const a=i-125,s=this._baseLayerPickerDropDown;if(defined(s)&&(s.style.maxHeight=a+"px"),defined(this._geocoder)){this._geocoder.searchSuggestionsContainer.style.maxHeight=a+"px"}defined(this._infoBox)&&(this._infoBox.viewModel.maxHeight=a);const c=this._timeline;let l,u=0,d=0,h=0;if(r&&"hidden"!==window.getComputedStyle(this._animation.container).visibility){const e=this._lastWidth;l=this._animation.container,n>900?(u=169,e<=900&&(l.style.width="169px",l.style.height="112px",this._animation.resize())):n>=600?(u=136,(e<600||e>900)&&(l.style.width="136px",l.style.height="90px",this._animation.resize())):(u=106,(e>600||0===e)&&(l.style.width="106px",l.style.height="70px",this._animation.resize())),d=u+5}if(o&&"hidden"!==window.getComputedStyle(this._timeline.container).visibility){const e=this._fullscreenButton,t=this._vrButton,n=c.container,i=n.style;h=n.clientHeight+3,i.left=u+"px";let r=0;defined(e)&&(r+=e.container.clientWidth),defined(t)&&(r+=t.container.clientWidth),i.right=r+"px",c.resize()}this._bottomContainer.style.left=d+"px",this._bottomContainer.style.bottom=h+"px",this._lastWidth=n,this._lastHeight=i},Viewer.prototype.forceResize=function(){this._lastWidth=0,this.resize()},Viewer.prototype.render=function(){this._cesiumWidget.render()},Viewer.prototype.isDestroyed=function(){return!1},Viewer.prototype.destroy=function(){let e;this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK);const t=this.dataSources,n=t.length;for(e=0;e<n;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),defined(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),defined(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),defined(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),defined(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),defined(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),defined(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),defined(this._timeline)&&(this._timeline.removeEventListener("settime",onTimelineScrubfunction,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),defined(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),defined(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),defined(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),defined(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._destroyClockViewModel&&(this._clockViewModel=this._clockViewModel.destroy()),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),this._cesiumWidget=this._cesiumWidget.destroy(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),destroyObject(this)},Viewer.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Viewer.prototype._onEntityCollectionChanged,this)},Viewer.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(Viewer.prototype._onEntityCollectionChanged,this),defined(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),defined(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)},Viewer.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(defined(i)){const e=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(e,!1,boundingSphereScratch)===BoundingSphereState$1.DONE&&i.update(t,boundingSphereScratch)}let r,o=!1;const a=this.selectedEntity,s=defined(a)&&this._enableInfoOrSelection;if(s&&a.isShowing&&a.isAvailable(t)){this._dataSourceDisplay.getBoundingSphere(a,!0,boundingSphereScratch)!==BoundingSphereState$1.FAILED?r=boundingSphereScratch.center:defined(a.position)&&(r=a.position.getValue(t,r)),o=defined(r)}const c=defined(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;defined(c)&&(c.position=Cartesian3.clone(r,c.position),c.showSelection=s&&o,c.update());const l=defined(this._infoBox)?this._infoBox.viewModel:void 0;defined(l)&&(l.showInfo=s,l.enableCamera=o,l.isCameraTracking=this.trackedEntity===this.selectedEntity,s?(l.titleText=defaultValue(a.name,a.id),l.description=Property.getValueOrDefault(a.description,t,"")):(l.titleText="",l.description=""))},Viewer.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let e=0;e<i;e++){const t=n[e];this.trackedEntity===t&&(this.trackedEntity=void 0),this.selectedEntity===t&&(this.selectedEntity=void 0)}},Viewer.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{defined(this.selectedEntity.position)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}},Viewer.prototype._clearTrackedObject=function(){this.trackedEntity=void 0},Viewer.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0},Viewer.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0},Viewer.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&trackDataSourceClock(this.timeline,this.clock,e)},Viewer.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,Viewer.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i},Viewer.prototype._onDataSourceRemoved=function(e,t){const n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){const t=e.length;this._automaticallyTrackDataSourceClocks&&t>0?this.clockTrackedDataSource=e.get(t-1):this.clockTrackedDataSource=void 0}},Viewer.prototype.zoomTo=function(e,t){return zoomToOrFly(this,e,{offset:t},!1)},Viewer.prototype.flyTo=function(e,t){return zoomToOrFly(this,e,t,!0)},Viewer.prototype._postRender=function(){updateZoomTarget(this),updateTrackedEntity(this)};const VERSION="1.89";exports.AlphaMode=AlphaMode$1,exports.AlphaPipelineStage=AlphaPipelineStage,exports.Animation=Animation,exports.AnimationViewModel=AnimationViewModel,exports.Appearance=Appearance,exports.ApproximateTerrainHeights=ApproximateTerrainHeights,exports.ArcGISTiledElevationTerrainProvider=ArcGISTiledElevationTerrainProvider,exports.ArcGisMapServerImageryProvider=ArcGisMapServerImageryProvider,exports.ArcType=ArcType$1,exports.AssociativeArray=AssociativeArray,exports.AttributeCompression=AttributeCompression,exports.AttributeType=AttributeType$1,exports.AutoExposure=AutoExposure,exports.Autolinker=Autolinker,exports.AutomaticUniforms=AutomaticUniforms,exports.Axis=Axis$1,exports.AxisAlignedBoundingBox=AxisAlignedBoundingBox,exports.B3dmLoader=B3dmLoader,exports.B3dmParser=B3dmParser,exports.BaseLayerPicker=BaseLayerPicker,exports.BaseLayerPickerViewModel=BaseLayerPickerViewModel,exports.BatchTable=BatchTable,exports.BatchTableHierarchy=BatchTableHierarchy,exports.BatchTexture=BatchTexture,exports.BatchTexturePipelineStage=BatchTexturePipelineStage,exports.Batched3DModel3DTileContent=Batched3DModel3DTileContent,exports.Billboard=Billboard,exports.BillboardCollection=BillboardCollection,exports.BillboardGraphics=BillboardGraphics,exports.BillboardVisualizer=BillboardVisualizer,exports.BingMapsGeocoderService=BingMapsGeocoderService,exports.BingMapsImageryProvider=BingMapsImageryProvider,exports.BingMapsStyle=BingMapsStyle$1,exports.BlendEquation=BlendEquation$1,exports.BlendFunction=BlendFunction$1,exports.BlendOption=BlendOption$1,exports.BlendingState=BlendingState$1,exports.BoundingRectangle=BoundingRectangle,exports.BoundingSphere=BoundingSphere,exports.BoundingSphereState=BoundingSphereState$1,exports.BoxEmitter=BoxEmitter,exports.BoxGeometry=BoxGeometry,exports.BoxGeometryUpdater=BoxGeometryUpdater,exports.BoxGraphics=BoxGraphics,exports.BoxOutlineGeometry=BoxOutlineGeometry,exports.BrdfLutGenerator=BrdfLutGenerator,exports.Buffer=Buffer$1,exports.BufferLoader=BufferLoader,exports.BufferUsage=BufferUsage$1,exports.CPUStylingPipelineStage=CPUStylingPipelineStage,exports.CallbackProperty=CallbackProperty,exports.Camera=Camera,exports.CameraEventAggregator=CameraEventAggregator,exports.CameraEventType=CameraEventType$1,exports.CameraFlightPath=CameraFlightPath,exports.Cartesian2=Cartesian2,exports.Cartesian3=Cartesian3,exports.Cartesian4=Cartesian4,exports.Cartographic=Cartographic,exports.CartographicGeocoderService=CartographicGeocoderService,exports.CatmullRomSpline=CatmullRomSpline,exports.Cesium3DTile=Cesium3DTile,exports.Cesium3DTileBatchTable=Cesium3DTileBatchTable,exports.Cesium3DTileColorBlendMode=Cesium3DTileColorBlendMode$1,exports.Cesium3DTileContent=Cesium3DTileContent,exports.Cesium3DTileContentFactory=Cesium3DTileContentFactory,exports.Cesium3DTileContentState=Cesium3DTileContentState$1,exports.Cesium3DTileContentType=Cesium3DTileContentType$1,exports.Cesium3DTileFeature=Cesium3DTileFeature,exports.Cesium3DTileFeatureTable=Cesium3DTileFeatureTable,exports.Cesium3DTileOptimizationHint=Cesium3DTileOptimizationHint$1,exports.Cesium3DTileOptimizations=Cesium3DTileOptimizations,exports.Cesium3DTilePass=Cesium3DTilePass$1,exports.Cesium3DTilePassState=Cesium3DTilePassState,exports.Cesium3DTilePointFeature=Cesium3DTilePointFeature,exports.Cesium3DTileRefine=Cesium3DTileRefine$1,exports.Cesium3DTileStyle=Cesium3DTileStyle,exports.Cesium3DTileStyleEngine=Cesium3DTileStyleEngine,exports.Cesium3DTilesInspector=Cesium3DTilesInspector,exports.Cesium3DTilesInspectorViewModel=Cesium3DTilesInspectorViewModel,exports.Cesium3DTileset=Cesium3DTileset,exports.Cesium3DTilesetCache=Cesium3DTilesetCache,exports.Cesium3DTilesetGraphics=Cesium3DTilesetGraphics,exports.Cesium3DTilesetHeatmap=Cesium3DTilesetHeatmap,exports.Cesium3DTilesetMetadata=Cesium3DTilesetMetadata,exports.Cesium3DTilesetMostDetailedTraversal=Cesium3DTilesetMostDetailedTraversal,exports.Cesium3DTilesetStatistics=Cesium3DTilesetStatistics,exports.Cesium3DTilesetTraversal=Cesium3DTilesetTraversal,exports.Cesium3DTilesetVisualizer=Cesium3DTilesetVisualizer,exports.CesiumInspector=CesiumInspector,exports.CesiumInspectorViewModel=CesiumInspectorViewModel,exports.CesiumTerrainProvider=CesiumTerrainProvider,exports.CesiumWidget=CesiumWidget,exports.Check=Check,exports.CheckerboardMaterialProperty=CheckerboardMaterialProperty,exports.CircleEmitter=CircleEmitter,exports.CircleGeometry=CircleGeometry,exports.CircleOutlineGeometry=CircleOutlineGeometry,exports.ClassificationModel=ClassificationModel,exports.ClassificationPrimitive=ClassificationPrimitive,exports.ClassificationType=ClassificationType$1,exports.ClearCommand=ClearCommand,exports.ClippingPlane=ClippingPlane,exports.ClippingPlaneCollection=ClippingPlaneCollection,exports.Clock=Clock,exports.ClockRange=ClockRange$1,exports.ClockStep=ClockStep$1,exports.ClockViewModel=ClockViewModel,exports.CloudCollection=CloudCollection,exports.CloudType=CloudType$1,exports.Color=Color,exports.ColorBlendMode=ColorBlendMode$1,exports.ColorGeometryInstanceAttribute=ColorGeometryInstanceAttribute,exports.ColorMaterialProperty=ColorMaterialProperty,exports.Command=Command,exports.ComponentDatatype=ComponentDatatype$1,exports.Composite3DTileContent=Composite3DTileContent,exports.CompositeEntityCollection=CompositeEntityCollection,exports.CompositeMaterialProperty=CompositeMaterialProperty,exports.CompositePositionProperty=CompositePositionProperty,exports.CompositeProperty=CompositeProperty,exports.CompressedTextureBuffer=CompressedTextureBuffer,exports.ComputeCommand=ComputeCommand,exports.ComputeEngine=ComputeEngine,exports.ConditionsExpression=ConditionsExpression,exports.ConeEmitter=ConeEmitter,exports.ConstantPositionProperty=ConstantPositionProperty,exports.ConstantProperty=ConstantProperty,exports.Context=Context,exports.ContextLimits=ContextLimits,exports.CoplanarPolygonGeometry=CoplanarPolygonGeometry,exports.CoplanarPolygonGeometryLibrary=CoplanarPolygonGeometryLibrary,exports.CoplanarPolygonOutlineGeometry=CoplanarPolygonOutlineGeometry,exports.CornerType=CornerType$1,exports.CorridorGeometry=CorridorGeometry,exports.CorridorGeometryLibrary=CorridorGeometryLibrary,exports.CorridorGeometryUpdater=CorridorGeometryUpdater,exports.CorridorGraphics=CorridorGraphics,exports.CorridorOutlineGeometry=CorridorOutlineGeometry,exports.Credit=Credit,exports.CreditDisplay=CreditDisplay,exports.CubeMap=CubeMap,exports.CubeMapFace=CubeMapFace,exports.CubicRealPolynomial=CubicRealPolynomial,exports.CullFace=CullFace$1,exports.CullingVolume=CullingVolume,exports.CumulusCloud=CumulusCloud,exports.CustomDataSource=CustomDataSource,exports.CustomHeightmapTerrainProvider=CustomHeightmapTerrainProvider,exports.CustomShader=CustomShader,exports.CustomShaderMode=CustomShaderMode$1,exports.CustomShaderPipelineStage=CustomShaderPipelineStage,exports.CylinderGeometry=CylinderGeometry,exports.CylinderGeometryLibrary=CylinderGeometryLibrary,exports.CylinderGeometryUpdater=CylinderGeometryUpdater,exports.CylinderGraphics=CylinderGraphics,exports.CylinderOutlineGeometry=CylinderOutlineGeometry,exports.CzmlDataSource=CzmlDataSource,exports.DataSource=DataSource,exports.DataSourceClock=DataSourceClock,exports.DataSourceCollection=DataSourceCollection,exports.DataSourceDisplay=DataSourceDisplay,exports.DebugAppearance=DebugAppearance,exports.DebugCameraPrimitive=DebugCameraPrimitive,exports.DebugInspector=DebugInspector,exports.DebugModelMatrixPrimitive=DebugModelMatrixPrimitive,exports.DefaultProxy=DefaultProxy,exports.DepthFunction=DepthFunction$1,exports.DepthPlane=DepthPlane,exports.DequantizationPipelineStage=DequantizationPipelineStage,exports.DerivedCommand=DerivedCommand,exports.DeveloperError=DeveloperError,exports.DeviceOrientationCameraController=DeviceOrientationCameraController,exports.DirectionalLight=DirectionalLight,exports.DiscardEmptyTileImagePolicy=DiscardEmptyTileImagePolicy,exports.DiscardMissingTileImagePolicy=DiscardMissingTileImagePolicy,exports.DistanceDisplayCondition=DistanceDisplayCondition,exports.DistanceDisplayConditionGeometryInstanceAttribute=DistanceDisplayConditionGeometryInstanceAttribute,exports.DoubleEndedPriorityQueue=DoubleEndedPriorityQueue,exports.DoublyLinkedList=DoublyLinkedList,exports.DracoLoader=DracoLoader,exports.DrawCommand=DrawCommand,exports.DynamicGeometryBatch=DynamicGeometryBatch,exports.DynamicGeometryUpdater=DynamicGeometryUpdater$1,exports.EarthOrientationParameters=EarthOrientationParameters,exports.EarthOrientationParametersSample=EarthOrientationParametersSample,exports.EasingFunction=EasingFunction$1,exports.EllipseGeometry=EllipseGeometry,exports.EllipseGeometryLibrary=EllipseGeometryLibrary,exports.EllipseGeometryUpdater=EllipseGeometryUpdater,exports.EllipseGraphics=EllipseGraphics,exports.EllipseOutlineGeometry=EllipseOutlineGeometry,exports.Ellipsoid=Ellipsoid,exports.EllipsoidGeodesic=EllipsoidGeodesic,exports.EllipsoidGeometry=EllipsoidGeometry,exports.EllipsoidGeometryUpdater=EllipsoidGeometryUpdater,exports.EllipsoidGraphics=EllipsoidGraphics,exports.EllipsoidOutlineGeometry=EllipsoidOutlineGeometry,exports.EllipsoidPrimitive=EllipsoidPrimitive,exports.EllipsoidRhumbLine=EllipsoidRhumbLine,exports.EllipsoidSurfaceAppearance=EllipsoidSurfaceAppearance,exports.EllipsoidTangentPlane=EllipsoidTangentPlane,exports.EllipsoidTerrainProvider=EllipsoidTerrainProvider,exports.EllipsoidalOccluder=EllipsoidalOccluder,exports.Empty3DTileContent=Empty3DTileContent,exports.EncodedCartesian3=EncodedCartesian3,exports.Entity=Entity,exports.EntityCluster=EntityCluster,exports.EntityCollection=EntityCollection,exports.EntityView=EntityView,exports.Event=Event,exports.EventHelper=EventHelper,exports.ExperimentalFeatures=ExperimentalFeatures,exports.Expression=Expression,exports.ExpressionNodeType=ExpressionNodeType$1,exports.ExtrapolationType=ExtrapolationType$1,exports.FeatureDetection=FeatureDetection,exports.FeatureIdPipelineStage=FeatureIdPipelineStage,exports.FeatureMetadata=FeatureMetadata,exports.Fog=Fog,exports.ForEach=ForEach,exports.FrameRateMonitor=FrameRateMonitor,exports.FrameState=FrameState,exports.Framebuffer=Framebuffer,exports.FramebufferManager=FramebufferManager,exports.FrustumCommands=FrustumCommands,exports.FrustumGeometry=FrustumGeometry,exports.FrustumOutlineGeometry=FrustumOutlineGeometry,exports.Fullscreen=Fullscreen,exports.FullscreenButton=FullscreenButton,exports.FullscreenButtonViewModel=FullscreenButtonViewModel,exports.GeoJsonDataSource=GeoJsonDataSource,exports.GeocodeType=GeocodeType$1,exports.Geocoder=Geocoder,exports.GeocoderService=GeocoderService,exports.GeocoderViewModel=GeocoderViewModel,exports.GeographicProjection=GeographicProjection,exports.GeographicTilingScheme=GeographicTilingScheme,exports.Geometry=Geometry,exports.Geometry3DTileContent=Geometry3DTileContent,exports.GeometryAttribute=GeometryAttribute,exports.GeometryAttributes=GeometryAttributes,exports.GeometryFactory=GeometryFactory,exports.GeometryInstance=GeometryInstance,exports.GeometryInstanceAttribute=GeometryInstanceAttribute,exports.GeometryOffsetAttribute=GeometryOffsetAttribute$1,exports.GeometryPipeline=GeometryPipeline,exports.GeometryPipelineStage=GeometryPipelineStage,exports.GeometryType=GeometryType$1,exports.GeometryUpdater=GeometryUpdater,exports.GeometryVisualizer=GeometryVisualizer,exports.GetFeatureInfoFormat=GetFeatureInfoFormat,exports.Globe=Globe,exports.GlobeDepth=GlobeDepth,exports.GlobeSurfaceShaderSet=GlobeSurfaceShaderSet,exports.GlobeSurfaceTile=GlobeSurfaceTile,exports.GlobeSurfaceTileProvider=GlobeSurfaceTileProvider,exports.GlobeTranslucency=GlobeTranslucency,exports.GlobeTranslucencyFramebuffer=GlobeTranslucencyFramebuffer,exports.GlobeTranslucencyState=GlobeTranslucencyState,exports.Gltf3DTileContent=Gltf3DTileContent,exports.GltfBufferViewLoader=GltfBufferViewLoader,exports.GltfDracoLoader=GltfDracoLoader,exports.GltfFeatureMetadataLoader=GltfFeatureMetadataLoader,exports.GltfImageLoader=GltfImageLoader,exports.GltfIndexBufferLoader=GltfIndexBufferLoader,exports.GltfJsonLoader=GltfJsonLoader,exports.GltfLoader=GltfLoader,exports.GltfLoaderUtil=GltfLoaderUtil,exports.GltfTextureLoader=GltfTextureLoader,exports.GltfVertexBufferLoader=GltfVertexBufferLoader,exports.GoogleEarthEnterpriseImageryProvider=GoogleEarthEnterpriseImageryProvider,exports.GoogleEarthEnterpriseMapsProvider=GoogleEarthEnterpriseMapsProvider,exports.GoogleEarthEnterpriseMetadata=GoogleEarthEnterpriseMetadata,exports.GoogleEarthEnterpriseTerrainData=GoogleEarthEnterpriseTerrainData,exports.GoogleEarthEnterpriseTerrainProvider=GoogleEarthEnterpriseTerrainProvider,exports.GoogleEarthEnterpriseTileInformation=GoogleEarthEnterpriseTileInformation,exports.GregorianDate=GregorianDate,exports.GridImageryProvider=GridImageryProvider,exports.GridMaterialProperty=GridMaterialProperty,exports.GroundGeometryUpdater=GroundGeometryUpdater,exports.GroundPolylineGeometry=GroundPolylineGeometry,exports.GroundPolylinePrimitive=GroundPolylinePrimitive,exports.GroundPrimitive=GroundPrimitive,exports.GroupMetadata=GroupMetadata,exports.HeadingPitchRange=HeadingPitchRange,exports.HeadingPitchRoll=HeadingPitchRoll,exports.Heap=Heap,exports.HeightReference=HeightReference$1,exports.HeightmapEncoding=HeightmapEncoding$1,exports.HeightmapTerrainData=HeightmapTerrainData,exports.HeightmapTessellator=HeightmapTessellator,exports.HermitePolynomialApproximation=HermitePolynomialApproximation,exports.HermiteSpline=HermiteSpline,exports.HilbertOrder=HilbertOrder,exports.HomeButton=HomeButton,exports.HomeButtonViewModel=HomeButtonViewModel,exports.HorizontalOrigin=HorizontalOrigin$1,exports.I3dmLoader=I3dmLoader,exports.I3dmParser=I3dmParser,exports.Iau2000Orientation=Iau2000Orientation,exports.Iau2006XysData=Iau2006XysData,exports.Iau2006XysSample=Iau2006XysSample,exports.IauOrientationAxes=IauOrientationAxes,exports.IauOrientationParameters=IauOrientationParameters,exports.ImageMaterialProperty=ImageMaterialProperty,exports.Imagery=Imagery,exports.ImageryLayer=ImageryLayer,exports.ImageryLayerCollection=ImageryLayerCollection,exports.ImageryLayerFeatureInfo=ImageryLayerFeatureInfo,exports.ImageryProvider=ImageryProvider,exports.ImagerySplitDirection=ImagerySplitDirection$1,exports.ImageryState=ImageryState$1,exports.Implicit3DTileContent=Implicit3DTileContent,exports.ImplicitAvailabilityBitstream=ImplicitAvailabilityBitstream,exports.ImplicitSubdivisionScheme=ImplicitSubdivisionScheme$1,exports.ImplicitSubtree=ImplicitSubtree,exports.ImplicitTileCoordinates=ImplicitTileCoordinates,exports.ImplicitTileMetadata=ImplicitTileMetadata,exports.ImplicitTileset=ImplicitTileset,exports.IndexDatatype=IndexDatatype$1,exports.InfoBox=InfoBox,exports.InfoBoxViewModel=InfoBoxViewModel,exports.InspectorShared=InspectorShared,exports.InstanceAttributeSemantic=InstanceAttributeSemantic$1,exports.Instanced3DModel3DTileContent=Instanced3DModel3DTileContent,exports.InstancingPipelineStage=InstancingPipelineStage,exports.InterpolationAlgorithm=InterpolationAlgorithm,exports.Intersect=Intersect$1,exports.IntersectionTests=IntersectionTests,exports.Intersections2D=Intersections2D,exports.Interval=Interval,exports.InvertClassification=InvertClassification,exports.Ion=Ion,exports.IonGeocoderService=IonGeocoderService,exports.IonImageryProvider=IonImageryProvider,exports.IonResource=IonResource,exports.IonWorldImageryStyle=IonWorldImageryStyle$1,exports.Iso8601=Iso8601,exports.JobScheduler=JobScheduler,exports.JobType=JobType$1,exports.JsonMetadataTable=JsonMetadataTable,exports.JulianDate=JulianDate,exports.KTX2Transcoder=KTX2Transcoder,exports.KeyboardEventModifier=KeyboardEventModifier$1,exports.KmlCamera=KmlCamera,exports.KmlDataSource=KmlDataSource,exports.KmlLookAt=KmlLookAt,exports.KmlTour=KmlTour,exports.KmlTourFlyTo=KmlTourFlyTo,exports.KmlTourWait=KmlTourWait,exports.Label=Label,exports.LabelCollection=LabelCollection,exports.LabelGraphics=LabelGraphics,exports.LabelStyle=LabelStyle$1,exports.LabelVisualizer=LabelVisualizer,exports.LagrangePolynomialApproximation=LagrangePolynomialApproximation,exports.LeapSecond=LeapSecond,exports.Light=Light,exports.LightingModel=LightingModel$1,exports.LightingPipelineStage=LightingPipelineStage,exports.LinearApproximation=LinearApproximation,exports.LinearSpline=LinearSpline,exports.ManagedArray=ManagedArray,exports.MapMode2D=MapMode2D$1,exports.MapProjection=MapProjection,exports.MapboxImageryProvider=MapboxImageryProvider,exports.MapboxStyleImageryProvider=MapboxStyleImageryProvider,exports.Material=Material$4,exports.MaterialAppearance=MaterialAppearance,exports.MaterialPipelineStage=MaterialPipelineStage,exports.MaterialProperty=MaterialProperty,exports.Math=CesiumMath,exports.Matrix2=Matrix2,exports.Matrix3=Matrix3,exports.Matrix4=Matrix4,exports.MetadataClass=MetadataClass,exports.MetadataClassProperty=MetadataClassProperty,exports.MetadataComponentType=MetadataComponentType$1,exports.MetadataEntity=MetadataEntity,exports.MetadataEnum=MetadataEnum,exports.MetadataEnumValue=MetadataEnumValue,exports.MetadataSchema=MetadataSchema,exports.MetadataSchemaLoader=MetadataSchemaLoader,exports.MetadataSemantic=MetadataSemantic$1,exports.MetadataTable=MetadataTable,exports.MetadataTableProperty=MetadataTableProperty,exports.MetadataType=MetadataType$1,exports.MipmapHint=MipmapHint$1,exports.Model=Model,exports.ModelAlphaOptions=ModelAlphaOptions,exports.ModelAnimation=ModelAnimation,exports.ModelAnimationCache=ModelAnimationCache,exports.ModelAnimationCollection=ModelAnimationCollection,exports.ModelAnimationLoop=ModelAnimationLoop$1,exports.ModelAnimationState=ModelAnimationState,exports.ModelColorPipelineStage=ModelColorPipelineStage,exports.ModelComponents=ModelComponents,exports.ModelExperimental=ModelExperimental,exports.ModelExperimental3DTileContent=ModelExperimental3DTileContent,exports.ModelExperimentalNode=ModelExperimentalNode,exports.ModelExperimentalPrimitive=ModelExperimentalPrimitive,exports.ModelExperimentalSceneGraph=ModelExperimentalSceneGraph,exports.ModelExperimentalType=ModelExperimentalType$1,exports.ModelExperimentalUtility=ModelExperimentalUtility,exports.ModelFeature=ModelFeature,exports.ModelFeatureTable=ModelFeatureTable,exports.ModelGraphics=ModelGraphics,exports.ModelInstance=ModelInstance,exports.ModelInstanceCollection=ModelInstanceCollection,exports.ModelLightingOptions=ModelLightingOptions,exports.ModelLoadResources=ModelLoadResources,exports.ModelMaterial=ModelMaterial,exports.ModelMatrixUpdateStage=ModelMatrixUpdateStage,exports.ModelMesh=ModelMesh,exports.ModelNode=ModelNode,exports.ModelOutlineLoader=ModelOutlineLoader,exports.ModelRenderResources=ModelRenderResources,exports.ModelUtility=ModelUtility,exports.ModelVisualizer=ModelVisualizer,exports.Moon=Moon,exports.MortonOrder=MortonOrder,exports.Multiple3DTileContent=Multiple3DTileContent,exports.NavigationHelpButton=NavigationHelpButton,exports.NavigationHelpButtonViewModel=NavigationHelpButtonViewModel,exports.NearFarScalar=NearFarScalar,exports.NeverTileDiscardPolicy=NeverTileDiscardPolicy,exports.NodeRenderResources=NodeRenderResources,exports.NodeTransformationProperty=NodeTransformationProperty,exports.OIT=OIT,exports.Occluder=Occluder,exports.OctahedralProjectedCubeMap=OctahedralProjectedCubeMap,exports.OffsetGeometryInstanceAttribute=OffsetGeometryInstanceAttribute,exports.OpenCageGeocoderService=OpenCageGeocoderService,exports.OpenStreetMapImageryProvider=OpenStreetMapImageryProvider,exports.OrderedGroundPrimitiveCollection=OrderedGroundPrimitiveCollection,exports.OrientedBoundingBox=OrientedBoundingBox,exports.OrthographicFrustum=OrthographicFrustum,exports.OrthographicOffCenterFrustum=OrthographicOffCenterFrustum,exports.Packable=Packable,exports.PackableForInterpolation=PackableForInterpolation,exports.Particle=Particle,exports.ParticleBurst=ParticleBurst,exports.ParticleEmitter=ParticleEmitter,exports.ParticleSystem=ParticleSystem,exports.Pass=Pass$1,exports.PassState=PassState,exports.PathGraphics=PathGraphics,exports.PathVisualizer=PathVisualizer,exports.PeliasGeocoderService=PeliasGeocoderService,exports.PerInstanceColorAppearance=PerInstanceColorAppearance,exports.PerformanceDisplay=PerformanceDisplay,exports.PerformanceWatchdog=PerformanceWatchdog,exports.PerformanceWatchdogViewModel=PerformanceWatchdogViewModel,exports.PerspectiveFrustum=PerspectiveFrustum,exports.PerspectiveOffCenterFrustum=PerspectiveOffCenterFrustum,exports.PickDepth=PickDepth,exports.PickDepthFramebuffer=PickDepthFramebuffer,exports.PickFramebuffer=PickFramebuffer,exports.Picking=Picking,exports.PickingPipelineStage=PickingPipelineStage,exports.PinBuilder=PinBuilder,exports.PixelDatatype=PixelDatatype$1,exports.PixelFormat=PixelFormat$1,exports.Plane=Plane,exports.PlaneGeometry=PlaneGeometry,exports.PlaneGeometryUpdater=PlaneGeometryUpdater,exports.PlaneGraphics=PlaneGraphics,exports.PlaneOutlineGeometry=PlaneOutlineGeometry,exports.PntsLoader=PntsLoader,exports.PntsParser=PntsParser,exports.PointCloud=PointCloud,exports.PointCloud3DTileContent=PointCloud3DTileContent,exports.PointCloudAttenuationPipelineStage=PointCloudAttenuationPipelineStage,exports.PointCloudEyeDomeLighting=PointCloudEyeDomeLighting,exports.PointCloudShading=PointCloudShading,exports.PointGraphics=PointGraphics,exports.PointPrimitive=PointPrimitive,exports.PointPrimitiveCollection=PointPrimitiveCollection,exports.PointVisualizer=PointVisualizer,exports.PolygonGeometry=PolygonGeometry,exports.PolygonGeometryLibrary=PolygonGeometryLibrary,exports.PolygonGeometryUpdater=PolygonGeometryUpdater,exports.PolygonGraphics=PolygonGraphics,exports.PolygonHierarchy=PolygonHierarchy,exports.PolygonOutlineGeometry=PolygonOutlineGeometry,exports.PolygonPipeline=PolygonPipeline,exports.Polyline=Polyline,exports.PolylineArrowMaterialProperty=PolylineArrowMaterialProperty,exports.PolylineCollection=PolylineCollection,exports.PolylineColorAppearance=PolylineColorAppearance,exports.PolylineDashMaterialProperty=PolylineDashMaterialProperty,exports.PolylineGeometry=PolylineGeometry,exports.PolylineGeometryUpdater=PolylineGeometryUpdater,exports.PolylineGlowMaterialProperty=PolylineGlowMaterialProperty,exports.PolylineGraphics=PolylineGraphics,exports.PolylineMaterialAppearance=PolylineMaterialAppearance,exports.PolylineOutlineMaterialProperty=PolylineOutlineMaterialProperty,exports.PolylinePipeline=PolylinePipeline,exports.PolylineVisualizer=PolylineVisualizer,exports.PolylineVolumeGeometry=PolylineVolumeGeometry,exports.PolylineVolumeGeometryLibrary=PolylineVolumeGeometryLibrary,exports.PolylineVolumeGeometryUpdater=PolylineVolumeGeometryUpdater,exports.PolylineVolumeGraphics=PolylineVolumeGraphics,exports.PolylineVolumeOutlineGeometry=PolylineVolumeOutlineGeometry,exports.PositionProperty=PositionProperty,exports.PositionPropertyArray=PositionPropertyArray,exports.PostProcessStage=PostProcessStage,exports.PostProcessStageCollection=PostProcessStageCollection,exports.PostProcessStageComposite=PostProcessStageComposite,exports.PostProcessStageLibrary=PostProcessStageLibrary,exports.PostProcessStageSampleMode=PostProcessStageSampleMode,exports.PostProcessStageTextureCache=PostProcessStageTextureCache,exports.Primitive=Primitive$3,exports.PrimitiveCollection=PrimitiveCollection,exports.PrimitivePipeline=PrimitivePipeline,exports.PrimitiveRenderResources=PrimitiveRenderResources,exports.PrimitiveState=PrimitiveState$1,exports.PrimitiveType=PrimitiveType$1,exports.ProjectionPicker=ProjectionPicker,exports.ProjectionPickerViewModel=ProjectionPickerViewModel,exports.Property=Property,exports.PropertyArray=PropertyArray,exports.PropertyBag=PropertyBag,exports.PropertyTable=PropertyTable,exports.PropertyTexture=PropertyTexture,exports.PropertyTextureProperty=PropertyTextureProperty,exports.ProviderViewModel=ProviderViewModel,exports.Proxy=Proxy,exports.QuadraticRealPolynomial=QuadraticRealPolynomial,exports.QuadtreeOccluders=QuadtreeOccluders,exports.QuadtreePrimitive=QuadtreePrimitive,exports.QuadtreeTile=QuadtreeTile,exports.QuadtreeTileLoadState=QuadtreeTileLoadState$1,exports.QuadtreeTileProvider=QuadtreeTileProvider,exports.QuantizedMeshTerrainData=QuantizedMeshTerrainData,exports.QuarticRealPolynomial=QuarticRealPolynomial,exports.Quaternion=Quaternion,exports.QuaternionSpline=QuaternionSpline,exports.Queue=Queue,exports.Ray=Ray,exports.Rectangle=Rectangle,exports.RectangleCollisionChecker=RectangleCollisionChecker,exports.RectangleGeometry=RectangleGeometry,exports.RectangleGeometryLibrary=RectangleGeometryLibrary,exports.RectangleGeometryUpdater=RectangleGeometryUpdater,exports.RectangleGraphics=RectangleGraphics,exports.RectangleOutlineGeometry=RectangleOutlineGeometry,exports.ReferenceFrame=ReferenceFrame$1,exports.ReferenceProperty=ReferenceProperty,exports.RenderState=RenderState,exports.Renderbuffer=Renderbuffer,exports.RenderbufferFormat=RenderbufferFormat$1,exports.Request=Request,exports.RequestErrorEvent=RequestErrorEvent,exports.RequestScheduler=RequestScheduler,exports.RequestState=RequestState$1,exports.RequestType=RequestType$1,exports.Resource=Resource,exports.ResourceCache=ResourceCache,exports.ResourceCacheKey=ResourceCacheKey,exports.ResourceLoader=ResourceLoader,exports.ResourceLoaderState=ResourceLoaderState$1,exports.Rotation=Rotation,exports.RuntimeError=RuntimeError,exports.S2Cell=S2Cell,exports.SDFSettings=SDFSettings$1,exports.SampledPositionProperty=SampledPositionProperty,exports.SampledProperty=SampledProperty,exports.Sampler=Sampler,exports.ScaledPositionProperty=ScaledPositionProperty,exports.Scene=Scene,exports.SceneFramebuffer=SceneFramebuffer,exports.SceneMode=SceneMode$1,exports.SceneModePicker=SceneModePicker,exports.SceneModePickerViewModel=SceneModePickerViewModel,exports.SceneTransforms=SceneTransforms,exports.SceneTransitioner=SceneTransitioner,exports.ScreenSpaceCameraController=ScreenSpaceCameraController,exports.ScreenSpaceEventHandler=ScreenSpaceEventHandler,exports.ScreenSpaceEventType=ScreenSpaceEventType$1,exports.SelectionIndicator=SelectionIndicator,exports.SelectionIndicatorViewModel=SelectionIndicatorViewModel,exports.ShaderBuilder=ShaderBuilder,exports.ShaderCache=ShaderCache,exports.ShaderDestination=ShaderDestination$1,exports.ShaderFunction=ShaderFunction,exports.ShaderProgram=ShaderProgram,exports.ShaderSource=ShaderSource,exports.ShaderStruct=ShaderStruct,exports.ShadowMap=ShadowMap,exports.ShadowMapShader=ShadowMapShader,exports.ShadowMode=ShadowMode$1,exports.ShadowVolumeAppearance=ShadowVolumeAppearance,exports.ShowGeometryInstanceAttribute=ShowGeometryInstanceAttribute,exports.Simon1994PlanetaryPositions=Simon1994PlanetaryPositions,exports.SimplePolylineGeometry=SimplePolylineGeometry,exports.SingleTileImageryProvider=SingleTileImageryProvider,exports.SkyAtmosphere=SkyAtmosphere,exports.SkyBox=SkyBox,exports.SphereEmitter=SphereEmitter,exports.SphereGeometry=SphereGeometry,exports.SphereOutlineGeometry=SphereOutlineGeometry,exports.Spherical=Spherical,exports.Spline=Spline,exports.StaticGeometryColorBatch=StaticGeometryColorBatch,exports.StaticGeometryPerMaterialBatch=StaticGeometryPerMaterialBatch,exports.StaticGroundGeometryColorBatch=StaticGroundGeometryColorBatch,exports.StaticGroundGeometryPerMaterialBatch=StaticGroundGeometryPerMaterialBatch,exports.StaticGroundPolylinePerMaterialBatch=StaticGroundPolylinePerMaterialBatch,exports.StaticOutlineGeometryBatch=StaticOutlineGeometryBatch,exports.StencilConstants=StencilConstants$1,exports.StencilFunction=StencilFunction$1,exports.StencilOperation=StencilOperation$1,exports.StripeMaterialProperty=StripeMaterialProperty,exports.StripeOrientation=StripeOrientation$1,exports.StyleCommandsNeeded=StyleCommandsNeeded$1,exports.StyleExpression=StyleExpression,exports.Sun=Sun,exports.SunLight=SunLight,exports.SunPostProcess=SunPostProcess,exports.SupportedImageFormats=SupportedImageFormats,exports.SvgPathBindingHandler=SvgPathBindingHandler,exports.TaskProcessor=TaskProcessor,exports.TerrainData=TerrainData,exports.TerrainEncoding=TerrainEncoding,exports.TerrainExaggeration=TerrainExaggeration,exports.TerrainFillMesh=TerrainFillMesh,exports.TerrainMesh=TerrainMesh,exports.TerrainOffsetProperty=TerrainOffsetProperty,exports.TerrainProvider=TerrainProvider,exports.TerrainQuantization=TerrainQuantization$1,exports.TerrainState=TerrainState$1,exports.Texture=Texture,exports.TextureAtlas=TextureAtlas,exports.TextureCache=TextureCache,exports.TextureMagnificationFilter=TextureMagnificationFilter$1,exports.TextureManager=TextureManager,exports.TextureMinificationFilter=TextureMinificationFilter$1,exports.TextureUniform=TextureUniform,exports.TextureWrap=TextureWrap$1,exports.TileAvailability=TileAvailability,exports.TileBoundingRegion=TileBoundingRegion,exports.TileBoundingS2Cell=TileBoundingS2Cell,exports.TileBoundingSphere=TileBoundingSphere,exports.TileBoundingVolume=TileBoundingVolume,exports.TileCoordinatesImageryProvider=TileCoordinatesImageryProvider,exports.TileDiscardPolicy=TileDiscardPolicy,exports.TileEdge=TileEdge,exports.TileImagery=TileImagery,exports.TileMapServiceImageryProvider=TileMapServiceImageryProvider,exports.TileMetadata=TileMetadata,exports.TileOrientedBoundingBox=TileOrientedBoundingBox,exports.TileProviderError=TileProviderError,exports.TileReplacementQueue=TileReplacementQueue,exports.TileSelectionResult=TileSelectionResult,exports.TileState=TileState$1,exports.Tileset3DTileContent=Tileset3DTileContent,exports.TilesetMetadata=TilesetMetadata,exports.TilingScheme=TilingScheme,exports.TimeConstants=TimeConstants$1,exports.TimeDynamicImagery=TimeDynamicImagery,exports.TimeDynamicPointCloud=TimeDynamicPointCloud,exports.TimeInterval=TimeInterval,exports.TimeIntervalCollection=TimeIntervalCollection,exports.TimeIntervalCollectionPositionProperty=TimeIntervalCollectionPositionProperty,exports.TimeIntervalCollectionProperty=TimeIntervalCollectionProperty,exports.TimeStandard=TimeStandard$1,exports.Timeline=Timeline,exports.TimelineHighlightRange=TimelineHighlightRange,exports.TimelineTrack=TimelineTrack,exports.Tipsify=Tipsify,exports.ToggleButtonViewModel=ToggleButtonViewModel,exports.Tonemapper=Tonemapper$1,exports.Transforms=Transforms,exports.TranslationRotationScale=TranslationRotationScale,exports.TranslucentTileClassification=TranslucentTileClassification,exports.TridiagonalSystemSolver=TridiagonalSystemSolver,exports.TrustedServers=TrustedServers,exports.Tween=Tween$1,exports.TweenCollection=TweenCollection,exports.UniformState=UniformState,exports.UniformType=UniformType$1,exports.Uri=URI,exports.UrlTemplateImageryProvider=UrlTemplateImageryProvider,exports.VERSION=VERSION,exports.VRButton=VRButton,exports.VRButtonViewModel=VRButtonViewModel,exports.VRTheWorldTerrainProvider=VRTheWorldTerrainProvider,exports.VaryingType=VaryingType$1,exports.Vector3DTileBatch=Vector3DTileBatch,exports.Vector3DTileClampedPolylines=Vector3DTileClampedPolylines,exports.Vector3DTileContent=Vector3DTileContent,exports.Vector3DTileGeometry=Vector3DTileGeometry,exports.Vector3DTilePoints=Vector3DTilePoints,exports.Vector3DTilePolygons=Vector3DTilePolygons,exports.Vector3DTilePolylines=Vector3DTilePolylines,exports.Vector3DTilePrimitive=Vector3DTilePrimitive,exports.VelocityOrientationProperty=VelocityOrientationProperty,exports.VelocityVectorProperty=VelocityVectorProperty,exports.VertexArray=VertexArray,exports.VertexArrayFacade=VertexArrayFacade,exports.VertexAttributeSemantic=VertexAttributeSemantic$1,exports.VertexFormat=VertexFormat,exports.VerticalOrigin=VerticalOrigin$1,exports.VideoSynchronizer=VideoSynchronizer,exports.View=View,exports.Viewer=Viewer,exports.ViewportQuad=ViewportQuad,exports.Visibility=Visibility$1,exports.Visualizer=Visualizer,exports.VulkanConstants=VulkanConstants$1,exports.WallGeometry=WallGeometry,exports.WallGeometryLibrary=WallGeometryLibrary,exports.WallGeometryUpdater=WallGeometryUpdater,exports.WallGraphics=WallGraphics,exports.WallOutlineGeometry=WallOutlineGeometry,exports.WebGLConstants=WebGLConstants$1,exports.WebMapServiceImageryProvider=WebMapServiceImageryProvider,exports.WebMapTileServiceImageryProvider=WebMapTileServiceImageryProvider,exports.WebMercatorProjection=WebMercatorProjection,exports.WebMercatorTilingScheme=WebMercatorTilingScheme,exports.WeightSpline=WeightSpline,exports.WindingOrder=WindingOrder$1,exports._shadersAcesTonemappingStage=AcesTonemapping,exports._shadersAdditiveBlend=AdditiveBlend,exports._shadersAdjustTranslucentFS=AdjustTranslucentFS,exports._shadersAllMaterialAppearanceFS=AllMaterialAppearanceFS,exports._shadersAllMaterialAppearanceVS=AllMaterialAppearanceVS,exports._shadersAmbientOcclusionGenerate=AmbientOcclusionGenerate,exports._shadersAmbientOcclusionModulate=AmbientOcclusionModulate,exports._shadersAspectRampMaterial=AspectRampMaterial,exports._shadersBasicMaterialAppearanceFS=BasicMaterialAppearanceFS,exports._shadersBasicMaterialAppearanceVS=BasicMaterialAppearanceVS,exports._shadersBillboardCollectionFS=BillboardCollectionFS,exports._shadersBillboardCollectionVS=BillboardCollectionVS,exports._shadersBlackAndWhite=BlackAndWhite,exports._shadersBloomComposite=BloomComposite,exports._shadersBrdfLutGeneratorFS=BrdfLutGeneratorFS,exports._shadersBrightPass=BrightPass,exports._shadersBrightness=Brightness,exports._shadersBumpMapMaterial=BumpMapMaterial,exports._shadersCPUStylingStageFS=CPUStylingStageFS,exports._shadersCPUStylingStageVS=CPUStylingStageVS,exports._shadersCheckerboardMaterial=CheckerboardMaterial,exports._shadersCloudCollectionFS=CloudCollectionFS,exports._shadersCloudCollectionVS=CloudCollectionVS,exports._shadersCloudNoiseFS=CloudNoiseFS,exports._shadersCloudNoiseVS=CloudNoiseVS,exports._shadersCompareAndPackTranslucentDepth=CompareAndPackTranslucentDepth,exports._shadersCompositeOITFS=CompositeOITFS,exports._shadersCompositeTranslucentClassification=CompositeTranslucentClassification,exports._shadersContrastBias=ContrastBias,exports._shadersCustomShaderStageFS=CustomShaderStageFS,exports._shadersCustomShaderStageVS=CustomShaderStageVS,exports._shadersCzmBuiltins=CzmBuiltins,exports._shadersDepthOfField=DepthOfField,exports._shadersDepthPlaneFS=DepthPlaneFS,exports._shadersDepthPlaneVS=DepthPlaneVS,exports._shadersDepthView=DepthView,exports._shadersDepthViewPacked=DepthViewPacked,exports._shadersDotMaterial=DotMaterial,exports._shadersEdgeDetection=EdgeDetection,exports._shadersElevationBandMaterial=ElevationBandMaterial,exports._shadersElevationContourMaterial=ElevationContourMaterial,exports._shadersElevationRampMaterial=ElevationRampMaterial,exports._shadersEllipsoidFS=EllipsoidFS,exports._shadersEllipsoidSurfaceAppearanceFS=EllipsoidSurfaceAppearanceFS,exports._shadersEllipsoidSurfaceAppearanceVS=EllipsoidSurfaceAppearanceVS,exports._shadersEllipsoidVS=EllipsoidVS,exports._shadersFXAA=FXAA,exports._shadersFXAA3_11=FXAA3_11,exports._shadersFadeMaterial=FadeMaterial,exports._shadersFeatureStageCommon=FeatureStageCommon,exports._shadersFeatureStageFS=FeatureStageFS,exports._shadersFeatureStageVS=FeatureStageVS,exports._shadersFilmicTonemapping=FilmicTonemapping,exports._shadersGaussianBlur1D=GaussianBlur1D,exports._shadersGeometryStageFS=GeometryStageFS,exports._shadersGeometryStageVS=GeometryStageVS,exports._shadersGlobeFS=GlobeFS,exports._shadersGlobeVS=GlobeVS,exports._shadersGridMaterial=GridMaterial,exports._shadersGroundAtmosphere=GroundAtmosphere,exports._shadersHSBToRGB=czm_HSBToRGB,exports._shadersHSLToRGB=czm_HSLToRGB,exports._shadersInstancingStageCommon=InstancingStageCommon,exports._shadersInstancingStageVS=InstancingStageVS,exports._shadersLegacyInstancingStageVS=LegacyInstancingStageVS,exports._shadersLensFlare=LensFlare,exports._shadersLightingStageFS=LightingStageFS,exports._shadersMaterialStageFS=MaterialStageFS,exports._shadersModelColorStageFS=ModelColorStageFS,exports._shadersModelExperimentalFS=ModelExperimentalFS,exports._shadersModelExperimentalVS=ModelExperimentalVS,exports._shadersModifiedReinhardTonemapping=ModifiedReinhardTonemapping,exports._shadersNightVision=NightVision,exports._shadersNormalMapMaterial=NormalMapMaterial,exports._shadersOctahedralProjectionAtlasFS=OctahedralProjectionAtlasFS,exports._shadersOctahedralProjectionFS=OctahedralProjectionFS;exports._shadersOctahedralProjectionVS=OctahedralProjectionVS,exports._shadersPassThrough=PassThrough,exports._shadersPassThroughDepth=PassThroughDepth,exports._shadersPerInstanceColorAppearanceFS=PerInstanceColorAppearanceFS,exports._shadersPerInstanceColorAppearanceVS=PerInstanceColorAppearanceVS,exports._shadersPerInstanceFlatColorAppearanceFS=PerInstanceFlatColorAppearanceFS,exports._shadersPerInstanceFlatColorAppearanceVS=PerInstanceFlatColorAppearanceVS,exports._shadersPointCloudAttenuationStageVS=PointCloudAttenuationStageVS,exports._shadersPointCloudEyeDomeLighting=PointCloudEyeDomeLightingShader,exports._shadersPointPrimitiveCollectionFS=PointPrimitiveCollectionFS,exports._shadersPointPrimitiveCollectionVS=PointPrimitiveCollectionVS,exports._shadersPolylineArrowMaterial=PolylineArrowMaterial,exports._shadersPolylineColorAppearanceVS=PolylineColorAppearanceVS,exports._shadersPolylineCommon=PolylineCommon,exports._shadersPolylineDashMaterial=PolylineDashMaterial,exports._shadersPolylineFS=PolylineFS$1,exports._shadersPolylineGlowMaterial=PolylineGlowMaterial,exports._shadersPolylineMaterialAppearanceVS=PolylineMaterialAppearanceVS,exports._shadersPolylineOutlineMaterial=PolylineOutlineMaterial,exports._shadersPolylineShadowVolumeFS=PolylineShadowVolumeFS,exports._shadersPolylineShadowVolumeMorphFS=PolylineShadowVolumeMorphFS,exports._shadersPolylineShadowVolumeMorphVS=PolylineShadowVolumeMorphVS,exports._shadersPolylineShadowVolumeVS=PolylineShadowVolumeVS,exports._shadersPolylineVS=PolylineVS,exports._shadersRGBToHSB=czm_RGBToHSB,exports._shadersRGBToHSL=czm_RGBToHSL,exports._shadersRGBToXYZ=czm_RGBToXYZ,exports._shadersReinhardTonemapping=ReinhardTonemapping,exports._shadersReprojectWebMercatorFS=ReprojectWebMercatorFS,exports._shadersReprojectWebMercatorVS=ReprojectWebMercatorVS,exports._shadersRimLightingMaterial=RimLightingMaterial,exports._shadersShadowVolumeAppearanceFS=ShadowVolumeAppearanceFS,exports._shadersShadowVolumeAppearanceVS=ShadowVolumeAppearanceVS,exports._shadersShadowVolumeFS=ShadowVolumeFS,exports._shadersSilhouette=Silhouette,exports._shadersSkyAtmosphereCommon=SkyAtmosphereCommon,exports._shadersSkyAtmosphereFS=SkyAtmosphereFS,exports._shadersSkyAtmosphereVS=SkyAtmosphereVS,exports._shadersSkyBoxFS=SkyBoxFS,exports._shadersSkyBoxVS=SkyBoxVS,exports._shadersSlopeRampMaterial=SlopeRampMaterial,exports._shadersStripeMaterial=StripeMaterial,exports._shadersSunFS=SunFS,exports._shadersSunTextureFS=SunTextureFS,exports._shadersSunVS=SunVS,exports._shadersTexturedMaterialAppearanceFS=TexturedMaterialAppearanceFS,exports._shadersTexturedMaterialAppearanceVS=TexturedMaterialAppearanceVS,exports._shadersVector3DTileClampedPolylinesFS=Vector3DTileClampedPolylinesFS,exports._shadersVector3DTileClampedPolylinesVS=Vector3DTileClampedPolylinesVS,exports._shadersVector3DTilePolylinesVS=Vector3DTilePolylinesVS,exports._shadersVectorTileVS=VectorTileVS,exports._shadersViewportQuadFS=ViewportQuadFS,exports._shadersViewportQuadVS=ViewportQuadVS,exports._shadersWater=WaterMaterial,exports._shadersXYZToRGB=czm_XYZToRGB,exports._shadersacesTonemapping=czm_acesTonemapping,exports._shadersalphaWeight=czm_alphaWeight,exports._shadersantialias=czm_antialias,exports._shadersapproximateSphericalCoordinates=czm_approximateSphericalCoordinates,exports._shadersbackFacing=czm_backFacing,exports._shadersbranchFreeTernary=czm_branchFreeTernary,exports._shaderscascadeColor=czm_cascadeColor,exports._shaderscascadeDistance=czm_cascadeDistance,exports._shaderscascadeMatrix=czm_cascadeMatrix,exports._shaderscascadeWeights=czm_cascadeWeights,exports._shaderscolumbusViewMorph=czm_columbusViewMorph,exports._shaderscomputePosition=czm_computePosition,exports._shaderscosineAndSine=czm_cosineAndSine,exports._shadersdecompressTextureCoordinates=czm_decompressTextureCoordinates,exports._shadersdefaultPbrMaterial=czm_defaultPbrMaterial,exports._shadersdegreesPerRadian=czm_degreesPerRadian,exports._shadersdepthClamp=czm_depthClamp,exports._shadersdepthRange=czm_depthRange,exports._shadersdepthRangeStruct=czm_depthRangeStruct,exports._shaderseastNorthUpToEyeCoordinates=czm_eastNorthUpToEyeCoordinates,exports._shadersellipsoidContainsPoint=czm_ellipsoidContainsPoint,exports._shadersellipsoidWgs84TextureCoordinates=czm_ellipsoidWgs84TextureCoordinates,exports._shadersepsilon1=czm_epsilon1,exports._shadersepsilon2=czm_epsilon2,exports._shadersepsilon3=czm_epsilon3,exports._shadersepsilon4=czm_epsilon4,exports._shadersepsilon5=czm_epsilon5,exports._shadersepsilon6=czm_epsilon6,exports._shadersepsilon7=czm_epsilon7,exports._shadersequalsEpsilon=czm_equalsEpsilon,exports._shaderseyeOffset=czm_eyeOffset,exports._shaderseyeToWindowCoordinates=czm_eyeToWindowCoordinates,exports._shadersfastApproximateAtan=czm_fastApproximateAtan,exports._shadersfog=czm_fog,exports._shadersgammaCorrect=czm_gammaCorrect,exports._shadersgeodeticSurfaceNormal=czm_geodeticSurfaceNormal,exports._shadersgetDefaultMaterial=czm_getDefaultMaterial,exports._shadersgetLambertDiffuse=czm_getLambertDiffuse,exports._shadersgetSpecular=czm_getSpecular,exports._shadersgetWaterNoise=czm_getWaterNoise,exports._shadershue=czm_hue,exports._shadersinfinity=czm_infinity,exports._shadersinverseGamma=czm_inverseGamma,exports._shadersisEmpty=czm_isEmpty,exports._shadersisFull=czm_isFull,exports._shaderslatitudeToWebMercatorFraction=czm_latitudeToWebMercatorFraction,exports._shaderslineDistance=czm_lineDistance,exports._shaderslinearToSrgb=czm_linearToSrgb,exports._shadersluminance=czm_luminance,exports._shadersmaterial=czm_material,exports._shadersmaterialInput=czm_materialInput,exports._shadersmetersPerPixel=czm_metersPerPixel,exports._shadersmodelMaterial=czm_modelMaterial,exports._shadersmodelToWindowCoordinates=czm_modelToWindowCoordinates,exports._shadersmodelVertexOutput=czm_modelVertexOutput,exports._shadersmultiplyWithColorBalance=czm_multiplyWithColorBalance,exports._shadersnearFarScalar=czm_nearFarScalar,exports._shadersoctDecode=czm_octDecode,exports._shadersoneOverPi=czm_oneOverPi,exports._shadersoneOverTwoPi=czm_oneOverTwoPi,exports._shaderspackDepth=czm_packDepth,exports._shaderspassCesium3DTile=czm_passCesium3DTile,exports._shaderspassCesium3DTileClassification=czm_passCesium3DTileClassification,exports._shaderspassCesium3DTileClassificationIgnoreShow=czm_passCesium3DTileClassificationIgnoreShow,exports._shaderspassClassification=czm_passClassification,exports._shaderspassCompute=czm_passCompute,exports._shaderspassEnvironment=czm_passEnvironment,exports._shaderspassGlobe=czm_passGlobe,exports._shaderspassOpaque=czm_passOpaque,exports._shaderspassOverlay=czm_passOverlay,exports._shaderspassTerrainClassification=czm_passTerrainClassification,exports._shaderspassTranslucent=czm_passTranslucent,exports._shaderspbrLighting=czm_pbrLighting,exports._shaderspbrMetallicRoughnessMaterial=czm_pbrMetallicRoughnessMaterial,exports._shaderspbrParameters=czm_pbrParameters,exports._shaderspbrSpecularGlossinessMaterial=czm_pbrSpecularGlossinessMaterial,exports._shadersphong=czm_phong,exports._shaderspi=czm_pi,exports._shaderspiOverFour=czm_piOverFour,exports._shaderspiOverSix=czm_piOverSix,exports._shaderspiOverThree=czm_piOverThree,exports._shaderspiOverTwo=czm_piOverTwo,exports._shadersplaneDistance=czm_planeDistance,exports._shaderspointAlongRay=czm_pointAlongRay,exports._shadersradiansPerDegree=czm_radiansPerDegree,exports._shadersray=czm_ray,exports._shadersrayEllipsoidIntersectionInterval=czm_rayEllipsoidIntersectionInterval,exports._shadersraySegment=czm_raySegment,exports._shadersreadDepth=czm_readDepth,exports._shadersreadNonPerspective=czm_readNonPerspective,exports._shadersreverseLogDepth=czm_reverseLogDepth,exports._shaderssampleOctahedralProjection=czm_sampleOctahedralProjection,exports._shaderssaturation=czm_saturation,exports._shaderssceneMode2D=czm_sceneMode2D,exports._shaderssceneMode3D=czm_sceneMode3D,exports._shaderssceneModeColumbusView=czm_sceneModeColumbusView,exports._shaderssceneModeMorphing=czm_sceneModeMorphing,exports._shadersshadowDepthCompare=czm_shadowDepthCompare,exports._shadersshadowParameters=czm_shadowParameters,exports._shadersshadowVisibility=czm_shadowVisibility,exports._shaderssignNotZero=czm_signNotZero,exports._shaderssolarRadius=czm_solarRadius,exports._shaderssphericalHarmonics=czm_sphericalHarmonics,exports._shaderssrgbToLinear=czm_srgbToLinear,exports._shaderstangentToEyeSpaceMatrix=czm_tangentToEyeSpaceMatrix,exports._shadersthreePiOver2=czm_threePiOver2,exports._shaderstransformPlane=czm_transformPlane,exports._shaderstranslateRelativeToEye=czm_translateRelativeToEye,exports._shaderstranslucentPhong=czm_translucentPhong,exports._shaderstranspose=czm_transpose,exports._shaderstwoPi=czm_twoPi,exports._shadersunpackDepth=czm_unpackDepth,exports._shadersunpackFloat=czm_unpackFloat,exports._shadersvertexLogDepth=czm_vertexLogDepth,exports._shaderswebMercatorMaxLatitude=czm_webMercatorMaxLatitude,exports._shaderswindowToEyeCoordinates=czm_windowToEyeCoordinates,exports._shaderswriteDepthClamp=czm_writeDepthClamp,exports._shaderswriteLogDepth=czm_writeLogDepth,exports._shaderswriteNonPerspective=czm_writeNonPerspective,exports.addBuffer=addBuffer,exports.addDefaults=addDefaults,exports.addExtensionsRequired=addExtensionsRequired,exports.addExtensionsUsed=addExtensionsUsed,exports.addPipelineExtras=addPipelineExtras,exports.addToArray=addToArray,exports.appendForwardSlash=appendForwardSlash,exports.arrayFill=arrayFill,exports.arrayRemoveDuplicates=arrayRemoveDuplicates,exports.arraySlice=arraySlice,exports.barycentricCoordinates=barycentricCoordinates,exports.binarySearch=binarySearch,exports.bitmap_sdf=bitmapSdf,exports.buildDrawCommands=buildDrawCommands,exports.buildModuleUrl=buildModuleUrl,exports.cancelAnimationFrame=cancelAnimationFramePolyfill,exports.clone=clone$1,exports.combine=combine$2,exports.computeFlyToLocationForRectangle=computeFlyToLocationForRectangle,exports.createBillboardPointCallback=createBillboardPointCallback,exports.createCommand=createCommand,exports.createDefaultImageryProviderViewModels=createDefaultImageryProviderViewModels,exports.createDefaultTerrainProviderViewModels=createDefaultTerrainProviderViewModels,exports.createElevationBandMaterial=createElevationBandMaterial,exports.createGuid=createGuid,exports.createMaterialPropertyDescriptor=createMaterialPropertyDescriptor,exports.createOsmBuildings=createOsmBuildings,exports.createPropertyDescriptor=createPropertyDescriptor,exports.createRawPropertyDescriptor=createRawPropertyDescriptor,exports.createTangentSpaceDebugPrimitive=createTangentSpaceDebugPrimitive,exports.createTaskProcessorWorker=createTaskProcessorWorker,exports.createUniform=createUniform,exports.createUniformArray=createUniformArray,exports.createWorldImagery=createWorldImagery,exports.createWorldTerrain=createWorldTerrain,exports.decodeGoogleEarthEnterpriseData=decodeGoogleEarthEnterpriseData,exports.decodeVectorPolylinePositions=decodeVectorPolylinePositions,exports.defaultValue=defaultValue,exports.defined=defined,exports.deprecationWarning=deprecationWarning,exports.destroyObject=destroyObject,exports.dompurify=purify,exports.earcut=earcut_1,exports.exportKml=exportKml,exports.findAccessorMinMax=findAccessorMinMax,exports.findGroupMetadata=findGroupMetadata,exports.forEachTextureInMaterial=forEachTextureInMaterial,exports.formatError=formatError,exports.freezeRenderState=freezeRenderState,exports.getAbsoluteUri=getAbsoluteUri,exports.getAccessorByteStride=getAccessorByteStride,exports.getBaseUri=getBaseUri,exports.getBinaryAccessor=getBinaryAccessor,exports.getClipAndStyleCode=getClipAndStyleCode,exports.getClippingFunction=getClippingFunction,exports.getComponentReader=getComponentReader,exports.getElement=getElement,exports.getExtensionFromUri=getExtensionFromUri,exports.getFilenameFromUri=getFilenameFromUri,exports.getImagePixels=getImagePixels,exports.getJsonFromTypedArray=getJsonFromTypedArray,exports.getMagic=getMagic,exports.getStringFromTypedArray=getStringFromTypedArray,exports.getTimestamp=getTimestamp$1,exports.grapheme_splitter=graphemeSplitter,exports.hasExtension=hasExtension,exports.heightReferenceOnEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,exports.isBitSet=isBitSet,exports.isBlobUri=isBlobUri,exports.isCrossOriginUrl=isCrossOriginUrl,exports.isDataUri=isDataUri,exports.isLeapYear=isLeapYear,exports.jsep=jsep,exports.kdbush=KDBush,exports.knockout=knockout,exports.knockout_3_5_1=knockout,exports.knockout_es5=knockout_es5,exports.ktx_parse=p,exports.lerc=LercDecode,exports.loadAndExecuteScript=loadAndExecuteScript,exports.loadCubeMap=loadCubeMap,exports.loadImageFromTypedArray=loadImageFromTypedArray,exports.loadKTX2=loadKTX2,exports.mergeSort=mergeSort,exports.mersenne_twister=mersenneTwister,exports.meshoptimizer=MeshoptDecoder,exports.modernizeShader=modernizeShader,exports.moveTechniqueRenderStates=moveTechniqueRenderStates,exports.moveTechniquesToExtension=moveTechniquesToExtension,exports.nosleep=src,exports.numberOfComponentsForType=numberOfComponentsForType,exports.objectToQuery=objectToQuery,exports.oneTimeWarning=oneTimeWarning,exports.pako=inflate_1,exports.parseBatchTable=parseBatchTable,exports.parseBoundingVolumeSemantics=parseBoundingVolumeSemantics,exports.parseFeatureMetadata=parseFeatureMetadata,exports.parseFeatureMetadataLegacy=parseFeatureMetadataLegacy,exports.parseGlb=parseGlb,exports.parseResponseHeaders=parseResponseHeaders,exports.pointInsideTriangle=pointInsideTriangle,exports.preprocess3DTileContent=preprocess3DTileContent,exports.processModelMaterialsCommon=processModelMaterialsCommon,exports.processPbrMaterials=processPbrMaterials,exports.protobufjs=protobuf$1,exports.queryToObject=queryToObject,exports.rbush=RBush,exports.readAccessorPacked=readAccessorPacked,exports.removeExtensionsRequired=removeExtensionsRequired,exports.removeExtensionsUsed=removeExtensionsUsed,exports.removePipelineExtras=removePipelineExtras,exports.removeUnusedElements=removeUnusedElements,exports.requestAnimationFrame=requestAnimationFramePolyFill,exports.sampleTerrain=sampleTerrain,exports.sampleTerrainMostDetailed=sampleTerrainMostDetailed,exports.scaleToGeodeticSurface=scaleToGeodeticSurface,exports.subdivideArray=subdivideArray,exports.subscribeAndEvaluate=subscribeAndEvaluate,exports.topojson=index,exports.updateAccessorComponentTypes=updateAccessorComponentTypes,exports.updateVersion=updateVersion,exports.usesExtension=usesExtension,exports.viewerCesium3DTilesInspectorMixin=viewerCesium3DTilesInspectorMixin,exports.viewerCesiumInspectorMixin=viewerCesiumInspectorMixin,exports.viewerDragDropMixin=viewerDragDropMixin,exports.viewerPerformanceWatchdogMixin=viewerPerformanceWatchdogMixin,exports.webGLConstantToGlslType=webGLConstantToGlslType,exports.when=when,exports.wrapFunction=wrapFunction,exports.writeTextToCanvas=writeTextToCanvas,exports.zip=zipNoWorker,Object.defineProperty(exports,"__esModule",{value:!0})}));