import{Q as pP,a3 as e_,_ as eU,r as Ps,a2 as zq,x as Uq,a4 as kq,d as ea,o as _x,c as gx,N as Vq,e as Xn,w as ic,l as is,A as jf,f as gr,m as tU,I as Hq,a5 as Gq,a6 as em,a7 as jq,n as dg,K as mL,M as _L,J as gL,O as yL,a8 as Wq}from"./index.064676a5.js";import{R as qq}from"./index.030fe210.js";import{d as Yq}from"./download.fe7036ba.js";function $q(e){return pP({url:"/hjjc/sxjg",method:"get",params:e})}function Xq(e){return pP({url:"/hjjc/gjmchqjwd",method:"get",params:e})}function Tb(e){return pP({url:"/hjjc/gjdevhsjqcx",method:"get",params:e})}function c(e){return e!=null}function E(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(E.prototype=Object.create(Error.prototype),E.prototype.constructor=E);E.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=` ${this.stack.toString()}`),e};E.throwInstantiationError=function(){throw new E("This function defines an interface and should not be called directly.")};const Wo={};Wo.typeOf={};function Qq(e){return`${e} is required, actual value was undefined`}function k_(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Wo.defined=function(e,t){if(!c(t))throw new E(Qq(e))};Wo.typeOf.func=function(e,t){if(typeof t!="function")throw new E(k_(typeof t,"function",e))};Wo.typeOf.string=function(e,t){if(typeof t!="string")throw new E(k_(typeof t,"string",e))};Wo.typeOf.number=function(e,t){if(typeof t!="number")throw new E(k_(typeof t,"number",e))};Wo.typeOf.number.lessThan=function(e,t,n){if(Wo.typeOf.number(e,t),t>=n)throw new E(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Wo.typeOf.number.lessThanOrEquals=function(e,t,n){if(Wo.typeOf.number(e,t),t>n)throw new E(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Wo.typeOf.number.greaterThan=function(e,t,n){if(Wo.typeOf.number(e,t),t<=n)throw new E(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Wo.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Wo.typeOf.number(e,t),t>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};yd.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[i]+i,this.mt[n]>>>=0,n++,i++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648};yd.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>>1^t[e&1];for(;n>>1^t[e&1];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[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0};yd.prototype.random_int31=function(){return this.random_int()>>>1};yd.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};yd.prototype.random=function(){return this.random_int()*(1/4294967296)};yd.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};yd.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};var fC=yd;const Be={};Be.EPSILON1=.1;Be.EPSILON2=.01;Be.EPSILON3=.001;Be.EPSILON4=1e-4;Be.EPSILON5=1e-5;Be.EPSILON6=1e-6;Be.EPSILON7=1e-7;Be.EPSILON8=1e-8;Be.EPSILON9=1e-9;Be.EPSILON10=1e-10;Be.EPSILON11=1e-11;Be.EPSILON12=1e-12;Be.EPSILON13=1e-13;Be.EPSILON14=1e-14;Be.EPSILON15=1e-15;Be.EPSILON16=1e-16;Be.EPSILON17=1e-17;Be.EPSILON18=1e-18;Be.EPSILON19=1e-19;Be.EPSILON20=1e-20;Be.EPSILON21=1e-21;Be.GRAVITATIONALPARAMETER=3986004418e5;Be.SOLAR_RADIUS=6955e5;Be.LUNAR_RADIUS=1737400;Be.SIXTY_FOUR_KILOBYTES=64*1024;Be.FOUR_GIGABYTES=4*1024*1024*1024;Be.sign=y(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});Be.signNotZero=function(e){return e<0?-1:1};Be.toSNorm=function(e,t){return t=y(t,255),Math.round((Be.clamp(e,-1,1)*.5+.5)*t)};Be.fromSNorm=function(e,t){return t=y(t,255),Be.clamp(e,0,t)/t*2-1};Be.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:Be.clamp((e-t)/n,0,1)};Be.sinh=y(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});Be.cosh=y(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});Be.lerp=function(e,t,n){return(1-n)*e+n*t};Be.PI=Math.PI;Be.ONE_OVER_PI=1/Math.PI;Be.PI_OVER_TWO=Math.PI/2;Be.PI_OVER_THREE=Math.PI/3;Be.PI_OVER_FOUR=Math.PI/4;Be.PI_OVER_SIX=Math.PI/6;Be.THREE_PI_OVER_TWO=3*Math.PI/2;Be.TWO_PI=2*Math.PI;Be.ONE_OVER_TWO_PI=1/(2*Math.PI);Be.RADIANS_PER_DEGREE=Math.PI/180;Be.DEGREES_PER_RADIAN=180/Math.PI;Be.RADIANS_PER_ARCSECOND=Be.RADIANS_PER_DEGREE/3600;Be.toRadians=function(e){if(!c(e))throw new E("degrees is required.");return e*Be.RADIANS_PER_DEGREE};Be.toDegrees=function(e){if(!c(e))throw new E("radians is required.");return e*Be.DEGREES_PER_RADIAN};Be.convertLongitudeRange=function(e){if(!c(e))throw new E("angle is required.");const t=Be.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};Be.clampToLatitudeRange=function(e){if(!c(e))throw new E("angle is required.");return Be.clamp(e,-1*Be.PI_OVER_TWO,Be.PI_OVER_TWO)};Be.negativePiToPi=function(e){if(!c(e))throw new E("angle is required.");return e>=-Be.PI&&e<=Be.PI?e:Be.zeroToTwoPi(e+Be.PI)-Be.PI};Be.zeroToTwoPi=function(e){if(!c(e))throw new E("angle is required.");if(e>=0&&e<=Be.TWO_PI)return e;const t=Be.mod(e,Be.TWO_PI);return Math.abs(t)Be.EPSILON14?Be.TWO_PI:t};Be.mod=function(e,t){if(!c(e))throw new E("m is required.");if(!c(t))throw new E("n is required.");if(t===0)throw new E("divisor cannot be 0.");return Be.sign(e)===Be.sign(t)&&Math.abs(e)n};Be.greaterThanOrEquals=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t>-n};const Ab=[1];Be.factorial=function(e){if(typeof e!="number"||e<0)throw new E("A number greater than or equal to 0 is required.");const t=Ab.length;if(e>=t){let n=Ab[t-1];for(let i=t;i<=e;i++){const o=n*i;Ab.push(o),n=o}}return Ab[e]};Be.incrementWrap=function(e,t,n){if(n=y(n,0),!c(e))throw new E("n is required.");if(t<=n)throw new E("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e};Be.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0};Be.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new E("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};Be.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e};Be.clamp=function(e,t,n){return A.typeOf.number("value",e),A.typeOf.number("min",t),A.typeOf.number("max",n),en?n:e};let nU=new fC;Be.setRandomNumberSeed=function(e){if(!c(e))throw new E("seed is required.");nU=new fC(e)};Be.nextRandomNumber=function(){return nU.random()};Be.randomBetween=function(e,t){return Be.nextRandomNumber()*(t-e)+e};Be.acosClamped=function(e){if(!c(e))throw new E("value is required.");return Math.acos(Be.clamp(e,-1,1))};Be.asinClamped=function(e){if(!c(e))throw new E("value is required.");return Math.asin(Be.clamp(e,-1,1))};Be.chordLength=function(e,t){if(!c(e))throw new E("angle is required.");if(!c(t))throw new E("radius is required.");return 2*t*Math.sin(e*.5)};Be.logBase=function(e,t){if(!c(e))throw new E("number is required.");if(!c(t))throw new E("base is required.");return Math.log(e)/Math.log(t)};Be.cbrt=y(Math.cbrt,function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});Be.log2=y(Math.log2,function(t){return Math.log(t)*Math.LOG2E});Be.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))};Be.fastApproximateAtan=function(e){return A.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};Be.fastApproximateAtan2=function(e,t){A.typeOf.number("x",e),A.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);const o=Math.max(i,n);n=Math.min(i,n);const r=n/o;if(isNaN(r))throw new E("either x or y must be nonzero");return i=Be.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?Be.PI_OVER_TWO-i:i,i=e<0?Be.PI-i:i,i=t<0?-i:i,i};const R=Be;function d(e,t,n){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0)}d.fromSpherical=function(e,t){A.typeOf.object("spherical",e),c(t)||(t=new d);const n=e.clock,i=e.cone,o=y(e.magnitude,1),r=o*Math.sin(i);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(i),t};d.fromElements=function(e,t,n,i){return c(i)?(i.x=e,i.y=t,i.z=n,i):new d(e,t,n)};d.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new d(e.x,e.y,e.z)};d.fromCartesian4=d.clone;d.packedLength=3;d.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};d.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new d),n.x=e[t++],n.y=e[t++],n.z=e[t],n};d.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*3;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}for(let o=0;oi&&(o=u,i=h)}let r=1,s=0;const a=dI[o],l=hI[o];if(Math.abs(e[$.getElementIndex(l,a)])>n){const u=e[$.getElementIndex(l,l)],h=e[$.getElementIndex(a,a)],f=e[$.getElementIndex(l,a)],_=(u-h)/2/f;let g;_<0?g=-1/(-_+Math.sqrt(1+_*_)):g=1/(_+Math.sqrt(1+_*_)),r=1/Math.sqrt(1+g*g),s=g*r}return t=$.clone($.IDENTITY,t),t[$.getElementIndex(a,a)]=t[$.getElementIndex(l,l)]=r,t[$.getElementIndex(l,a)]=s,t[$.getElementIndex(a,l)]=-s,t}const Cb=new $,xL=new $;$.computeEigenDecomposition=function(e,t){A.typeOf.object("matrix",e);const n=R.EPSILON20,i=10;let o=0,r=0;c(t)||(t={});const s=t.unitary=$.clone($.IDENTITY,t.unitary),a=t.diagonal=$.clone(e,t.diagonal),l=n*s7(a);for(;rl;)c7(a,Cb),$.transpose(Cb,xL),$.multiply(a,Cb,a),$.multiply(xL,a,a),$.multiply(s,Cb,s),++o>2&&(++r,o=0);return t};$.abs=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),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};$.determinant=function(e){A.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],l=e[5],u=e[8];return t*(r*u-l*s)+o*(l*i-n*u)+a*(n*s-r*i)};$.inverse=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],l=e[6],u=e[7],h=e[8],f=$.determinant(e);if(Math.abs(f)<=R.EPSILON15)throw new E("matrix is not invertible");t[0]=s*h-u*a,t[1]=u*o-i*h,t[2]=i*a-s*o,t[3]=l*a-r*h,t[4]=n*h-l*o,t[5]=r*o-n*a,t[6]=r*u-l*s,t[7]=l*i-n*u,t[8]=n*s-r*i;const _=1/f;return $.multiplyByScalar(t,_,t)};const l7=new $;$.inverseTranspose=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),$.inverse($.transpose(e,l7),t)};$.equals=function(e,t){return e===t||c(e)&&c(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]};$.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(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};$.IDENTITY=Object.freeze(new $(1,0,0,0,1,0,0,0,1));$.ZERO=Object.freeze(new $(0,0,0,0,0,0,0,0,0));$.COLUMN0ROW0=0;$.COLUMN0ROW1=1;$.COLUMN0ROW2=2;$.COLUMN1ROW0=3;$.COLUMN1ROW1=4;$.COLUMN1ROW2=5;$.COLUMN2ROW0=6;$.COLUMN2ROW1=7;$.COLUMN2ROW2=8;Object.defineProperties($.prototype,{length:{get:function(){return $.packedLength}}});$.prototype.clone=function(e){return $.clone(this,e)};$.prototype.equals=function(e){return $.equals(this,e)};$.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]};$.prototype.equalsEpsilon=function(e,t){return $.equalsEpsilon(this,e,t)};$.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]}) (${this[1]}, ${this[4]}, ${this[7]}) (${this[2]}, ${this[5]}, ${this[8]})`};function Te(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(Te.prototype=Object.create(Error.prototype),Te.prototype.constructor=Te);Te.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=` ${this.stack.toString()}`),e};function L(e,t,n,i,o,r,s,a,l,u,h,f,_,g,m,b){this[0]=y(e,0),this[1]=y(o,0),this[2]=y(l,0),this[3]=y(_,0),this[4]=y(t,0),this[5]=y(r,0),this[6]=y(u,0),this[7]=y(g,0),this[8]=y(n,0),this[9]=y(s,0),this[10]=y(h,0),this[11]=y(m,0),this[12]=y(i,0),this[13]=y(a,0),this[14]=y(f,0),this[15]=y(b,0)}L.packedLength=16;L.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(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};L.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new L),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};L.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*16;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o=R.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};or.createTypedArrayFromArrayBuffer=function(e,t,n,i){if(!c(e))throw new E("numberOfVertices is required.");if(!c(t))throw new E("sourceArray is required.");if(!c(n))throw new E("byteOffset is required.");return e>=R.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};or.fromTypedArray=function(e){if(e instanceof Uint8Array)return or.UNSIGNED_BYTE;if(e instanceof Uint16Array)return or.UNSIGNED_SHORT;if(e instanceof Uint32Array)return or.UNSIGNED_INT;throw new E("array must be a Uint8Array, Uint16Array, or Uint32Array.")};const je=Object.freeze(or),PA={STREAM_DRAW:J.STREAM_DRAW,STATIC_DRAW:J.STATIC_DRAW,DYNAMIC_DRAW:J.DYNAMIC_DRAW,validate:function(e){return e===PA.STREAM_DRAW||e===PA.STATIC_DRAW||e===PA.DYNAMIC_DRAW}},ke=Object.freeze(PA);function ct(e){if(e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context),!c(e.typedArray)&&!c(e.sizeInBytes))throw new E("Either options.sizeInBytes or options.typedArray is required.");if(c(e.typedArray)&&c(e.sizeInBytes))throw new E("Cannot pass in both options.sizeInBytes and options.typedArray.");if(c(e.typedArray)&&(A.typeOf.object("options.typedArray",e.typedArray),A.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!ke.validate(e.usage))throw new E("usage is invalid.");const t=e.context._gl,n=e.bufferTarget,i=e.typedArray;let o=e.sizeInBytes;const r=e.usage,s=c(i);s&&(o=i.byteLength),A.typeOf.number.greaterThan("sizeInBytes",o,0);const a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=Wr(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}ct.createVertexBuffer=function(e){return A.defined("options.context",e.context),new ct({context:e.context,bufferTarget:J.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};ct.createIndexBuffer=function(e){if(A.defined("options.context",e.context),!je.validate(e.indexDatatype))throw new E("Invalid indexDatatype.");if(e.indexDatatype===je.UNSIGNED_INT&&!e.context.elementIndexUint)throw new E("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");const t=e.context,n=e.indexDatatype,i=je.getSizeInBytes(n),o=new ct({context:t,bufferTarget:J.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o};Object.defineProperties(ct.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});ct.prototype._getBuffer=function(){return this._buffer};ct.prototype.copyFromArrayView=function(e,t){t=y(t,0),A.defined("arrayView",e),A.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};ct.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new E("A WebGL 2 context is required.");if(!c(e))throw new E("readBuffer must be defined.");if(!c(i)||i<=0)throw new E("sizeInBytes must be defined and be greater than zero.");if(!c(t)||t<0||t+i>e._sizeInBytes)throw new E("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!c(n)||n<0||n+i>this._sizeInBytes)throw new E("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&nn&&ts)throw new E("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new E("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new E("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new E("sourceOffset + length must be less than the buffers size.");const a=this._gl,l=J.COPY_READ_BUFFER;a.bindBuffer(l,this._buffer),a.getBufferSubData(l,t,e,n,i),a.bindBuffer(l,null)};ct.prototype.isDestroyed=function(){return!1};ct.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),ve(this)};let Nd;const no={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},ta={};Object.defineProperties(ta,{element:{get:function(){if(!!ta.supportsFullscreen())return document[no.fullscreenElement]}},changeEventName:{get:function(){if(!!ta.supportsFullscreen())return no.fullscreenchange}},errorEventName:{get:function(){if(!!ta.supportsFullscreen())return no.fullscreenerror}},enabled:{get:function(){if(!!ta.supportsFullscreen())return document[no.fullscreenEnabled]}},fullscreen:{get:function(){if(!!ta.supportsFullscreen())return ta.element!==null}}});ta.supportsFullscreen=function(){if(c(Nd))return Nd;Nd=!1;const e=document.body;if(typeof e.requestFullscreen=="function")return no.requestFullscreen="requestFullscreen",no.exitFullscreen="exitFullscreen",no.fullscreenEnabled="fullscreenEnabled",no.fullscreenElement="fullscreenElement",no.fullscreenchange="fullscreenchange",no.fullscreenerror="fullscreenerror",Nd=!0,Nd;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,o=t.length;i{const t=new Image;t.onload=function(){os._result=t.width>0&&t.height>0,e(os._result)},t.onerror=function(){os._result=!1,e(os._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),os._promise};Object.defineProperties(os,{initialized:{get:function(){return c(os._result)}}});const Nm=[];typeof ArrayBuffer<"u"&&(Nm.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Nm.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Nm.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Nm.push(BigInt64Array),typeof BigUint64Array<"u"&&Nm.push(BigUint64Array));const Cc={isChrome:_P,chromeVersion:C7,isSafari:sU,safariVersion:E7,isWebkit:aU,webkitVersion:w7,isInternetExplorer:cU,internetExplorerVersion:S7,isEdge:pC,edgeVersion:v7,isFirefox:mC,firefoxVersion:P7,isWindows:I7,isIPadOrIOS:D7,hardwareConcurrency:y(ps.hardwareConcurrency,3),supportsPointerEvents:O7,supportsImageRenderingPixelated:dU,supportsWebP:os,imageRenderingValue:L7,typedArrayTypes:Nm};Cc.supportsBasis=function(e){return Cc.supportsWebAssembly()&&e.context.supportsBasis};Cc.supportsFullscreen=function(){return Tr.supportsFullscreen()};Cc.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};Cc.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};Cc.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};Cc.supportsBigInt=function(){return typeof BigInt<"u"};Cc.supportsWebWorkers=function(){return typeof Worker<"u"};Cc.supportsWebAssembly=function(){return typeof WebAssembly<"u"};Cc.supportsWebgl2=function(e){return A.defined("scene",e),e.context.webgl2};Cc.supportsEsmWebWorkers=function(){return!mC()||parseInt(gP)>=114};const Yt=Cc;function BE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n*6<1?e+(t-e)*6*n:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function z(e,t,n,i){this.red=y(e,1),this.green=y(t,1),this.blue=y(n,1),this.alpha=y(i,1)}z.fromCartesian4=function(e,t){return A.typeOf.object("cartesian",e),c(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new z(e.x,e.y,e.z,e.w)};z.fromBytes=function(e,t,n,i,o){return e=z.byteToFloat(y(e,255)),t=z.byteToFloat(y(t,255)),n=z.byteToFloat(y(n,255)),i=z.byteToFloat(y(i,255)),c(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new z(e,t,n,i)};z.fromAlpha=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("alpha",t),c(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new z(e.red,e.green,e.blue,t)};let zE,yP,Wu;Yt.supportsTypedArrays()&&(zE=new ArrayBuffer(4),yP=new Uint32Array(zE),Wu=new Uint8Array(zE));z.fromRgba=function(e,t){return yP[0]=e,z.fromBytes(Wu[0],Wu[1],Wu[2],Wu[3],t)};z.fromHsl=function(e,t,n,i,o){e=y(e,0)%1,t=y(t,0),n=y(n,0),i=y(i,1);let r=n,s=n,a=n;if(t!==0){let l;n<.5?l=n*(1+t):l=n+t-n*t;const u=2*n-l;r=BE(u,l,e+1/3),s=BE(u,l,e),a=BE(u,l,e-1/3)}return c(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new z(r,s,a,i)};z.fromRandom=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.red;if(!c(n)){const s=y(e.minimumRed,0),a=y(e.maximumRed,1);A.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+R.nextRandomNumber()*(a-s)}let i=e.green;if(!c(i)){const s=y(e.minimumGreen,0),a=y(e.maximumGreen,1);A.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+R.nextRandomNumber()*(a-s)}let o=e.blue;if(!c(o)){const s=y(e.minimumBlue,0),a=y(e.maximumBlue,1);A.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+R.nextRandomNumber()*(a-s)}let r=e.alpha;if(!c(r)){const s=y(e.minimumAlpha,0),a=y(e.maximumAlpha,1);A.typeOf.number.lessThanOrEquals("minumumAlpha",s,a),r=s+R.nextRandomNumber()*(a-s)}return c(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new z(n,i,o,r)};const R7=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,N7=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,M7=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,F7=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;z.fromCssColorString=function(e,t){A.typeOf.string("color",e),c(t)||(t=new z),e=e.trim();const n=z[e.toUpperCase()];if(c(n))return z.clone(n,t),t;let i=R7.exec(e);return i!==null?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(y(i[4],"f"),16)/15,t):(i=N7.exec(e),i!==null?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(y(i[4],"ff"),16)/255,t):(i=M7.exec(e),i!==null?(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(y(i[4],"1.0")),t):(i=F7.exec(e),i!==null?z.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(y(i[4],"1.0")),t):(t=void 0,t))))};z.packedLength=4;z.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};z.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new z),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};z.byteToFloat=function(e){return e/255};z.floatToByte=function(e){return e===1?255:e*256|0};z.clone=function(e,t){if(!!c(e))return c(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new z(e.red,e.green,e.blue,e.alpha)};z.equals=function(e,t){return e===t||c(e)&&c(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};z.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]};z.prototype.clone=function(e){return z.clone(this,e)};z.prototype.equals=function(e){return z.equals(this,e)};z.prototype.equalsEpsilon=function(e,t){return this===e||c(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};z.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};z.prototype.toCssColorString=function(){const e=z.floatToByte(this.red),t=z.floatToByte(this.green),n=z.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};z.prototype.toCssHexString=function(){let e=z.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=z.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=z.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=z.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};z.prototype.toBytes=function(e){const t=z.floatToByte(this.red),n=z.floatToByte(this.green),i=z.floatToByte(this.blue),o=z.floatToByte(this.alpha);return c(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};z.prototype.toRgba=function(){return Wu[0]=z.floatToByte(this.red),Wu[1]=z.floatToByte(this.green),Wu[2]=z.floatToByte(this.blue),Wu[3]=z.floatToByte(this.alpha),yP[0]};z.prototype.brighten=function(e,t){return A.typeOf.number("magnitude",e),A.typeOf.number.greaterThanOrEquals("magnitude",e,0),A.typeOf.object("result",t),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};z.prototype.darken=function(e,t){return A.typeOf.number("magnitude",e),A.typeOf.number.greaterThanOrEquals("magnitude",e,0),A.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};z.prototype.withAlpha=function(e,t){return z.fromAlpha(this,e,t)};z.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),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};z.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),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};z.multiply=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),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};z.divide=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),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};z.mod=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),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};z.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),i.red=R.lerp(e.red,t.red,n),i.green=R.lerp(e.green,t.green,n),i.blue=R.lerp(e.blue,t.blue,n),i.alpha=R.lerp(e.alpha,t.alpha,n),i};z.multiplyByScalar=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};z.divideByScalar=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};z.ALICEBLUE=Object.freeze(z.fromCssColorString("#F0F8FF"));z.ANTIQUEWHITE=Object.freeze(z.fromCssColorString("#FAEBD7"));z.AQUA=Object.freeze(z.fromCssColorString("#00FFFF"));z.AQUAMARINE=Object.freeze(z.fromCssColorString("#7FFFD4"));z.AZURE=Object.freeze(z.fromCssColorString("#F0FFFF"));z.BEIGE=Object.freeze(z.fromCssColorString("#F5F5DC"));z.BISQUE=Object.freeze(z.fromCssColorString("#FFE4C4"));z.BLACK=Object.freeze(z.fromCssColorString("#000000"));z.BLANCHEDALMOND=Object.freeze(z.fromCssColorString("#FFEBCD"));z.BLUE=Object.freeze(z.fromCssColorString("#0000FF"));z.BLUEVIOLET=Object.freeze(z.fromCssColorString("#8A2BE2"));z.BROWN=Object.freeze(z.fromCssColorString("#A52A2A"));z.BURLYWOOD=Object.freeze(z.fromCssColorString("#DEB887"));z.CADETBLUE=Object.freeze(z.fromCssColorString("#5F9EA0"));z.CHARTREUSE=Object.freeze(z.fromCssColorString("#7FFF00"));z.CHOCOLATE=Object.freeze(z.fromCssColorString("#D2691E"));z.CORAL=Object.freeze(z.fromCssColorString("#FF7F50"));z.CORNFLOWERBLUE=Object.freeze(z.fromCssColorString("#6495ED"));z.CORNSILK=Object.freeze(z.fromCssColorString("#FFF8DC"));z.CRIMSON=Object.freeze(z.fromCssColorString("#DC143C"));z.CYAN=Object.freeze(z.fromCssColorString("#00FFFF"));z.DARKBLUE=Object.freeze(z.fromCssColorString("#00008B"));z.DARKCYAN=Object.freeze(z.fromCssColorString("#008B8B"));z.DARKGOLDENROD=Object.freeze(z.fromCssColorString("#B8860B"));z.DARKGRAY=Object.freeze(z.fromCssColorString("#A9A9A9"));z.DARKGREEN=Object.freeze(z.fromCssColorString("#006400"));z.DARKGREY=z.DARKGRAY;z.DARKKHAKI=Object.freeze(z.fromCssColorString("#BDB76B"));z.DARKMAGENTA=Object.freeze(z.fromCssColorString("#8B008B"));z.DARKOLIVEGREEN=Object.freeze(z.fromCssColorString("#556B2F"));z.DARKORANGE=Object.freeze(z.fromCssColorString("#FF8C00"));z.DARKORCHID=Object.freeze(z.fromCssColorString("#9932CC"));z.DARKRED=Object.freeze(z.fromCssColorString("#8B0000"));z.DARKSALMON=Object.freeze(z.fromCssColorString("#E9967A"));z.DARKSEAGREEN=Object.freeze(z.fromCssColorString("#8FBC8F"));z.DARKSLATEBLUE=Object.freeze(z.fromCssColorString("#483D8B"));z.DARKSLATEGRAY=Object.freeze(z.fromCssColorString("#2F4F4F"));z.DARKSLATEGREY=z.DARKSLATEGRAY;z.DARKTURQUOISE=Object.freeze(z.fromCssColorString("#00CED1"));z.DARKVIOLET=Object.freeze(z.fromCssColorString("#9400D3"));z.DEEPPINK=Object.freeze(z.fromCssColorString("#FF1493"));z.DEEPSKYBLUE=Object.freeze(z.fromCssColorString("#00BFFF"));z.DIMGRAY=Object.freeze(z.fromCssColorString("#696969"));z.DIMGREY=z.DIMGRAY;z.DODGERBLUE=Object.freeze(z.fromCssColorString("#1E90FF"));z.FIREBRICK=Object.freeze(z.fromCssColorString("#B22222"));z.FLORALWHITE=Object.freeze(z.fromCssColorString("#FFFAF0"));z.FORESTGREEN=Object.freeze(z.fromCssColorString("#228B22"));z.FUCHSIA=Object.freeze(z.fromCssColorString("#FF00FF"));z.GAINSBORO=Object.freeze(z.fromCssColorString("#DCDCDC"));z.GHOSTWHITE=Object.freeze(z.fromCssColorString("#F8F8FF"));z.GOLD=Object.freeze(z.fromCssColorString("#FFD700"));z.GOLDENROD=Object.freeze(z.fromCssColorString("#DAA520"));z.GRAY=Object.freeze(z.fromCssColorString("#808080"));z.GREEN=Object.freeze(z.fromCssColorString("#008000"));z.GREENYELLOW=Object.freeze(z.fromCssColorString("#ADFF2F"));z.GREY=z.GRAY;z.HONEYDEW=Object.freeze(z.fromCssColorString("#F0FFF0"));z.HOTPINK=Object.freeze(z.fromCssColorString("#FF69B4"));z.INDIANRED=Object.freeze(z.fromCssColorString("#CD5C5C"));z.INDIGO=Object.freeze(z.fromCssColorString("#4B0082"));z.IVORY=Object.freeze(z.fromCssColorString("#FFFFF0"));z.KHAKI=Object.freeze(z.fromCssColorString("#F0E68C"));z.LAVENDER=Object.freeze(z.fromCssColorString("#E6E6FA"));z.LAVENDAR_BLUSH=Object.freeze(z.fromCssColorString("#FFF0F5"));z.LAWNGREEN=Object.freeze(z.fromCssColorString("#7CFC00"));z.LEMONCHIFFON=Object.freeze(z.fromCssColorString("#FFFACD"));z.LIGHTBLUE=Object.freeze(z.fromCssColorString("#ADD8E6"));z.LIGHTCORAL=Object.freeze(z.fromCssColorString("#F08080"));z.LIGHTCYAN=Object.freeze(z.fromCssColorString("#E0FFFF"));z.LIGHTGOLDENRODYELLOW=Object.freeze(z.fromCssColorString("#FAFAD2"));z.LIGHTGRAY=Object.freeze(z.fromCssColorString("#D3D3D3"));z.LIGHTGREEN=Object.freeze(z.fromCssColorString("#90EE90"));z.LIGHTGREY=z.LIGHTGRAY;z.LIGHTPINK=Object.freeze(z.fromCssColorString("#FFB6C1"));z.LIGHTSEAGREEN=Object.freeze(z.fromCssColorString("#20B2AA"));z.LIGHTSKYBLUE=Object.freeze(z.fromCssColorString("#87CEFA"));z.LIGHTSLATEGRAY=Object.freeze(z.fromCssColorString("#778899"));z.LIGHTSLATEGREY=z.LIGHTSLATEGRAY;z.LIGHTSTEELBLUE=Object.freeze(z.fromCssColorString("#B0C4DE"));z.LIGHTYELLOW=Object.freeze(z.fromCssColorString("#FFFFE0"));z.LIME=Object.freeze(z.fromCssColorString("#00FF00"));z.LIMEGREEN=Object.freeze(z.fromCssColorString("#32CD32"));z.LINEN=Object.freeze(z.fromCssColorString("#FAF0E6"));z.MAGENTA=Object.freeze(z.fromCssColorString("#FF00FF"));z.MAROON=Object.freeze(z.fromCssColorString("#800000"));z.MEDIUMAQUAMARINE=Object.freeze(z.fromCssColorString("#66CDAA"));z.MEDIUMBLUE=Object.freeze(z.fromCssColorString("#0000CD"));z.MEDIUMORCHID=Object.freeze(z.fromCssColorString("#BA55D3"));z.MEDIUMPURPLE=Object.freeze(z.fromCssColorString("#9370DB"));z.MEDIUMSEAGREEN=Object.freeze(z.fromCssColorString("#3CB371"));z.MEDIUMSLATEBLUE=Object.freeze(z.fromCssColorString("#7B68EE"));z.MEDIUMSPRINGGREEN=Object.freeze(z.fromCssColorString("#00FA9A"));z.MEDIUMTURQUOISE=Object.freeze(z.fromCssColorString("#48D1CC"));z.MEDIUMVIOLETRED=Object.freeze(z.fromCssColorString("#C71585"));z.MIDNIGHTBLUE=Object.freeze(z.fromCssColorString("#191970"));z.MINTCREAM=Object.freeze(z.fromCssColorString("#F5FFFA"));z.MISTYROSE=Object.freeze(z.fromCssColorString("#FFE4E1"));z.MOCCASIN=Object.freeze(z.fromCssColorString("#FFE4B5"));z.NAVAJOWHITE=Object.freeze(z.fromCssColorString("#FFDEAD"));z.NAVY=Object.freeze(z.fromCssColorString("#000080"));z.OLDLACE=Object.freeze(z.fromCssColorString("#FDF5E6"));z.OLIVE=Object.freeze(z.fromCssColorString("#808000"));z.OLIVEDRAB=Object.freeze(z.fromCssColorString("#6B8E23"));z.ORANGE=Object.freeze(z.fromCssColorString("#FFA500"));z.ORANGERED=Object.freeze(z.fromCssColorString("#FF4500"));z.ORCHID=Object.freeze(z.fromCssColorString("#DA70D6"));z.PALEGOLDENROD=Object.freeze(z.fromCssColorString("#EEE8AA"));z.PALEGREEN=Object.freeze(z.fromCssColorString("#98FB98"));z.PALETURQUOISE=Object.freeze(z.fromCssColorString("#AFEEEE"));z.PALEVIOLETRED=Object.freeze(z.fromCssColorString("#DB7093"));z.PAPAYAWHIP=Object.freeze(z.fromCssColorString("#FFEFD5"));z.PEACHPUFF=Object.freeze(z.fromCssColorString("#FFDAB9"));z.PERU=Object.freeze(z.fromCssColorString("#CD853F"));z.PINK=Object.freeze(z.fromCssColorString("#FFC0CB"));z.PLUM=Object.freeze(z.fromCssColorString("#DDA0DD"));z.POWDERBLUE=Object.freeze(z.fromCssColorString("#B0E0E6"));z.PURPLE=Object.freeze(z.fromCssColorString("#800080"));z.RED=Object.freeze(z.fromCssColorString("#FF0000"));z.ROSYBROWN=Object.freeze(z.fromCssColorString("#BC8F8F"));z.ROYALBLUE=Object.freeze(z.fromCssColorString("#4169E1"));z.SADDLEBROWN=Object.freeze(z.fromCssColorString("#8B4513"));z.SALMON=Object.freeze(z.fromCssColorString("#FA8072"));z.SANDYBROWN=Object.freeze(z.fromCssColorString("#F4A460"));z.SEAGREEN=Object.freeze(z.fromCssColorString("#2E8B57"));z.SEASHELL=Object.freeze(z.fromCssColorString("#FFF5EE"));z.SIENNA=Object.freeze(z.fromCssColorString("#A0522D"));z.SILVER=Object.freeze(z.fromCssColorString("#C0C0C0"));z.SKYBLUE=Object.freeze(z.fromCssColorString("#87CEEB"));z.SLATEBLUE=Object.freeze(z.fromCssColorString("#6A5ACD"));z.SLATEGRAY=Object.freeze(z.fromCssColorString("#708090"));z.SLATEGREY=z.SLATEGRAY;z.SNOW=Object.freeze(z.fromCssColorString("#FFFAFA"));z.SPRINGGREEN=Object.freeze(z.fromCssColorString("#00FF7F"));z.STEELBLUE=Object.freeze(z.fromCssColorString("#4682B4"));z.TAN=Object.freeze(z.fromCssColorString("#D2B48C"));z.TEAL=Object.freeze(z.fromCssColorString("#008080"));z.THISTLE=Object.freeze(z.fromCssColorString("#D8BFD8"));z.TOMATO=Object.freeze(z.fromCssColorString("#FF6347"));z.TURQUOISE=Object.freeze(z.fromCssColorString("#40E0D0"));z.VIOLET=Object.freeze(z.fromCssColorString("#EE82EE"));z.WHEAT=Object.freeze(z.fromCssColorString("#F5DEB3"));z.WHITE=Object.freeze(z.fromCssColorString("#FFFFFF"));z.WHITESMOKE=Object.freeze(z.fromCssColorString("#F5F5F5"));z.YELLOW=Object.freeze(z.fromCssColorString("#FFFF00"));z.YELLOWGREEN=Object.freeze(z.fromCssColorString("#9ACD32"));z.TRANSPARENT=Object.freeze(new z(0,0,0,0));function bi(e){e=y(e,y.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}bi.ALL=Object.freeze(new bi({color:new z(0,0,0,0),depth:1,stencil:0}));bi.prototype.execute=function(e,t){e.clear(this,t)};const B7={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,VOXELS:9,OVERLAY:10,NUMBER_OF_PASSES:11},xe=Object.freeze(B7);function A_(e){e=y(e,y.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=y(e.persists,!1),this.pass=xe.COMPUTE,this.owner=e.owner}A_.prototype.execute=function(e){e.execute(this)};function H(e,t){this.x=y(e,0),this.y=y(t,0)}H.fromElements=function(e,t,n){return c(n)?(n.x=e,n.y=t,n):new H(e,t)};H.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t):new H(e.x,e.y)};H.fromCartesian3=H.clone;H.fromCartesian4=H.clone;H.packedLength=2;H.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n]=e.y,t};H.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new H),n.x=e[t++],n.y=e[t],n};H.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*2;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}for(let o=0;oR.EPSILON12);return c(o)?(o.x=r*U,o.y=s*B,o.z=a*S,o):new d(r*U,s*B,a*S)}function he(e,t,n){this.longitude=y(e,0),this.latitude=y(t,0),this.height=y(n,0)}he.fromRadians=function(e,t,n,i){return A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),n=y(n,0),c(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new he(e,t,n)};he.fromDegrees=function(e,t,n,i){return A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),e=R.toRadians(e),t=R.toRadians(t),he.fromRadians(e,t,n,i)};const V7=new d,H7=new d,G7=new d,j7=new d(1/6378137,1/6378137,1/6356752314245179e-9),W7=new d(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),q7=R.EPSILON1;he.fromCartesian=function(e,t,n){const i=c(t)?t.oneOverRadii:j7,o=c(t)?t.oneOverRadiiSquared:W7,r=c(t)?t._centerToleranceSquared:q7,s=hU(e,i,o,r,H7);if(!c(s))return;let a=d.multiplyComponents(s,o,V7);a=d.normalize(a,a);const l=d.subtract(e,s,G7),u=Math.atan2(a.y,a.x),h=Math.asin(a.z),f=R.sign(d.dot(l,e))*d.magnitude(l);return c(n)?(n.longitude=u,n.latitude=h,n.height=f,n):new he(u,h,f)};he.toCartesian=function(e,t,n){return A.defined("cartographic",e),d.fromRadians(e.longitude,e.latitude,e.height,t,n)};he.clone=function(e,t){if(!!c(e))return c(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new he(e.longitude,e.latitude,e.height)};he.equals=function(e,t){return e===t||c(e)&&c(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};he.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};he.ZERO=Object.freeze(new he(0,0,0));he.prototype.clone=function(e){return he.clone(this,e)};he.prototype.equals=function(e){return he.equals(this,e)};he.prototype.equalsEpsilon=function(e,t){return he.equalsEpsilon(this,e,t)};he.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function fU(e,t,n,i){t=y(t,0),n=y(n,0),i=y(i,0),A.typeOf.number.greaterThanOrEquals("x",t,0),A.typeOf.number.greaterThanOrEquals("y",n,0),A.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new d(t,n,i),e._radiiSquared=new d(t*t,n*n,i*i),e._radiiToTheFourth=new d(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new d(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new d(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=R.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function ae(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,fU(this,e,t,n)}Object.defineProperties(ae.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}}});ae.clone=function(e,t){if(!c(e))return;const n=e._radii;return c(t)?(d.clone(n,t._radii),d.clone(e._radiiSquared,t._radiiSquared),d.clone(e._radiiToTheFourth,t._radiiToTheFourth),d.clone(e._oneOverRadii,t._oneOverRadii),d.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new ae(n.x,n.y,n.z)};ae.fromCartesian3=function(e,t){return c(t)||(t=new ae),c(e)&&fU(t,e.x,e.y,e.z),t};ae.WGS84=Object.freeze(new ae(6378137,6378137,6356752314245179e-9));ae.UNIT_SPHERE=Object.freeze(new ae(1,1,1));ae.MOON=Object.freeze(new ae(R.LUNAR_RADIUS,R.LUNAR_RADIUS,R.LUNAR_RADIUS));ae.prototype.clone=function(e){return ae.clone(this,e)};ae.packedLength=d.packedLength;ae.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),d.pack(e._radii,t,n),t};ae.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=d.unpack(e,t);return ae.fromCartesian3(i,n)};ae.prototype.geocentricSurfaceNormal=d.normalize;ae.prototype.geodeticSurfaceNormalCartographic=function(e,t){A.typeOf.object("cartographic",e);const n=e.longitude,i=e.latitude,o=Math.cos(i),r=o*Math.cos(n),s=o*Math.sin(n),a=Math.sin(i);return c(t)||(t=new d),t.x=r,t.y=s,t.z=a,d.normalize(t,t)};ae.prototype.geodeticSurfaceNormal=function(e,t){if(A.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new E("cartesian has a NaN component");if(!d.equalsEpsilon(e,d.ZERO,R.EPSILON14))return c(t)||(t=new d),t=d.multiplyComponents(e,this._oneOverRadiiSquared,t),d.normalize(t,t)};const Y7=new d,$7=new d;ae.prototype.cartographicToCartesian=function(e,t){const n=Y7,i=$7;this.geodeticSurfaceNormalCartographic(e,n),d.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(d.dot(n,i));return d.divideByScalar(i,o,i),d.multiplyByScalar(n,e.height,n),c(t)||(t=new d),d.add(i,n,t)};ae.prototype.cartographicArrayToCartesianArray=function(e,t){A.defined("cartographics",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i=this._radii.z-t))return n};const Z7=new d;ae.prototype.getLocalCurvature=function(e,t){A.typeOf.object("surfacePosition",e),c(t)||(t=new H);const n=this.getSurfaceNormalIntersectionWithZAxis(e,0,Z7),i=d.distance(e,n),o=this.minimumRadius*i/this.maximumRadius**2,r=i*o**2;return H.fromElements(1/i,1/r,t)};const J7=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],eY=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function vL(e,t,n){A.typeOf.number("a",e),A.typeOf.number("b",t),A.typeOf.func("func",n);const i=.5*(t+e),o=.5*(t-e);let r=0;for(let s=0;s<5;s++){const a=o*J7[s];r+=eY[s]*(n(i+a)+n(i-a))}return r*=o,r}ae.prototype.surfaceArea=function(e){A.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n0){o=r-1;continue}return r}return~(o+1)}function bP(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function $y(e){if(e===null||isNaN(e))throw new E("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}const IL=[31,28,31,30,31,30,31,31,30,31,30,31];function L0(e,t,n,i,o,r,s,a){e=y(e,1),t=y(t,1),n=y(n,1),i=y(i,0),o=y(o,0),r=y(r,0),s=y(s,0),a=y(a,!1),b(),T(),this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a;function b(){A.typeOf.number.greaterThanOrEquals("Year",e,1),A.typeOf.number.lessThanOrEquals("Year",e,9999),A.typeOf.number.greaterThanOrEquals("Month",t,1),A.typeOf.number.lessThanOrEquals("Month",t,12),A.typeOf.number.greaterThanOrEquals("Day",n,1),A.typeOf.number.lessThanOrEquals("Day",n,31),A.typeOf.number.greaterThanOrEquals("Hour",i,0),A.typeOf.number.lessThanOrEquals("Hour",i,23),A.typeOf.number.greaterThanOrEquals("Minute",o,0),A.typeOf.number.lessThanOrEquals("Minute",o,59),A.typeOf.bool("IsLeapSecond",a),A.typeOf.number.greaterThanOrEquals("Second",r,0),A.typeOf.number.lessThanOrEquals("Second",r,a?59+1:59),A.typeOf.number.greaterThanOrEquals("Millisecond",s,0),A.typeOf.number.lessThan("Millisecond",s,1e3)}function T(){const x=t===2&&$y(e)?IL[t-1]+1:IL[t-1];if(n>x)throw new E("Month and Day represents invalid date")}}function ei(e,t){this.julianDate=e,this.offset=t}const nY={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:24000005e-1},qn=Object.freeze(nY),iY={UTC:0,TAI:1},fn=Object.freeze(iY),pU=new L0,Pb=[31,28,31,30,31,30,31,31,30,31,30,31],Ob=29;function TP(e,t){return ie.compare(e.julianDate,t.julianDate)}const x_=new ei;function _C(e){x_.julianDate=e;const t=ie.leapSeconds;let n=Hr(t,x_,TP);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&ie.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),ie.addSeconds(e,i,e)}function DL(e,t){x_.julianDate=e;const n=ie.leapSeconds;let i=Hr(n,x_,TP);if(i<0&&(i=~i),i===0)return ie.addSeconds(e,-n[0].offset,t);if(i>=n.length)return ie.addSeconds(e,-n[i-1].offset,t);const o=ie.secondsDifference(n[i].julianDate,e);if(o===0)return ie.addSeconds(e,-n[i].offset,t);if(!(o<=1))return ie.addSeconds(e,-n[--i].offset,t)}function $h(e,t,n){const i=t/qn.SECONDS_PER_DAY|0;return e+=i,t-=qn.SECONDS_PER_DAY*i,t<0&&(e--,t+=qn.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function AP(e,t,n,i,o,r,s){const a=(t-14)/12|0,l=e+4800+a;let u=(1461*l/4|0)+(367*(t-2-12*a)/12|0)-(3*((l+100)/100|0)/4|0)+n-32075;i=i-12,i<0&&(i+=24);const h=r+(i*qn.SECONDS_PER_HOUR+o*qn.SECONDS_PER_MINUTE+s*qn.SECONDS_PER_MILLISECOND);return h>=43200&&(u-=1),[u,h]}const oY=/^(\d{4})$/,rY=/^(\d{4})-(\d{2})$/,sY=/^(\d{4})-?(\d{3})$/,aY=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,cY=/^(\d{4})-?(\d{2})-?(\d{2})$/,xP=/([Z+\-])?(\d{2})?:?(\d{2})?$/,lY=/^(\d{2})(\.\d+)?/.source+xP.source,uY=/^(\d{2}):?(\d{2})(\.\d+)?/.source+xP.source,dY=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+xP.source,qc="Invalid ISO 8601 date.";function ie(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=y(e,0),t=y(t,0),n=y(n,fn.UTC);const i=e|0;t=t+(e-i)*qn.SECONDS_PER_DAY,$h(i,t,this),n===fn.UTC&&_C(this)}ie.fromGregorianDate=function(e,t){if(!(e instanceof L0))throw new E("date must be a valid GregorianDate.");const n=AP(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return c(t)?($h(n[0],n[1],t),_C(t),t):new ie(n[0],n[1],fn.UTC)};ie.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new E("date must be a valid JavaScript Date.");const n=AP(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return c(t)?($h(n[0],n[1],t),_C(t),t):new ie(n[0],n[1],fn.UTC)};ie.fromIso8601=function(e,t){if(typeof e!="string")throw new E(qc);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,l=0,u=0;const h=n[0],f=n[1];let _,g;if(!c(h))throw new E(qc);let m;if(n=h.match(cY),n!==null){if(m=h.split("-").length-1,m>0&&m!==2)throw new E(qc);i=+n[1],o=+n[2],r=+n[3]}else if(n=h.match(rY),n!==null)i=+n[1],o=+n[2];else if(n=h.match(oY),n!==null)i=+n[1];else{let C;if(n=h.match(sY),n!==null){if(i=+n[1],C=+n[2],g=$y(i),C<1||g&&C>366||!g&&C>365)throw new E(qc)}else if(n=h.match(aY),n!==null){i=+n[1];const w=+n[2],v=+n[3]||0;if(m=h.split("-").length-1,m>0&&(!c(n[3])&&m!==1||c(n[3])&&m!==2))throw new E(qc);const P=new Date(Date.UTC(i,0,4));C=w*7+v-P.getUTCDay()-3}else throw new E(qc);_=new Date(Date.UTC(i,0,1)),_.setUTCDate(C),o=_.getUTCMonth()+1,r=_.getUTCDate()}if(g=$y(i),o<1||o>12||r<1||(o!==2||!g)&&r>Pb[o-1]||g&&o===2&&r>Ob)throw new E(qc);let b;if(c(f)){if(n=f.match(dY),n!==null){if(m=f.split(":").length-1,m>0&&m!==2&&m!==3)throw new E(qc);s=+n[1],a=+n[2],l=+n[3],u=+(n[4]||0)*1e3,b=5}else if(n=f.match(uY),n!==null){if(m=f.split(":").length-1,m>2)throw new E(qc);s=+n[1],a=+n[2],l=+(n[3]||0)*60,b=4}else if(n=f.match(lY),n!==null)s=+n[1],a=+(n[2]||0)*60,b=3;else throw new E(qc);if(a>=60||l>=61||s>24||s===24&&(a>0||l>0||u>0))throw new E(qc);const C=n[b],w=+n[b+1],v=+(n[b+2]||0);switch(C){case"+":s=s-w,a=a-v;break;case"-":s=s+w,a=a+v;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}const T=l===60;for(T&&l--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(_=g&&o===2?Ob:Pb[o-1];r>_;)r-=_,o++,o>12&&(o-=12,i++),_=g&&o===2?Ob:Pb[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),_=g&&o===2?Ob:Pb[o-1],r+=_;const x=AP(i,o,r,s,a,l,u);return c(t)?($h(x[0],x[1],t),_C(t)):t=new ie(x[0],x[1],fn.UTC),T&&ie.addSeconds(t,1,t),t};ie.now=function(e){return ie.fromDate(new Date,e)};const Lb=new ie(0,0,fn.TAI);ie.toGregorianDate=function(e,t){if(!c(e))throw new E("julianDate is required.");let n=!1,i=DL(e,Lb);c(i)||(ie.addSeconds(e,-1,Lb),i=DL(Lb,Lb),n=!0);let o=i.dayNumber;const r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const l=4e3*(s+1)/1461001|0;s=s-(1461*l/4|0)+31|0;const u=80*s/2447|0,h=s-(2447*u/80|0)|0;s=u/11|0;const f=u+2-12*s|0,_=100*(a-49)+l+s|0;let g=r/qn.SECONDS_PER_HOUR|0,m=r-g*qn.SECONDS_PER_HOUR;const b=m/qn.SECONDS_PER_MINUTE|0;m=m-b*qn.SECONDS_PER_MINUTE;let T=m|0;const x=(m-T)/qn.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(T+=1),c(t)?(t.year=_,t.month=f,t.day=h,t.hour=g,t.minute=b,t.second=T,t.millisecond=x,t.isLeapSecond=n,t):new L0(_,f,h,g,b,T,x,n)};ie.toDate=function(e){if(!c(e))throw new E("julianDate is required.");const t=ie.toGregorianDate(e,pU);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))};ie.toIso8601=function(e,t){if(!c(e))throw new E("julianDate is required.");const n=ie.toGregorianDate(e,pU);let i=n.year,o=n.month,r=n.day,s=n.hour;const a=n.minute,l=n.second,u=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&l===0&&u===0&&(i=9999,o=12,r=31,s=24);let h;return!c(t)&&u!==0?(h=(u*.01).toString().replace(".",""),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`):!c(t)||t===0?`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}Z`:(h=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`)};ie.clone=function(e,t){if(!!c(e))return c(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new ie(e.dayNumber,e.secondsOfDay,fn.TAI)};ie.compare=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};ie.equals=function(e,t){return e===t||c(e)&&c(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};ie.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(ie.secondsDifference(e,t))<=n};ie.totalDays=function(e){if(!c(e))throw new E("julianDate is required.");return e.dayNumber+e.secondsOfDay/qn.SECONDS_PER_DAY};ie.secondsDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");return(e.dayNumber-t.dayNumber)*qn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};ie.daysDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");const n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/qn.SECONDS_PER_DAY;return n+i};ie.computeTaiMinusUtc=function(e){x_.julianDate=e;const t=ie.leapSeconds;let n=Hr(t,x_,TP);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};ie.addSeconds=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("seconds is required.");if(!c(n))throw new E("result is required.");return $h(e.dayNumber,e.secondsOfDay+t,n)};ie.addMinutes=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("minutes is required.");if(!c(n))throw new E("result is required.");const i=e.secondsOfDay+t*qn.SECONDS_PER_MINUTE;return $h(e.dayNumber,i,n)};ie.addHours=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("hours is required.");if(!c(n))throw new E("result is required.");const i=e.secondsOfDay+t*qn.SECONDS_PER_HOUR;return $h(e.dayNumber,i,n)};ie.addDays=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("days is required.");if(!c(n))throw new E("result is required.");const i=e.dayNumber+t;return $h(i,e.secondsOfDay,n)};ie.lessThan=function(e,t){return ie.compare(e,t)<0};ie.lessThanOrEquals=function(e,t){return ie.compare(e,t)<=0};ie.greaterThan=function(e,t){return ie.compare(e,t)>0};ie.greaterThanOrEquals=function(e,t){return ie.compare(e,t)>=0};ie.prototype.clone=function(e){return ie.clone(this,e)};ie.prototype.equals=function(e){return ie.equals(this,e)};ie.prototype.equalsEpsilon=function(e,t){return ie.equalsEpsilon(this,e,t)};ie.prototype.toString=function(){return ie.toIso8601(this)};ie.leapSeconds=[new ei(new ie(2441317,43210,fn.TAI),10),new ei(new ie(2441499,43211,fn.TAI),11),new ei(new ie(2441683,43212,fn.TAI),12),new ei(new ie(2442048,43213,fn.TAI),13),new ei(new ie(2442413,43214,fn.TAI),14),new ei(new ie(2442778,43215,fn.TAI),15),new ei(new ie(2443144,43216,fn.TAI),16),new ei(new ie(2443509,43217,fn.TAI),17),new ei(new ie(2443874,43218,fn.TAI),18),new ei(new ie(2444239,43219,fn.TAI),19),new ei(new ie(2444786,43220,fn.TAI),20),new ei(new ie(2445151,43221,fn.TAI),21),new ei(new ie(2445516,43222,fn.TAI),22),new ei(new ie(2446247,43223,fn.TAI),23),new ei(new ie(2447161,43224,fn.TAI),24),new ei(new ie(2447892,43225,fn.TAI),25),new ei(new ie(2448257,43226,fn.TAI),26),new ei(new ie(2448804,43227,fn.TAI),27),new ei(new ie(2449169,43228,fn.TAI),28),new ei(new ie(2449534,43229,fn.TAI),29),new ei(new ie(2450083,43230,fn.TAI),30),new ei(new ie(2450630,43231,fn.TAI),31),new ei(new ie(2451179,43232,fn.TAI),32),new ei(new ie(2453736,43233,fn.TAI),33),new ei(new ie(2454832,43234,fn.TAI),34),new ei(new ie(2456109,43235,fn.TAI),35),new ei(new ie(2457204,43236,fn.TAI),36),new ei(new ie(2457754,43237,fn.TAI),37)];var mU={exports:{}},Rb={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var PL;function hY(){return PL||(PL=1,function(e,t){(function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,r=typeof e_=="object"&&e_;(r.global===r||r.window===r||r.self===r)&&(n=r);var s,a=2147483647,l=36,u=1,h=26,f=38,_=700,g=72,m=128,b="-",T=/^xn--/,x=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=l-u,P=Math.floor,N=String.fromCharCode,k;function M(W){throw new RangeError(w[W])}function U(W,X){for(var q=W.length,ee=[];q--;)ee[q]=X(W[q]);return ee}function B(W,X){var q=W.split("@"),ee="";q.length>1&&(ee=q[0]+"@",W=q[1]),W=W.replace(C,".");var Y=W.split("."),ne=U(Y,X).join(".");return ee+ne}function S(W){for(var X=[],q=0,ee=W.length,Y,ne;q=55296&&Y<=56319&&q65535&&(X-=65536,q+=N(X>>>10&1023|55296),X=56320|X&1023),q+=N(X),q}).join("")}function p(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:l}function I(W,X){return W+22+75*(W<26)-((X!=0)<<5)}function O(W,X,q){var ee=0;for(W=q?P(W/_):W>>1,W+=P(W/X);W>v*h>>1;ee+=l)W=P(W/v);return P(ee+(v+1)*W/(W+f))}function F(W){var X=[],q=W.length,ee,Y=0,ne=m,Q=g,le,pe,re,de,fe,ye,Ce,we,Pe;for(le=W.lastIndexOf(b),le<0&&(le=0),pe=0;pe=128&&M("not-basic"),X.push(W.charCodeAt(pe));for(re=le>0?le+1:0;re=q&&M("invalid-input"),Ce=p(W.charCodeAt(re++)),(Ce>=l||Ce>P((a-Y)/fe))&&M("overflow"),Y+=Ce*fe,we=ye<=Q?u:ye>=Q+h?h:ye-Q,!(CeP(a/Pe)&&M("overflow"),fe*=Pe;ee=X.length+1,Q=O(Y-de,ee,de==0),P(Y/ee)>a-ne&&M("overflow"),ne+=P(Y/ee),Y%=ee,X.splice(Y++,0,ne)}return D(X)}function V(W){var X,q,ee,Y,ne,Q,le,pe,re,de,fe,ye=[],Ce,we,Pe,lt;for(W=S(W),Ce=W.length,X=m,q=0,ne=g,Q=0;Q=X&&feP((a-q)/we)&&M("overflow"),q+=(le-X)*we,X=le,Q=0;Qa&&M("overflow"),fe==X){for(pe=q,re=l;de=re<=ne?u:re>=ne+h?h:re-ne,!(pe1);g++)f.splice(0,1);a[_]=f.join("")}var m=-1,b=0,T=0,x=-1,C=!1;for(_=0;_b&&(m=x,b=T)):a[_]==="0"&&(C=!0,x=_,T=1);T>b&&(m=x,b=T),b>1&&a.splice(m,b,""),l=a.length;var w="";for(a[0]===""&&(w=":"),_=0;_=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(s+1,r)+" ")>=0:!1},is:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s>=0)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(0,r)+" ")>=0:!1},get:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return null;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return null;var a=i.list[o.slice(r+1)];return!a||a.indexOf(" "+o.slice(s+1,r)+" ")<0?null:o.slice(s+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=n),this}};return i})}(kE)),kE.exports}/*! * URI.js - Mutating URLs * * Version: 1.19.11 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */(function(e){(function(t,n){e.exports?e.exports=n(hY(),fY(),pY()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(e_,function(t,n,i,o){var r=o&&o.URI;function s(p,I){var O=arguments.length>=1,F=arguments.length>=2;if(!(this instanceof s))return O?F?new s(p,I):new s(p):new s;if(p===void 0){if(O)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?p=location.href+"":p=""}if(p===null&&O)throw new TypeError("null is not a valid argument for URI");return this.href(p),I!==void 0?this.absoluteTo(I):this}function a(p){return/^[0-9]+$/.test(p)}s.version="1.19.11";var l=s.prototype,u=Object.prototype.hasOwnProperty;function h(p){return p.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(p){return p===void 0?"Undefined":String(Object.prototype.toString.call(p)).slice(8,-1)}function _(p){return f(p)==="Array"}function g(p,I){var O={},F,V;if(f(I)==="RegExp")O=null;else if(_(I))for(F=0,V=I.length;F]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.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"},s.getDomAttribute=function(p){if(!(!p||!p.nodeName)){var I=p.nodeName.toLowerCase();if(!(I==="input"&&p.type!=="image"))return s.domAttributes[I]}};function x(p){return escape(p)}function C(p){return encodeURIComponent(p).replace(/[!'()*]/g,x).replace(/\*/g,"%2A")}s.encode=C,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=C,s.decode=decodeURIComponent},s.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,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)/ig,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)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(p,I){var O=s.encode(p+"");return I===void 0&&(I=s.escapeQuerySpace),I?O.replace(/%20/g,"+"):O},s.decodeQuery=function(p,I){p+="",I===void 0&&(I=s.escapeQuerySpace);try{return s.decode(I?p.replace(/\+/g,"%20"):p)}catch{return p}};var w={encode:"encode",decode:"decode"},v,P=function(p,I){return function(O){try{return s[I](O+"").replace(s.characters[p][I].expression,function(F){return s.characters[p][I].map[F]})}catch{return O}}};for(v in w)s[v+"PathSegment"]=P("pathname",w[v]),s[v+"UrnPathSegment"]=P("urnpath",w[v]);var N=function(p,I,O){return function(F){var V;O?V=function(X){return s[I](s[O](X))}:V=s[I];for(var G=(F+"").split(p),j=0,W=G.length;j-1&&(I.fragment=p.substring(O+1)||null,p=p.substring(0,O)),O=p.indexOf("?"),O>-1&&(I.query=p.substring(O+1)||null,p=p.substring(0,O)),p=p.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),p=p.replace(/^[/\\]{2,}/i,"//"),p.substring(0,2)==="//"?(I.protocol=null,p=p.substring(2),p=s.parseAuthority(p,I)):(O=p.indexOf(":"),O>-1&&(I.protocol=p.substring(0,O)||null,I.protocol&&!I.protocol.match(s.protocol_expression)?I.protocol=void 0:p.substring(O+1,O+3).replace(/\\/g,"/")==="//"?(p=p.substring(O+3),p=s.parseAuthority(p,I)):(p=p.substring(O+1),I.urn=!0))),I.path=p,I},s.parseHost=function(p,I){p||(p=""),p=p.replace(/\\/g,"/");var O=p.indexOf("/"),F,V;if(O===-1&&(O=p.length),p.charAt(0)==="[")F=p.indexOf("]"),I.hostname=p.substring(1,F)||null,I.port=p.substring(F+2,O)||null,I.port==="/"&&(I.port=null);else{var G=p.indexOf(":"),j=p.indexOf("/"),W=p.indexOf(":",G+1);W!==-1&&(j===-1||W-1?V:p.length-1),j;return G>-1&&(V===-1||G-1?ne=ne.slice(0,Q)+ne.slice(Q).replace(G,""):ne=ne.replace(G,""),!(ne.length<=X[0].length)&&!(O.ignore&&O.ignore.test(ne))){Y=q+ne.length;var re=I(ne,q,Y,p);if(re===void 0){F.lastIndex=Y;continue}re=String(re),p=p.slice(0,q)+re+p.slice(Y),F.lastIndex=q+re.length}}return F.lastIndex=0,p},s.ensureValidHostname=function(p,I){var O=!!p,F=!!I,V=!1;if(F&&(V=m(s.hostProtocols,I)),V&&!O)throw new TypeError("Hostname cannot be empty, if protocol is "+I);if(p&&p.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(p).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(p){if(!!p){var I=Number(p);if(!(a(I)&&I>0&&I<65536))throw new TypeError('Port "'+p+'" is not a valid port')}},s.noConflict=function(p){if(p){var I={URI:this.noConflict()};return o.URITemplate&&typeof o.URITemplate.noConflict=="function"&&(I.URITemplate=o.URITemplate.noConflict()),o.IPv6&&typeof o.IPv6.noConflict=="function"&&(I.IPv6=o.IPv6.noConflict()),o.SecondLevelDomains&&typeof o.SecondLevelDomains.noConflict=="function"&&(I.SecondLevelDomains=o.SecondLevelDomains.noConflict()),I}else o.URI===this&&(o.URI=r);return this},l.build=function(p){return p===!0?this._deferred_build=!0:(p===void 0||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},l.clone=function(){return new s(this)},l.valueOf=l.toString=function(){return this.build(!1)._string};function k(p){return function(I,O){return I===void 0?this._parts[p]||"":(this._parts[p]=I||null,this.build(!O),this)}}function M(p,I){return function(O,F){return O===void 0?this._parts[p]||"":(O!==null&&(O=O+"",O.charAt(0)===I&&(O=O.substring(1))),this._parts[p]=O,this.build(!F),this)}}l.protocol=k("protocol"),l.username=k("username"),l.password=k("password"),l.hostname=k("hostname"),l.port=k("port"),l.query=M("query","?"),l.fragment=M("fragment","#"),l.search=function(p,I){var O=this.query(p,I);return typeof O=="string"&&O.length?"?"+O:O},l.hash=function(p,I){var O=this.fragment(p,I);return typeof O=="string"&&O.length?"#"+O:O},l.pathname=function(p,I){if(p===void 0||p===!0){var O=this._parts.path||(this._parts.hostname?"/":"");return p?(this._parts.urn?s.decodeUrnPath:s.decodePath)(O):O}else return this._parts.urn?this._parts.path=p?s.recodeUrnPath(p):"":this._parts.path=p?s.recodePath(p):"/",this.build(!I),this},l.path=l.pathname,l.href=function(p,I){var O;if(p===void 0)return this.toString();this._string="",this._parts=s._parts();var F=p instanceof s,V=typeof p=="object"&&(p.hostname||p.path||p.pathname);if(p.nodeName){var G=s.getDomAttribute(p);p=p[G]||"",V=!1}if(!F&&V&&p.pathname!==void 0&&(p=p.toString()),typeof p=="string"||p instanceof String)this._parts=s.parse(String(p),this._parts);else if(F||V){var j=F?p._parts:p;for(O in j)O!=="query"&&u.call(this._parts,O)&&(this._parts[O]=j[O]);j.query&&this.query(j.query,!1)}else throw new TypeError("invalid input");return this.build(!I),this},l.is=function(p){var I=!1,O=!1,F=!1,V=!1,G=!1,j=!1,W=!1,X=!this._parts.urn;switch(this._parts.hostname&&(X=!1,O=s.ip4_expression.test(this._parts.hostname),F=s.ip6_expression.test(this._parts.hostname),I=O||F,V=!I,G=V&&i&&i.has(this._parts.hostname),j=V&&s.idn_expression.test(this._parts.hostname),W=V&&s.punycode_expression.test(this._parts.hostname)),p.toLowerCase()){case"relative":return X;case"absolute":return!X;case"domain":case"name":return V;case"sld":return G;case"ip":return I;case"ip4":case"ipv4":case"inet4":return O;case"ip6":case"ipv6":case"inet6":return F;case"idn":return j;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return W}return null};var U=l.protocol,B=l.port,S=l.hostname;l.protocol=function(p,I){if(p&&(p=p.replace(/:(\/\/)?$/,""),!p.match(s.protocol_expression)))throw new TypeError('Protocol "'+p+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return U.call(this,p,I)},l.scheme=l.protocol,l.port=function(p,I){return this._parts.urn?p===void 0?"":this:(p!==void 0&&(p===0&&(p=null),p&&(p+="",p.charAt(0)===":"&&(p=p.substring(1)),s.ensureValidPort(p))),B.call(this,p,I))},l.hostname=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p!==void 0){var O={preventInvalidHostname:this._parts.preventInvalidHostname},F=s.parseHost(p,O);if(F!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');p=O.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(p,this._parts.protocol)}return S.call(this,p,I)},l.origin=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){var O=this.protocol(),F=this.authority();return F?(O?O+"://":"")+this.authority():""}else{var V=s(p);return this.protocol(V.protocol()).authority(V.authority()).build(!I),this}},l.host=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var O=s.parseHost(p,this._parts);if(O!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');return this.build(!I),this},l.authority=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var O=s.parseAuthority(p,this._parts);if(O!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');return this.build(!I),this},l.userinfo=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){var O=s.buildUserinfo(this._parts);return O&&O.substring(0,O.length-1)}else return p[p.length-1]!=="@"&&(p+="@"),s.parseUserinfo(p,this._parts),this.build(!I),this},l.resource=function(p,I){var O;return p===void 0?this.path()+this.search()+this.hash():(O=s.parse(p),this._parts.path=O.path,this._parts.query=O.query,this._parts.fragment=O.fragment,this.build(!I),this)},l.subdomain=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,O)||""}else{var F=this._parts.hostname.length-this.domain().length,V=this._parts.hostname.substring(0,F),G=new RegExp("^"+h(V));if(p&&p.charAt(p.length-1)!=="."&&(p+="."),p.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return p&&s.ensureValidHostname(p,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(G,p),this.build(!I),this}},l.domain=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p=="boolean"&&(I=p,p=void 0),p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.match(/\./g);if(O&&O.length<2)return this._parts.hostname;var F=this._parts.hostname.length-this.tld(I).length-1;return F=this._parts.hostname.lastIndexOf(".",F-1)+1,this._parts.hostname.substring(F)||""}else{if(!p)throw new TypeError("cannot set domain empty");if(p.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(p,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=p;else{var V=new RegExp(h(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(V,p)}return this.build(!I),this}},l.tld=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p=="boolean"&&(I=p,p=void 0),p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.lastIndexOf("."),F=this._parts.hostname.substring(O+1);return I!==!0&&i&&i.list[F.toLowerCase()]&&i.get(this._parts.hostname)||F}else{var V;if(p)if(p.match(/[^a-zA-Z0-9-]/))if(i&&i.is(p))V=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,p);else throw new TypeError('TLD "'+p+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");V=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,p)}else throw new TypeError("cannot set TLD empty");return this.build(!I),this}},l.directory=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0||p===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var O=this._parts.path.length-this.filename().length-1,F=this._parts.path.substring(0,O)||(this._parts.hostname?"/":"");return p?s.decodePath(F):F}else{var V=this._parts.path.length-this.filename().length,G=this._parts.path.substring(0,V),j=new RegExp("^"+h(G));return this.is("relative")||(p||(p="/"),p.charAt(0)!=="/"&&(p="/"+p)),p&&p.charAt(p.length-1)!=="/"&&(p+="/"),p=s.recodePath(p),this._parts.path=this._parts.path.replace(j,p),this.build(!I),this}},l.filename=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p!="string"){if(!this._parts.path||this._parts.path==="/")return"";var O=this._parts.path.lastIndexOf("/"),F=this._parts.path.substring(O+1);return p?s.decodePathSegment(F):F}else{var V=!1;p.charAt(0)==="/"&&(p=p.substring(1)),p.match(/\.?\//)&&(V=!0);var G=new RegExp(h(this.filename())+"$");return p=s.recodePath(p),this._parts.path=this._parts.path.replace(G,p),V?this.normalizePath(I):this.build(!I),this}},l.suffix=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0||p===!0){if(!this._parts.path||this._parts.path==="/")return"";var O=this.filename(),F=O.lastIndexOf("."),V,G;return F===-1?"":(V=O.substring(F+1),G=/^[a-z0-9%]+$/i.test(V)?V:"",p?s.decodePathSegment(G):G)}else{p.charAt(0)==="."&&(p=p.substring(1));var j=this.suffix(),W;if(j)p?W=new RegExp(h(j)+"$"):W=new RegExp(h("."+j)+"$");else{if(!p)return this;this._parts.path+="."+s.recodePath(p)}return W&&(p=s.recodePath(p),this._parts.path=this._parts.path.replace(W,p)),this.build(!I),this}},l.segment=function(p,I,O){var F=this._parts.urn?":":"/",V=this.path(),G=V.substring(0,1)==="/",j=V.split(F);if(p!==void 0&&typeof p!="number"&&(O=I,I=p,p=void 0),p!==void 0&&typeof p!="number")throw new Error('Bad segment "'+p+'", must be 0-based integer');if(G&&j.shift(),p<0&&(p=Math.max(j.length+p,0)),I===void 0)return p===void 0?j:j[p];if(p===null||j[p]===void 0)if(_(I)){j=[];for(var W=0,X=I.length;W"u")return e;t=y(n.baseURI,n.location.href)}const i=new Ec(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function _Y(e,t){if(!c(e))throw new E("uri is required.");let n="";const i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new Ec(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function gY(e){if(!c(e))throw new E("uri is required.");const t=new Ec(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),i=n.lastIndexOf("."),i===-1?n="":n=n.substr(i+1),n}const RL={};function Ax(e,t,n){c(t)||(t=e.width),c(n)||(n=e.height);let i=RL[t];c(i)||(i={},RL[t]=i);let o=i[n];if(!c(o)){const r=document.createElement("canvas");r.width=t,r.height=n,o=r.getContext("2d",{willReadFrequently:!0}),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}const yY=/^blob:/i;function _U(e){return A.typeOf.string("uri",e),yY.test(e)}let Vl;function gU(e){c(Vl)||(Vl=document.createElement("a")),Vl.href=window.location.href;const t=Vl.host,n=Vl.protocol;return Vl.href=e,Vl.href=Vl.href,n!==Vl.protocol||t!==Vl.host}const bY=/^data:/i;function CP(e){return A.typeOf.string("uri",e),bY.test(e)}function TY(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const o=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,o.removeChild(t),n()},t.onerror=function(r){i(r)},o.appendChild(t)})}function AY(e){if(!c(e))throw new E("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let r=0,s=i.length;r0){const s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}function E_(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=wY(this.responseHeaders))}E_.prototype.toString=function(){let e="Request has failed.";return c(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function Le(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(Le.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});Le.prototype.addEventListener=function(e,t){A.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}};Le.prototype.removeEventListener=function(e,t){A.typeOf.func("listener",e);const n=this._listeners,i=this._scopes;let o=-1;for(let r=0;r0){for(o.sort(SY),e=0;e=0;--t)this.heapify(t)};Dp.prototype.insert=function(e){A.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let o=this._length++;for(oi&&(r=t[i],this._length=i),r};Dp.prototype.pop=function(e){if(e=y(e,0),this._length===0)return;A.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return EP(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function vY(e,t){return e.priority-t.priority}const Un={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let t_=20;const us=new Dp({comparator:vY});us.maximumLength=t_;us.reserve(t_);const Xl=[];let cd={};const IY=typeof document<"u"?new Ec(document.location.href):new Ec,gC=new Le;function Nn(){}Nn.maximumRequests=50;Nn.maximumRequestsPerServer=18;Nn.requestsByServer={};Nn.throttleRequests=!0;Nn.debugShowStatistics=!1;Nn.requestCompletedEvent=gC;Object.defineProperties(Nn,{statistics:{get:function(){return Un}},priorityHeapLength:{get:function(){return t_},set:function(e){if(ee;){const t=us.pop();Xf(t)}t_=e,us.maximumLength=e,us.reserve(e)}}});function yU(e){c(e.priorityFunction)&&(e.priority=e.priorityFunction())}Nn.serverHasOpenSlots=function(e,t){t=y(t,1);const n=y(Nn.requestsByServer[e],Nn.maximumRequestsPerServer);return cd[e]+t<=n};Nn.heapHasOpenSlots=function(e){return us.length+e<=t_};function bU(e){return e.state===di.UNISSUED&&(e.state=di.ISSUED,e.deferred=R0()),e.deferred.promise}function DY(e){return function(t){if(e.state===di.CANCELLED)return;const n=e.deferred;--Un.numberOfActiveRequests,--cd[e.serverKey],gC.raiseEvent(),e.state=di.RECEIVED,e.deferred=void 0,n.resolve(t)}}function PY(e){return function(t){e.state!==di.CANCELLED&&(++Un.numberOfFailedRequests,--Un.numberOfActiveRequests,--cd[e.serverKey],gC.raiseEvent(t),e.state=di.FAILED,e.deferred.reject(t))}}function TU(e){const t=bU(e);return e.state=di.ACTIVE,Xl.push(e),++Un.numberOfActiveRequests,++Un.numberOfActiveRequestsEver,++cd[e.serverKey],e.requestFunction().then(DY(e)).catch(PY(e)),t}function Xf(e){const t=e.state===di.ACTIVE;if(e.state=di.CANCELLED,++Un.numberOfCancelledRequests,c(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--Un.numberOfActiveRequests,--cd[e.serverKey],++Un.numberOfCancelledActiveRequests),c(e.cancelFunction)&&e.cancelFunction()}Nn.update=function(){let e,t,n=0;const i=Xl.length;for(e=0;e0&&(Xl[e-n]=t)}Xl.length-=n;const o=us.internalArray,r=us.length;for(e=0;e0;){if(t=us.pop(),t.cancelled){Xf(t);continue}if(t.throttleByServer&&!Nn.serverHasOpenSlots(t.serverKey)){Xf(t);continue}TU(t),++a}OY()};Nn.getServerKey=function(e){A.typeOf.string("url",e);let t=new Ec(e);t.scheme()===""&&(t=t.absoluteTo(IY),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=cd[n];return c(i)||(cd[n]=0),n};Nn.request=function(e){if(A.typeOf.object("request",e),A.typeOf.string("request.url",e.url),A.typeOf.func("request.requestFunction",e.requestFunction),CP(e.url)||_U(e.url))return gC.raiseEvent(),e.state=di.RECEIVED,e.requestFunction();if(++Un.numberOfAttemptedRequests,c(e.serverKey)||(e.serverKey=Nn.getServerKey(e.url)),Nn.throttleRequests&&e.throttleByServer&&!Nn.serverHasOpenSlots(e.serverKey))return;if(!Nn.throttleRequests||!e.throttle)return TU(e);if(Xl.length>=Nn.maximumRequests)return;yU(e);const t=us.insert(e);if(c(t)){if(t===e)return;Xf(t)}return bU(e)};function OY(){!Nn.debugShowStatistics||(Un.numberOfActiveRequests===0&&Un.lastNumberOfActiveRequests>0&&(Un.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Un.numberOfAttemptedRequests}`),Un.numberOfAttemptedRequests=0),Un.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Un.numberOfCancelledRequests}`),Un.numberOfCancelledRequests=0),Un.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Un.numberOfCancelledActiveRequests}`),Un.numberOfCancelledActiveRequests=0),Un.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Un.numberOfFailedRequests}`),Un.numberOfFailedRequests=0)),Un.lastNumberOfActiveRequests=Un.numberOfActiveRequests)}Nn.clearForSpecs=function(){for(;us.length>0;){const t=us.pop();Xf(t)}const e=Xl.length;for(let t=0;t0}},credits:{get:function(){return this._credits}}});Ae.prototype.toString=function(){return this.getUrlComponent(!0,!0)};Ae.prototype.parseUrl=function(e,t,n,i){let o=new Ec(e);const r=RY(o.query());this._queryParameters=t?xx(r,this.queryParameters,n):r,o.search(""),o.fragment(""),c(i)&&o.scheme()===""&&(o=o.absoluteTo(C_(i))),this._url=o.toString()};function RY(e){return e.length===0?{}:e.indexOf("=")===-1?{[e]:void 0}:xY(e)}function xx(e,t,n){if(!n)return jt(e,t);const i=Je(e,!0);for(const o in t)if(t.hasOwnProperty(o)){let r=i[o];const s=t[o];c(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}Ae.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=this._url;e&&(n=`${n}${NY(this.queryParameters)}`),n=n.replace(/%7B/g,"{").replace(/%7D/g,"}");const i=this._templateValues;return Object.keys(i).length>0&&(n=n.replace(/{(.*?)}/g,function(o,r){const s=i[r];return c(s)?encodeURIComponent(s):o})),t&&c(this.proxy)&&(n=this.proxy.getURL(n)),n};function NY(e){const t=Object.keys(e);return t.length===0?"":t.length===1&&!c(e[t[0]])?`?${t[0]}`:`?${AY(e)}`}Ae.prototype.setQueryParameters=function(e,t){t?this._queryParameters=xx(this._queryParameters,e,!1):this._queryParameters=xx(e,this._queryParameters,!1)};Ae.prototype.appendQueryParameters=function(e){this._queryParameters=xx(e,this._queryParameters,!0)};Ae.prototype.setTemplateValues=function(e,t){t?this._templateValues=jt(this._templateValues,e):this._templateValues=jt(e,this._templateValues)};Ae.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,c(e.url)){const n=y(e.preserveQueryParameters,!1);t.parseUrl(e.url,!0,n,this._url)}return c(e.queryParameters)&&(t._queryParameters=jt(e.queryParameters,t.queryParameters)),c(e.templateValues)&&(t._templateValues=jt(e.templateValues,t.templateValues)),c(e.headers)&&(t.headers=jt(e.headers,t.headers)),c(e.proxy)&&(t.proxy=e.proxy),c(e.request)&&(t.request=e.request),c(e.retryCallback)&&(t.retryCallback=e.retryCallback),c(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};Ae.prototype.retryOnError=function(e){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})};Ae.prototype.clone=function(e){return c(e)?(e._url=this._url,e._queryParameters=Je(this._queryParameters),e._templateValues=Je(this._templateValues),e.headers=Je(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e):new Ae({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:c(this.credits)?this.credits.slice():void 0})};Ae.prototype.getBaseUri=function(e){return _Y(this.getUrlComponent(e),e)};Ae.prototype.appendForwardSlash=function(){this._url=mY(this._url)};Ae.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};Ae.fetchArrayBuffer=function(e){return new Ae(e).fetchArrayBuffer()};Ae.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};Ae.fetchBlob=function(e){return new Ae(e).fetchBlob()};Ae.prototype.fetchImage=function(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.preferImageBitmap,!1),n=y(e.preferBlob,!1),i=y(e.flipY,!1),o=y(e.skipColorSpaceConversion,!1);if(wP(this.request),!xU||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return mI({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!c(r))return;let s,a,l,u;return Ae.supportsImageBitmapOptions().then(function(h){return s=h,a=s&&t,r}).then(function(h){if(!c(h))return;if(u=h,a)return Ae.createImageBitmapFromBlob(h,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const f=window.URL.createObjectURL(h);return l=new Ae({url:f}),mI({resource:l,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(h){if(!!c(h))return h.blob=u,a||window.URL.revokeObjectURL(l.url),h}).catch(function(h){return c(l)&&window.URL.revokeObjectURL(l.url),h.blob=u,Promise.reject(h)})};function mI(e){const t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,o=e.preferImageBitmap,r=t.request;r.url=t.url,r.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);const l=R0();return Ae._Implementations.createImage(r,a,l,n,i,o),l.promise};const s=Nn.request(r);if(!!c(s))return s.catch(function(a){return r.state!==di.FAILED?Promise.reject(a):t.retryOnError(a).then(function(l){return l?(r.state=di.UNISSUED,r.deferred=void 0,mI({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}Ae.fetchImage=function(e){return new Ae(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};Ae.prototype.fetchText=function(){return this.fetch({responseType:"text"})};Ae.fetchText=function(e){return new Ae(e).fetchText()};Ae.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(!!c(e))return e.then(function(t){if(!!c(t))return JSON.parse(t)})};Ae.fetchJson=function(e){return new Ae(e).fetchJson()};Ae.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};Ae.fetchXML=function(e){return new Ae(e).fetchXML()};Ae.prototype.fetchJsonp=function(e){e=y(e,"callback"),wP(this.request);let t;do t=`loadJsonp${R.nextRandomNumber().toString().substring(2,8)}`;while(c(window[t]));return CU(this,e,t)};function CU(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request,r=e.url;o.url=r,o.requestFunction=function(){const a=R0();return window[n]=function(l){a.resolve(l);try{delete window[n]}catch{window[n]=void 0}},Ae._Implementations.loadAndExecuteScript(r,n,a),a.promise};const s=Nn.request(o);if(!!c(s))return s.catch(function(a){return o.state!==di.FAILED?Promise.reject(a):e.retryOnError(a).then(function(l){return l?(o.state=di.UNISSUED,o.deferred=void 0,CU(e,t,n)):Promise.reject(a)})})}Ae.fetchJsonp=function(e){return new Ae(e).fetchJsonp(e.callbackParameterName)};Ae.prototype._makeRequest=function(e){const t=this;wP(t.request);const n=t.request,i=t.url;n.url=i,n.requestFunction=function(){const r=e.responseType,s=jt(e.headers,t.headers),a=e.overrideMimeType,l=e.method,u=e.data,h=R0(),f=Ae._Implementations.loadWithXhr(i,r,l,u,s,h,a);return c(f)&&c(f.abort)&&(n.cancelFunction=function(){f.abort()}),h.promise};const o=Nn.request(n);if(!!c(o))return o.then(function(r){return n.cancelFunction=void 0,r}).catch(function(r){return n.cancelFunction=void 0,n.state!==di.FAILED?Promise.reject(r):t.retryOnError(r).then(function(s){return s?(n.state=di.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(r)})})};function wP(e){if(e.state===di.ISSUED||e.state===di.ACTIVE)throw new Te("The Resource is already being fetched.");e.state=di.UNISSUED,e.deferred=void 0}const MY=/^data:(.*?)(;base64)?,(.*)$/;function OA(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function NL(e,t){const n=OA(e,t),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let r=0;r{if(!a.ok){const l={};a.headers.forEach((u,h)=>{l[h]=u}),r.reject(new E_(a.status,a,l));return}switch(t){case"text":r.resolve(a.text());break;case"json":r.resolve(a.json());break;default:r.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{r.reject(new E_)})}const zY=typeof XMLHttpRequest>"u";Ae._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=MY.exec(e);if(a!==null){r.resolve(FY(a,t));return}if(zY){BY(e,t,n,i,o,r);return}const l=new XMLHttpRequest;if(AU.contains(e)&&(l.withCredentials=!0),l.open(n,e,!0),c(s)&&c(l.overrideMimeType)&&l.overrideMimeType(s),c(o))for(const h in o)o.hasOwnProperty(h)&&l.setRequestHeader(h,o[h]);c(t)&&(l.responseType=t);let u=!1;return typeof e=="string"&&(u=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),l.onload=function(){if((l.status<200||l.status>=300)&&!(u&&l.status===0)){r.reject(new E_(l.status,l.response,l.getAllResponseHeaders()));return}const h=l.response,f=l.responseType;if(n==="HEAD"||n==="OPTIONS"){const g=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};g.forEach(function(b){const T=b.split(": "),x=T.shift();m[x]=T.join(": ")}),r.resolve(m);return}if(l.status===204)r.resolve(void 0);else if(c(h)&&(!c(t)||f===t))r.resolve(h);else if(t==="json"&&typeof h=="string")try{r.resolve(JSON.parse(h))}catch(_){r.reject(_)}else(f===""||f==="document")&&c(l.responseXML)&&l.responseXML.hasChildNodes()?r.resolve(l.responseXML):(f===""||f==="text")&&c(l.responseText)?r.resolve(l.responseText):r.reject(new Te("Invalid XMLHttpRequest response type."))},l.onerror=function(h){r.reject(new E_)},l.send(i),l};Ae._Implementations.loadAndExecuteScript=function(e,t,n){return TY(e).catch(function(i){n.reject(i)})};Ae._DefaultImplementations={};Ae._DefaultImplementations.createImage=Ae._Implementations.createImage;Ae._DefaultImplementations.loadWithXhr=Ae._Implementations.loadWithXhr;Ae._DefaultImplementations.loadAndExecuteScript=Ae._Implementations.loadAndExecuteScript;Ae.DEFAULT=Object.freeze(new Ae({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function Xy(e){e=y(e,y.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._addNewLeapSeconds=y(e.addNewLeapSeconds,!0),c(e.data)?ML(this,e.data):ML(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Xy.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT);const n=Ae.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Te(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new Xy({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};Xy.NONE=Object.freeze({compute:function(e,t){return c(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new bP(0,0,0,0,0),t}});Xy.prototype.compute=function(e,t){if(!c(this._samples))return;if(c(t)||(t=new bP(0,0,0,0,0)),this._samples.length===0)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 o=0,r=0;if(c(i)){const a=n[i],l=n[i+1],u=ie.lessThanOrEquals(a,e),h=!c(l),f=h||ie.greaterThanOrEquals(l,e);if(u&&f)return o=i,!h&&l.equals(e)&&++o,r=o+1,BL(this,n,this._samples,e,o,r,t),t}let s=Hr(n,e,ie.compare,this._dateColumn);return s>=0?(st.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;const l=t[o],u=t[r];if(l.equals(u)||i.equals(l))return FL(e,n,o,a,s),s;if(i.equals(u))return FL(e,n,r,a,s),s;const h=ie.secondsDifference(i,l)/ie.secondsDifference(u,l),f=o*a,_=r*a;let g=n[f+e._ut1MinusUtcSecondsColumn],m=n[_+e._ut1MinusUtcSecondsColumn];const b=m-g;if(b>.5||b<-.5){const T=n[f+e._taiMinusUtcSecondsColumn],x=n[_+e._taiMinusUtcSecondsColumn];T!==x&&(u.equals(i)?g=m:m-=x-T)}return s.xPoleWander=pg(h,n[f+e._xPoleWanderRadiansColumn],n[_+e._xPoleWanderRadiansColumn]),s.yPoleWander=pg(h,n[f+e._yPoleWanderRadiansColumn],n[_+e._yPoleWanderRadiansColumn]),s.xPoleOffset=pg(h,n[f+e._xCelestialPoleOffsetRadiansColumn],n[_+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=pg(h,n[f+e._yCelestialPoleOffsetRadiansColumn],n[_+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=pg(h,g,m),s}function lr(e,t,n){this.heading=y(e,0),this.pitch=y(t,0),this.roll=y(n,0)}lr.fromQuaternion=function(e,t){if(!c(e))throw new E("quaternion is required");c(t)||(t=new lr);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),o=2*(e.w*e.x+e.y*e.z),r=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,r),t.roll=Math.atan2(o,i),t.pitch=-R.asinClamped(n),t};lr.fromDegrees=function(e,t,n,i){if(!c(e))throw new E("heading is required");if(!c(t))throw new E("pitch is required");if(!c(n))throw new E("roll is required");return c(i)||(i=new lr),i.heading=e*R.RADIANS_PER_DEGREE,i.pitch=t*R.RADIANS_PER_DEGREE,i.roll=n*R.RADIANS_PER_DEGREE,i};lr.clone=function(e,t){if(!!c(e))return c(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new lr(e.heading,e.pitch,e.roll)};lr.equals=function(e,t){return e===t||c(e)&&c(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};lr.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&R.equalsEpsilon(e.heading,t.heading,n,i)&&R.equalsEpsilon(e.pitch,t.pitch,n,i)&&R.equalsEpsilon(e.roll,t.roll,n,i)};lr.prototype.clone=function(e){return lr.clone(this,e)};lr.prototype.equals=function(e){return lr.equals(this,e)};lr.prototype.equalsEpsilon=function(e,t,n){return lr.equalsEpsilon(this,e,t,n)};lr.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const EU=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function kY(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t"u"?e:(c(Nb)||(Nb=document.createElement("a")),Nb.href=e,Nb.href)}let Uf;function SU(){var t;if(c(Uf))return Uf;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:c((t=import.meta)==null?void 0:t.url)?e=C_(".",import.meta.url):typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?e=C_("..",Zt("Core/buildModuleUrl.js")):e=kY(),!c(e))throw new E("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return Uf=new Ae({url:wU(e)}),Uf.appendForwardSlash(),Uf}function VY(e){return wU(require.toUrl(`../${e}`))}function vU(e){return SU().getDerivedResource({url:e}).url}let Mb;function Zt(e){return c(Mb)||(typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?Mb=VY:Mb=vU),Mb(e)}Zt._cesiumScriptRegex=EU;Zt._buildModuleUrlFromBaseUrl=vU;Zt._clearBaseResource=function(){Uf=void 0};Zt.setBaseUrl=function(e){Uf=Ae.DEFAULT.getDerivedResource({url:e})};Zt.getCesiumBaseUrl=SU;function IU(e,t,n){this.x=e,this.y=t,this.s=n}function SP(e){e=y(e,y.EMPTY_OBJECT),this._xysFileUrlTemplate=Ae.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=y(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=y(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new ie(this._sampleZeroJulianEphemerisDate,0,fn.TAI),this._stepSizeDays=y(e.stepSizeDays,1),this._samplesPerXysFile=y(e.samplesPerXysFile,1e3),this._totalSamples=y(e.totalSamples,27426),this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t);for(let r=0;r<=t;++r){n[r]=o,i[r]=r*this._stepSizeDays;for(let s=0;s<=t;++s)s!==r&&(n[r]*=r-s);n[r]=1/n[r]}this._work=new Array(t+1),this._coef=new Array(t+1)}const HY=new ie(0,0,fn.TAI);function _I(e,t,n){const i=HY;return i.dayNumber=t,i.secondsOfDay=n,ie.daysDifference(i,e._sampleZeroDateTT)}SP.prototype.preload=function(e,t,n,i){const o=_I(this,e,t),r=_I(this,n,i);let s=o/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=r/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const l=s/this._samplesPerXysFile|0,u=a/this._samplesPerXysFile|0,h=[];for(let f=l;f<=u;++f)h.push(gI(this,f));return Promise.all(h)};SP.prototype.computeXysRadians=function(e,t,n){const i=_I(this,e,t);if(i<0)return;const o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;const r=this._interpolationOrder;let s=o-(r/2|0);s<0&&(s=0);let a=s+r;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-r,s<0&&(s=0));let l=!1;const u=this._samples;if(c(u[s*3])||(gI(this,s/this._samplesPerXysFile|0),l=!0),c(u[a*3])||(gI(this,a/this._samplesPerXysFile|0),l=!0),l)return;c(n)?(n.x=0,n.y=0,n.s=0):n=new IU(0,0,0);const h=i-s*this._stepSizeDays,f=this._work,_=this._denominators,g=this._coef,m=this._xTable;let b,T;for(b=0;b<=r;++b)f[b]=h-m[b];for(b=0;b<=r;++b){for(g[b]=1,T=0;T<=r;++T)T!==b&&(g[b]*=f[T]);g[b]*=_[b];let x=(s+b)*3;n.x+=g[b]*u[x++],n.y+=g[b]*u[x++],n.s+=g[b]*u[x]}return n};function gI(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;c(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new Ae({url:Zt(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const o=n.fetchJson().then(function(r){e._chunkDownloadsInProgress[t]=!1;const s=e._samples,a=r.samples,l=t*e._samplesPerXysFile*3;for(let u=0,h=a.length;u0)n=Math.sqrt(h+1),s=.5*n,n=.5/n,i=(e[$.COLUMN1ROW2]-e[$.COLUMN2ROW1])*n,o=(e[$.COLUMN2ROW0]-e[$.COLUMN0ROW2])*n,r=(e[$.COLUMN0ROW1]-e[$.COLUMN1ROW0])*n;else{const f=GY;let _=0;l>a&&(_=1),u>a&&u>l&&(_=2);const g=f[_],m=f[g];n=Math.sqrt(e[$.getElementIndex(_,_)]-e[$.getElementIndex(g,g)]-e[$.getElementIndex(m,m)]+1);const b=jY;b[_]=.5*n,n=.5/n,s=(e[$.getElementIndex(m,g)]-e[$.getElementIndex(g,m)])*n,b[g]=(e[$.getElementIndex(g,_)]+e[$.getElementIndex(_,g)])*n,b[m]=(e[$.getElementIndex(m,_)]+e[$.getElementIndex(_,m)])*n,i=-b[0],o=-b[1],r=-b[2]}return c(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new _e(i,o,r,s)};const zL=new _e;let UL=new _e,VE=new _e,kL=new _e;_e.fromHeadingPitchRoll=function(e,t){return A.typeOf.object("headingPitchRoll",e),kL=_e.fromAxisAngle(d.UNIT_X,e.roll,zL),VE=_e.fromAxisAngle(d.UNIT_Y,-e.pitch,t),t=_e.multiply(VE,kL,VE),UL=_e.fromAxisAngle(d.UNIT_Z,-e.heading,zL),_e.multiply(UL,t,t)};const Fb=new d,HE=new d,tl=new _e,VL=new _e,Bb=new _e;_e.packedLength=4;_e.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};_e.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new _e),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};_e.packedInterpolationLength=3;_e.convertPackedArrayForInterpolation=function(e,t,n,i){_e.unpack(e,n*4,Bb),_e.conjugate(Bb,Bb);for(let o=0,r=n-t+1;o=0?r=1:(r=-1,o=-o);const s=o-1,a=1-n,l=n*n,u=a*a;for(let g=7;g>=0;--g)vu[g]=(Cx[g]*l-Ex[g])*s,Iu[g]=(Cx[g]*u-Ex[g])*s;const h=r*n*(1+vu[0]*(1+vu[1]*(1+vu[2]*(1+vu[3]*(1+vu[4]*(1+vu[5]*(1+vu[6]*(1+vu[7])))))))),f=a*(1+Iu[0]*(1+Iu[1]*(1+Iu[2]*(1+Iu[3]*(1+Iu[4]*(1+Iu[5]*(1+Iu[6]*(1+Iu[7])))))))),_=_e.multiplyByScalar(e,f,YY);return _e.multiplyByScalar(t,h,i),_e.add(_,i,i)};_e.fastSquad=function(e,t,n,i,o,r){A.typeOf.object("q0",e),A.typeOf.object("q1",t),A.typeOf.object("s0",n),A.typeOf.object("s1",i),A.typeOf.number("t",o),A.typeOf.object("result",r);const s=_e.fastSlerp(e,t,o,Iy),a=_e.fastSlerp(n,i,o,jm);return _e.fastSlerp(s,a,2*o*(1-o),r)};_e.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};_e.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(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};_e.ZERO=Object.freeze(new _e(0,0,0,0));_e.IDENTITY=Object.freeze(new _e(0,0,0,1));_e.prototype.clone=function(e){return _e.clone(this,e)};_e.prototype.equals=function(e){return _e.equals(this,e)};_e.prototype.equalsEpsilon=function(e,t){return _e.equalsEpsilon(this,e,t)};_e.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const Bn={},qE={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"}},rm={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},YE={},Xs={east:new d,north:new d,up:new d,west:new d,south:new d,down:new d};let Md=new d,Fd=new d,Bd=new d;Bn.localFrameToFixedFrameGenerator=function(e,t){if(!qE.hasOwnProperty(e)||!qE[e].hasOwnProperty(t))throw new E("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=qE[e][t];let i;const o=e+t;return c(YE[o])?i=YE[o]:(i=function(r,s,a){if(!c(r))throw new E("origin is required.");if(isNaN(r.x)||isNaN(r.y)||isNaN(r.z))throw new E("origin has a NaN component");if(c(a)||(a=new L),d.equalsEpsilon(r,d.ZERO,R.EPSILON14))d.unpack(rm[e],0,Md),d.unpack(rm[t],0,Fd),d.unpack(rm[n],0,Bd);else if(R.equalsEpsilon(r.x,0,R.EPSILON14)&&R.equalsEpsilon(r.y,0,R.EPSILON14)){const l=R.sign(r.z);d.unpack(rm[e],0,Md),e!=="east"&&e!=="west"&&d.multiplyByScalar(Md,l,Md),d.unpack(rm[t],0,Fd),t!=="east"&&t!=="west"&&d.multiplyByScalar(Fd,l,Fd),d.unpack(rm[n],0,Bd),n!=="east"&&n!=="west"&&d.multiplyByScalar(Bd,l,Bd)}else{s=y(s,ae.WGS84),s.geodeticSurfaceNormal(r,Xs.up);const l=Xs.up,u=Xs.east;u.x=-r.y,u.y=r.x,u.z=0,d.normalize(u,Xs.east),d.cross(l,u,Xs.north),d.multiplyByScalar(Xs.up,-1,Xs.down),d.multiplyByScalar(Xs.east,-1,Xs.west),d.multiplyByScalar(Xs.north,-1,Xs.south),Md=Xs[e],Fd=Xs[t],Bd=Xs[n]}return a[0]=Md.x,a[1]=Md.y,a[2]=Md.z,a[3]=0,a[4]=Fd.x,a[5]=Fd.y,a[6]=Fd.z,a[7]=0,a[8]=Bd.x,a[9]=Bd.y,a[10]=Bd.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},YE[o]=i),i};Bn.eastNorthUpToFixedFrame=Bn.localFrameToFixedFrameGenerator("east","north");Bn.northEastDownToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","east");Bn.northUpEastToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","up");Bn.northWestUpToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","west");const $Y=new _e,XY=new d(1,1,1),QY=new L;Bn.headingPitchRollToFixedFrame=function(e,t,n,i,o){A.typeOf.object("HeadingPitchRoll",t),i=y(i,Bn.eastNorthUpToFixedFrame);const r=_e.fromHeadingPitchRoll(t,$Y),s=L.fromTranslationQuaternionRotationScale(d.ZERO,r,XY,QY);return o=i(e,n,o),L.multiply(o,s,o)};const KY=new L,ZY=new $;Bn.headingPitchRollQuaternion=function(e,t,n,i,o){A.typeOf.object("HeadingPitchRoll",t);const r=Bn.headingPitchRollToFixedFrame(e,t,n,i,KY),s=L.getMatrix3(r,ZY);return _e.fromRotationMatrix(s,o)};const JY=new d(1,1,1),e$=new d,GL=new L,t$=new L,n$=new $,i$=new _e;Bn.fixedFrameToHeadingPitchRoll=function(e,t,n,i){A.defined("transform",e),t=y(t,ae.WGS84),n=y(n,Bn.eastNorthUpToFixedFrame),c(i)||(i=new lr);const o=L.getTranslation(e,e$);if(d.equals(o,d.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=L.inverseTransformation(n(o,t,GL),GL),s=L.setScale(e,JY,t$);s=L.setTranslation(s,d.ZERO,s),r=L.multiply(r,s,r);let a=_e.fromRotationMatrix(L.getMatrix3(r,n$),i$);return a=_e.normalize(a,a),lr.fromQuaternion(a,i)};const o$=6*3600+41*60+50.54841,r$=8640184812866e-6,s$=.093104,a$=-62e-7,c$=11772758384668e-32,l$=72921158553e-15,u$=R.TWO_PI/86400;let zb=new ie;Bn.computeTemeToPseudoFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");zb=ie.addSeconds(e,-ie.computeTaiMinusUtc(e),zb);const n=zb.dayNumber,i=zb.secondsOfDay;let o;const r=n-2451545;i>=43200?o=(r+.5)/qn.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/qn.DAYS_PER_JULIAN_CENTURY;const a=(o$+o*(r$+o*(s$+o*a$)))*u$%R.TWO_PI,l=l$+c$*(n-24515455e-1),u=(i+qn.SECONDS_PER_DAY*.5)%qn.SECONDS_PER_DAY,h=a+l*u,f=Math.cos(h),_=Math.sin(h);return c(t)?(t[0]=f,t[1]=-_,t[2]=0,t[3]=_,t[4]=f,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new $(f,_,0,-_,f,0,0,0,1)};Bn.iau2006XysData=new SP;Bn.earthOrientationParameters=Xy.NONE;const yI=32.184,d$=2451545;Bn.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+yI,i=e.stop.dayNumber,o=e.stop.secondsOfDay+yI;return Bn.iau2006XysData.preload(t,n,i,o)};Bn.computeIcrfToFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new $);const n=Bn.computeFixedToIcrfMatrix(e,t);if(!!c(n))return $.transpose(n,t)};const h$=new IU(0,0,0),f$=new bP(0,0,0,0,0),$E=new $,XE=new $;Bn.computeFixedToIcrfMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new $);const n=Bn.earthOrientationParameters.compute(e,f$);if(!c(n))return;const i=e.dayNumber,o=e.secondsOfDay+yI,r=Bn.iau2006XysData.computeXysRadians(i,o,h$);if(!c(r))return;const s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,l=1/(1+Math.sqrt(1-s*s-a*a)),u=$E;u[0]=1-l*s*s,u[3]=-l*s*a,u[6]=s,u[1]=-l*s*a,u[4]=1-l*a*a,u[7]=a,u[2]=-s,u[5]=-a,u[8]=1-l*(s*s+a*a);const h=$.fromRotationZ(-r.s,XE),f=$.multiply(u,h,$E),_=e.dayNumber,g=e.secondsOfDay-ie.computeTaiMinusUtc(e)+n.ut1MinusUtc,m=_-2451545,b=g/qn.SECONDS_PER_DAY;let T=.779057273264+b+.00273781191135448*(m+b);T=T%1*R.TWO_PI;const x=$.fromRotationZ(T,XE),C=$.multiply(f,x,$E),w=Math.cos(n.xPoleWander),v=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),N=Math.sin(n.yPoleWander);let k=i-d$+o/qn.SECONDS_PER_DAY;k/=36525;const M=-47e-6*k*R.RADIANS_PER_DEGREE/3600,U=Math.cos(M),B=Math.sin(M),S=XE;return S[0]=w*U,S[1]=w*B,S[2]=P,S[3]=-v*B+N*P*U,S[4]=v*U+N*P*B,S[5]=-N*w,S[6]=-N*B-v*P*U,S[7]=N*U-v*P*B,S[8]=v*w,$.multiply(C,S,t)};const p$=new te;Bn.pointToWindowCoordinates=function(e,t,n,i){return i=Bn.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};Bn.pointToGLWindowCoordinates=function(e,t,n,i){if(!c(e))throw new E("modelViewProjectionMatrix is required.");if(!c(t))throw new E("viewportTransformation is required.");if(!c(n))throw new E("point is required.");c(i)||(i=new H);const o=p$;return L.multiplyByVector(e,te.fromElements(n.x,n.y,n.z,1,o),o),te.multiplyByScalar(o,1/o.w,o),L.multiplyByVector(t,o,o),H.fromCartesian4(o,i)};const m$=new d,_$=new d,g$=new d;Bn.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("velocity is required.");const o=y(n,ae.WGS84).geodeticSurfaceNormal(e,m$);let r=d.cross(t,o,_$);d.equalsEpsilon(r,d.ZERO,R.EPSILON6)&&(r=d.clone(d.UNIT_X,r));const s=d.cross(r,t,g$);return d.normalize(s,s),d.cross(t,s,r),d.negate(r,r),d.normalize(r,r),c(i)||(i=new $),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};const PU=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),OU=new he,bI=new d,y$=new d,b$=new $,TI=new L,LU=new L;Bn.basisTo2D=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("matrix is required.");if(!c(n))throw new E("result is required.");const i=L.getTranslation(t,y$),o=e.ellipsoid;let r;if(d.equals(i,d.ZERO))r=d.clone(d.ZERO,bI);else{const h=o.cartesianToCartographic(i,OU);r=e.project(h,bI),d.fromElements(r.z,r.x,r.y,r)}const s=Bn.eastNorthUpToFixedFrame(i,o,TI),a=L.inverseTransformation(s,LU),l=L.getMatrix3(t,b$),u=L.multiplyByMatrix3(a,l,n);return L.multiply(PU,u,n),L.setTranslation(n,r,n),n};Bn.wgs84To2DModelMatrix=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("center is required.");if(!c(n))throw new E("result is required.");const i=e.ellipsoid,o=Bn.eastNorthUpToFixedFrame(t,i,TI),r=L.inverseTransformation(o,LU),s=i.cartesianToCartographic(t,OU),a=e.project(s,bI);d.fromElements(a.z,a.x,a.y,a);const l=L.fromTranslation(a,TI);return L.multiply(PU,r,n),L.multiply(l,n,n),n};const zt=Bn;function ce(e,t,n,i){this.west=y(e,0),this.south=y(t,0),this.east=y(n,0),this.north=y(i,0)}Object.defineProperties(ce.prototype,{width:{get:function(){return ce.computeWidth(this)}},height:{get:function(){return ce.computeHeight(this)}}});ce.packedLength=4;ce.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};ce.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new ce),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};ce.computeWidth=function(e){A.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t=0?h.longitude:h.longitude+R.TWO_PI;o=Math.min(o,f),r=Math.max(r,f)}return i-n>r-o&&(n=o,i=r,i>R.PI&&(i=i-R.TWO_PI),n>R.PI&&(n=n-R.TWO_PI)),c(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new ce(n,s,i,a)};ce.fromCartesianArray=function(e,t,n){A.defined("cartesians",e),t=y(t,ae.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let u=0,h=e.length;u=0?f.longitude:f.longitude+R.TWO_PI;r=Math.min(r,_),s=Math.max(s,_)}return o-i>s-r&&(i=r,o=s,o>R.PI&&(o=o-R.TWO_PI),i>R.PI&&(i=i-R.TWO_PI)),c(n)?(n.west=i,n.south=a,n.east=o,n.north=l,n):new ce(i,a,o,l)};const T$=new d,A$=new d,x$=new d,C$=new d,E$=new d,AI=new Array(5);for(let e=0;e0?i+=R.TWO_PI:r0&&(r+=R.TWO_PI),i=h))return c(n)?(n.west=a,n.south=u,n.east=l,n.north=h,n):new ce(a,u,l,h)};ce.simpleIntersection=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("otherRectangle",t);const i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return c(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new ce(i,o,r,s)};ce.union=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("otherRectangle",t),c(n)||(n=new ce);let i=e.east,o=e.west,r=t.east,s=t.west;i0?i+=R.TWO_PI:r0&&(r+=R.TWO_PI),io||R.equalsEpsilon(n,o,R.EPSILON14))&&(n=e.south&&i<=e.north};const w$=new he;ce.subsample=function(e,t,n,i){A.typeOf.object("rectangle",e),t=y(t,ae.WGS84),n=y(n,0),c(i)||(i=[]);let o=0;const r=e.north,s=e.south,a=e.east,l=e.west,u=w$;u.height=n,u.longitude=l,u.latitude=r,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.latitude=s,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,r<0?u.latitude=r:s>0?u.latitude=s:u.latitude=0;for(let h=1;h<8;++h)u.longitude=-Math.PI+h*R.PI_OVER_TWO,ce.contains(e,u)&&(i[o]=t.cartographicToCartesian(u,i[o]),o++);return u.latitude===0&&(u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++),i.length=o,i};ce.subsection=function(e,t,n,i,o,r){if(A.typeOf.object("rectangle",e),A.typeOf.number.greaterThanOrEquals("westLerp",t,0),A.typeOf.number.lessThanOrEquals("westLerp",t,1),A.typeOf.number.greaterThanOrEquals("southLerp",n,0),A.typeOf.number.lessThanOrEquals("southLerp",n,1),A.typeOf.number.greaterThanOrEquals("eastLerp",i,0),A.typeOf.number.lessThanOrEquals("eastLerp",i,1),A.typeOf.number.greaterThanOrEquals("northLerp",o,0),A.typeOf.number.lessThanOrEquals("northLerp",o,1),A.typeOf.number.lessThanOrEquals("westLerp",t,i),A.typeOf.number.lessThanOrEquals("southLerp",n,o),c(r)||(r=new ce),e.west<=e.east){const a=e.east-e.west;r.west=e.west+t*a,r.east=e.west+i*a}else{const a=R.TWO_PI+e.east-e.west;r.west=R.negativePiToPi(e.west+t*a),r.east=R.negativePiToPi(e.west+i*a)}const s=e.north-e.south;return r.south=e.south+n*s,r.north=e.south+o*s,t===1&&(r.west=e.east),i===1&&(r.east=e.east),n===1&&(r.south=e.north),o===1&&(r.north=e.north),r};ce.MAX_VALUE=Object.freeze(new ce(-Math.PI,-R.PI_OVER_TWO,Math.PI,R.PI_OVER_TWO));function Re(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.width=y(n,0),this.height=y(i,0)}Re.packedLength=4;Re.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};Re.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new Re),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};Re.fromPoints=function(e,t){if(c(t)||(t=new Re),!c(e)||e.length===0)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;an.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),o>n.height?n.height=o:o<0&&(n.height-=o,n.y=t.y),n};Re.intersect=function(e,t){A.typeOf.object("left",e),A.typeOf.object("right",t);const n=e.x,i=e.y,o=t.x,r=t.y;return n>o+t.width||n+e.widthr+t.height?Bt.OUTSIDE:Bt.INTERSECTING};Re.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};Re.prototype.clone=function(e){return Re.clone(this,e)};Re.prototype.intersect=function(e){return Re.intersect(this,e)};Re.prototype.equals=function(e){return Re.equals(this,e)};const Br={POINTS:J.POINTS,LINES:J.LINES,LINE_LOOP:J.LINE_LOOP,LINE_STRIP:J.LINE_STRIP,TRIANGLES:J.TRIANGLES,TRIANGLE_STRIP:J.TRIANGLE_STRIP,TRIANGLE_FAN:J.TRIANGLE_FAN};Br.isLines=function(e){return e===Br.LINES||e===Br.LINE_LOOP||e===Br.LINE_STRIP};Br.isTriangles=function(e){return e===Br.TRIANGLES||e===Br.TRIANGLE_STRIP||e===Br.TRIANGLE_FAN};Br.validate=function(e){return e===Br.POINTS||e===Br.LINES||e===Br.LINE_LOOP||e===Br.LINE_STRIP||e===Br.TRIANGLES||e===Br.TRIANGLE_STRIP||e===Br.TRIANGLE_FAN};const ze=Object.freeze(Br),RU=`in vec4 position; in vec2 textureCoordinates; out vec2 v_textureCoordinates; void main() { gl_Position = position; v_textureCoordinates = textureCoordinates; } `,Wi={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function Ze(e){e=y(e,y.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=y(e.primitiveType,ze.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=y(e.offset,0),this._instanceCount=y(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=y(e.cull,!0),this.occlude=y(e.occlude,!0),this.executeInClosestFrustum=y(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.castShadows=y(e.castShadows,!1),this.receiveShadows=y(e.receiveShadows,!1),this.pickOnly=y(e.pickOnly,!1),this.depthForTranslucentClassification=y(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Kr(e,t){return(e._flags&t)===t}function zd(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(Ze.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 Kr(this,Wi.CULL)},set:function(e){Kr(this,Wi.CULL)!==e&&(zd(this,Wi.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Kr(this,Wi.OCCLUDE)},set:function(e){Kr(this,Wi.OCCLUDE)!==e&&(zd(this,Wi.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 Kr(this,Wi.CAST_SHADOWS)},set:function(e){Kr(this,Wi.CAST_SHADOWS)!==e&&(zd(this,Wi.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return Kr(this,Wi.RECEIVE_SHADOWS)},set:function(e){Kr(this,Wi.RECEIVE_SHADOWS)!==e&&(zd(this,Wi.RECEIVE_SHADOWS,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 Kr(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){Kr(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(zd(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM,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 Kr(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){Kr(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(zd(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME,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 Kr(this,Wi.PICK_ONLY)},set:function(e){Kr(this,Wi.PICK_ONLY)!==e&&(zd(this,Wi.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Kr(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){Kr(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(zd(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});Ze.shallowClone=function(e,t){if(!!c(e))return c(t)||(t=new Ze),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,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._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t};Ze.prototype.execute=function(e,t){e.draw(this,t)};const Cn={UNSIGNED_BYTE:J.UNSIGNED_BYTE,UNSIGNED_SHORT:J.UNSIGNED_SHORT,UNSIGNED_INT:J.UNSIGNED_INT,FLOAT:J.FLOAT,HALF_FLOAT:J.HALF_FLOAT_OES,UNSIGNED_INT_24_8:J.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:J.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:J.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:J.UNSIGNED_SHORT_5_6_5};Cn.toWebGLConstant=function(e,t){switch(e){case Cn.UNSIGNED_BYTE:return J.UNSIGNED_BYTE;case Cn.UNSIGNED_SHORT:return J.UNSIGNED_SHORT;case Cn.UNSIGNED_INT:return J.UNSIGNED_INT;case Cn.FLOAT:return J.FLOAT;case Cn.HALF_FLOAT:return t.webgl2?J.HALF_FLOAT:J.HALF_FLOAT_OES;case Cn.UNSIGNED_INT_24_8:return J.UNSIGNED_INT_24_8;case Cn.UNSIGNED_SHORT_4_4_4_4:return J.UNSIGNED_SHORT_4_4_4_4;case Cn.UNSIGNED_SHORT_5_5_5_1:return J.UNSIGNED_SHORT_5_5_5_1;case Cn.UNSIGNED_SHORT_5_6_5:return Cn.UNSIGNED_SHORT_5_6_5}};Cn.isPacked=function(e){return e===Cn.UNSIGNED_INT_24_8||e===Cn.UNSIGNED_SHORT_4_4_4_4||e===Cn.UNSIGNED_SHORT_5_5_5_1||e===Cn.UNSIGNED_SHORT_5_6_5};Cn.sizeInBytes=function(e){switch(e){case Cn.UNSIGNED_BYTE:return 1;case Cn.UNSIGNED_SHORT:case Cn.UNSIGNED_SHORT_4_4_4_4:case Cn.UNSIGNED_SHORT_5_5_5_1:case Cn.UNSIGNED_SHORT_5_6_5:case Cn.HALF_FLOAT:return 2;case Cn.UNSIGNED_INT:case Cn.FLOAT:case Cn.UNSIGNED_INT_24_8:return 4}};Cn.validate=function(e){return e===Cn.UNSIGNED_BYTE||e===Cn.UNSIGNED_SHORT||e===Cn.UNSIGNED_INT||e===Cn.FLOAT||e===Cn.HALF_FLOAT||e===Cn.UNSIGNED_INT_24_8||e===Cn.UNSIGNED_SHORT_4_4_4_4||e===Cn.UNSIGNED_SHORT_5_5_5_1||e===Cn.UNSIGNED_SHORT_5_6_5};const Me=Object.freeze(Cn),Ne={DEPTH_COMPONENT:J.DEPTH_COMPONENT,DEPTH_STENCIL:J.DEPTH_STENCIL,ALPHA:J.ALPHA,RED:J.RED,RG:J.RG,RGB:J.RGB,RGBA:J.RGBA,LUMINANCE:J.LUMINANCE,LUMINANCE_ALPHA:J.LUMINANCE_ALPHA,RGB_DXT1:J.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:J.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:J.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:J.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:J.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:J.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:J.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:J.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:J.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:J.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:J.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:J.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:J.COMPRESSED_RGBA_BPTC_UNORM};Ne.componentsLength=function(e){switch(e){case Ne.RGB:return 3;case Ne.RGBA:return 4;case Ne.LUMINANCE_ALPHA:case Ne.RG:return 2;case Ne.ALPHA:case Ne.RED:case Ne.LUMINANCE:return 1;default:return 1}};Ne.validate=function(e){return e===Ne.DEPTH_COMPONENT||e===Ne.DEPTH_STENCIL||e===Ne.ALPHA||e===Ne.RED||e===Ne.RG||e===Ne.RGB||e===Ne.RGBA||e===Ne.LUMINANCE||e===Ne.LUMINANCE_ALPHA||e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5||e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1||e===Ne.RGBA_ASTC||e===Ne.RGB_ETC1||e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC||e===Ne.RGBA_BC7};Ne.isColorFormat=function(e){return e===Ne.RED||e===Ne.ALPHA||e===Ne.RGB||e===Ne.RGBA||e===Ne.LUMINANCE||e===Ne.LUMINANCE_ALPHA};Ne.isDepthFormat=function(e){return e===Ne.DEPTH_COMPONENT||e===Ne.DEPTH_STENCIL};Ne.isCompressedFormat=function(e){return e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5||e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1||e===Ne.RGBA_ASTC||e===Ne.RGB_ETC1||e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC||e===Ne.RGBA_BC7};Ne.isDXTFormat=function(e){return e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5};Ne.isPVRTCFormat=function(e){return e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1};Ne.isASTCFormat=function(e){return e===Ne.RGBA_ASTC};Ne.isETC1Format=function(e){return e===Ne.RGB_ETC1};Ne.isETC2Format=function(e){return e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC};Ne.isBC7Format=function(e){return e===Ne.RGBA_BC7};Ne.compressedTextureSizeInBytes=function(e,t,n){switch(e){case Ne.RGB_DXT1:case Ne.RGBA_DXT1:case Ne.RGB_ETC1:case Ne.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case Ne.RGBA_DXT3:case Ne.RGBA_DXT5:case Ne.RGBA_ASTC:case Ne.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case Ne.RGB_PVRTC_4BPPV1:case Ne.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case Ne.RGB_PVRTC_2BPPV1:case Ne.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case Ne.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};Ne.textureSizeInBytes=function(e,t,n,i){let o=Ne.componentsLength(e);return Me.isPacked(t)&&(o=1),o*Me.sizeInBytes(t)*n*i};Ne.alignmentInBytes=function(e,t,n){const i=Ne.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};Ne.createTypedArray=function(e,t,n,i){let o;const r=Me.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===Me.FLOAT?o=Float32Array:o=Uint32Array;const s=Ne.componentsLength(e)*n*i;return new o(s)};Ne.flipY=function(e,t,n,i,o){if(o===1)return e;const r=Ne.createTypedArray(t,n,i,o),s=Ne.componentsLength(t),a=i*s;for(let l=0;li)throw new E("The number of color attachments exceeds the number supported.");for(l=0;li)throw new E("The number of color attachments exceeds the number supported.");for(l=0;l=this._colorTextures.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]};ur.prototype.getColorRenderbuffer=function(e){if(!c(e)||e<0||e>=this._colorRenderbuffers.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]};ur.prototype.isDestroyed=function(){return!1};ur.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;ept.maximumAliasedLineWidth)throw new E("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!wc.validate(this.frontFace))throw new E("Invalid renderState.frontFace.");if(!D$(this.cull.face))throw new E("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new E("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new E("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new E("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new E("renderState.depthRange.far must be less than or equal to one.");if(!P$(this.depthTest.func))throw new E("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new E("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!jL(this.blending.equationRgb))throw new E("Invalid renderState.blending.equationRgb.");if(!jL(this.blending.equationAlpha))throw new E("Invalid renderState.blending.equationAlpha.");if(!kb(this.blending.functionSourceRgb))throw new E("Invalid renderState.blending.functionSourceRgb.");if(!kb(this.blending.functionSourceAlpha))throw new E("Invalid renderState.blending.functionSourceAlpha.");if(!kb(this.blending.functionDestinationRgb))throw new E("Invalid renderState.blending.functionDestinationRgb.");if(!kb(this.blending.functionDestinationAlpha))throw new E("Invalid renderState.blending.functionDestinationAlpha.");if(!WL(this.stencilTest.frontFunction))throw new E("Invalid renderState.stencilTest.frontFunction.");if(!WL(this.stencilTest.backFunction))throw new E("Invalid renderState.stencilTest.backFunction.");if(!sm(this.stencilTest.frontOperation.fail))throw new E("Invalid renderState.stencilTest.frontOperation.fail.");if(!sm(this.stencilTest.frontOperation.zFail))throw new E("Invalid renderState.stencilTest.frontOperation.zFail.");if(!sm(this.stencilTest.frontOperation.zPass))throw new E("Invalid renderState.stencilTest.frontOperation.zPass.");if(!sm(this.stencilTest.backOperation.fail))throw new E("Invalid renderState.stencilTest.backOperation.fail.");if(!sm(this.stencilTest.backOperation.zFail))throw new E("Invalid renderState.stencilTest.backOperation.zFail.");if(!sm(this.stencilTest.backOperation.zPass))throw new E("Invalid renderState.stencilTest.backOperation.zPass.");if(c(this.viewport)){if(this.viewport.width<0)throw new E("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new E("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>pt.maximumViewportWidth)throw new E(`renderState.viewport.width must be less than or equal to the maximum viewport width (${pt.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>pt.maximumViewportHeight)throw new E(`renderState.viewport.height must be less than or equal to the maximum viewport height (${pt.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let O$=0,Ql={};Ue.fromCache=function(e){const t=JSON.stringify(e);let n=Ql[t];if(c(n))return++n.referenceCount,n.state;let i=new Ue(e);const o=JSON.stringify(i);return n=Ql[o],c(n)||(i.id=O$++,i=NU(i),n={referenceCount:0,state:i},Ql[o]=n),++n.referenceCount,Ql[t]={referenceCount:1,state:n.state},n.state};Ue.removeFromCache=function(e){const t=new Ue(e),n=JSON.stringify(t),i=Ql[n],o=JSON.stringify(e),r=Ql[o];c(r)&&(--r.referenceCount,r.referenceCount===0&&(delete Ql[o],c(i)&&--i.referenceCount)),c(i)&&i.referenceCount===0&&delete Ql[n]};Ue.getCache=function(){return Ql};Ue.clearCache=function(){Ql={}};function Pp(e,t,n){n?e.enable(t):e.disable(t)}function MU(e,t){e.frontFace(t.frontFace)}function FU(e,t){const n=t.cull,i=n.enabled;Pp(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function BU(e,t){e.lineWidth(t.lineWidth)}function zU(e,t){const n=t.polygonOffset,i=n.enabled;Pp(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function UU(e,t,n){const i=t.scissorTest,o=c(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(Pp(e,e.SCISSOR_TEST,o),o){const r=c(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function kU(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function VU(e,t){const n=t.depthTest,i=n.enabled;Pp(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function HU(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function GU(e,t){e.depthMask(t.depthMask)}function jU(e,t){e.stencilMask(t.stencilMask)}function L$(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function WU(e,t,n){const i=t.blending,o=c(n.blendingEnabled)?n.blendingEnabled:i.enabled;Pp(e,e.BLEND,o),o&&(L$(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function qU(e,t){const n=t.stencilTest,i=n.enabled;if(Pp(e,e.STENCIL_TEST,i),i){const o=n.frontFunction,r=n.backFunction,s=n.reference,a=n.mask;e.stencilFunc(o,s,a),e.stencilFuncSeparate(e.BACK,r,s,a),e.stencilFuncSeparate(e.FRONT,o,s,a);const l=n.frontOperation,u=l.fail,h=l.zFail,f=l.zPass;e.stencilOpSeparate(e.FRONT,u,h,f);const _=n.backOperation,g=_.fail,m=_.zFail,b=_.zPass;e.stencilOpSeparate(e.BACK,g,m,b)}}function YU(e,t){const n=t.sampleCoverage,i=n.enabled;Pp(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}const R$=new Re;function $U(e,t,n){let i=y(t.viewport,n.viewport);c(i)||(i=R$,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)}Ue.apply=function(e,t,n){MU(e,t),FU(e,t),BU(e,t),zU(e,t),kU(e,t),VU(e,t),HU(e,t),GU(e,t),jU(e,t),qU(e,t),YU(e,t),UU(e,t,n),WU(e,t,n),$U(e,t,n)};function N$(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(MU),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(FU),e.lineWidth!==t.lineWidth&&n.push(BU),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(zU),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(kU),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(VU),(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(HU),e.depthMask!==t.depthMask&&n.push(GU),e.stencilMask!==t.stencilMask&&n.push(jU),(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(qU),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(YU),n}Ue.partialApply=function(e,t,n,i,o,r){if(t!==n){let h=n._applyFunctions[t.id];c(h)||(h=N$(t,n),n._applyFunctions[t.id]=h);const f=h.length;for(let _=0;_0&&console.log(`${Hl}Vertex shader compile log: ${l}`),l=e.getShaderInfoLog(r),c(l)&&l.length>0&&console.log(`${Hl}Fragment shader compile log: ${l}`),l=e.getProgramInfoLog(s),c(l)&&l.length>0&&console.log(`${Hl}Shader program link log: ${l}`)),e.deleteShader(o),e.deleteShader(r),s;let u;const h=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(l=e.getProgramInfoLog(s),console.error(`${Hl}Shader program link log: ${l}`),f(o,"vertex"),f(r,"fragment"),u=`Program failed to link. Link log: ${l}`):(l=e.getShaderInfoLog(o),console.error(`${Hl}Vertex shader compile log: ${l}`),console.error(`${Hl} Vertex shader source: ${n}`),u=`Vertex shader failed to compile. Compile log: ${l}`):(l=e.getShaderInfoLog(r),console.error(`${Hl}Fragment shader compile log: ${l}`),console.error(`${Hl} Fragment shader source: ${i}`),u=`Fragment shader failed to compile. Compile log: ${l}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new Te(u);function f(_,g){if(!c(h))return;const m=h.getTranslatedShaderSource(_);if(m===""){console.error(`${Hl}${g} shader translation failed.`);return}console.error(`${Hl}Translated ${g} shaderSource: ${m}`)}}function Y$(e,t,n){const i={};for(let o=0;o=0){if(h=n[u.slice(0,m)],!c(h))continue;f=h._locations,f.length<=1&&(_=h.value,g=e.getUniformLocation(t,u),g!==null&&(f.push(g),_.push(e.getUniform(t,g))))}else{f=[];for(let b=0;b4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.values))throw new E("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.values=e.values}function S_(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(S_.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}}});S_.clone=function(e){if(!!c(e))return new S_(e._format,e._datatype,e._width,e._height,e._buffer)};S_.prototype.clone=function(){return S_.clone(this)};function yk(){if(!c(Kn._canTransferArrayBuffer)){const e=DP("transferTypedArrayTest");e.postMessage=y(e.webkitPostMessage,e.postMessage);const t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return Kn._canTransferArrayBuffer=!1,Kn._canTransferArrayBuffer}Kn._canTransferArrayBuffer=new Promise(i=>{e.onmessage=function(o){const r=o.data.array,s=c(r)&&r[0]===t;i(s),e.terminate(),Kn._canTransferArrayBuffer=s}})}return Kn._canTransferArrayBuffer}const xI=new Le;function KE(e){let t;try{t=new Blob([e],{type:"application/javascript"})}catch{const o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,r=new o;r.append(e),t=r.getBlob("application/javascript")}return(window.URL||window.webkitURL).createObjectURL(t)}function DP(e){const t=new Ec(e),n=t.scheme().length!==0&&t.fragment().length===0,i={};let o;if(gU(e)){const s=`importScripts("${e}");`;return o=KE(s),new Worker(o,i)}const r=e.replace(/\.js$/,"");if(!n&&typeof CESIUM_WORKERS<"u"){const s=` importScripts("${KE(CESIUM_WORKERS)}"); CesiumWorkers["${r}"](); `;return o=KE(s),new Worker(o,i)}if(o=e,n||(o=Zt(`${Kn._workerModulePrefix+r}.js`)),!Yt.supportsEsmWebWorkers())throw new Te("This browser is not supported. Please update your browser to continue.");return i.type="module",new Worker(o,i)}async function hX(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Yt.supportsWebAssembly()){if(!c(t.fallbackModulePath))throw new Te(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=Zt(t.fallbackModulePath),n}n.wasmBinaryFile=Zt(t.wasmBinaryFile);const i=await Ae.fetchArrayBuffer({url:n.wasmBinaryFile});return n.wasmBinary=i,n}function Kn(e,t){this._workerPath=e,this._maximumActiveTasks=y(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}const fX=(e,t,n,i)=>{const o=({data:r})=>{if(r.id===t){if(c(r.error)){let s=r.error;s.name==="RuntimeError"?(s=new Te(r.error.message),s.stack=r.error.stack):s.name==="DeveloperError"?(s=new E(r.error.message),s.stack=r.error.stack):s.name==="Error"&&(s=new Error(r.error.message),s.stack=r.error.stack),xI.raiseEvent(s),i(s)}else xI.raiseEvent(),n(r.result);e.removeEventListener("message",o)}};return o},pX=[];async function mX(e,t,n){const i=await Promise.resolve(yk());c(n)?i||(n.length=0):n=pX;const o=e._nextID++,r=new Promise((s,a)=>{e._worker.addEventListener("message",fX(e._worker,o,s,a))});return e._worker.postMessage({id:o,baseUrl:Zt.getCesiumBaseUrl().url,parameters:t,canTransferArrayBuffer:i},n),r}async function _X(e,t,n){++e._activeTasks;try{const i=await mX(e,t,n);return--e._activeTasks,i}catch(i){throw--e._activeTasks,i}}Kn.prototype.scheduleTask=function(e,t){if(c(this._worker)||(this._worker=DP(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return _X(this,e,t)};Kn.prototype.initWebAssemblyModule=async function(e){if(c(this._webAssemblyPromise))return this._webAssemblyPromise;const t=async()=>{const n=this._worker=DP(this._workerPath),i=await hX(this,e),o=await Promise.resolve(yk());let r;const s=i.wasmBinary;c(s)&&o&&(r=[s]);const a=new Promise((l,u)=>{n.onmessage=function({data:h}){c(h)?l(h.result):u(new Te("Could not configure wasm module"))}});return n.postMessage({canTransferArrayBuffer:o,parameters:{webAssemblyConfig:i}},r),a};return this._webAssemblyPromise=t(),this._webAssemblyPromise};Kn.prototype.isDestroyed=function(){return!1};Kn.prototype.destroy=function(){return c(this._worker)&&this._worker.terminate(),ve(this)};Kn.taskCompletedEvent=xI;Kn._defaultWorkerModulePrefix="Workers/";Kn._workerModulePrefix=Kn._defaultWorkerModulePrefix;Kn._canTransferArrayBuffer=void 0;function Qu(){}Qu._transcodeTaskProcessor=new Kn("transcodeKTX2",Number.POSITIVE_INFINITY);Qu._readyPromise=void 0;function gX(){const e=Qu._transcodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(t){if(t)return Qu._transcodeTaskProcessor;throw new Te("KTX2 transcoder could not be initialized.")});Qu._readyPromise=e}Qu.transcode=function(e,t){return A.defined("supportedTargetFormats",t),c(Qu._readyPromise)||gX(),Qu._readyPromise.then(function(n){let i;if(e instanceof ArrayBuffer){const o=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:o},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])}).then(function(n){const i=n.length,o=Object.keys(n[0]),r=o.length;let s;for(s=0;sthis._size)throw new E("xOffset + options.source.width must be less than or equal to width.");if(n+e.source.height>this._size)throw new E("yOffset + options.source.height must be less than or equal to height.");const i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);const a=i.width,l=i.height;let u=i.arrayBufferView;const h=this._size,f=this._pixelFormat,_=this._internalFormat,g=this._pixelDatatype,m=this._preMultiplyAlpha,b=this._flipY,T=y(e.skipColorSpaceConversion,!1);let x=4;c(u)&&(x=Ve.alignmentInBytes(f,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,x),T?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(t===0&&n===0&&a===h&&l===h)c(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=Ve.flipY(u,f,g,h,h)),o.texImage2D(s,0,_,h,h,0,f,Me.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,b),o.texImage2D(s,0,_,f,Me.toWebGLConstant(g,this._context),i)),C=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const w=Ve.createTypedArray(f,g,h,h);o.texImage2D(s,0,_,h,h,0,f,Me.toWebGLConstant(g,this._context),w)}this._initialized=!0}C||(c(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=Ve.flipY(u,f,g,a,l)),o.texSubImage2D(s,0,t,n,a,l,f,Me.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,b),o.texSubImage2D(s,0,t,n,f,Me.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};zu.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._size),r=y(r,this._size),A.typeOf.number.greaterThanOrEquals("xOffset",e,0),A.typeOf.number.greaterThanOrEquals("yOffset",t,0),A.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),A.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new E("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new E("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===Me.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Me.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(this._targetFace,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};const NA={DONT_CARE:J.DONT_CARE,FASTEST:J.FASTEST,NICEST:J.NICEST,validate:function(e){return e===NA.DONT_CARE||e===NA.FASTEST||e===NA.NICEST}},v_=Object.freeze(NA),MA={NEAREST:J.NEAREST,LINEAR:J.LINEAR};MA.validate=function(e){return e===MA.NEAREST||e===MA.LINEAR};const Yo=Object.freeze(MA),Jd={NEAREST:J.NEAREST,LINEAR:J.LINEAR,NEAREST_MIPMAP_NEAREST:J.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:J.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:J.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:J.LINEAR_MIPMAP_LINEAR};Jd.validate=function(e){return e===Jd.NEAREST||e===Jd.LINEAR||e===Jd.NEAREST_MIPMAP_NEAREST||e===Jd.LINEAR_MIPMAP_NEAREST||e===Jd.NEAREST_MIPMAP_LINEAR||e===Jd.LINEAR_MIPMAP_LINEAR};const en=Object.freeze(Jd),FA={CLAMP_TO_EDGE:J.CLAMP_TO_EDGE,REPEAT:J.REPEAT,MIRRORED_REPEAT:J.MIRRORED_REPEAT,validate:function(e){return e===FA.CLAMP_TO_EDGE||e===FA.REPEAT||e===FA.MIRRORED_REPEAT}},Fn=Object.freeze(FA);function un(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.wrapS,Fn.CLAMP_TO_EDGE),n=y(e.wrapT,Fn.CLAMP_TO_EDGE),i=y(e.minificationFilter,en.LINEAR),o=y(e.magnificationFilter,Yo.LINEAR),r=c(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!Fn.validate(t))throw new E("Invalid sampler.wrapS.");if(!Fn.validate(n))throw new E("Invalid sampler.wrapT.");if(!en.validate(i))throw new E("Invalid sampler.minificationFilter.");if(!Yo.validate(o))throw new E("Invalid sampler.magnificationFilter.");A.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(un.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}}});un.equals=function(e,t){return e===t||c(e)&&c(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};un.NEAREST=Object.freeze(new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST}));function Sl(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const t=e.context,n=e.source;let i,o;if(c(n)){const C=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];if(!C[0]||!C[1]||!C[2]||!C[3]||!C[4]||!C[5])throw new E("options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");i=C[0].width,o=C[0].height;for(let w=1;w<6;++w)if(Number(C[w].width)!==i||Number(C[w].height)!==o)throw new E("Each face in options.source must have the same width and height.")}else i=e.width,o=e.height;const r=i,s=y(e.pixelDatatype,Me.UNSIGNED_BYTE),a=y(e.pixelFormat,Ve.RGBA),l=Ve.toInternalFormat(a,s,t);if(!c(i)||!c(o))throw new E("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(i!==o)throw new E("Width must equal height.");if(r<=0)throw new E("Width and height must be greater than zero.");if(r>pt.maximumCubeMapSize)throw new E(`Width and height must be less than or equal to the maximum cube map size (${pt.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!Ve.validate(a))throw new E("Invalid options.pixelFormat.");if(Ve.isDepthFormat(a))throw new E("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!Me.validate(s))throw new E("Invalid options.pixelDatatype.");if(s===Me.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===Me.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");const u=Ve.textureSizeInBytes(a,s,r,r)*6,h=e.preMultiplyAlpha||a===Ve.RGB||a===Ve.LUMINANCE,f=y(e.flipY,!0),_=y(e.skipColorSpaceConversion,!1),g=t._gl,m=g.TEXTURE_CUBE_MAP,b=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,b);function T(C,w,v,P,N){let k=w.arrayBufferView;c(k)||(k=w.bufferView);let M=4;c(k)&&(M=Ve.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,M),N?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),c(k)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),P&&(k=Ve.flipY(k,a,s,r,r)),g.texImage2D(C,0,l,r,r,0,a,Me.toWebGLConstant(s,t),k)):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,P),g.texImage2D(C,0,l,a,Me.toWebGLConstant(s,t),w))}c(n)?(T(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,h,f,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,h,f,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,h,f,_)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null)),g.bindTexture(m,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=m,this._texture=b,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=u,this._preMultiplyAlpha=h,this._flipY=f,this._sampler=void 0;const x=c(n);this._positiveX=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_X,l,a,s,r,h,f,x),this._negativeX=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_X,l,a,s,r,h,f,x),this._positiveY=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_Y,l,a,s,r,h,f,x),this._negativeY=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,l,a,s,r,h,f,x),this._positiveZ=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_Z,l,a,s,r,h,f,x),this._negativeZ=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,l,a,s,r,h,f,x),this.sampler=c(e.sampler)?e.sampler:new un}Object.defineProperties(Sl.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===en.NEAREST_MIPMAP_NEAREST||t===en.NEAREST_MIPMAP_LINEAR||t===en.LINEAR_MIPMAP_NEAREST||t===en.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===Me.FLOAT&&!o.textureFloatLinear||r===Me.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?en.NEAREST_MIPMAP_NEAREST:en.NEAREST,n=Yo.NEAREST);const s=o._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.texParameteri(a,s.TEXTURE_MIN_FILTER,t),s.texParameteri(a,s.TEXTURE_MAG_FILTER,n),s.texParameteri(a,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(a,s.TEXTURE_WRAP_T,e.wrapT),c(this._textureFilterAnisotropic)&&s.texParameteri(a,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(a,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(this._sizeInBytes*4/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}});Sl.prototype.generateMipmap=function(e){if(e=y(e,v_.DONT_CARE),this._size>1&&!R.isPowerOfTwo(this._size))throw new E("width and height must be a power of two to call generateMipmap().");if(!v_.validate(e))throw new E("hint is invalid.");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)};Sl.prototype.isDestroyed=function(){return!1};Sl.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=ve(this._positiveX),this._negativeX=ve(this._negativeX),this._positiveY=ve(this._positiveY),this._negativeY=ve(this._negativeY),this._positiveZ=ve(this._positiveZ),this._negativeZ=ve(this._negativeZ),ve(this)};function Lp(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}const yX=`/** * A built-in GLSL floating-point constant for converting radians to degrees. * * @alias czm_degreesPerRadian * @glslConstant * * @see CesiumMath.DEGREES_PER_RADIAN * * @example * // GLSL declaration * const float czm_degreesPerRadian = ...; * * // Example * float deg = czm_degreesPerRadian * rad; */ const float czm_degreesPerRadian = 57.29577951308232; `,bX=`/** * A built-in GLSL vec2 constant for defining the depth range. * This is a workaround to a bug where IE11 does not implement gl_DepthRange. * * @alias czm_depthRange * @glslConstant * * @example * // GLSL declaration * float depthRangeNear = czm_depthRange.near; * float depthRangeFar = czm_depthRange.far; * */ const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0); `,TX=`/** * 0.1 * * @name czm_epsilon1 * @glslConstant */ const float czm_epsilon1 = 0.1; `,AX=`/** * 0.01 * * @name czm_epsilon2 * @glslConstant */ const float czm_epsilon2 = 0.01; `,xX=`/** * 0.001 * * @name czm_epsilon3 * @glslConstant */ const float czm_epsilon3 = 0.001; `,CX=`/** * 0.0001 * * @name czm_epsilon4 * @glslConstant */ const float czm_epsilon4 = 0.0001; `,EX=`/** * 0.00001 * * @name czm_epsilon5 * @glslConstant */ const float czm_epsilon5 = 0.00001; `,wX=`/** * 0.000001 * * @name czm_epsilon6 * @glslConstant */ const float czm_epsilon6 = 0.000001; `,SX=`/** * 0.0000001 * * @name czm_epsilon7 * @glslConstant */ const float czm_epsilon7 = 0.0000001; `,vX=`/** * DOC_TBA * * @name czm_infinity * @glslConstant */ const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp? `,IX=`/** * A built-in GLSL floating-point constant for 1/pi. * * @alias czm_oneOverPi * @glslConstant * * @see CesiumMath.ONE_OVER_PI * * @example * // GLSL declaration * const float czm_oneOverPi = ...; * * // Example * float pi = 1.0 / czm_oneOverPi; */ const float czm_oneOverPi = 0.3183098861837907; `,DX=`/** * A built-in GLSL floating-point constant for 1/2pi. * * @alias czm_oneOverTwoPi * @glslConstant * * @see CesiumMath.ONE_OVER_TWO_PI * * @example * // GLSL declaration * const float czm_oneOverTwoPi = ...; * * // Example * float pi = 2.0 * czm_oneOverTwoPi; */ const float czm_oneOverTwoPi = 0.15915494309189535; `,PX=`/** * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE} * * @name czm_passCesium3DTile * @glslConstant * * @see czm_pass */ const float czm_passCesium3DTile = 4.0; `,OX=`/** * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION} * * @name czm_passCesium3DTileClassification * @glslConstant * * @see czm_pass */ const float czm_passCesium3DTileClassification = 5.0; `,LX=`/** * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW} * * @name czm_passCesium3DTileClassificationIgnoreShow * @glslConstant * * @see czm_pass */ const float czm_passCesium3DTileClassificationIgnoreShow = 6.0; `,RX=`/** * The automatic GLSL constant for {@link Pass#CLASSIFICATION} * * @name czm_passClassification * @glslConstant * * @see czm_pass */ const float czm_passClassification = 7.0; `,NX=`/** * The automatic GLSL constant for {@link Pass#COMPUTE} * * @name czm_passCompute * @glslConstant * * @see czm_pass */ const float czm_passCompute = 1.0; `,MX=`/** * The automatic GLSL constant for {@link Pass#ENVIRONMENT} * * @name czm_passEnvironment * @glslConstant * * @see czm_pass */ const float czm_passEnvironment = 0.0; `,FX=`/** * The automatic GLSL constant for {@link Pass#GLOBE} * * @name czm_passGlobe * @glslConstant * * @see czm_pass */ const float czm_passGlobe = 2.0; `,BX=`/** * The automatic GLSL constant for {@link Pass#OPAQUE} * * @name czm_passOpaque * @glslConstant * * @see czm_pass */ const float czm_passOpaque = 7.0; `,zX=`/** * The automatic GLSL constant for {@link Pass#OVERLAY} * * @name czm_passOverlay * @glslConstant * * @see czm_pass */ const float czm_passOverlay = 10.0; `,UX=`/** * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION} * * @name czm_passTerrainClassification * @glslConstant * * @see czm_pass */ const float czm_passTerrainClassification = 3.0; `,kX=`/** * The automatic GLSL constant for {@link Pass#TRANSLUCENT} * * @name czm_passTranslucent * @glslConstant * * @see czm_pass */ const float czm_passTranslucent = 8.0; `,VX=`/** * The automatic GLSL constant for {@link Pass#VOXELS} * * @name czm_passVoxels * @glslConstant * * @see czm_pass */ const float czm_passVoxels = 9.0; `,HX=`/** * A built-in GLSL floating-point constant for Math.PI. * * @alias czm_pi * @glslConstant * * @see CesiumMath.PI * * @example * // GLSL declaration * const float czm_pi = ...; * * // Example * float twoPi = 2.0 * czm_pi; */ const float czm_pi = 3.141592653589793; `,GX=`/** * A built-in GLSL floating-point constant for pi/4. * * @alias czm_piOverFour * @glslConstant * * @see CesiumMath.PI_OVER_FOUR * * @example * // GLSL declaration * const float czm_piOverFour = ...; * * // Example * float pi = 4.0 * czm_piOverFour; */ const float czm_piOverFour = 0.7853981633974483; `,jX=`/** * A built-in GLSL floating-point constant for pi/6. * * @alias czm_piOverSix * @glslConstant * * @see CesiumMath.PI_OVER_SIX * * @example * // GLSL declaration * const float czm_piOverSix = ...; * * // Example * float pi = 6.0 * czm_piOverSix; */ const float czm_piOverSix = 0.5235987755982988; `,WX=`/** * A built-in GLSL floating-point constant for pi/3. * * @alias czm_piOverThree * @glslConstant * * @see CesiumMath.PI_OVER_THREE * * @example * // GLSL declaration * const float czm_piOverThree = ...; * * // Example * float pi = 3.0 * czm_piOverThree; */ const float czm_piOverThree = 1.0471975511965976; `,qX=`/** * A built-in GLSL floating-point constant for pi/2. * * @alias czm_piOverTwo * @glslConstant * * @see CesiumMath.PI_OVER_TWO * * @example * // GLSL declaration * const float czm_piOverTwo = ...; * * // Example * float pi = 2.0 * czm_piOverTwo; */ const float czm_piOverTwo = 1.5707963267948966; `,YX=`/** * A built-in GLSL floating-point constant for converting degrees to radians. * * @alias czm_radiansPerDegree * @glslConstant * * @see CesiumMath.RADIANS_PER_DEGREE * * @example * // GLSL declaration * const float czm_radiansPerDegree = ...; * * // Example * float rad = czm_radiansPerDegree * deg; */ const float czm_radiansPerDegree = 0.017453292519943295; `,$X=`/** * The constant identifier for the 2D {@link SceneMode} * * @name czm_sceneMode2D * @glslConstant * @see czm_sceneMode * @see czm_sceneModeColumbusView * @see czm_sceneMode3D * @see czm_sceneModeMorphing */ const float czm_sceneMode2D = 2.0; `,XX=`/** * The constant identifier for the 3D {@link SceneMode} * * @name czm_sceneMode3D * @glslConstant * @see czm_sceneMode * @see czm_sceneMode2D * @see czm_sceneModeColumbusView * @see czm_sceneModeMorphing */ const float czm_sceneMode3D = 3.0; `,QX=`/** * The constant identifier for the Columbus View {@link SceneMode} * * @name czm_sceneModeColumbusView * @glslConstant * @see czm_sceneMode * @see czm_sceneMode2D * @see czm_sceneMode3D * @see czm_sceneModeMorphing */ const float czm_sceneModeColumbusView = 1.0; `,KX=`/** * The constant identifier for the Morphing {@link SceneMode} * * @name czm_sceneModeMorphing * @glslConstant * @see czm_sceneMode * @see czm_sceneMode2D * @see czm_sceneModeColumbusView * @see czm_sceneMode3D */ const float czm_sceneModeMorphing = 0.0; `,ZX=`/** * A built-in GLSL floating-point constant for one solar radius. * * @alias czm_solarRadius * @glslConstant * * @see CesiumMath.SOLAR_RADIUS * * @example * // GLSL declaration * const float czm_solarRadius = ...; */ const float czm_solarRadius = 695500000.0; `,JX=`/** * A built-in GLSL floating-point constant for 3pi/2. * * @alias czm_threePiOver2 * @glslConstant * * @see CesiumMath.THREE_PI_OVER_TWO * * @example * // GLSL declaration * const float czm_threePiOver2 = ...; * * // Example * float pi = (2.0 / 3.0) * czm_threePiOver2; */ const float czm_threePiOver2 = 4.71238898038469; `,eQ=`/** * A built-in GLSL floating-point constant for 2pi. * * @alias czm_twoPi * @glslConstant * * @see CesiumMath.TWO_PI * * @example * // GLSL declaration * const float czm_twoPi = ...; * * // Example * float pi = czm_twoPi / 2.0; */ const float czm_twoPi = 6.283185307179586; `,tQ=`/** * The maximum latitude, in radians, both North and South, supported by a Web Mercator * (EPSG:3857) projection. Technically, the Mercator projection is defined * for any latitude up to (but not including) 90 degrees, but it makes sense * to cut it off sooner because it grows exponentially with increasing latitude. * The logic behind this particular cutoff value, which is the one used by * Google Maps, Bing Maps, and Esri, is that it makes the projection * square. That is, the rectangle is equal in the X and Y directions. * * The constant value is computed as follows: * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi))) * * @name czm_webMercatorMaxLatitude * @glslConstant */ const float czm_webMercatorMaxLatitude = 1.4844222297453324; `,nQ=`/** * @name czm_depthRangeStruct * @glslStruct */ struct czm_depthRangeStruct { float near; float far; }; `,iQ=`/** * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions. * * @name czm_material * @glslStruct * * @property {vec3} diffuse Incoming light that scatters evenly in all directions. * @property {float} specular Intensity of incoming light reflecting in a single direction. * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight. * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal. * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light. * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque. */ struct czm_material { vec3 diffuse; float specular; float shininess; vec3 normal; vec3 emission; float alpha; }; `,oQ=`/** * Used as input to every material's czm_getMaterial function. * * @name czm_materialInput * @glslStruct * * @property {float} s 1D texture coordinates. * @property {vec2} st 2D texture coordinates. * @property {vec3} str 3D texture coordinates. * @property {vec3} normalEC Unperturbed surface normal in eye coordinates. * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space. * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye. * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials. * @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials. * @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials. */ struct czm_materialInput { float s; vec2 st; vec3 str; vec3 normalEC; mat3 tangentToEyeMatrix; vec3 positionToEyeEC; float height; float slope; float aspect; }; `,rQ=`/** * Struct for representing a material for a {@link Model}. The model * rendering pipeline will pass this struct between material, custom shaders, * and lighting stages. This is not to be confused with {@link czm_material} * which is used by the older Fabric materials system, although they are similar. *

* All color values (diffuse, specular, emissive) are in linear color space. *

* * @name czm_modelMaterial * @glslStruct * * @property {vec3} diffuse Incoming light that scatters evenly in all directions. * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque. * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature. * @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces. * @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal. * @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded. * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light. */ struct czm_modelMaterial { vec3 diffuse; float alpha; vec3 specular; float roughness; vec3 normalEC; float occlusion; vec3 emissive; }; `,sQ=`/** * Struct for representing the output of a custom vertex shader. * * @name czm_modelVertexOutput * @glslStruct * * @see {@link CustomShader} * @see {@link Model} * * @property {vec3} positionMC The position of the vertex in model coordinates * @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives. */ struct czm_modelVertexOutput { vec3 positionMC; float pointSize; }; `,aQ=`/** * Parameters for {@link czm_pbrLighting} * * @name czm_material * @glslStruct * * @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation * @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is. * @property {vec3} f0 The reflectance of the material at normal incidence */ struct czm_pbrParameters { vec3 diffuseColor; float roughness; vec3 f0; }; `,cQ=`/** * DOC_TBA * * @name czm_ray * @glslStruct */ struct czm_ray { vec3 origin; vec3 direction; }; `,lQ=`/** * DOC_TBA * * @name czm_raySegment * @glslStruct */ struct czm_raySegment { float start; float stop; }; /** * DOC_TBA * * @name czm_emptyRaySegment * @glslConstant */ const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity); /** * DOC_TBA * * @name czm_fullRaySegment * @glslConstant */ const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity); `,uQ=`struct czm_shadowParameters { #ifdef USE_CUBE_MAP_SHADOW vec3 texCoords; #else vec2 texCoords; #endif float depthBias; float depth; float nDotL; vec2 texelStepSize; float normalShadingSmooth; float darkness; }; `,dQ=`/** * Converts an HSB color (hue, saturation, brightness) to RGB * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl} * * @name czm_HSBToRGB * @glslFunction * * @param {vec3} hsb The color in HSB. * * @returns {vec3} The color in RGB. * * @example * vec3 hsb = czm_RGBToHSB(rgb); * hsb.z *= 0.1; * rgb = czm_HSBToRGB(hsb); */ const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 czm_HSBToRGB(vec3 hsb) { vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www); return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y); } `,hQ=`/** * Converts an HSL color (hue, saturation, lightness) to RGB * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html} * * @name czm_HSLToRGB * @glslFunction * * @param {vec3} rgb The color in HSL. * * @returns {vec3} The color in RGB. * * @example * vec3 hsl = czm_RGBToHSL(rgb); * hsl.z *= 0.1; * rgb = czm_HSLToRGB(hsl); */ vec3 hueToRGB(float hue) { float r = abs(hue * 6.0 - 3.0) - 1.0; float g = 2.0 - abs(hue * 6.0 - 2.0); float b = 2.0 - abs(hue * 6.0 - 4.0); return clamp(vec3(r, g, b), 0.0, 1.0); } vec3 czm_HSLToRGB(vec3 hsl) { vec3 rgb = hueToRGB(hsl.x); float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y; return (rgb - 0.5) * c + hsl.z; } `,fQ=`/** * Converts an RGB color to HSB (hue, saturation, brightness) * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl} * * @name czm_RGBToHSB * @glslFunction * * @param {vec3} rgb The color in RGB. * * @returns {vec3} The color in HSB. * * @example * vec3 hsb = czm_RGBToHSB(rgb); * hsb.z *= 0.1; * rgb = czm_HSBToRGB(hsb); */ const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec3 czm_RGBToHSB(vec3 rgb) { vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g)); vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r)); float d = q.x - min(q.w, q.y); return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x); } `,pQ=`/** * Converts an RGB color to HSL (hue, saturation, lightness) * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html} * * @name czm_RGBToHSL * @glslFunction * * @param {vec3} rgb The color in RGB. * * @returns {vec3} The color in HSL. * * @example * vec3 hsl = czm_RGBToHSL(rgb); * hsl.z *= 0.1; * rgb = czm_HSLToRGB(hsl); */ vec3 RGBtoHCV(vec3 rgb) { // Based on work by Sam Hocevar and Emil Persson vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0); vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx); float c = q.x - min(q.w, q.y); float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z); return vec3(h, c, q.x); } vec3 czm_RGBToHSL(vec3 rgb) { vec3 hcv = RGBtoHCV(rgb); float l = hcv.z - hcv.y * 0.5; float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7); return vec3(hcv.x, s, l); } `,mQ=`/** * Converts an RGB color to CIE Yxy. *

The conversion is described in * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform} *

* * @name czm_RGBToXYZ * @glslFunction * * @param {vec3} rgb The color in RGB. * * @returns {vec3} The color in CIE Yxy. * * @example * vec3 xyz = czm_RGBToXYZ(rgb); * xyz.x = max(xyz.x - luminanceThreshold, 0.0); * rgb = czm_XYZToRGB(xyz); */ vec3 czm_RGBToXYZ(vec3 rgb) { const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193, 0.3576, 0.7152, 0.1192, 0.1805, 0.0722, 0.9505); vec3 xyz = RGB2XYZ * rgb; vec3 Yxy; Yxy.r = xyz.g; float temp = dot(vec3(1.0), xyz); Yxy.gb = xyz.rg / temp; return Yxy; } `,_Q=`/** * Converts a CIE Yxy color to RGB. *

The conversion is described in * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform} *

* * @name czm_XYZToRGB * @glslFunction * * @param {vec3} Yxy The color in CIE Yxy. * * @returns {vec3} The color in RGB. * * @example * vec3 xyz = czm_RGBToXYZ(rgb); * xyz.x = max(xyz.x - luminanceThreshold, 0.0); * rgb = czm_XYZToRGB(xyz); */ vec3 czm_XYZToRGB(vec3 Yxy) { const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556, -1.5371, 1.8760, -0.2040, -0.4985, 0.0416, 1.0572); vec3 xyz; xyz.r = Yxy.r * Yxy.g / Yxy.b; xyz.g = Yxy.r; xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b; return XYZ2RGB * xyz; } `,gQ=`// See: // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ vec3 czm_acesTonemapping(vec3 color) { float g = 0.985; float a = 0.065; float b = 0.0001; float c = 0.433; float d = 0.238; color = (color * (color + a) - b) / (color * (g * color + c) + d); color = clamp(color, 0.0, 1.0); return color; } `,yQ=`/** * @private */ float czm_alphaWeight(float a) { float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2]; // See Weighted Blended Order-Independent Transparency for examples of different weighting functions: // http://jcgt.org/published/0002/02/09/ return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0)))); } `,bQ=`/** * Procedural anti-aliasing by blurring two colors that meet at a sharp edge. * * @name czm_antialias * @glslFunction * * @param {vec4} color1 The color on one side of the edge. * @param {vec4} color2 The color on the other side of the edge. * @param {vec4} currentcolor The current color, either color1 or color2. * @param {float} dist The distance to the edge in texture coordinates. * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors. * @returns {vec4} The anti-aliased color. * * @example * // GLSL declarations * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor); * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist); * * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space * float dist = abs(textureCoordinates.t - 0.5); * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t)); * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1); */ vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor) { float val1 = clamp(dist / fuzzFactor, 0.0, 1.0); float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0); val1 = val1 * (1.0 - val2); val1 = val1 * val1 * (3.0 - (2.0 * val1)); val1 = pow(val1, 0.5); //makes the transition nicer vec4 midColor = (color1 + color2) * 0.5; return mix(midColor, currentColor, val1); } vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist) { return czm_antialias(color1, color2, currentColor, dist, 0.1); } `,TQ=`/** * Apply a HSB color shift to an RGB color. * * @param {vec3} rgb The color in RGB space. * @param {vec3} hsbShift The amount to shift each component. The xyz components correspond to hue, saturation, and brightness. Shifting the hue by +/- 1.0 corresponds to shifting the hue by a full cycle. Saturation and brightness are clamped between 0 and 1 after the adjustment * @param {bool} ignoreBlackPixels If true, black pixels will be unchanged. This is necessary in some shaders such as atmosphere-related effects. * * @return {vec3} The RGB color after shifting in HSB space and clamping saturation and brightness to a valid range. */ vec3 czm_applyHSBShift(vec3 rgb, vec3 hsbShift, bool ignoreBlackPixels) { // Convert rgb color to hsb vec3 hsb = czm_RGBToHSB(rgb); // Perform hsb shift // Hue cycles around so no clamp is needed. hsb.x += hsbShift.x; // hue hsb.y = clamp(hsb.y + hsbShift.y, 0.0, 1.0); // saturation // brightness // // Some shaders such as atmosphere-related effects need to leave black // pixels unchanged if (ignoreBlackPixels) { hsb.z = hsb.z > czm_epsilon7 ? hsb.z + hsbShift.z : 0.0; } else { hsb.z = hsb.z + hsbShift.z; } hsb.z = clamp(hsb.z, 0.0, 1.0); // Convert shifted hsb back to rgb return czm_HSBToRGB(hsb); } `,AQ=`/** * Approximately computes spherical coordinates given a normal. * Uses approximate inverse trigonometry for speed and consistency, * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU. * * @name czm_approximateSphericalCoordinates * @glslFunction * * @param {vec3} normal arbitrary-length normal. * * @returns {vec2} Approximate latitude and longitude spherical coordinates. */ vec2 czm_approximateSphericalCoordinates(vec3 normal) { // Project into plane with vertical for latitude float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z); float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y); return vec2(latitudeApproximation, longitudeApproximation); } `,xQ=`/** * Compute a rational approximation to tanh(x) * * @param {float} x A real number input * @returns {float} An approximation for tanh(x) */ float czm_approximateTanh(float x) { float x2 = x * x; return max(-1.0, min(1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2))); } `,CQ=`/** * Determines if the fragment is back facing * * @name czm_backFacing * @glslFunction * * @returns {bool} true if the fragment is back facing; otherwise, false. */ bool czm_backFacing() { // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494. return gl_FrontFacing == false; } `,EQ=`/** * Branchless ternary operator to be used when it's inexpensive to explicitly * evaluate both possibilities for a float expression. * * @name czm_branchFreeTernary * @glslFunction * * @param {bool} comparison A comparison statement * @param {float} a Value to return if the comparison is true. * @param {float} b Value to return if the comparison is false. * * @returns {float} equivalent of comparison ? a : b */ float czm_branchFreeTernary(bool comparison, float a, float b) { float useA = float(comparison); return a * useA + b * (1.0 - useA); } /** * Branchless ternary operator to be used when it's inexpensive to explicitly * evaluate both possibilities for a vec2 expression. * * @name czm_branchFreeTernary * @glslFunction * * @param {bool} comparison A comparison statement * @param {vec2} a Value to return if the comparison is true. * @param {vec2} b Value to return if the comparison is false. * * @returns {vec2} equivalent of comparison ? a : b */ vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) { float useA = float(comparison); return a * useA + b * (1.0 - useA); } /** * Branchless ternary operator to be used when it's inexpensive to explicitly * evaluate both possibilities for a vec3 expression. * * @name czm_branchFreeTernary * @glslFunction * * @param {bool} comparison A comparison statement * @param {vec3} a Value to return if the comparison is true. * @param {vec3} b Value to return if the comparison is false. * * @returns {vec3} equivalent of comparison ? a : b */ vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) { float useA = float(comparison); return a * useA + b * (1.0 - useA); } /** * Branchless ternary operator to be used when it's inexpensive to explicitly * evaluate both possibilities for a vec4 expression. * * @name czm_branchFreeTernary * @glslFunction * * @param {bool} comparison A comparison statement * @param {vec3} a Value to return if the comparison is true. * @param {vec3} b Value to return if the comparison is false. * * @returns {vec3} equivalent of comparison ? a : b */ vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) { float useA = float(comparison); return a * useA + b * (1.0 - useA); } `,wQ=` vec4 czm_cascadeColor(vec4 weights) { return vec4(1.0, 0.0, 0.0, 1.0) * weights.x + vec4(0.0, 1.0, 0.0, 1.0) * weights.y + vec4(0.0, 0.0, 1.0, 1.0) * weights.z + vec4(1.0, 0.0, 1.0, 1.0) * weights.w; } `,SQ=` uniform vec4 shadowMap_cascadeDistances; float czm_cascadeDistance(vec4 weights) { return dot(shadowMap_cascadeDistances, weights); } `,vQ=` uniform mat4 shadowMap_cascadeMatrices[4]; mat4 czm_cascadeMatrix(vec4 weights) { return shadowMap_cascadeMatrices[0] * weights.x + shadowMap_cascadeMatrices[1] * weights.y + shadowMap_cascadeMatrices[2] * weights.z + shadowMap_cascadeMatrices[3] * weights.w; } `,IQ=` uniform vec4 shadowMap_cascadeSplits[2]; vec4 czm_cascadeWeights(float depthEye) { // One component is set to 1.0 and all others set to 0.0. vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye)); vec4 far = step(depthEye, shadowMap_cascadeSplits[1]); return near * far; } `,DQ=`float getSignedDistance(vec2 uv, highp sampler2D clippingDistance) { float signedDistance = texture(clippingDistance, uv).r; return (signedDistance - 0.5) * 2.0; } void czm_clipPolygons(highp sampler2D clippingDistance, int extentsLength, vec2 clippingPosition, int regionIndex) { // Position is completely outside of polygons bounds vec2 rectUv = clippingPosition; if (regionIndex < 0 || rectUv.x <= 0.0 || rectUv.y <= 0.0 || rectUv.x >= 1.0 || rectUv.y >= 1.0) { #ifdef CLIPPING_INVERSE discard; #endif return; } vec2 clippingDistanceTextureDimensions = vec2(textureSize(clippingDistance, 0)); vec2 sampleOffset = max(1.0 / clippingDistanceTextureDimensions, vec2(0.005)); float dimension = float(extentsLength); if (extentsLength > 2) { dimension = ceil(log2(float(extentsLength))); } vec2 textureOffset = vec2(mod(float(regionIndex), dimension), floor(float(regionIndex) / dimension)) / dimension; vec2 uv = textureOffset + rectUv / dimension; float signedDistance = getSignedDistance(uv, clippingDistance); #ifdef CLIPPING_INVERSE if (signedDistance > 0.0) { discard; } #else if (signedDistance < 0.0) { discard; } #endif } `,PQ=`/** * DOC_TBA * * @name czm_columbusViewMorph * @glslFunction */ vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time) { // Just linear for now. vec3 p = mix(position2D.xyz, position3D.xyz, time); return vec4(p, 1.0); } `,OQ=`/** * Compute the atmosphere color, applying Rayleigh and Mie scattering. This * builtin uses automatic uniforms so the atmophere settings are synced with the * state of the Scene, even in other contexts like Model. * * @name czm_computeAtmosphereColor * @glslFunction * * @param {vec3} positionWC Position of the fragment in world coords (low precision) * @param {vec3} lightDirection Light direction from the sun or other light source. * @param {vec3} rayleighColor The Rayleigh scattering color computed by a scattering function * @param {vec3} mieColor The Mie scattering color computed by a scattering function * @param {float} opacity The opacity computed by a scattering function. */ vec4 czm_computeAtmosphereColor( vec3 positionWC, vec3 lightDirection, vec3 rayleighColor, vec3 mieColor, float opacity ) { // Setup the primary ray: from the camera position to the vertex position. vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC; vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC); float cosAngle = dot(cameraToPositionWCDirection, lightDirection); float cosAngleSq = cosAngle * cosAngle; float G = czm_atmosphereMieAnisotropy; float GSq = G * G; // The Rayleigh phase function. float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq); // The Mie phase function. float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq)); // The final color is generated by combining the effects of the Rayleigh and Mie scattering. vec3 rayleigh = rayleighPhase * rayleighColor; vec3 mie = miePhase * mieColor; vec3 color = (rayleigh + mie) * czm_atmosphereLightIntensity; return vec4(color, opacity); } `,LQ=`/** * Compute atmosphere scattering for the ground atmosphere and fog. This method * uses automatic uniforms so it is always synced with the scene settings. * * @name czm_computeGroundAtmosphereScattering * @glslfunction * * @param {vec3} positionWC The position of the fragment in world coordinates. * @param {vec3} lightDirection The direction of the light to calculate the scattering from. * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to. * @param {vec3} mieColor The variable the Mie scattering will be written to. * @param {float} opacity The variable the transmittance will be written to. */ void czm_computeGroundAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) { vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC; vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC); czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection); float atmosphereInnerRadius = length(positionWC); czm_computeScattering( primaryRay, length(cameraToPositionWC), lightDirection, atmosphereInnerRadius, rayleighColor, mieColor, opacity ); } `,RQ=`/** * Returns a position in model coordinates relative to eye taking into * account the current scene mode: 3D, 2D, or Columbus view. *

* This uses standard position attributes, position3DHigh, * position3DLow, position2DHigh, and position2DLow, * and should be used when writing a vertex shader for an {@link Appearance}. *

* * @name czm_computePosition * @glslFunction * * @returns {vec4} The position relative to eye. * * @example * vec4 p = czm_computePosition(); * v_positionEC = (czm_modelViewRelativeToEye * p).xyz; * gl_Position = czm_modelViewProjectionRelativeToEye * p; * * @see czm_translateRelativeToEye */ vec4 czm_computePosition(); `,NQ=`/** * This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as * the transmittance value for the ray. This function uses automatic uniforms * so the atmosphere settings are always synced with the current scene. * * @name czm_computeScattering * @glslfunction * * @param {czm_ray} primaryRay The ray from the camera to the position. * @param {float} primaryRayLength The length of the primary ray. * @param {vec3} lightDirection The direction of the light to calculate the scattering from. * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to. * @param {vec3} mieColor The variable the Mie scattering will be written to. * @param {float} opacity The variable the transmittance will be written to. */ void czm_computeScattering( czm_ray primaryRay, float primaryRayLength, vec3 lightDirection, float atmosphereInnerRadius, out vec3 rayleighColor, out vec3 mieColor, out float opacity ) { const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters. const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled. const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray. // Initialize the default scattering amounts to 0. rayleighColor = vec3(0.0); mieColor = vec3(0.0); opacity = 0.0; float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS; vec3 origin = vec3(0.0); // Calculate intersection from the camera to the outer ring of the atmosphere. czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius); // Return empty colors if no intersection with the atmosphere geometry. if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) { rayleighColor = vec3(1.0, 0.0, 1.0); return; } // To deal with smaller values of PRIMARY_STEPS (e.g. 4) // we implement a split strategy: sky or horizon. // For performance reasons, instead of a if/else branch // a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0 float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength); // Value close to 0.0: close to the horizon // Value close to 1.0: above in the sky float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x)); // The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere. float start_0 = primaryRayAtmosphereIntersect.start; primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0); // The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller. primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength)); // For the number of ray steps, distinguish inside or outside atmosphere (outer space) // (1) from outer space we have to use more ray steps to get a realistic rendering // (2) within atmosphere we need fewer steps for faster rendering float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a)); int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled. int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray. // Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere. float rayPositionLength = primaryRayAtmosphereIntersect.start; // (1) Outside the atmosphere: constant rayStepLength // (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength; float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0)); float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS)); vec3 rayleighAccumulation = vec3(0.0); vec3 mieAccumulation = vec3(0.0); vec2 opticalDepth = vec2(0.0); vec2 heightScale = vec2(czm_atmosphereRayleighScaleHeight, czm_atmosphereMieScaleHeight); // Sample positions on the primary ray. for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) { // The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot // loop with non-constant condition, so it has to break early instead if (i >= PRIMARY_STEPS) { break; } // Calculate sample position along viewpoint ray. vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength); // Calculate height of sample position above ellipsoid. float sampleHeight = length(samplePosition) - atmosphereInnerRadius; // Calculate and accumulate density of particles at the sample position. vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength; opticalDepth += sampleDensity; // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere. czm_ray lightRay = czm_ray(samplePosition, lightDirection); czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius); float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS); float lightPositionLength = 0.0; vec2 lightOpticalDepth = vec2(0.0); // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment. for (int j = 0; j < LIGHT_STEPS_MAX; ++j) { // The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot // loop with non-constant condition, so it has to break early instead if (j >= LIGHT_STEPS) { break; } // Calculate sample position along light ray. vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5); // Calculate height of the light sample position above ellipsoid. float lightHeight = length(lightPosition) - atmosphereInnerRadius; // Calculate density of photons at the light sample position. lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength; // Increment distance on light ray. lightPositionLength += lightStepLength; } // Compute attenuation via the primary ray and the light ray. vec3 attenuation = exp(-((czm_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (czm_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x)))); // Accumulate the scattering. rayleighAccumulation += sampleDensity.x * attenuation; mieAccumulation += sampleDensity.y * attenuation; // Increment distance on primary ray. rayPositionLength += (rayStepLength += rayStepLengthIncrease); } // Compute the scattering amount. rayleighColor = czm_atmosphereRayleighCoefficient * rayleighAccumulation; mieColor = czm_atmosphereMieCoefficient * mieAccumulation; // Compute the transmittance i.e. how much light is passing through the atmosphere. opacity = length(exp(-((czm_atmosphereMieCoefficient * opticalDepth.y) + (czm_atmosphereRayleighCoefficient * opticalDepth.x)))); } `,MQ=`/** * @private */ vec2 cordic(float angle) { // Scale the vector by the appropriate factor for the 24 iterations to follow. vec2 vector = vec2(6.0725293500888267e-1, 0.0); // Iteration 1 float sense = (angle < 0.0) ? -1.0 : 1.0; // float factor = sense * 1.0; // 2^-0 mat2 rotation = mat2(1.0, sense, -sense, 1.0); vector = rotation * vector; angle -= sense * 7.8539816339744828e-1; // atan(2^-0) // Iteration 2 sense = (angle < 0.0) ? -1.0 : 1.0; float factor = sense * 5.0e-1; // 2^-1 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.6364760900080609e-1; // atan(2^-1) // Iteration 3 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.5e-1; // 2^-2 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.4497866312686414e-1; // atan(2^-2) // Iteration 4 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.25e-1; // 2^-3 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.2435499454676144e-1; // atan(2^-3) // Iteration 5 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 6.25e-2; // 2^-4 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 6.2418809995957350e-2; // atan(2^-4) // Iteration 6 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.125e-2; // 2^-5 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.1239833430268277e-2; // atan(2^-5) // Iteration 7 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.5625e-2; // 2^-6 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.5623728620476831e-2; // atan(2^-6) // Iteration 8 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 7.8125e-3; // 2^-7 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 7.8123410601011111e-3; // atan(2^-7) // Iteration 9 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.90625e-3; // 2^-8 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.9062301319669718e-3; // atan(2^-8) // Iteration 10 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.953125e-3; // 2^-9 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.9531225164788188e-3; // atan(2^-9) // Iteration 11 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 9.765625e-4; // 2^-10 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 9.7656218955931946e-4; // atan(2^-10) // Iteration 12 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 4.8828125e-4; // 2^-11 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.8828121119489829e-4; // atan(2^-11) // Iteration 13 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.44140625e-4; // 2^-12 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.4414062014936177e-4; // atan(2^-12) // Iteration 14 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.220703125e-4; // 2^-13 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.2207031189367021e-4; // atan(2^-13) // Iteration 15 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 6.103515625e-5; // 2^-14 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 6.1035156174208773e-5; // atan(2^-14) // Iteration 16 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.0517578125e-5; // 2^-15 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.0517578115526096e-5; // atan(2^-15) // Iteration 17 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.52587890625e-5; // 2^-16 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.5258789061315762e-5; // atan(2^-16) // Iteration 18 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 7.62939453125e-6; // 2^-17 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 7.6293945311019700e-6; // atan(2^-17) // Iteration 19 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.814697265625e-6; // 2^-18 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.8146972656064961e-6; // atan(2^-18) // Iteration 20 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.9073486328125e-6; // 2^-19 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.9073486328101870e-6; // atan(2^-19) // Iteration 21 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 9.5367431640625e-7; // 2^-20 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 9.5367431640596084e-7; // atan(2^-20) // Iteration 22 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 4.76837158203125e-7; // 2^-21 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.7683715820308884e-7; // atan(2^-21) // Iteration 23 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.384185791015625e-7; // 2^-22 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.3841857910155797e-7; // atan(2^-22) // Iteration 24 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.1920928955078125e-7; // 2^-23 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; // angle -= sense * 1.1920928955078068e-7; // atan(2^-23) return vector; } /** * Computes the cosine and sine of the provided angle using the CORDIC algorithm. * * @name czm_cosineAndSine * @glslFunction * * @param {float} angle The angle in radians. * * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate). * * @example * vec2 v = czm_cosineAndSine(czm_piOverSix); * float cosine = v.x; * float sine = v.y; */ vec2 czm_cosineAndSine(float angle) { if (angle < -czm_piOverTwo || angle > czm_piOverTwo) { if (angle < 0.0) { return -cordic(angle + czm_pi); } else { return -cordic(angle - czm_pi); } } else { return cordic(angle); } } `,FQ=`/** * Decompresses texture coordinates that were packed into a single float. * * @name czm_decompressTextureCoordinates * @glslFunction * * @param {float} encoded The compressed texture coordinates. * @returns {vec2} The decompressed texture coordinates. */ vec2 czm_decompressTextureCoordinates(float encoded) { float temp = encoded / 4096.0; float xZeroTo4095 = floor(temp); float stx = xZeroTo4095 / 4095.0; float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0; return vec2(stx, sty); } `,BQ=`/** * Get default parameters for physically based rendering. These defaults * describe a rough dielectric (non-metal) surface (e.g. rough plastic). * * @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting} */ czm_pbrParameters czm_defaultPbrMaterial() { czm_pbrParameters results; results.diffuseColor = vec3(1.0); results.roughness = 1.0; const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04); results.f0 = REFLECTANCE_DIELECTRIC; return results; } `,zQ=`// emulated noperspective #if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH) out float v_WindowZ; #endif /** * Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2. * GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes, * capping the shadow volume. More information here: * https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt. * * When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring * no geometry gets clipped by setting the clip space z value to 0.0 and then * sending the unaltered screen space z value (using emulated noperspective * interpolation) to the frag shader where it is clamped to [0,1] and then * written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on: * https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv. * * When GL_EXT_frag_depth is not available, which is the case on some mobile * devices, we must attempt to fix this only in the vertex shader. * The approach is to clamp the z value to the far plane, which closes the * shadow volume but also distorts the geometry, so there can still be artifacts * on frustum seams. * * @name czm_depthClamp * @glslFunction * * @param {vec4} coords The vertex in clip coordinates. * @returns {vec4} The modified vertex. * * @example * gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0)); * * @see czm_writeDepthClamp */ vec4 czm_depthClamp(vec4 coords) { #ifndef LOG_DEPTH #if __VERSION__ == 300 || defined(GL_EXT_frag_depth) v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w; coords.z = 0.0; #else coords.z = min(coords.z, coords.w); #endif #endif return coords; } `,UQ=`/** * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping. *

* The ellipsoid is assumed to be centered at the model coordinate's origin. * * @name czm_eastNorthUpToEyeCoordinates * @glslFunction * * @param {vec3} positionMC The position on the ellipsoid in model coordinates. * @param {vec3} normalEC The normalized ellipsoid surface normal, at positionMC, in eye coordinates. * * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates. * * @example * // Transform a vector defined in the east-north-up coordinate * // system, (0, 0, 1) which is the surface normal, to eye * // coordinates. * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC); * vec3 normalEC = m * vec3(0.0, 0.0, 1.0); */ mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC) { vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordinates vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates return mat3( tangentEC.x, tangentEC.y, tangentEC.z, bitangentEC.x, bitangentEC.y, bitangentEC.z, normalEC.x, normalEC.y, normalEC.z); } `,kQ=`/** * DOC_TBA * * @name czm_ellipsoidContainsPoint * @glslFunction * */ bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point) { vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz; return (dot(scaled, scaled) <= 1.0); } `,VQ=`/** * DOC_TBA * * @name czm_ellipsoidWgs84TextureCoordinates * @glslFunction */ vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal) { return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5); } `,HQ=`/** * Compares left and right componentwise. Returns true * if they are within epsilon and false otherwise. The inputs * left and right can be floats, vec2s, * vec3s, or vec4s. * * @name czm_equalsEpsilon * @glslFunction * * @param {} left The first vector. * @param {} right The second vector. * @param {float} epsilon The epsilon to use for equality testing. * @returns {bool} true if the components are within epsilon and false otherwise. * * @example * // GLSL declarations * bool czm_equalsEpsilon(float left, float right, float epsilon); * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon); * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon); * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon); */ bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) { return all(lessThanEqual(abs(left - right), vec4(epsilon))); } bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) { return all(lessThanEqual(abs(left - right), vec3(epsilon))); } bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) { return all(lessThanEqual(abs(left - right), vec2(epsilon))); } bool czm_equalsEpsilon(float left, float right, float epsilon) { return (abs(left - right) <= epsilon); } `,GQ=`/** * DOC_TBA * * @name czm_eyeOffset * @glslFunction * * @param {vec4} positionEC DOC_TBA. * @param {vec3} eyeOffset DOC_TBA. * * @returns {vec4} DOC_TBA. */ vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset) { // This equation is approximate in x and y. vec4 p = positionEC; vec4 zEyeOffset = normalize(p) * eyeOffset.z; p.xy += eyeOffset.xy + zEyeOffset.xy; p.z += zEyeOffset.z; return p; } `,jQ=`/** * Transforms a position from eye to window coordinates. The transformation * from eye to clip coordinates is done using {@link czm_projection}. * The transform from normalized device coordinates to window coordinates is * done using {@link czm_viewportTransformation}, which assumes a depth range * of near = 0 and far = 1. *

* This transform is useful when there is a need to manipulate window coordinates * in a vertex shader as done by {@link BillboardCollection}. * * @name czm_eyeToWindowCoordinates * @glslFunction * * @param {vec4} position The position in eye coordinates to transform. * * @returns {vec4} The transformed position in window coordinates. * * @see czm_modelToWindowCoordinates * @see czm_projection * @see czm_viewportTransformation * @see BillboardCollection * * @example * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); */ vec4 czm_eyeToWindowCoordinates(vec4 positionEC) { vec4 q = czm_projection * positionEC; // clip coordinates q.xyz /= q.w; // normalized device coordinates q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates return q; } `,WQ=`/** * Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input. * * Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on * "Efficient approximations for the arctangent function," Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006. * Adapted from ShaderFastLibs under MIT License. * * Chosen for the following characteristics over range [0, 1]: * - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan) * - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator) * * The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301); * Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2. * * @name czm_fastApproximateAtan * @glslFunction * * @param {float} x Value between 0 and 1 inclusive. * * @returns {float} Approximation of atan(x) */ float czm_fastApproximateAtan(float x) { return x * (-0.1784 * x - 0.0663 * x * x + 1.0301); } /** * Approximation of atan2. * * Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html * However, we replaced their atan curve with Michael Drobot's (see above). * * @name czm_fastApproximateAtan * @glslFunction * * @param {float} x Value between -1 and 1 inclusive. * @param {float} y Value between -1 and 1 inclusive. * * @returns {float} Approximation of atan2(x, y) */ float czm_fastApproximateAtan(float x, float y) { // atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications. // So range-reduce using abs and by flipping whether x or y is on top. float t = abs(x); // t used as swap and atan result. float opposite = abs(y); float adjacent = max(t, opposite); opposite = min(t, opposite); t = czm_fastApproximateAtan(opposite / adjacent); // Undo range reduction t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t); t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t); t = czm_branchFreeTernary(y < 0.0, -t, t); return t; } `,qQ=`/** * Gets the color with fog at a distance from the camera. * * @name czm_fog * @glslFunction * * @param {float} distanceToCamera The distance to the camera in meters. * @param {vec3} color The original color. * @param {vec3} fogColor The color of the fog. * * @returns {vec3} The color adjusted for fog at the distance from the camera. */ vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor) { float scalar = distanceToCamera * czm_fogDensity; float fog = 1.0 - exp(-(scalar * scalar)); return mix(color, fogColor, fog); } /** * Gets the color with fog at a distance from the camera. * * @name czm_fog * @glslFunction * * @param {float} distanceToCamera The distance to the camera in meters. * @param {vec3} color The original color. * @param {vec3} fogColor The color of the fog. * @param {float} fogModifierConstant A constant to modify the appearance of fog. * * @returns {vec3} The color adjusted for fog at the distance from the camera. */ vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant) { float scalar = distanceToCamera * czm_fogDensity; float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant)))); return mix(color, fogColor, fog); } `,YQ=`/** * Converts a color from RGB space to linear space. * * @name czm_gammaCorrect * @glslFunction * * @param {vec3} color The color in RGB space. * @returns {vec3} The color in linear space. */ vec3 czm_gammaCorrect(vec3 color) { #ifdef HDR color = pow(color, vec3(czm_gamma)); #endif return color; } vec4 czm_gammaCorrect(vec4 color) { #ifdef HDR color.rgb = pow(color.rgb, vec3(czm_gamma)); #endif return color; } `,$Q=`/** * DOC_TBA * * @name czm_geodeticSurfaceNormal * @glslFunction * * @param {vec3} positionOnEllipsoid DOC_TBA * @param {vec3} ellipsoidCenter DOC_TBA * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA * * @returns {vec3} DOC_TBA. */ vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared) { return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared); } `,XQ=`/** * An czm_material with default values. Every material's czm_getMaterial * should use this default material as a base for the material it returns. * The default normal value is given by materialInput.normalEC. * * @name czm_getDefaultMaterial * @glslFunction * * @param {czm_materialInput} input The input used to construct the default material. * * @returns {czm_material} The default material. * * @see czm_materialInput * @see czm_material * @see czm_getMaterial */ czm_material czm_getDefaultMaterial(czm_materialInput materialInput) { czm_material material; material.diffuse = vec3(0.0); material.specular = 0.0; material.shininess = 1.0; material.normal = materialInput.normalEC; material.emission = vec3(0.0); material.alpha = 1.0; return material; } `,QQ=`/** * Select which direction vector to use for dynamic atmosphere lighting based on an enum value * * @name czm_getDynamicAtmosphereLightDirection * @glslfunction * @see DynamicAtmosphereLightingType.js * * @param {vec3} positionWC the position of the vertex/fragment in world coordinates. This is normalized and returned when dynamic lighting is turned off. * @param {float} lightEnum The enum value for selecting between light sources. * @return {vec3} The normalized light direction vector. Depending on the enum value, it is either positionWC, czm_lightDirectionWC or czm_sunDirectionWC */ vec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) { const float NONE = 0.0; const float SCENE_LIGHT = 1.0; const float SUNLIGHT = 2.0; vec3 lightDirection = positionWC * float(lightEnum == NONE) + czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) + czm_sunDirectionWC * float(lightEnum == SUNLIGHT); return normalize(lightDirection); } `,KQ=`/** * Calculates the intensity of diffusely reflected light. * * @name czm_getLambertDiffuse * @glslFunction * * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates. * @param {vec3} normalEC The surface normal in eye coordinates. * * @returns {float} The intensity of the diffuse reflection. * * @see czm_phong * * @example * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC); * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200); * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity); */ float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC) { return max(dot(lightDirectionEC, normalEC), 0.0); } `,ZQ=`/** * Calculates the specular intensity of reflected light. * * @name czm_getSpecular * @glslFunction * * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates. * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates. * @param {vec3} normalEC The surface normal in eye coordinates. * @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight. * * @returns {float} The intensity of the specular highlight. * * @see czm_phong * * @example * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC); * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200); * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity); */ float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess) { vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC); float specular = max(dot(toReflectedLight, toEyeEC), 0.0); // pow has undefined behavior if both parameters <= 0. // Prevent this by making sure shininess is at least czm_epsilon2. return pow(specular, max(shininess, czm_epsilon2)); } `,JQ=`/** * @private */ vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians) { float cosAngle = cos(angleInRadians); float sinAngle = sin(angleInRadians); // time dependent sampling directions vec2 s0 = vec2(1.0/17.0, 0.0); vec2 s1 = vec2(-1.0/29.0, 0.0); vec2 s2 = vec2(1.0/101.0, 1.0/59.0); vec2 s3 = vec2(-1.0/109.0, -1.0/57.0); // rotate sampling direction by specified angle s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y)); s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y)); s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y)); s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y)); vec2 uv0 = (uv/103.0) + (time * s0); vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23); vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51); vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71); uv0 = fract(uv0); uv1 = fract(uv1); uv2 = fract(uv2); uv3 = fract(uv3); vec4 noise = (texture(normalMap, uv0)) + (texture(normalMap, uv1)) + (texture(normalMap, uv2)) + (texture(normalMap, uv3)); // average and scale to between -1 and 1 return ((noise / 4.0) - 0.5) * 2.0; } `,eK=`/** * Adjusts the hue of a color. * * @name czm_hue * @glslFunction * * @param {vec3} rgb The color. * @param {float} adjustment The amount to adjust the hue of the color in radians. * * @returns {float} The color with the hue adjusted. * * @example * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi) */ vec3 czm_hue(vec3 rgb, float adjustment) { const mat3 toYIQ = mat3(0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135); const mat3 toRGB = mat3(1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.107, 1.7046); vec3 yiq = toYIQ * rgb; float hue = atan(yiq.z, yiq.y) + adjustment; float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y); vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue)); return toRGB * color; } `,tK=`/** * Converts a color in linear space to RGB space. * * @name czm_inverseGamma * @glslFunction * * @param {vec3} color The color in linear space. * @returns {vec3} The color in RGB space. */ vec3 czm_inverseGamma(vec3 color) { return pow(color, vec3(1.0 / czm_gamma)); } `,nK=`/** * Determines if a time interval is empty. * * @name czm_isEmpty * @glslFunction * * @param {czm_raySegment} interval The interval to test. * * @returns {bool} true if the time interval is empty; otherwise, false. * * @example * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0. */ bool czm_isEmpty(czm_raySegment interval) { return (interval.stop < 0.0); } `,iK=`/** * Determines if a time interval is empty. * * @name czm_isFull * @glslFunction * * @param {czm_raySegment} interval The interval to test. * * @returns {bool} true if the time interval is empty; otherwise, false. * * @example * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0. */ bool czm_isFull(czm_raySegment interval) { return (interval.start == 0.0 && interval.stop == czm_infinity); } `,oK=`/** * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located. * * @name czm_latitudeToWebMercatorFraction * @glslFunction * * @param {float} latitude The geodetic latitude, in radians. * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle. * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates. * * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection. */ float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight) { float sinLatitude = sin(latitude); float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude)); return (mercatorY - southMercatorY) * oneOverMercatorHeight; } `,rK=`/** * Computes distance from an point in 2D to a line in 2D. * * @name czm_lineDistance * @glslFunction * * param {vec2} point1 A point along the line. * param {vec2} point2 A point along the line. * param {vec2} point A point that may or may not be on the line. * returns {float} The distance from the point to the line. */ float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) { return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1); } `,sK=`/** * Converts a linear RGB color to an sRGB color. * * @param {vec3|vec4} linearIn The color in linear color space. * @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input. */ vec3 czm_linearToSrgb(vec3 linearIn) { return pow(linearIn, vec3(1.0/2.2)); } vec4 czm_linearToSrgb(vec4 linearIn) { vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2)); return vec4(srgbOut, linearIn.a); } `,aK=`/** * Computes the luminance of a color. * * @name czm_luminance * @glslFunction * * @param {vec3} rgb The color. * * @returns {float} The luminance. * * @example * float light = czm_luminance(vec3(0.0)); // 0.0 * float dark = czm_luminance(vec3(1.0)); // ~1.0 */ float czm_luminance(vec3 rgb) { // Algorithm from Chapter 10 of Graphics Shaders. const vec3 W = vec3(0.2125, 0.7154, 0.0721); return dot(rgb, W); } `,cK=`/** * Computes the size of a pixel in meters at a distance from the eye. *

* Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel. *

* @name czm_metersPerPixel * @glslFunction * * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates. * @param {float} pixelRatio The scaling factor from pixel space to coordinate space * * @returns {float} The meters per pixel at positionEC. */ float czm_metersPerPixel(vec4 positionEC, float pixelRatio) { float width = czm_viewport.z; float height = czm_viewport.w; float pixelWidth; float pixelHeight; float top = czm_frustumPlanes.x; float bottom = czm_frustumPlanes.y; float left = czm_frustumPlanes.z; float right = czm_frustumPlanes.w; if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0) { float frustumWidth = right - left; float frustumHeight = top - bottom; pixelWidth = frustumWidth / width; pixelHeight = frustumHeight / height; } else { float distanceToPixel = -positionEC.z; float inverseNear = 1.0 / czm_currentFrustum.x; float tanTheta = top * inverseNear; pixelHeight = 2.0 * distanceToPixel * tanTheta / height; tanTheta = right * inverseNear; pixelWidth = 2.0 * distanceToPixel * tanTheta / width; } return max(pixelWidth, pixelHeight) * pixelRatio; } /** * Computes the size of a pixel in meters at a distance from the eye. *

* Use this version when scaling by pixel ratio. *

* @name czm_metersPerPixel * @glslFunction * * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates. * * @returns {float} The meters per pixel at positionEC. */ float czm_metersPerPixel(vec4 positionEC) { return czm_metersPerPixel(positionEC, czm_pixelRatio); } `,lK=`/** * Transforms a position from model to window coordinates. The transformation * from model to clip coordinates is done using {@link czm_modelViewProjection}. * The transform from normalized device coordinates to window coordinates is * done using {@link czm_viewportTransformation}, which assumes a depth range * of near = 0 and far = 1. *

* This transform is useful when there is a need to manipulate window coordinates * in a vertex shader as done by {@link BillboardCollection}. *

* This function should not be confused with {@link czm_viewportOrthographic}, * which is an orthographic projection matrix that transforms from window * coordinates to clip coordinates. * * @name czm_modelToWindowCoordinates * @glslFunction * * @param {vec4} position The position in model coordinates to transform. * * @returns {vec4} The transformed position in window coordinates. * * @see czm_eyeToWindowCoordinates * @see czm_modelViewProjection * @see czm_viewportTransformation * @see czm_viewportOrthographic * @see BillboardCollection * * @example * vec4 positionWC = czm_modelToWindowCoordinates(positionMC); */ vec4 czm_modelToWindowCoordinates(vec4 position) { vec4 q = czm_modelViewProjection * position; // clip coordinates q.xyz /= q.w; // normalized device coordinates q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates return q; } `,uK=`/** * DOC_TBA * * @name czm_multiplyWithColorBalance * @glslFunction */ vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right) { // Algorithm from Chapter 10 of Graphics Shaders. const vec3 W = vec3(0.2125, 0.7154, 0.0721); vec3 target = left * right; float leftLuminance = dot(left, W); float rightLuminance = dot(right, W); float targetLuminance = dot(target, W); return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target; } `,dK=`/** * Computes a value that scales with distance. The scaling is clamped at the near and * far distances, and does not extrapolate. This function works with the * {@link NearFarScalar} JavaScript class. * * @name czm_nearFarScalar * @glslFunction * * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w). * @param {float} cameraDistSq The square of the current distance from the camera. * * @returns {float} The value at this distance. */ float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq) { float valueAtMin = nearFarScalar.y; float valueAtMax = nearFarScalar.w; float nearDistanceSq = nearFarScalar.x * nearFarScalar.x; float farDistanceSq = nearFarScalar.z * nearFarScalar.z; float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq); t = pow(clamp(t, 0.0, 1.0), 0.2); return mix(valueAtMin, valueAtMax, t); } `,hK=` /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/ * * @name czm_octDecode * @param {vec2} encoded The oct-encoded, unit-length vector * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits. * @returns {vec3} The decoded and normalized vector */ vec3 czm_octDecode(vec2 encoded, float range) { if (encoded.x == 0.0 && encoded.y == 0.0) { return vec3(0.0, 0.0, 0.0); } encoded = encoded / range * 2.0 - 1.0; vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y)); if (v.z < 0.0) { v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy); } return normalize(v); } /** * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/ * * @name czm_octDecode * @param {vec2} encoded The oct-encoded, unit-length vector * @returns {vec3} The decoded and normalized vector */ vec3 czm_octDecode(vec2 encoded) { return czm_octDecode(encoded, 255.0); } /** * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/ * * @name czm_octDecode * @param {float} encoded The oct-encoded, unit-length vector * @returns {vec3} The decoded and normalized vector */ vec3 czm_octDecode(float encoded) { float temp = encoded / 256.0; float x = floor(temp); float y = (temp - x) * 256.0; return czm_octDecode(vec2(x, y)); } /** * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/ * * @name czm_octDecode * @param {vec2} encoded The packed oct-encoded, unit-length vectors. * @param {vec3} vector1 One decoded and normalized vector. * @param {vec3} vector2 One decoded and normalized vector. * @param {vec3} vector3 One decoded and normalized vector. */ void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3) { float temp = encoded.x / 65536.0; float x = floor(temp); float encodedFloat1 = (temp - x) * 65536.0; temp = encoded.y / 65536.0; float y = floor(temp); float encodedFloat2 = (temp - y) * 65536.0; vector1 = czm_octDecode(encodedFloat1); vector2 = czm_octDecode(encodedFloat2); vector3 = czm_octDecode(vec2(x, y)); } `,fK=`/** * Packs a depth value into a vec3 that can be represented by unsigned bytes. * * @name czm_packDepth * @glslFunction * * @param {float} depth The floating-point depth. * @returns {vec3} The packed depth. */ vec4 czm_packDepth(float depth) { // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth; enc = fract(enc); enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); return enc; } `,pK=`vec3 lambertianDiffuse(vec3 diffuseColor) { return diffuseColor / czm_pi; } vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) { return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0); } float smithVisibilityG1(float NdotV, float roughness) { // this is the k value for direct lighting. // for image based lighting it will be roughness^2 / 2 float k = (roughness + 1.0) * (roughness + 1.0) / 8.0; return NdotV / (NdotV * (1.0 - k) + k); } float smithVisibilityGGX(float roughness, float NdotL, float NdotV) { return ( smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness) ); } float GGX(float roughness, float NdotH) { float roughnessSquared = roughness * roughness; float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0; return roughnessSquared / (czm_pi * f * f); } /** * Compute the diffuse and specular contributions using physically based * rendering. This function only handles direct lighting. *

* This function only handles the lighting calculations. Metallic/roughness * and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial} *

* * @name czm_pbrlighting * @glslFunction * * @param {vec3} positionEC The position of the fragment in eye coordinates * @param {vec3} normalEC The surface normal in eye coordinates * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates. * @param {vec3} lightColorHdr radiance of the light source. This is a HDR value. * @param {czm_pbrParameters} The computed PBR parameters. * @return {vec3} The computed HDR color * * @example * czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial( * baseColor, * metallic, * roughness * ); * vec3 color = czm_pbrlighting( * positionEC, * normalEC, * lightDirectionEC, * lightColorHdr, * pbrParameters); */ vec3 czm_pbrLighting( vec3 positionEC, vec3 normalEC, vec3 lightDirectionEC, vec3 lightColorHdr, czm_pbrParameters pbrParameters ) { vec3 v = -normalize(positionEC); vec3 l = normalize(lightDirectionEC); vec3 h = normalize(v + l); vec3 n = normalEC; float NdotL = clamp(dot(n, l), 0.001, 1.0); float NdotV = abs(dot(n, v)) + 0.001; float NdotH = clamp(dot(n, h), 0.0, 1.0); float LdotH = clamp(dot(l, h), 0.0, 1.0); float VdotH = clamp(dot(v, h), 0.0, 1.0); vec3 f0 = pbrParameters.f0; float reflectance = max(max(f0.r, f0.g), f0.b); vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0)); vec3 F = fresnelSchlick2(f0, f90, VdotH); float alpha = pbrParameters.roughness; float G = smithVisibilityGGX(alpha, NdotL, NdotV); float D = GGX(alpha, NdotH); vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV); vec3 diffuseColor = pbrParameters.diffuseColor; // F here represents the specular contribution vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor); // Lo = (diffuse + specular) * Li * NdotL return (diffuseContribution + specularContribution) * NdotL * lightColorHdr; } `,mK=`/** * Compute parameters for physically based rendering using the * metallic/roughness workflow. All inputs are linear; sRGB texture values must * be decoded beforehand * * @name czm_pbrMetallicRoughnessMaterial * @glslFunction * * @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence) * @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt); * @param {float} roughness A value between 0.0 and 1.0 * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting} */ czm_pbrParameters czm_pbrMetallicRoughnessMaterial( vec3 baseColor, float metallic, float roughness ) { czm_pbrParameters results; // roughness is authored as perceptual roughness // square it to get material roughness roughness = clamp(roughness, 0.0, 1.0); results.roughness = roughness * roughness; // dielectrics use f0 = 0.04, metals use albedo as f0 metallic = clamp(metallic, 0.0, 1.0); const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04); vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic); results.f0 = f0; // diffuse only applies to dielectrics. results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic); return results; } `,_K=`/** * Compute parameters for physically based rendering using the * specular/glossy workflow. All inputs are linear; sRGB texture values must * be decoded beforehand * * @name czm_pbrSpecularGlossinessMaterial * @glslFunction * * @param {vec3} diffuse The diffuse color for dielectrics (non-metals) * @param {vec3} specular The reflectance at normal incidence (f0) * @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is. * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting} */ czm_pbrParameters czm_pbrSpecularGlossinessMaterial( vec3 diffuse, vec3 specular, float glossiness ) { czm_pbrParameters results; // glossiness is the opposite of roughness, but easier for artists to use. float roughness = 1.0 - glossiness; results.roughness = roughness * roughness; results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b)); results.f0 = specular; return results; } `,gK=`float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material) { return czm_getLambertDiffuse(lightDirectionEC, material.normal); } float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material) { return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess); } /** * Computes a color using the Phong lighting model. * * @name czm_phong * @glslFunction * * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates. * @param {czm_material} material The fragment's material. * * @returns {vec4} The computed color. * * @example * vec3 positionToEyeEC = // ... * czm_material material = // ... * vec3 lightDirectionEC = // ... * out_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC); * * @see czm_getMaterial */ vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC) { // Diffuse from directional light sources at eye (for top-down) float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material); if (czm_sceneMode == czm_sceneMode3D) { // (and horizon views in 3D) diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material); } float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material); // Temporary workaround for adding ambient. vec3 materialDiffuse = material.diffuse * 0.5; vec3 ambient = materialDiffuse; vec3 color = ambient + material.emission; color += materialDiffuse * diffuse * czm_lightColor; color += material.specular * specular * czm_lightColor; return vec4(color, material.alpha); } vec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC) { float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material); float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material); vec3 ambient = vec3(0.0); vec3 color = ambient + material.emission; color += material.diffuse * diffuse * czm_lightColor; color += material.specular * specular * czm_lightColor; return vec4(color, material.alpha); } `,yK=`/** * Computes distance from a point to a plane. * * @name czm_planeDistance * @glslFunction * * param {vec4} plane A Plane in Hessian Normal Form. See Plane.js * param {vec3} point A point in the same space as the plane. * returns {float} The distance from the point to the plane. */ float czm_planeDistance(vec4 plane, vec3 point) { return (dot(plane.xyz, point) + plane.w); } /** * Computes distance from a point to a plane. * * @name czm_planeDistance * @glslFunction * * param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js * param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js * param {vec3} point A point in the same space as the plane. * returns {float} The distance from the point to the plane. */ float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) { return (dot(planeNormal, point) + planeDistance); } `,bK=`/** * Computes the point along a ray at the given time. time can be positive, negative, or zero. * * @name czm_pointAlongRay * @glslFunction * * @param {czm_ray} ray The ray to compute the point along. * @param {float} time The time along the ray. * * @returns {vec3} The point along the ray at the given time. * * @example * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0) */ vec3 czm_pointAlongRay(czm_ray ray, float time) { return ray.origin + (time * ray.direction); } `,TK=`/** * DOC_TBA * * @name czm_rayEllipsoidIntersectionInterval * @glslFunction */ czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii) { // ray and ellipsoid center in eye coordinates. radii in model coordinates. vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz; vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz; q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz; float q2 = dot(q, q); float qw = dot(q, w); if (q2 > 1.0) // Outside ellipsoid. { if (qw >= 0.0) // Looking outward or tangent (0 intersections). { return czm_emptyRaySegment; } else // qw < 0.0. { float qw2 = qw * qw; float difference = q2 - 1.0; // Positively valued. float w2 = dot(w, w); float product = w2 * difference; if (qw2 < product) // Imaginary roots (0 intersections). { return czm_emptyRaySegment; } else if (qw2 > product) // Distinct roots (2 intersections). { float discriminant = qw * qw - product; float temp = -qw + sqrt(discriminant); // Avoid cancellation. float root0 = temp / w2; float root1 = difference / temp; if (root0 < root1) { czm_raySegment i = czm_raySegment(root0, root1); return i; } else { czm_raySegment i = czm_raySegment(root1, root0); return i; } } else // qw2 == product. Repeated roots (2 intersections). { float root = sqrt(difference / w2); czm_raySegment i = czm_raySegment(root, root); return i; } } } else if (q2 < 1.0) // Inside ellipsoid (2 intersections). { float difference = q2 - 1.0; // Negatively valued. float w2 = dot(w, w); float product = w2 * difference; // Negatively valued. float discriminant = qw * qw - product; float temp = -qw + sqrt(discriminant); // Positively valued. czm_raySegment i = czm_raySegment(0.0, temp / w2); return i; } else // q2 == 1.0. On ellipsoid. { if (qw < 0.0) // Looking inward. { float w2 = dot(w, w); czm_raySegment i = czm_raySegment(0.0, -qw / w2); return i; } else // qw >= 0.0. Looking outward or tangent. { return czm_emptyRaySegment; } } } `,AK=`/** * Compute the intersection interval of a ray with a sphere. * * @name czm_raySphereIntersectionInterval * @glslFunction * * @param {czm_ray} ray The ray. * @param {vec3} center The center of the sphere. * @param {float} radius The radius of the sphere. * @return {czm_raySegment} The intersection interval of the ray with the sphere. */ czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius) { vec3 o = ray.origin; vec3 d = ray.direction; vec3 oc = o - center; float a = dot(d, d); float b = 2.0 * dot(d, oc); float c = dot(oc, oc) - (radius * radius); float det = (b * b) - (4.0 * a * c); if (det < 0.0) { return czm_emptyRaySegment; } float sqrtDet = sqrt(det); float t0 = (-b - sqrtDet) / (2.0 * a); float t1 = (-b + sqrtDet) / (2.0 * a); czm_raySegment result = czm_raySegment(t0, t1); return result; } `,xK=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords) { return czm_reverseLogDepth(texture(depthTexture, texCoords).r); } `,CK=`/** * Reads a value previously transformed with {@link czm_writeNonPerspective} * by dividing it by \`w\`, the value used in the perspective divide. * This function is intended to be called in a fragment shader to access a * \`varying\` that should not be subject to perspective interpolation. * For example, screen-space texture coordinates. The value should have been * previously written in the vertex shader with a call to * {@link czm_writeNonPerspective}. * * @name czm_readNonPerspective * @glslFunction * * @param {float|vec2|vec3|vec4} value The non-perspective value to be read. * @param {float} oneOverW One over the perspective divide value, \`w\`. Usually this is simply \`gl_FragCoord.w\`. * @returns {float|vec2|vec3|vec4} The usable value. */ float czm_readNonPerspective(float value, float oneOverW) { return value * oneOverW; } vec2 czm_readNonPerspective(vec2 value, float oneOverW) { return value * oneOverW; } vec3 czm_readNonPerspective(vec3 value, float oneOverW) { return value * oneOverW; } vec4 czm_readNonPerspective(vec4 value, float oneOverW) { return value * oneOverW; } `,EK=`float czm_reverseLogDepth(float logZ) { #ifdef LOG_DEPTH float near = czm_currentFrustum.x; float far = czm_currentFrustum.y; float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne; float depthFromNear = pow(2.0, log2Depth) - 1.0; return far * (1.0 - near / (depthFromNear + near)) / (far - near); #endif return logZ; } `,wK=`/** * Round a floating point value. This function exists because round() doesn't * exist in GLSL 1.00. * * @param {float|vec2|vec3|vec4} value The value to round * @param {float|vec2|vec3|vec3} The rounded value. The type matches the input. */ float czm_round(float value) { return floor(value + 0.5); } vec2 czm_round(vec2 value) { return floor(value + 0.5); } vec3 czm_round(vec3 value) { return floor(value + 0.5); } vec4 czm_round(vec4 value) { return floor(value + 0.5); } `,SK=`/** * Samples the 4 neighboring pixels and return the weighted average. * * @private */ vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod) { direction /= dot(vec3(1.0), abs(direction)); vec2 rev = abs(direction.zx) - vec2(1.0); vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x, direction.z < 0.0 ? rev.y : -rev.y); vec2 uv = direction.y < 0.0 ? neg : direction.xz; vec2 coord = 0.5 * uv + vec2(0.5); vec2 pixel = 1.0 / textureSize; if (lod > 0.0) { // Each subseqeuent mip level is half the size float scale = 1.0 / pow(2.0, lod); float offset = ((textureSize.y + 1.0) / textureSize.x); coord.x *= offset; coord *= scale; coord.x += offset + pixel.x; coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0; } else { coord.x *= (textureSize.y / textureSize.x); } // Do bilinear filtering #ifndef OES_texture_float_linear vec3 color1 = texture(projectedMap, coord + vec2(0.0, pixel.y)).rgb; vec3 color2 = texture(projectedMap, coord + vec2(pixel.x, 0.0)).rgb; vec3 color3 = texture(projectedMap, coord + pixel).rgb; vec3 color4 = texture(projectedMap, coord).rgb; vec2 texturePosition = coord * textureSize; float fu = fract(texturePosition.x); float fv = fract(texturePosition.y); vec3 average1 = mix(color4, color2, fu); vec3 average2 = mix(color1, color3, fu); vec3 color = mix(average1, average2, fv); #else vec3 color = texture(projectedMap, coord).rgb; #endif return color; } /** * Samples from a cube map that has been projected using an octahedral projection from the given direction. * * @name czm_sampleOctahedralProjection * @glslFunction * * @param {sampler2D} projectedMap The texture with the octahedral projected cube map. * @param {vec2} textureSize The width and height dimensions in pixels of the projected map. * @param {vec3} direction The normalized direction used to sample the cube map. * @param {float} lod The level of detail to sample. * @param {float} maxLod The maximum level of detail. * @returns {vec3} The color of the cube map at the direction. */ vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) { float currentLod = floor(lod + 0.5); float nextLod = min(currentLod + 1.0, maxLod); vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod); vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod); return mix(colorNextLod, colorCurrentLod, nextLod - lod); } `,vK=`/** * Adjusts the saturation of a color. * * @name czm_saturation * @glslFunction * * @param {vec3} rgb The color. * @param {float} adjustment The amount to adjust the saturation of the color. * * @returns {float} The color with the saturation adjusted. * * @example * vec3 greyScale = czm_saturation(color, 0.0); * vec3 doubleSaturation = czm_saturation(color, 2.0); */ vec3 czm_saturation(vec3 rgb, float adjustment) { // Algorithm from Chapter 16 of OpenGL Shading Language const vec3 W = vec3(0.2125, 0.7154, 0.0721); vec3 intensity = vec3(dot(rgb, W)); return mix(intensity, rgb, adjustment); } `,IK=` float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d) { return czm_unpackDepth(czm_textureCube(shadowMap, d)); } float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv) { #ifdef USE_SHADOW_DEPTH_TEXTURE return texture(shadowMap, uv).r; #else return czm_unpackDepth(texture(shadowMap, uv)); #endif } float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth) { return step(depth, czm_sampleShadowMap(shadowMap, uv)); } float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth) { return step(depth, czm_sampleShadowMap(shadowMap, uv)); } `,DK=` float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness) { #ifdef USE_NORMAL_SHADING #ifdef USE_NORMAL_SHADING_SMOOTH float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0); #else float strength = step(0.0, nDotL); #endif visibility *= strength; #endif visibility = max(visibility, darkness); return visibility; } #ifdef USE_CUBE_MAP_SHADOW float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters) { float depthBias = shadowParameters.depthBias; float depth = shadowParameters.depth; float nDotL = shadowParameters.nDotL; float normalShadingSmooth = shadowParameters.normalShadingSmooth; float darkness = shadowParameters.darkness; vec3 uvw = shadowParameters.texCoords; depth -= depthBias; float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth); return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness); } #else float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters) { float depthBias = shadowParameters.depthBias; float depth = shadowParameters.depth; float nDotL = shadowParameters.nDotL; float normalShadingSmooth = shadowParameters.normalShadingSmooth; float darkness = shadowParameters.darkness; vec2 uv = shadowParameters.texCoords; depth -= depthBias; #ifdef USE_SOFT_SHADOWS vec2 texelStepSize = shadowParameters.texelStepSize; float radius = 1.0; float dx0 = -texelStepSize.x * radius; float dy0 = -texelStepSize.y * radius; float dx1 = texelStepSize.x * radius; float dy1 = texelStepSize.y * radius; float visibility = ( czm_shadowDepthCompare(shadowMap, uv, depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth) ) * (1.0 / 9.0); #else float visibility = czm_shadowDepthCompare(shadowMap, uv, depth); #endif return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness); } #endif `,PK=`/** * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL * built-in function sign except that returns 1.0 instead of 0.0 when the input value is 0.0. * * @name czm_signNotZero * @glslFunction * * @param {} value The value for which to determine the sign. * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative. */ float czm_signNotZero(float value) { return value >= 0.0 ? 1.0 : -1.0; } vec2 czm_signNotZero(vec2 value) { return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y)); } vec3 czm_signNotZero(vec3 value) { return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z)); } vec4 czm_signNotZero(vec4 value) { return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w)); } `,OK=`/** * Computes a color from the third order spherical harmonic coefficients and a normalized direction vector. *

* The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22]. *

* * @name czm_sphericalHarmonics * @glslFunction * * @param {vec3} normal The normalized direction. * @param {vec3[9]} coefficients The third order spherical harmonic coefficients. * @returns {vec3} The color at the direction. * * @see https://graphics.stanford.edu/papers/envmap/envmap.pdf */ vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9]) { vec3 L00 = coefficients[0]; vec3 L1_1 = coefficients[1]; vec3 L10 = coefficients[2]; vec3 L11 = coefficients[3]; vec3 L2_2 = coefficients[4]; vec3 L2_1 = coefficients[5]; vec3 L20 = coefficients[6]; vec3 L21 = coefficients[7]; vec3 L22 = coefficients[8]; float x = normal.x; float y = normal.y; float z = normal.z; return L00 + L1_1 * y + L10 * z + L11 * x + L2_2 * (y * x) + L2_1 * (y * z) + L20 * (3.0 * z * z - 1.0) + L21 * (z * x) + L22 * (x * x - y * y); } `,LK=`/** * Converts an sRGB color to a linear RGB color. * * @param {vec3|vec4} srgbIn The color in sRGB space * @returns {vec3|vec4} The color in linear color space. The vector type matches the input. */ vec3 czm_srgbToLinear(vec3 srgbIn) { return pow(srgbIn, vec3(2.2)); } vec4 czm_srgbToLinear(vec4 srgbIn) { vec3 linearOut = pow(srgbIn.rgb, vec3(2.2)); return vec4(linearOut, srgbIn.a); } `,RK=`/** * Creates a matrix that transforms vectors from tangent space to eye space. * * @name czm_tangentToEyeSpaceMatrix * @glslFunction * * @param {vec3} normalEC The normal vector in eye coordinates. * @param {vec3} tangentEC The tangent vector in eye coordinates. * @param {vec3} bitangentEC The bitangent vector in eye coordinates. * * @returns {mat3} The matrix that transforms from tangent space to eye space. * * @example * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC); * vec3 normal = tangentToEye * texture(normalMap, st).xyz; */ mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC) { vec3 normal = normalize(normalEC); vec3 tangent = normalize(tangentEC); vec3 bitangent = normalize(bitangentEC); return mat3(tangent.x , tangent.y , tangent.z, bitangent.x, bitangent.y, bitangent.z, normal.x , normal.y , normal.z); } `,NK=`/** * A wrapper around the texture (WebGL2) / textureCube (WebGL1) * function to allow for WebGL 1 support. * * @name czm_textureCube * @glslFunction * * @param {samplerCube} sampler The sampler. * @param {vec3} p The coordinates to sample the texture at. */ vec4 czm_textureCube(samplerCube sampler, vec3 p) { #if __VERSION__ == 300 return texture(sampler, p); #else return textureCube(sampler, p); #endif }`,MK=`/** * Transforms a plane. * * @name czm_transformPlane * @glslFunction * * @param {vec4} plane The plane in Hessian Normal Form. * @param {mat4} transform The inverse-transpose of a transformation matrix. */ vec4 czm_transformPlane(vec4 plane, mat4 transform) { vec4 transformedPlane = transform * plane; // Convert the transformed plane to Hessian Normal Form float normalMagnitude = length(transformedPlane.xyz); return transformedPlane / normalMagnitude; } `,FK=`/** * Translates a position (or any vec3) that was encoded with {@link EncodedCartesian3}, * and then provided to the shader as separate high and low bits to * be relative to the eye. As shown in the example, the position can then be transformed in eye * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye}, * respectively. *

* This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as * described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}. *

* * @name czm_translateRelativeToEye * @glslFunction * * @param {vec3} high The position's high bits. * @param {vec3} low The position's low bits. * @returns {vec3} The position translated to be relative to the camera's position. * * @example * in vec3 positionHigh; * in vec3 positionLow; * * void main() * { * vec4 p = czm_translateRelativeToEye(positionHigh, positionLow); * gl_Position = czm_modelViewProjectionRelativeToEye * p; * } * * @see czm_modelViewRelativeToEye * @see czm_modelViewProjectionRelativeToEye * @see czm_computePosition * @see EncodedCartesian3 */ vec4 czm_translateRelativeToEye(vec3 high, vec3 low) { vec3 highDifference = high - czm_encodedCameraPositionMCHigh; // This check handles the case when NaN values have gotten into \`highDifference\`. // Such a thing could happen on devices running iOS. if (length(highDifference) == 0.0) { highDifference = vec3(0); } vec3 lowDifference = low - czm_encodedCameraPositionMCLow; return vec4(highDifference + lowDifference, 1.0); } `,BK=`/** * @private */ vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC) { // Diffuse from directional light sources at eye (for top-down and horizon views) float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal); if (czm_sceneMode == czm_sceneMode3D) { // (and horizon views in 3D) diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal); } diffuse = clamp(diffuse, 0.0, 1.0); float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess); // Temporary workaround for adding ambient. vec3 materialDiffuse = material.diffuse * 0.5; vec3 ambient = materialDiffuse; vec3 color = ambient + material.emission; color += materialDiffuse * diffuse * czm_lightColor; color += material.specular * specular * czm_lightColor; return vec4(color, material.alpha); } `,zK=`/** * Returns the transpose of the matrix. The input matrix can be * a mat2, mat3, or mat4. * * @name czm_transpose * @glslFunction * * @param {} matrix The matrix to transpose. * * @returns {} The transposed matrix. * * @example * // GLSL declarations * mat2 czm_transpose(mat2 matrix); * mat3 czm_transpose(mat3 matrix); * mat4 czm_transpose(mat4 matrix); * * // Transpose a 3x3 rotation matrix to find its inverse. * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates( * positionMC, normalEC); * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye); */ mat2 czm_transpose(mat2 matrix) { return mat2( matrix[0][0], matrix[1][0], matrix[0][1], matrix[1][1]); } mat3 czm_transpose(mat3 matrix) { return mat3( matrix[0][0], matrix[1][0], matrix[2][0], matrix[0][1], matrix[1][1], matrix[2][1], matrix[0][2], matrix[1][2], matrix[2][2]); } mat4 czm_transpose(mat4 matrix) { return mat4( matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0], matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1], matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2], matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]); } `,UK=`vec2 getLookupUv(vec2 dimensions, int i) { int pixY = i / int(dimensions.x); int pixX = i - (pixY * int(dimensions.x)); float pixelWidth = 1.0 / dimensions.x; float pixelHeight = 1.0 / dimensions.y; float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel float v = (float(pixY) + 0.5) * pixelHeight; return vec2(u, v); } vec4 czm_unpackClippingExtents(highp sampler2D extentsTexture, int index) { vec2 textureDimensions = vec2(textureSize(extentsTexture, 0)); return texture(extentsTexture, getLookupUv(textureDimensions, index)); }`,kK=`/** * Unpacks a vec4 depth value to a float in [0, 1) range. * * @name czm_unpackDepth * @glslFunction * * @param {vec4} packedDepth The packed depth. * * @returns {float} The floating-point depth in [0, 1) range. */ float czm_unpackDepth(vec4 packedDepth) { // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)); } `,VK=`/** * Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4. * * @name czm_unpackFloat * @glslFunction * * @param {vec4} packedFloat The packed float. * * @returns {float} The floating-point depth in arbitrary range. */ float czm_unpackFloat(vec4 packedFloat) { // Convert to [0.0, 255.0] and round to integer packedFloat = floor(packedFloat * 255.0 + 0.5); float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0; float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0; if (exponent == -127.0) { return 0.0; } float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000); float result = sign * exp2(exponent - 23.0) * mantissa; return result; } `,HK=`/** * Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type, * so the return value is an int. *

* There are also precision limitations in WebGL 1. highp int is still limited * to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur. *

* * @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order. * * @return {int} The unpacked value. */ int czm_unpackUint(float packedValue) { float rounded = czm_round(packedValue * 255.0); return int(rounded); } int czm_unpackUint(vec2 packedValue) { vec2 rounded = czm_round(packedValue * 255.0); return int(dot(rounded, vec2(1.0, 256.0))); } int czm_unpackUint(vec3 packedValue) { vec3 rounded = czm_round(packedValue * 255.0); return int(dot(rounded, vec3(1.0, 256.0, 65536.0))); } int czm_unpackUint(vec4 packedValue) { vec4 rounded = czm_round(packedValue * 255.0); return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0))); } `,GK=`/** * Transform metadata values following the EXT_structural_metadata spec * by multiplying by scale and adding the offset. Operations are always * performed component-wise, even for matrices. * * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value. * * @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input. */ float czm_valueTransform(float offset, float scale, float value) { return scale * value + offset; } vec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) { return scale * value + offset; } vec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) { return scale * value + offset; } vec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) { return scale * value + offset; } mat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) { return matrixCompMult(scale, value) + offset; } mat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) { return matrixCompMult(scale, value) + offset; } mat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) { return matrixCompMult(scale, value) + offset; } `,jK=`#ifdef LOG_DEPTH // 1.0 at the near plane, increasing linearly from there. out float v_depthFromNearPlusOne; #ifdef SHADOW_MAP out vec3 v_logPositionEC; #endif #endif vec4 czm_updatePositionDepth(vec4 coords) { #if defined(LOG_DEPTH) #ifdef SHADOW_MAP vec3 logPositionEC = (czm_inverseProjection * coords).xyz; v_logPositionEC = logPositionEC; #endif // With the very high far/near ratios used with the logarithmic depth // buffer, floating point rounding errors can cause linear depth values // to end up on the wrong side of the far plane, even for vertices that // are really nowhere near it. Since we always write a correct logarithmic // depth value in the fragment shader anyway, we just need to make sure // such errors don't cause the primitive to be clipped entirely before // we even get to the fragment shader. coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w; #endif return coords; } /** * Writes the logarithmic depth to gl_Position using the already computed gl_Position. * * @name czm_vertexLogDepth * @glslFunction */ void czm_vertexLogDepth() { #ifdef LOG_DEPTH v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0; gl_Position = czm_updatePositionDepth(gl_Position); #endif } /** * Writes the logarithmic depth to gl_Position using the provided clip coordinates. *

* An example use case for this function would be moving the vertex in window coordinates * before converting back to clip coordinates. Use the original vertex clip coordinates. *

* @name czm_vertexLogDepth * @glslFunction * * @param {vec4} clipCoords The vertex in clip coordinates. * * @example * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0)); */ void czm_vertexLogDepth(vec4 clipCoords) { #ifdef LOG_DEPTH v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0; czm_updatePositionDepth(clipCoords); #endif } `,WK=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate) { // Reconstruct NDC coordinates float x = 2.0 * screenCoordinate.x - 1.0; float y = 2.0 * screenCoordinate.y - 1.0; float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2]; vec4 q = vec4(x, y, z, 1.0); // Reverse the perspective division to obtain clip coordinates. q /= screenCoordinate.w; // Reverse the projection transformation to obtain eye coordinates. if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s { q = czm_inverseProjection * q; } else { float top = czm_frustumPlanes.x; float bottom = czm_frustumPlanes.y; float left = czm_frustumPlanes.z; float right = czm_frustumPlanes.w; float near = czm_currentFrustum.x; float far = czm_currentFrustum.y; q.x = (q.x * (right - left) + left + right) * 0.5; q.y = (q.y * (top - bottom) + bottom + top) * 0.5; q.z = (q.z * (near - far) - near - far) * 0.5; q.w = 1.0; } return q; } /** * Transforms a position from window to eye coordinates. * The transform from window to normalized device coordinates is done using components * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating * the inverse of czm_viewportTransformation. The transformation from * normalized device coordinates to clip coordinates is done using fragmentCoordinate.w, * which is expected to be the scalar used in the perspective divide. The transformation * from clip to eye coordinates is done using {@link czm_inverseProjection}. * * @name czm_windowToEyeCoordinates * @glslFunction * * @param {vec4} fragmentCoordinate The position in window coordinates to transform. * * @returns {vec4} The transformed position in eye coordinates. * * @see czm_modelToWindowCoordinates * @see czm_eyeToWindowCoordinates * @see czm_inverseProjection * @see czm_viewport * @see czm_viewportTransformation * * @example * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord); */ vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate) { vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw; return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw)); } vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth) { // See reverseLogDepth.glsl. This is separate to re-use the pow. #if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY) float near = czm_currentFrustum.x; float far = czm_currentFrustum.y; float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne; float depthFromNear = pow(2.0, log2Depth) - 1.0; float depthFromCamera = depthFromNear + near; vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0); vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord); eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision return eyeCoordinate; #else vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0); vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord); #endif return eyeCoordinate; } /** * Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates. * This function produces more accurate results for window positions with log depth than * conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version * of czm_windowToEyeCoordinates. * * @name czm_windowToEyeCoordinates * @glslFunction * * @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform. * @param {float} depthOrLogDepth A depth or log depth for the fragment. * * @see czm_modelToWindowCoordinates * @see czm_eyeToWindowCoordinates * @see czm_inverseProjection * @see czm_viewport * @see czm_viewportTransformation * * @returns {vec4} The transformed position in eye coordinates. */ vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth) { vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw; return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth); } `,qK=`// emulated noperspective #if !defined(LOG_DEPTH) in float v_WindowZ; #endif /** * Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane * by writing the fragment's depth. See czm_depthClamp for more details. * * @name czm_writeDepthClamp * @glslFunction * * @example * out_FragColor = color; * czm_writeDepthClamp(); * * @see czm_depthClamp */ void czm_writeDepthClamp() { #if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth))) gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0); #endif } `,YK=`#ifdef LOG_DEPTH in float v_depthFromNearPlusOne; #ifdef POLYGON_OFFSET uniform vec2 u_polygonOffset; #endif #endif /** * Writes the fragment depth to the logarithmic depth buffer. *

* Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when * ray-casting geometry using a full screen quad. *

* @name czm_writeLogDepth * @glslFunction * * @param {float} depth The depth coordinate, where 1.0 is on the near plane and * depth increases in eye-space units from there * * @example * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0); */ void czm_writeLogDepth(float depth) { #if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth))) // Discard the vertex if it's not between the near and far planes. // We allow a bit of epsilon on the near plane comparison because a 1.0 // from the vertex shader (indicating the vertex should be _on_ the near // plane) will not necessarily come here as exactly 1.0. if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) { discard; } #ifdef POLYGON_OFFSET // Polygon offset: m * factor + r * units float factor = u_polygonOffset[0]; float units = u_polygonOffset[1]; #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives)) // This factor doesn't work in IE 10 if (factor != 0.0) { // m = sqrt(dZdX^2 + dZdY^2); float x = dFdx(depth); float y = dFdy(depth); float m = sqrt(x * x + y * y); // Apply the factor before computing the log depth. depth += m * factor; } #endif #endif gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne; #ifdef POLYGON_OFFSET // Apply the units after the log depth. gl_FragDepth += czm_epsilon7 * units; #endif #endif } /** * Writes the fragment depth to the logarithmic depth buffer. *

* Use this when the vertex shader calls {@link czm_vertexlogDepth}. *

* * @name czm_writeLogDepth * @glslFunction */ void czm_writeLogDepth() { #ifdef LOG_DEPTH czm_writeLogDepth(v_depthFromNearPlusOne); #endif } `,$K=`/** * Transforms a value for non-perspective interpolation by multiplying * it by w, the value used in the perspective divide. This function is * intended to be called in a vertex shader to compute the value of a * \`varying\` that should not be subject to perspective interpolation. * For example, screen-space texture coordinates. The fragment shader * must call {@link czm_readNonPerspective} to retrieve the final * non-perspective value. * * @name czm_writeNonPerspective * @glslFunction * * @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective. * @param {float} w The perspective divide value. Usually this is the computed \`gl_Position.w\`. * @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a \`varying\` and read in the * fragment shader with {@link czm_readNonPerspective}. */ float czm_writeNonPerspective(float value, float w) { return value * w; } vec2 czm_writeNonPerspective(vec2 value, float w) { return value * w; } vec3 czm_writeNonPerspective(vec3 value, float w) { return value * w; } vec4 czm_writeNonPerspective(vec4 value, float w) { return value * w; } `,ZE={czm_degreesPerRadian:yX,czm_depthRange:bX,czm_epsilon1:TX,czm_epsilon2:AX,czm_epsilon3:xX,czm_epsilon4:CX,czm_epsilon5:EX,czm_epsilon6:wX,czm_epsilon7:SX,czm_infinity:vX,czm_oneOverPi:IX,czm_oneOverTwoPi:DX,czm_passCesium3DTile:PX,czm_passCesium3DTileClassification:OX,czm_passCesium3DTileClassificationIgnoreShow:LX,czm_passClassification:RX,czm_passCompute:NX,czm_passEnvironment:MX,czm_passGlobe:FX,czm_passOpaque:BX,czm_passOverlay:zX,czm_passTerrainClassification:UX,czm_passTranslucent:kX,czm_passVoxels:VX,czm_pi:HX,czm_piOverFour:GX,czm_piOverSix:jX,czm_piOverThree:WX,czm_piOverTwo:qX,czm_radiansPerDegree:YX,czm_sceneMode2D:$X,czm_sceneMode3D:XX,czm_sceneModeColumbusView:QX,czm_sceneModeMorphing:KX,czm_solarRadius:ZX,czm_threePiOver2:JX,czm_twoPi:eQ,czm_webMercatorMaxLatitude:tQ,czm_depthRangeStruct:nQ,czm_material:iQ,czm_materialInput:oQ,czm_modelMaterial:rQ,czm_modelVertexOutput:sQ,czm_pbrParameters:aQ,czm_ray:cQ,czm_raySegment:lQ,czm_shadowParameters:uQ,czm_HSBToRGB:dQ,czm_HSLToRGB:hQ,czm_RGBToHSB:fQ,czm_RGBToHSL:pQ,czm_RGBToXYZ:mQ,czm_XYZToRGB:_Q,czm_acesTonemapping:gQ,czm_alphaWeight:yQ,czm_antialias:bQ,czm_applyHSBShift:TQ,czm_approximateSphericalCoordinates:AQ,czm_approximateTanh:xQ,czm_backFacing:CQ,czm_branchFreeTernary:EQ,czm_cascadeColor:wQ,czm_cascadeDistance:SQ,czm_cascadeMatrix:vQ,czm_cascadeWeights:IQ,czm_clipPolygons:DQ,czm_columbusViewMorph:PQ,czm_computeAtmosphereColor:OQ,czm_computeGroundAtmosphereScattering:LQ,czm_computePosition:RQ,czm_computeScattering:NQ,czm_cosineAndSine:MQ,czm_decompressTextureCoordinates:FQ,czm_defaultPbrMaterial:BQ,czm_depthClamp:zQ,czm_eastNorthUpToEyeCoordinates:UQ,czm_ellipsoidContainsPoint:kQ,czm_ellipsoidWgs84TextureCoordinates:VQ,czm_equalsEpsilon:HQ,czm_eyeOffset:GQ,czm_eyeToWindowCoordinates:jQ,czm_fastApproximateAtan:WQ,czm_fog:qQ,czm_gammaCorrect:YQ,czm_geodeticSurfaceNormal:$Q,czm_getDefaultMaterial:XQ,czm_getDynamicAtmosphereLightDirection:QQ,czm_getLambertDiffuse:KQ,czm_getSpecular:ZQ,czm_getWaterNoise:JQ,czm_hue:eK,czm_inverseGamma:tK,czm_isEmpty:nK,czm_isFull:iK,czm_latitudeToWebMercatorFraction:oK,czm_lineDistance:rK,czm_linearToSrgb:sK,czm_luminance:aK,czm_metersPerPixel:cK,czm_modelToWindowCoordinates:lK,czm_multiplyWithColorBalance:uK,czm_nearFarScalar:dK,czm_octDecode:hK,czm_packDepth:fK,czm_pbrLighting:pK,czm_pbrMetallicRoughnessMaterial:mK,czm_pbrSpecularGlossinessMaterial:_K,czm_phong:gK,czm_planeDistance:yK,czm_pointAlongRay:bK,czm_rayEllipsoidIntersectionInterval:TK,czm_raySphereIntersectionInterval:AK,czm_readDepth:xK,czm_readNonPerspective:CK,czm_reverseLogDepth:EK,czm_round:wK,czm_sampleOctahedralProjection:SK,czm_saturation:vK,czm_shadowDepthCompare:IK,czm_shadowVisibility:DK,czm_signNotZero:PK,czm_sphericalHarmonics:OK,czm_srgbToLinear:LK,czm_tangentToEyeSpaceMatrix:RK,czm_textureCube:NK,czm_transformPlane:MK,czm_translateRelativeToEye:FK,czm_translucentPhong:BK,czm_transpose:zK,czm_unpackClippingExtents:UK,czm_unpackDepth:kK,czm_unpackFloat:VK,czm_unpackUint:HK,czm_valueTransform:GK,czm_vertexLogDepth:jK,czm_windowToEyeCoordinates:WK,czm_writeDepthClamp:qK,czm_writeLogDepth:YK,czm_writeNonPerspective:$K};function XK(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/\n\s*(in)\s+(vec\d|mat\d|float)/g,` varying $2`),/out_FragData_(\d+)/.test(n)&&(n=`#extension GL_EXT_draw_buffers : enable ${n}`,n=n.replaceAll(/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,""),n=n.replaceAll(/out_FragData_(\d+)/g,"gl_FragData[$1]")),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,""),n=n.replaceAll(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable ${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT")),n=`#ifdef GL_OES_standard_derivatives #extension GL_OES_standard_derivatives : enable #endif ${n}`):(n=n.replaceAll(/(in)\s+(vec\d|mat\d|float)/g,"attribute $2"),n=n.replaceAll(/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,"varying $2 $3;")),n=`#version 100 ${n}`,n}function Tk(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){const n=t.match(/\n/gm).length;let i="";for(let o=0;o0;){const o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){const o=t.shift();e.push(o);for(let r=0;r=0;--o)i=`${i+t[o].glslSource} `;return i.replace(n.glslSource,"")}function Ck(e,t,n){let i,o,r="";const s=e.sources;if(c(s))for(i=0,o=s.length;i-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};vl.prototype.getDerivedShaderProgram=function(e,t){const n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(!!c(o))return o.shaderProgram};vl.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword;let r=n.vertexShaderSource,s=n.fragmentShaderSource;const a=n.attributeLocations;typeof r=="string"&&(r=new Oe({sources:[r]})),typeof s=="string"&&(s=new Oe({sources:[s]}));const l=this._context,u=r.createCombinedVertexShader(l),h=s.createCombinedFragmentShader(l),f=new Jt({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:h,attributeLocations:a}),_={cache:this,shaderProgram:f,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),f._cachedShader=_,this._shaders[o]=_,f};function PP(e,t){const n=t.derivedKeywords,i=n.length;for(let o=0;opt.maximumTextureSize)throw new E(`Width must be less than or equal to the maximum texture size (${pt.maximumTextureSize}). Check maximumTextureSize.`);if(A.typeOf.number.greaterThan("height",i,0),i>pt.maximumTextureSize)throw new E(`Height must be less than or equal to the maximum texture size (${pt.maximumTextureSize}). Check maximumTextureSize.`);if(!Ve.validate(r))throw new E("Invalid options.pixelFormat.");if(!l&&!Me.validate(s))throw new E("Invalid options.pixelDatatype.");if(r===Ve.DEPTH_COMPONENT&&s!==Me.UNSIGNED_SHORT&&s!==Me.UNSIGNED_INT)throw new E("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===Ve.DEPTH_STENCIL&&s!==Me.UNSIGNED_INT_24_8)throw new E("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===Me.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s===Me.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(Ve.isDepthFormat(r)){if(c(o))throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.")}if(l){if(!c(o)||!c(o.arrayBufferView))throw new E("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(Ve.isDXTFormat(a)&&!t.s3tc)throw new E("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(Ve.isPVRTCFormat(a)&&!t.pvrtc)throw new E("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(Ve.isASTCFormat(a)&&!t.astc)throw new E("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(Ve.isETC2Format(a)&&!t.etc)throw new E("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(Ve.isETC1Format(a)&&!t.etc1)throw new E("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(Ve.isBC7Format(a)&&!t.bc7)throw new E("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(Ve.compressedTextureSizeInBytes(a,n,i)!==o.arrayBufferView.byteLength)throw new E("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}const u=e.preMultiplyAlpha||r===Ve.RGB||r===Ve.LUMINANCE,h=y(e.flipY,!0),f=y(e.skipColorSpaceConversion,!1);let _=!0;const g=t._gl,m=g.TEXTURE_2D,b=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,b);let T=4;if(c(o)&&c(o.arrayBufferView)&&!l&&(T=Ve.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,T),f?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),c(o))if(c(o.arrayBufferView)){g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1);let C=o.arrayBufferView,w,v,P;if(l){if(g.compressedTexImage2D(m,0,a,n,i,0,C),c(o.mipLevels))for(v=n,P=i,w=0;wn.drawingBufferWidth)throw new E("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new E("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new xt({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:c(l)?l:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(xt.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,o=this._pixelFormat,r=this._pixelDatatype,s=t===en.NEAREST_MIPMAP_NEAREST||t===en.NEAREST_MIPMAP_LINEAR||t===en.LINEAR_MIPMAP_NEAREST||t===en.LINEAR_MIPMAP_LINEAR;(r===Me.FLOAT&&!i.textureFloatLinear||r===Me.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?en.NEAREST_MIPMAP_NEAREST:en.NEAREST,n=Yo.NEAREST),i.webgl2&&Ve.isDepthFormat(o)&&(t=en.NEAREST,n=Yo.NEAREST);const a=i._gl,l=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(l,this._texture),a.texParameteri(l,a.TEXTURE_MIN_FILTER,t),a.texParameteri(l,a.TEXTURE_MAG_FILTER,n),a.texParameteri(l,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(l,a.TEXTURE_WRAP_T,e.wrapT),c(this._textureFilterAnisotropic)&&a.texParameteri(l,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(l,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(this._sizeInBytes*4/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}});xt.prototype.copyFrom=function(e){A.defined("options",e);const t=y(e.xOffset,0),n=y(e.yOffset,0);if(A.defined("options.source",e.source),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");A.typeOf.number.greaterThanOrEquals("xOffset",t,0),A.typeOf.number.greaterThanOrEquals("yOffset",n,0),A.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),A.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+e.source.height,this._height);const i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);const a=i.width,l=i.height;let u=i.arrayBufferView;const h=this._width,f=this._height,_=this._internalFormat,g=this._pixelFormat,m=this._pixelDatatype,b=this._preMultiplyAlpha,T=this._flipY,x=y(e.skipColorSpaceConversion,!1);let C=4;c(u)&&(C=Ve.alignmentInBytes(g,m,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,C),x?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let w=!1;if(!this._initialized){if(t===0&&n===0&&a===h&&l===f)c(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=Ve.flipY(u,g,m,h,f)),r.texImage2D(s,0,_,h,f,0,g,Me.toWebGLConstant(m,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texImage2D(s,0,_,g,Me.toWebGLConstant(m,o),i)),w=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const v=Ve.createTypedArray(g,m,h,f);r.texImage2D(s,0,_,h,f,0,g,Me.toWebGLConstant(m,o),v)}this._initialized=!0}w||(c(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=Ve.flipY(u,g,m,a,l)),r.texSubImage2D(s,0,t,n,a,l,g,Me.toWebGLConstant(m,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texSubImage2D(s,0,t,n,g,Me.toWebGLConstant(m,o),i))),r.bindTexture(s,null)};xt.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._width),r=y(r,this._height),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===Me.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Me.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");A.typeOf.number.greaterThanOrEquals("xOffset",e,0),A.typeOf.number.greaterThanOrEquals("yOffset",t,0),A.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),A.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),A.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),A.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(a,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};xt.prototype.generateMipmap=function(e){if(e=y(e,v_.DONT_CARE),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!R.isPowerOfTwo(this._width))throw new E("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!R.isPowerOfTwo(this._height))throw new E("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!v_.validate(e))throw new E("hint is invalid.");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)};xt.prototype.isDestroyed=function(){return!1};xt.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),ve(this)};function Rp(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(Rp.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});Rp.prototype.getTexture=function(e){const t=this._textures[e];if(!!c(t))return delete this._texturesToRelease[e],++t.count,t.texture};Rp.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){--n.count===0&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures};Rp.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={}};Rp.prototype.isDestroyed=function(){return!1};Rp.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return ve(this)};function rn(){this.high=d.clone(d.ZERO),this.low=d.clone(d.ZERO)}rn.encode=function(e,t){A.typeOf.number("value",e),c(t)||(t={high:0,low:0});let n;return e>=0?(n=Math.floor(e/65536)*65536,t.high=n,t.low=e-n):(n=Math.floor(-e/65536)*65536,t.high=-n,t.low=e+n),t};const Du={high:0,low:0};rn.fromCartesian=function(e,t){A.typeOf.object("cartesian",e),c(t)||(t=new rn);const n=t.high,i=t.low;return rn.encode(e.x,Du),n.x=Du.high,i.x=Du.low,rn.encode(e.y,Du),n.y=Du.high,i.y=Du.low,rn.encode(e.z,Du),n.z=Du.high,i.z=Du.low,t};const JE=new rn;rn.writeElements=function(e,t,n){A.defined("cartesianArray",t),A.typeOf.number("index",n),A.typeOf.number.greaterThanOrEquals("index",n,0),rn.fromCartesian(e,JE);const i=JE.high,o=JE.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z};function _t(e,t){if(A.typeOf.object("normal",e),!R.equalsEpsilon(d.magnitude(e),1,R.EPSILON6))throw new E("normal must be normalized.");A.typeOf.number("distance",t),this.normal=d.clone(e),this.distance=t}_t.fromPointNormal=function(e,t,n){if(A.typeOf.object("point",e),A.typeOf.object("normal",t),!R.equalsEpsilon(d.magnitude(t),1,R.EPSILON6))throw new E("normal must be normalized.");const i=-d.dot(t,e);return c(n)?(d.clone(t,n.normal),n.distance=i,n):new _t(t,i)};const nZ=new d;_t.fromCartesian4=function(e,t){A.typeOf.object("coefficients",e);const n=d.fromCartesian4(e,nZ),i=e.w;if(!R.equalsEpsilon(d.magnitude(n),1,R.EPSILON6))throw new E("normal must be normalized.");return c(t)?(d.clone(n,t.normal),t.distance=i,t):new _t(n,i)};_t.getPointDistance=function(e,t){return A.typeOf.object("plane",e),A.typeOf.object("point",t),d.dot(e.normal,t)+e.distance};const iZ=new d;_t.projectPointOntoPlane=function(e,t,n){A.typeOf.object("plane",e),A.typeOf.object("point",t),c(n)||(n=new d);const i=_t.getPointDistance(e,t),o=d.multiplyByScalar(e.normal,i,iZ);return d.subtract(t,o,n)};const oZ=new L,rZ=new te,sZ=new d;_t.transform=function(e,t,n){A.typeOf.object("plane",e),A.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=L.inverseTranspose(t,oZ);let s=te.fromElements(i.x,i.y,i.z,o,rZ);s=L.multiplyByVector(r,s,s);const a=d.fromCartesian4(s,sZ);return s=te.divideByScalar(s,d.magnitude(a),s),_t.fromCartesian4(s,n)};_t.clone=function(e,t){return A.typeOf.object("plane",e),c(t)?(d.clone(e.normal,t.normal),t.distance=e.distance,t):new _t(e.normal,e.distance)};_t.equals=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.distance===t.distance&&d.equals(e.normal,t.normal)};_t.ORIGIN_XY_PLANE=Object.freeze(new _t(d.UNIT_Z,0));_t.ORIGIN_YZ_PLANE=Object.freeze(new _t(d.UNIT_X,0));_t.ORIGIN_ZX_PLANE=Object.freeze(new _t(d.UNIT_Y,0));function _o(e){this.planes=y(e,[])}const Qy=[new d,new d,new d];d.clone(d.UNIT_X,Qy[0]);d.clone(d.UNIT_Y,Qy[1]);d.clone(d.UNIT_Z,Qy[2]);const Ud=new d,aZ=new d,Sk=new _t(new d(1,0,0),0);_o.fromBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");c(t)||(t=new _o);const n=Qy.length,i=t.planes;i.length=2*n;const o=e.center,r=e.radius;let s=0;for(let a=0;ae.right)throw new E("right must be greater than left.");if(e.bottom>e.top)throw new E("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than 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=L.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(Ki.prototype,{projectionMatrix:{get:function(){return vk(this),this._orthographicMatrix}}});const cZ=new d,lZ=new d,uZ=new d,ew=new d;Ki.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,h=d.cross(t,n,cZ);d.normalize(h,h);const f=lZ;d.multiplyByScalar(t,l,f),d.add(e,f,f);const _=uZ;d.multiplyByScalar(h,a,_),d.add(f,_,_);let g=i[0];return c(g)||(g=i[0]=new te),g.x=h.x,g.y=h.y,g.z=h.z,g.w=-d.dot(h,_),d.multiplyByScalar(h,s,_),d.add(f,_,_),g=i[1],c(g)||(g=i[1]=new te),g.x=-h.x,g.y=-h.y,g.z=-h.z,g.w=-d.dot(d.negate(h,ew),_),d.multiplyByScalar(n,r,_),d.add(f,_,_),g=i[2],c(g)||(g=i[2]=new te),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-d.dot(n,_),d.multiplyByScalar(n,o,_),d.add(f,_,_),g=i[3],c(g)||(g=i[3]=new te),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-d.dot(d.negate(n,ew),_),g=i[4],c(g)||(g=i[4]=new te),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-d.dot(t,f),d.multiplyByScalar(t,u,_),d.add(e,_,_),g=i[5],c(g)||(g=i[5]=new te),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-d.dot(d.negate(t,ew),_),this._cullingVolume};Ki.prototype.getPixelDimensions=function(e,t,n,i,o){if(vk(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required.");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");const r=this.right-this.left,s=this.top-this.bottom,a=i*r/e,l=i*s/t;return o.x=a,o.y=l,o};Ki.prototype.clone=function(e){return c(e)||(e=new Ki),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};Ki.prototype.equals=function(e){return c(e)&&e instanceof Ki&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Ki.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof Ki&&R.equalsEpsilon(this.right,e.right,t,n)&&R.equalsEpsilon(this.left,e.left,t,n)&&R.equalsEpsilon(this.top,e.top,t,n)&&R.equalsEpsilon(this.bottom,e.bottom,t,n)&&R.equalsEpsilon(this.near,e.near,t,n)&&R.equalsEpsilon(this.far,e.far,t,n)};function It(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new Ki,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far}It.packedLength=4;It.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};It.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new It),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function Ih(e){if(!c(e.width)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("width, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new E("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const n=1/e.aspectRatio;t.right=e.width*.5,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}Object.defineProperties(It.prototype,{projectionMatrix:{get:function(){return Ih(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return Ih(this),this._offCenterFrustum}}});It.prototype.computeCullingVolume=function(e,t,n){return Ih(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};It.prototype.getPixelDimensions=function(e,t,n,i,o){return Ih(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};It.prototype.clone=function(e){return c(e)||(e=new It),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};It.prototype.equals=function(e){return!c(e)||!(e instanceof It)?!1:(Ih(this),Ih(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};It.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof It)?!1:(Ih(this),Ih(e),R.equalsEpsilon(this.width,e.width,t,n)&&R.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const OP={};function dZ(e){const t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}const hZ=32.184,fZ=2451545;function Ik(e,t){t=ie.addSeconds(e,hZ,t);const n=ie.totalDays(t)-fZ;return t=ie.addSeconds(t,dZ(n),t),t}const wx=new ie(2451545,0,fn.TAI),pZ=1e3,rc=R.RADIANS_PER_DEGREE,ma=R.RADIANS_PER_ARCSECOND,qr=14959787e4,KL=new $;function Dk(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=R.PI),n<0||n>R.PI)throw new E("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");const a=e*(1-t),l=i-o,u=o,h=_Z(r-i,t);if(mZ(t,0)==="Hyperbolic"&&Math.abs(R.negativePiToPi(h))>=Math.acos(-1/t))throw new E("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");TZ(l,n,u,KL);const _=a*(1+t),g=Math.cos(h),m=Math.sin(h),b=1+t*g;if(b<=R.Epsilon10)throw new E("elements cannot be converted to cartesian");const T=_/b;return c(s)?(s.x=T*g,s.y=T*m,s.z=0):s=new d(T*g,T*m,0),$.multiplyByVector(KL,s,s)}function mZ(e,t){if(e<0)throw new E("eccentricity cannot be negative.");return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function _Z(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=yZ(e,t);return bZ(n,t)}const ZL=50,gZ=R.EPSILON8;function yZ(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=Math.floor(e/R.TWO_PI);e-=n*R.TWO_PI;let i=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE,r;for(r=0;rgZ;++r){o=i;const s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=ZL)throw new E("Kepler equation did not converge");return o=i+n*R.TWO_PI,o}function bZ(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=Math.floor(e/R.TWO_PI);e-=n*R.TWO_PI;const i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t);let r=Math.atan2(o,i);return r=R.zeroToTwoPi(r),e<0&&(r-=R.TWO_PI),r+=n*R.TWO_PI,r}function TZ(e,t,n,i){if(t<0||t>R.PI)throw new E("inclination out of range");const o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),l=Math.cos(n),u=Math.sin(n);return c(i)?(i[0]=l*o-u*r*s,i[1]=u*o+l*r*s,i[2]=r*a,i[3]=-l*r-u*o*s,i[4]=-u*r+l*o*s,i[5]=o*a,i[6]=u*a,i[7]=-l*a,i[8]=s):i=new $(l*o-u*r*s,-l*r-u*o*s,u*a,u*o+l*r*s,-u*r+l*o*s,-l*a,r*a,o*a,s),i}const AZ=1.0000010178*qr,xZ=100.46645683*rc,CZ=129597742283429e-5*ma,JL=16002,eR=21863,tR=32004,nR=10931,iR=14529,oR=16368,rR=15318,sR=32794,EZ=64*1e-7*qr,wZ=-152*1e-7*qr,SZ=62*1e-7*qr,vZ=-8*1e-7*qr,IZ=32*1e-7*qr,DZ=-41*1e-7*qr,PZ=19*1e-7*qr,OZ=-11*1e-7*qr,LZ=-150*1e-7*qr,RZ=-46*1e-7*qr,NZ=68*1e-7*qr,MZ=54*1e-7*qr,FZ=14*1e-7*qr,BZ=24*1e-7*qr,zZ=-28*1e-7*qr,UZ=22*1e-7*qr,aR=10,cR=16002,lR=21863,uR=10931,dR=1473,hR=32004,fR=4387,pR=73,kZ=-325*1e-7,VZ=-322*1e-7,HZ=-79*1e-7,GZ=232*1e-7,jZ=-52*1e-7,WZ=97*1e-7,qZ=55*1e-7,YZ=-41*1e-7,$Z=-105*1e-7,XZ=-137*1e-7,QZ=258*1e-7,KZ=35*1e-7,ZZ=-116*1e-7,JZ=-88*1e-7,eJ=-112*1e-7,tJ=-80*1e-7,n_=new ie(0,0,fn.TAI);function nJ(e,t){Ik(e,n_);const i=(n_.dayNumber-wx.dayNumber+(n_.secondsOfDay-wx.secondsOfDay)/qn.SECONDS_PER_DAY)/(qn.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=AZ+EZ*Math.cos(JL*o)+LZ*Math.sin(JL*o)+wZ*Math.cos(eR*o)+RZ*Math.sin(eR*o)+SZ*Math.cos(tR*o)+NZ*Math.sin(tR*o)+vZ*Math.cos(nR*o)+MZ*Math.sin(nR*o)+IZ*Math.cos(iR*o)+FZ*Math.sin(iR*o)+DZ*Math.cos(oR*o)+BZ*Math.sin(oR*o)+PZ*Math.cos(rR*o)+zZ*Math.sin(rR*o)+OZ*Math.cos(sR*o)+UZ*Math.sin(sR*o),s=xZ+CZ*i+kZ*Math.cos(aR*o)+$Z*Math.sin(aR*o)+VZ*Math.cos(cR*o)+XZ*Math.sin(cR*o)+HZ*Math.cos(lR*o)+QZ*Math.sin(lR*o)+GZ*Math.cos(uR*o)+KZ*Math.sin(uR*o)+jZ*Math.cos(dR*o)+ZZ*Math.sin(dR*o)+WZ*Math.cos(hR*o)+JZ*Math.sin(hR*o)+qZ*Math.cos(fR*o)+eJ*Math.sin(fR*o)+YZ*Math.cos(pR*o)+tJ*Math.sin(pR*o),a=.0167086342-.0004203654*i,l=102.93734808*rc+11612.3529*ma*i,u=469.97289*ma*i,h=174.87317577*rc-8679.27034*ma*i;return Dk(r,a,u,l,h,s,t)}function Pk(e,t){Ik(e,n_);const i=(n_.dayNumber-wx.dayNumber+(n_.secondsOfDay-wx.secondsOfDay)/qn.SECONDS_PER_DAY)/qn.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i;let a=383397.7725+.004*i,l=.055545526-16e-9*i;const u=5.15668983*rc;let h=-8e-5*i+.02966*o-42e-6*r-13e-8*s;const f=83.35324312*rc;let _=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s;const g=125.04455501*rc;let m=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s;const b=218.31664563*rc;let T=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s;const x=297.85019547*rc+ma*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),C=93.27209062*rc+ma*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),w=134.96340251*rc+ma*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),v=357.52910918*rc+ma*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),P=310.17137918*rc-ma*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),N=2*x,k=4*x,M=6*x,U=2*w,B=3*w,S=4*w,D=2*C;a+=3400.4*Math.cos(N)-635.6*Math.cos(N-w)-235.6*Math.cos(w)+218.1*Math.cos(N-v)+181*Math.cos(N+w),l+=.014216*Math.cos(N-w)+.008551*Math.cos(N-U)-.001383*Math.cos(w)+.001356*Math.cos(N+w)-.001147*Math.cos(k-B)-914e-6*Math.cos(k-U)+869e-6*Math.cos(N-v-w)-627e-6*Math.cos(N)-394e-6*Math.cos(k-S)+282e-6*Math.cos(N-v-U)-279e-6*Math.cos(x-w)-236e-6*Math.cos(U)+231e-6*Math.cos(k)+229e-6*Math.cos(M-S)-201e-6*Math.cos(U-D),h+=486.26*Math.cos(N-D)-40.13*Math.cos(N)+37.51*Math.cos(D)+25.73*Math.cos(U-D)+19.97*Math.cos(N-v-D),_+=-55609*Math.sin(N-w)-34711*Math.sin(N-U)-9792*Math.sin(w)+9385*Math.sin(k-B)+7505*Math.sin(k-U)+5318*Math.sin(N+w)+3484*Math.sin(k-S)-3417*Math.sin(N-v-w)-2530*Math.sin(M-S)-2376*Math.sin(N)-2075*Math.sin(N-B)-1883*Math.sin(U)-1736*Math.sin(M-5*w)+1626*Math.sin(v)-1370*Math.sin(M-B),m+=-5392*Math.sin(N-D)-540*Math.sin(v)-441*Math.sin(N)+423*Math.sin(D)-288*Math.sin(U-D),T+=-3332.9*Math.sin(N)+1197.4*Math.sin(N-w)-662.5*Math.sin(v)+396.3*Math.sin(w)-218*Math.sin(N-v);const p=2*P,I=3*P;h+=46.997*Math.cos(P)*i-.614*Math.cos(N-D+P)*i+.614*Math.cos(N-D-P)*i-.0297*Math.cos(p)*o-.0335*Math.cos(P)*o+.0012*Math.cos(N-D+p)*o-16e-5*Math.cos(P)*r+4e-5*Math.cos(I)*r+4e-5*Math.cos(p)*r;const O=2.116*Math.sin(P)*i-.111*Math.sin(N-D-P)*i-.0015*Math.sin(P)*o;_+=O,T+=O,m+=-520.77*Math.sin(P)*i+13.66*Math.sin(N-D+P)*i+1.12*Math.sin(N-P)*i-1.06*Math.sin(D-P)*i+.66*Math.sin(p)*o+.371*Math.sin(P)*o-.035*Math.sin(N-D+p)*o-.015*Math.sin(N-D+P)*o+.0014*Math.sin(P)*r-.0011*Math.sin(I)*r-9e-4*Math.sin(p)*r,a*=pZ;const F=u+h*ma,V=f+_*ma,G=b+T*ma,j=g+m*ma;return Dk(a,l,F,V,j,G,t)}const mR=.012300034,iJ=mR/(mR+1)*-1;function oJ(e,t){return t=Pk(e,t),d.multiplyByScalar(t,iJ,t)}const Ok=new $(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let gg=new d;OP.computeSunPositionInEarthInertialFrame=function(e,t){return c(e)||(e=ie.now()),c(t)||(t=new d),gg=nJ(e,gg),t=d.negate(gg,t),oJ(e,gg),d.subtract(t,gg,t),$.multiplyByVector(Ok,t,t),t};OP.computeMoonPositionInEarthInertialFrame=function(e,t){return c(e)||(e=ie.now()),t=Pk(e,t),$.multiplyByVector(Ok,t,t),t};const CI=OP,BA={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};BA.getMorphTime=function(e){return e===BA.SCENE3D?1:e===BA.MORPHING?void 0:0};const oe=Object.freeze(BA);function bC(e){e=y(e,y.EMPTY_OBJECT),this.color=z.clone(y(e.color,z.WHITE)),this.intensity=y(e.intensity,2)}function V_(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Re,this._viewportCartesian4=new te,this._viewportDirty=!1,this._viewportOrthographicMatrix=L.clone(L.IDENTITY),this._viewportTransformation=L.clone(L.IDENTITY),this._model=L.clone(L.IDENTITY),this._view=L.clone(L.IDENTITY),this._inverseView=L.clone(L.IDENTITY),this._projection=L.clone(L.IDENTITY),this._infiniteProjection=L.clone(L.IDENTITY),this._entireFrustum=new H,this._currentFrustum=new H,this._frustumPlanes=new te,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=$.clone(L.IDENTITY),this._view3DDirty=!0,this._view3D=new L,this._inverseView3DDirty=!0,this._inverseView3D=new L,this._inverseModelDirty=!0,this._inverseModel=new L,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new $,this._viewRotation=new $,this._inverseViewRotation=new $,this._viewRotation3D=new $,this._inverseViewRotation3D=new $,this._inverseProjectionDirty=!0,this._inverseProjection=new L,this._modelViewDirty=!0,this._modelView=new L,this._modelView3DDirty=!0,this._modelView3D=new L,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new L,this._inverseModelViewDirty=!0,this._inverseModelView=new L,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new L,this._viewProjectionDirty=!0,this._viewProjection=new L,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new L,this._modelViewProjectionDirty=!0,this._modelViewProjection=new L,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new L,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new L,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new L,this._normalDirty=!0,this._normal=new $,this._normal3DDirty=!0,this._normal3D=new $,this._inverseNormalDirty=!0,this._inverseNormal=new $,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new $,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new rn,this._cameraPosition=new d,this._sunPositionWC=new d,this._sunPositionColumbusView=new d,this._sunDirectionWC=new d,this._sunDirectionEC=new d,this._moonDirectionEC=new d,this._lightDirectionWC=new d,this._lightDirectionEC=new d,this._lightColor=new d,this._lightColorHdr=new d,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new d,this._cameraRight=new d,this._cameraUp=new d,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new H,this._eyeEllipsoidNormalEC=new d,this._eyeEllipsoidCurvature=new H,this._modelToEnu=new L,this._enuToModel=new L,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new z,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new H,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._fogMinimumBrightness=void 0,this._atmosphereHsbShift=void 0,this._atmosphereLightIntensity=void 0,this._atmosphereRayleighCoefficient=new d,this._atmosphereRayleighScaleHeight=new d,this._atmosphereMieCoefficient=new d,this._atmosphereMieScaleHeight=void 0,this._atmosphereMieAnisotropy=void 0,this._atmosphereDynamicLighting=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties(V_.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!Re.equals(e,this._viewport)){Re.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 gR(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return gR(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){L.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,L.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,L.getMatrix3(this.inverseModel,e),$.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return tw(this),this._view3D}},viewRotation:{get:function(){return tw(this),this._viewRotation}},viewRotation3D:{get:function(){return tw(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return TR(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return TR(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return mJ(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return _J(this),this._modelView}},modelView3D:{get:function(){return gJ(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return CJ(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return yJ(this),this._inverseModelView}},inverseModelView3D:{get:function(){return bJ(this),this._inverseModelView3D}},viewProjection:{get:function(){return TJ(this),this._viewProjection}},inverseViewProjection:{get:function(){return AJ(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return xJ(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return EJ(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return wJ(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return SJ(this),this._modelViewInfiniteProjection}},normal:{get:function(){return vJ(this),this._normal}},normal3D:{get:function(){return IJ(this),this._normal3D}},inverseNormal:{get:function(){return DJ(this),this._inverseNormal}},inverseNormal3D:{get:function(){return PJ(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}},eyeEllipsoidNormalEC:{get:function(){return this._eyeEllipsoidNormalEC}},eyeEllipsoidCurvature:{get:function(){return this._eyeEllipsoidCurvature}},modelToEnu:{get:function(){return this._modelToEnu}},enuToModel:{get:function(){return this._enuToModel}},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 bR(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return bR(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},fogMinimumBrightness:{get:function(){return this._fogMinimumBrightness}},atmosphereHsbShift:{get:function(){return this._atmosphereHsbShift}},atmosphereLightIntensity:{get:function(){return this._atmosphereLightIntensity}},atmosphereRayleighCoefficient:{get:function(){return this._atmosphereRayleighCoefficient}},atmosphereRayleighScaleHeight:{get:function(){return this._atmosphereRayleighScaleHeight}},atmosphereMieCoefficient:{get:function(){return this._atmosphereMieCoefficient}},atmosphereMieScaleHeight:{get:function(){return this._atmosphereMieScaleHeight}},atmosphereMieAnisotropy:{get:function(){return this._atmosphereMieAnisotropy}},atmosphereDynamicLighting:{get:function(){return this._atmosphereDynamicLighting}},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}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return y(this._ellipsoid,ae.WGS84)}}});function rJ(e,t){L.clone(t,e._view),L.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 sJ(e,t){L.clone(t,e._inverseView),L.getMatrix3(t,e._inverseViewRotation)}function aJ(e,t){L.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function cJ(e,t){L.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}const _R=new d,lJ=new L;function uJ(e,t){d.clone(t.positionWC,e._cameraPosition),d.clone(t.directionWC,e._cameraDirection),d.clone(t.rightWC,e._cameraRight),d.clone(t.upWC,e._cameraUp);const n=e._ellipsoid;let i;const o=t.positionCartographic;if(c(o)?(e._eyeHeight=o.height,e._eyeEllipsoidNormalEC=n.geodeticSurfaceNormalCartographic(o,e._eyeEllipsoidNormalEC),i=d.fromRadians(o.longitude,o.latitude,0,n,_R)):(e._eyeHeight=-n.maximumRadius,d.magnitude(t.positionWC)>0&&(e._eyeEllipsoidNormalEC=d.normalize(t.positionWC,e._eyeEllipsoidNormalEC)),i=n.scaleToGeodeticSurface(t.positionWC,_R)),e._encodedCameraPositionMCDirty=!0,!c(i))return;e._eyeEllipsoidNormalEC=$.multiplyByVector(e._viewRotation,e._eyeEllipsoidNormalEC,e._eyeEllipsoidNormalEC);const r=zt.eastNorthUpToFixedFrame(i,n,lJ);e._enuToModel=L.multiplyTransformation(e.inverseModel,r,e._enuToModel),e._modelToEnu=L.inverseTransformation(e._enuToModel,e._modelToEnu),R.equalsEpsilon(n._radii.x,n._radii.y,R.EPSILON15)&&(e._eyeEllipsoidCurvature=n.getLocalCurvature(i,e._eyeEllipsoidCurvature))}let yg=new $;const dJ=new he;function hJ(e,t){c(zt.computeIcrfToFixedMatrix(t.time,yg))||(yg=zt.computeTemeToPseudoFixedMatrix(t.time,yg));let n=CI.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);$.multiplyByVector(yg,n,n),d.normalize(n,e._sunDirectionWC),n=$.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),d.normalize(n,n),n=CI.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),$.multiplyByVector(yg,n,n),$.multiplyByVector(e.viewRotation3D,n,n),d.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,dJ);i.project(r,e._sunPositionColumbusView)}V_.prototype.updateCamera=function(e){rJ(this,e.viewMatrix),sJ(this,e.inverseViewMatrix),uJ(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==oe.SCENE2D&&e.frustum instanceof It};V_.prototype.updateFrustum=function(e){aJ(this,e.projectionMatrix),c(e.infiniteProjectionMatrix)&&cJ(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=R.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne;const t=e.offCenterFrustum;c(t)&&(e=t),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right};V_.prototype.updatePass=function(e){this._pass=e};const fJ=[],pJ=new bC;V_.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===oe.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=this._frustum2DWidth*.5,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),hJ(this,e);const n=y(e.light,pJ);n instanceof bC?(this._lightDirectionWC=d.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=d.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=d.normalize(d.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=$.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=d.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=d.multiplyByScalar(o,n.intensity,o);const r=d.maximumComponent(o);r>1?d.divideByScalar(o,r,this._lightColor):d.clone(o,this._lightColor);const s=e.brdfLutGenerator,a=c(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=y(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=y(e.sphericalHarmonicCoefficients,fJ),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,c(this._specularEnvironmentMaps)&&H.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._fogMinimumBrightness=e.fog.minimumBrightness;const l=e.atmosphere;c(l)&&(this._atmosphereHsbShift=d.fromElements(l.hueShift,l.saturationShift,l.brightnessShift,this._atmosphereHsbShift),this._atmosphereLightIntensity=l.lightIntensity,this._atmosphereRayleighCoefficient=d.clone(l.rayleighCoefficient,this._atmosphereRayleighCoefficient),this._atmosphereRayleighScaleHeight=l.rayleighScaleHeight,this._atmosphereMieCoefficient=d.clone(l.mieCoefficient,this._atmosphereMieCoefficient),this._atmosphereMieScaleHeight=l.mieScaleHeight,this._atmosphereMieAnisotropy=l.mieAnisotropy,this._atmosphereDynamicLighting=l.dynamicLighting),this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=zt.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const u=t.frustum.fov,h=this._viewport;let f;c(u)?h.height>h.width?f=Math.tan(.5*u)*2/h.height:f=Math.tan(.5*u)*2/h.width:f=1/Math.max(h.width,h.height),this._geometricToleranceOverMeter=f*e.maximumScreenSpaceError,z.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function gR(e){if(e._viewportDirty){const t=e._viewport;L.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),L.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function mJ(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==oe.SCENE2D&&e._mode!==oe.MORPHING&&!e._orthographicIn3D?L.inverse(e._projection,e._inverseProjection):L.clone(L.ZERO,e._inverseProjection))}function _J(e){e._modelViewDirty&&(e._modelViewDirty=!1,L.multiplyTransformation(e._view,e._model,e._modelView))}function gJ(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,L.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function yJ(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,L.inverse(e.modelView,e._inverseModelView))}function bJ(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,L.inverse(e.modelView3D,e._inverseModelView3D))}function TJ(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,L.multiply(e._projection,e._view,e._viewProjection))}function AJ(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,L.inverse(e.viewProjection,e._inverseViewProjection))}function xJ(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,L.multiply(e._projection,e.modelView,e._modelViewProjection))}function CJ(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 EJ(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,L.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function wJ(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,L.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function SJ(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,L.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function vJ(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;L.getMatrix3(e.inverseModelView,t),$.transpose(t,t)}}function IJ(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;L.getMatrix3(e.inverseModelView3D,t),$.transpose(t,t)}}function DJ(e){if(e._inverseNormalDirty){e._inverseNormalDirty=!1;const t=e._inverseNormal;L.getMatrix3(e.modelView,t),$.transpose(t,t)}}function PJ(e){if(e._inverseNormal3DDirty){e._inverseNormal3DDirty=!1;const t=e._inverseNormal3D;L.getMatrix3(e.modelView3D,t),$.transpose(t,t)}}const yR=new d;function bR(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,L.multiplyByPoint(e.inverseModel,e._cameraPosition,yR),rn.fromCartesian(yR,e._encodedCameraPositionMC))}const OJ=new d,LJ=new d,RJ=new d,NJ=new d,MJ=new he,FJ=new d,BJ=new L;function zJ(e,t,n,i,o,r,s,a){const l=OJ;l.x=e.y,l.y=e.z,l.z=e.x;const u=LJ;u.x=n.y,u.y=n.z,u.z=n.x;const h=RJ;h.x=i.y,h.y=i.z,h.z=i.x;const f=NJ;f.x=t.y,f.y=t.z,f.z=t.x,r===oe.SCENE2D&&(l.z=o*.5);const _=s.unproject(l,MJ);_.longitude=R.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=R.clamp(_.latitude,-R.PI_OVER_TWO,R.PI_OVER_TWO);const g=s.ellipsoid,m=g.cartographicToCartesian(_,FJ),b=zt.eastNorthUpToFixedFrame(m,g,BJ);return L.multiplyByPointAsVector(b,u,u),L.multiplyByPointAsVector(b,h,h),L.multiplyByPointAsVector(b,f,f),c(a)||(a=new L),a[0]=u.x,a[1]=h.x,a[2]=-f.x,a[3]=0,a[4]=u.y,a[5]=h.y,a[6]=-f.y,a[7]=0,a[8]=u.z,a[9]=h.z,a[10]=-f.z,a[11]=0,a[12]=-d.dot(u,m),a[13]=-d.dot(h,m),a[14]=d.dot(f,m),a[15]=1,a}function tw(e){e._view3DDirty&&(e._mode===oe.SCENE3D?L.clone(e._view,e._view3D):zJ(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),L.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function TR(e){e._inverseView3DDirty&&(L.inverseTransformation(e.view3D,e._inverseView3D),L.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function UJ(e,t,n,i){const o=c(t.vertexBuffer),r=c(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new E("attribute must have a vertexBuffer or a value.");if(o&&r)throw new E("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(s!==1&&s!==2&&s!==3&&s!==4)throw r?new E("attribute.value.length must be in the range [1, 4]."):new E("attribute.componentsPerAttribute must be in the range [1, 4].");if(c(t.componentDatatype)&&!Z.validate(t.componentDatatype))throw new E("attribute must have a valid componentDatatype or not specify it.");if(c(t.strideInBytes)&&t.strideInBytes>255)throw new E("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new E("instanced arrays is not supported");if(c(t.instanceDivisor)&&t.instanceDivisor<0)throw new E("attribute must have an instanceDivisor greater than or equal to zero");if(c(t.instanceDivisor)&&r)throw new E("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&t.index===0)throw new E("attribute zero cannot have an instanceDivisor greater than 0");const a={index:y(t.index,n),enabled:y(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:y(t.componentDatatype,Z.FLOAT),normalize:y(t.normalize,!1),offsetInBytes:y(t.offsetInBytes,0),strideInBytes:y(t.strideInBytes,0),instanceDivisor:y(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(l){const u=this.index;l.bindBuffer(l.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),l.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),l.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(l){l.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(l){l.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(l){l.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(l){l.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(l){l.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(l){}}e.push(a)}function Lk(e,t,n){for(let i=0;i0&&(l=!0),c(s[r].value)&&(u=!0);const f={};for(r=0;r0)for(r=AR(e[o[0]]),t=1;t0){const u=Z.getSizeInBytes(e[o[0]].componentDatatype),h=a%u;h!==0&&(a+=u-h);const f=r*a,_=new ArrayBuffer(f),g={};for(t=0;t=R.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?_=ct.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:je.UNSIGNED_INT}):_=ct.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:je.UNSIGNED_SHORT})),new Ci({context:t,attributes:h,indexBuffer:_})};Object.defineProperties(Ci.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});Ci.prototype.getAttribute=function(e){return A.defined("index",e),this._attributes[e]};function HJ(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=pt.maximumVertexAttributes;let s;if(n){const a=o.length;for(s=0;s0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function GJ(e,t){const n=e._attributes,i=n.length;for(let o=0;o"u")throw new Te("The browser does not support WebGL. Visit http://get.webgl.org.");!n&&!(typeof WebGL2RenderingContext<"u")&&(n=!0);const o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!c(r))throw new Te("The browser supports WebGL, but initialization failed.");return r}function WJ(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 qJ(e,t,n,i){let o=`${WJ(e,i)}: ${t.name}(`;for(let r=0;r=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},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=XJ(this._originalGLContext,e?YJ:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new xt({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return this._defaultEmissiveTexture===void 0&&(this._defaultEmissiveTexture=new xt({context:this,pixelFormat:Ve.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return this._defaultNormalTexture===void 0&&(this._defaultNormalTexture=new xt({context:this,pixelFormat:Ve.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(this._defaultCubeMap===void 0){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new Sl({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 QJ}}});function KJ(e){if(e.validateFramebuffer){const t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let i;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:i="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:i="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:i="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:i="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";break}throw new E(i)}}}function Rk(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,Ue.partialApply(e._gl,o,t,r,n,i)}let LP;typeof WebGLRenderingContext<"u"&&(LP=[J.BACK]);function RP(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=LP;if(c(t))t._bind(),KJ(e),n=t._getActiveColorAttachments();else{const i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}const ZJ=new bi;Va.prototype.clear=function(e,t){e=y(e,ZJ),t=y(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;c(o)&&(z.equals(this._clearColor,o)||(z.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),c(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),c(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);const a=y(e.renderState,this._defaultRenderState);Rk(this,a,t,!0);const l=y(e.framebuffer,t.framebuffer);RP(this,l),n.clear(i)};function JJ(e,t,n,i,o){if(c(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new E("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");RP(e,t),Rk(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function eee(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const l=t.instanceCount;if(!ze.validate(o))throw new E("drawCommand.primitiveType is required and must be valid.");if(A.defined("drawCommand.vertexArray",r),A.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),c(a)&&A.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),A.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",l,0),l>0&&!e.instancedArrays)throw new E("Instanced arrays extension is not supported");e._us.model=y(t._modelMatrix,L.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();const u=r.indexBuffer;c(u)?(s=s*u.bytesPerIndex,c(a)?a=Math.min(a,u.numberOfIndices):a=u.numberOfIndices,l===0?e._gl.drawElements(o,a,u.indexDatatype,s):e.glDrawElementsInstanced(o,a,u.indexDatatype,s,l)):(c(a)?a=Math.min(a,r.numberOfVertices):a=r.numberOfVertices,l===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,l)),r._unBind()}Va.prototype.draw=function(e,t,n,i){A.defined("drawCommand",e),A.defined("drawCommand.shaderProgram",e._shaderProgram),t=y(t,this._defaultPassState);const o=y(e._framebuffer,t.framebuffer),r=y(e._renderState,this._defaultRenderState);n=y(n,e._shaderProgram),i=y(i,e._uniformMap),JJ(this,o,t,n,r),eee(this,e,n,i)};Va.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=LP;this.drawBuffers&&this.glDrawBuffers(t);const n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let i=0;i0&&(a=s.getColorTexture(0).pixelDatatype);const l=Ve.createTypedArray(Ve.RGBA,a,o,r);return RP(this,s),t.readPixels(n,i,o,r,Ve.RGBA,Me.toWebGLConstant(a,this),l),l};const Nk={position:0,textureCoordinates:1};Va.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!c(e)){const t=new Tt({attributes:{position:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:ze.TRIANGLES});e=Ci.fromGeometry({context:this,geometry:t,attributeLocations:Nk,bufferUsage:ke.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Va.prototype.createViewportQuadCommand=function(e,t){return t=y(t,y.EMPTY_OBJECT),new Ze({vertexArray:this.getViewportQuadVertexArray(),primitiveType:ze.TRIANGLES,renderState:t.renderState,shaderProgram:Jt.fromCache({context:this,vertexShaderSource:RU,fragmentShaderSource:e,attributeLocations:Nk}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Va.prototype.getObjectByPickColor=function(e){return A.defined("pickColor",e),this._pickObjects[e.toRgba()]};function NP(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(NP.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});NP.prototype.destroy=function(){delete this._pickObjects[this.key]};Va.prototype.createPickId=function(e){A.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(t===0)throw new Te("Out of unique Pick IDs.");return this._pickObjects[t]=e,new NP(this._pickObjects,t,z.fromRgba(t))};Va.prototype.isDestroyed=function(){return!1};Va.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];c(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(),ve(this)};Va._deprecationWarning=Xh;function H_(e){e=y(e,y.EMPTY_OBJECT);const t=e.context,n=e.width,i=e.height;A.defined("options.context",t),A.defined("options.width",n),A.defined("options.height",i),this._width=n,this._height=i;const o=e.colorRenderbuffers,r=e.colorTextures;if(c(o)!==c(r))throw new E("Both color renderbuffer and texture attachments must be provided.");const s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(c(s)!==c(a))throw new E("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new ur({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new ur({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}H_.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};H_.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};H_.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const n=e._gl;let i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),c(this._colorFramebuffer.depthStencilTexture)&&(i|=n.DEPTH_BUFFER_BIT|(t?n.STENCIL_BUFFER_BIT:0)),n.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,i,n.NEAREST),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null)};H_.prototype.isDestroyed=function(){return!1};H_.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),ve(this)};const Zs={RGBA4:J.RGBA4,RGBA8:J.RGBA8,RGBA16F:J.RGBA16F,RGBA32F:J.RGBA32F,RGB5_A1:J.RGB5_A1,RGB565:J.RGB565,DEPTH_COMPONENT16:J.DEPTH_COMPONENT16,STENCIL_INDEX8:J.STENCIL_INDEX8,DEPTH_STENCIL:J.DEPTH_STENCIL,DEPTH24_STENCIL8:J.DEPTH24_STENCIL8,validate:function(e){return e===Zs.RGBA4||e===Zs.RGBA8||e===Zs.RGBA16F||e===Zs.RGBA32F||e===Zs.RGB5_A1||e===Zs.RGB565||e===Zs.DEPTH_COMPONENT16||e===Zs.STENCIL_INDEX8||e===Zs.DEPTH_STENCIL||e===Zs.DEPTH24_STENCIL8},getColorFormat:function(e){return e===J.FLOAT?Zs.RGBA32F:e===J.HALF_FLOAT_OES?Zs.RGBA16F:Zs.RGBA8}},qu=Object.freeze(Zs);function cl(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const n=e.context._gl,i=pt.maximumRenderbufferSize,o=y(e.format,qu.RGBA4),r=c(e.width)?e.width:n.drawingBufferWidth,s=c(e.height)?e.height:n.drawingBufferHeight,a=y(e.numSamples,1);if(!qu.validate(o))throw new E("Invalid format.");if(A.typeOf.number.greaterThan("width",r,0),r>i)throw new E(`Width must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);if(A.typeOf.number.greaterThan("height",s,0),s>i)throw new E(`Height must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);this._gl=n,this._format=o,this._width=r,this._height=s,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),a>1?n.renderbufferStorageMultisample(n.RENDERBUFFER,a,o,r,s):n.renderbufferStorage(n.RENDERBUFFER,o,r,s),n.bindRenderbuffer(n.RENDERBUFFER,null)}Object.defineProperties(cl.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});cl.prototype._getRenderbuffer=function(){return this._renderbuffer};cl.prototype.isDestroyed=function(){return!1};cl.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),ve(this)};function on(e){if(e=y(e,y.EMPTY_OBJECT),this._numSamples=y(e.numSamples,1),this._colorAttachmentsLength=y(e.colorAttachmentsLength,1),this._color=y(e.color,!0),this._depth=y(e.depth,!1),this._depthStencil=y(e.depthStencil,!1),this._supportsDepthTexture=y(e.supportsDepthTexture,!1),!this._color&&!this._depth&&!this._depthStencil)throw new E("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new E("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=y(e.createColorAttachments,!0),this._createDepthAttachments=y(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(on.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}});on.prototype.isDirty=function(e,t,n,i,o){n=y(n,1);const r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=c(i)&&this._pixelDatatype!==i||c(o)&&this._pixelFormat!==o,l=c(n===1?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!l||this._color&&!c(this._colorTextures[0])};on.prototype.update=function(e,t,n,i,o,r){if(!c(t)||!c(n))throw new E("width and height must be defined.");if(i=e.msaa?y(i,1):1,o=y(o,this._color?y(this._pixelDatatype,Me.UNSIGNED_BYTE):void 0),r=y(r,this._color?y(this._pixelFormat,Ve.RGBA):void 0),this.isDirty(t,n,i,o,r)){if(this.destroy(),this._width=t,this._height=n,this._numSamples=i,this._pixelDatatype=o,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments){for(let s=0;s1){const a=qu.getColorFormat(o);this._colorRenderbuffers[s]=new cl({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new xt({context:e,width:t,height:n,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new xt({context:e,width:t,height:n,pixelFormat:Ve.DEPTH_COMPONENT,pixelDatatype:Me.UNSIGNED_INT,sampler:un.NEAREST}):this._depthRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new H_({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new ur({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};on.prototype.getColorTexture=function(e){if(e=y(e,0),e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorTextures[e]};on.prototype.setColorTexture=function(e,t){if(t=y(t,0),this._createColorAttachments)throw new E("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};on.prototype.getColorRenderbuffer=function(e){if(e=y(e,0),e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]};on.prototype.setColorRenderbuffer=function(e,t){if(t=y(t,0),this._createColorAttachments)throw new E("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};on.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};on.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};on.prototype.getDepthTexture=function(){return this._depthTexture};on.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};on.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};on.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};on.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};on.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};on.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};on.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};on.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};on.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e0?Z.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};qo._createArrayViews=function(e,t){const n=[];let i=0;const o=e.length;for(let r=0;r0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(c(e.arrayBuffer)){const r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let l=0;l0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=c(n);if(!o||n.sizeInBytes=this._size)throw new E("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new E("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");const n=this._allBuffers;for(let i=0,o=n.length;i0){const i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}qo.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t0&&(this._hash={},e.length=0)};function Pt(e,t){e=y(e,0),this._near=e,t=y(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(Pt.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}}});Pt.packedLength=2;Pt.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),t[n++]=e.near,t[n]=e.far,t};Pt.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=y(t,0),c(n)||(n=new Pt),n.near=e[t++],n.far=e[t],n};Pt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.far===t.far};Pt.clone=function(e,t){if(!!c(e))return c(t)||(t=new Pt),t.near=e.near,t.far=e.far,t};Pt.prototype.clone=function(e){return Pt.clone(this,e)};Pt.prototype.equals=function(e){return Pt.equals(this,e)};function vt(e,t,n,i){this.near=y(e,0),this.nearValue=y(t,0),this.far=y(n,1),this.farValue=y(i,0)}vt.clone=function(e,t){if(!!c(e))return c(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new vt(e.near,e.nearValue,e.far,e.farValue)};vt.packedLength=4;vt.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};vt.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=y(t,0),c(n)||(n=new vt),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};vt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};vt.prototype.clone=function(e){return vt.clone(this,e)};vt.prototype.equals=function(e){return vt.equals(this,e)};const Kf={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2,CLAMP_TO_TERRAIN:3,RELATIVE_TO_TERRAIN:4,CLAMP_TO_3D_TILE:5,RELATIVE_TO_3D_TILE:6},gt=Object.freeze(Kf);function Np(e){return e===Kf.CLAMP_TO_GROUND||e===Kf.CLAMP_TO_3D_TILE||e===Kf.CLAMP_TO_TERRAIN}function zP(e){return e===Kf.RELATIVE_TO_GROUND||e===Kf.RELATIVE_TO_3D_TILE||e===Kf.RELATIVE_TO_TERRAIN}const uee={CENTER:0,LEFT:1,RIGHT:-1},Fs=Object.freeze(uee),dee={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},si=Object.freeze(dee),hee={DONE:0,PENDING:1,FAILED:2},rt=Object.freeze(hee);function K(){E.throwInstantiationError()}Object.defineProperties(K.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});K.prototype.getValue=E.throwInstantiationError;K.prototype.equals=E.throwInstantiationError;K.equals=function(e,t){return e===t||c(e)&&e.equals(t)};K.arrayEquals=function(e,t){if(e===t)return!0;if(!c(e)||!c(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i-1;o--)r=t[o],c(r._billboard)&&c(r._position)&&s.set(r.id,new xR(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._billboard)&&c(r._position)?s.contains(r.id)||s.set(r.id,new xR(r)):(EI(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],EI(s.get(r.id),r,a),s.remove(r.id)};function EI(e,t,n){c(e)&&(e.billboard=void 0,n.removeBillboard(t))}function Yu(e,t){this.start=y(e,0),this.stop=y(t,0)}function se(e,t){this.center=d.clone(y(e,d.ZERO)),this.radius=y(t,0)}const UP=new d,kP=new d,VP=new d,HP=new d,GP=new d,jP=new d,WP=new d,xr=new d,qP=new d,YP=new d,$P=new d,XP=new d,Lee=4/3*R.PI;se.fromPoints=function(e,t){if(c(t)||(t=new se),!c(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=d.clone(e[0],WP),i=d.clone(n,UP),o=d.clone(n,kP),r=d.clone(n,VP),s=d.clone(n,HP),a=d.clone(n,GP),l=d.clone(n,jP),u=e.length;let h;for(h=1;hs.x&&d.clone(n,s),Ua.y&&d.clone(n,a),Bl.z&&d.clone(n,l)}const f=d.magnitudeSquared(d.subtract(s,i,xr)),_=d.magnitudeSquared(d.subtract(a,o,xr)),g=d.magnitudeSquared(d.subtract(l,r,xr));let m=i,b=s,T=f;_>T&&(T=_,m=o,b=a),g>T&&(T=g,m=r,b=l);const x=qP;x.x=(m.x+b.x)*.5,x.y=(m.y+b.y)*.5,x.z=(m.z+b.z)*.5;let C=d.magnitudeSquared(d.subtract(b,x,xr)),w=Math.sqrt(C);const v=YP;v.x=i.x,v.y=o.y,v.z=r.z;const P=$P;P.x=s.x,P.y=a.y,P.z=l.z;const N=d.midpoint(v,P,XP);let k=0;for(h=0;hk&&(k=M);const U=d.magnitudeSquared(d.subtract(n,x,xr));if(U>C){const B=Math.sqrt(U);w=(w+B)*.5,C=w*w;const S=B-w;x.x=(w*x.x+S*n.x)/B,x.y=(w*x.y+S*n.y)/B,x.z=(w*x.z+S*n.z)/B}}return wl.x&&d.clone(o,l),Su.y&&d.clone(o,u),Dh.z&&d.clone(o,h)}const g=d.magnitudeSquared(d.subtract(l,r,xr)),m=d.magnitudeSquared(d.subtract(u,s,xr)),b=d.magnitudeSquared(d.subtract(h,a,xr));let T=r,x=l,C=g;m>C&&(C=m,T=s,x=u),b>C&&(C=b,T=a,x=h);const w=qP;w.x=(T.x+x.x)*.5,w.y=(T.y+x.y)*.5,w.z=(T.z+x.z)*.5;let v=d.magnitudeSquared(d.subtract(x,w,xr)),P=Math.sqrt(v);const N=YP;N.x=r.x,N.y=s.y,N.z=a.z;const k=$P;k.x=l.x,k.y=u.y,k.z=h.z;const M=d.midpoint(N,k,XP);let U=0;for(_=0;_U&&(U=B);const S=d.magnitudeSquared(d.subtract(o,w,xr));if(S>v){const D=Math.sqrt(S);P=(P+D)*.5,v=P*P;const p=D-P;w.x=(P*w.x+p*o.x)/D,w.y=(P*w.y+p*o.y)/D,w.z=(P*w.z+p*o.z)/D}}return Pa.x&&d.clone(i,a),Bl.y&&d.clone(i,l),Su.z&&d.clone(i,u)}const _=d.magnitudeSquared(d.subtract(a,o,xr)),g=d.magnitudeSquared(d.subtract(l,r,xr)),m=d.magnitudeSquared(d.subtract(u,s,xr));let b=o,T=a,x=_;g>x&&(x=g,b=r,T=l),m>x&&(x=m,b=s,T=u);const C=qP;C.x=(b.x+T.x)*.5,C.y=(b.y+T.y)*.5,C.z=(b.z+T.z)*.5;let w=d.magnitudeSquared(d.subtract(T,C,xr)),v=Math.sqrt(w);const P=YP;P.x=o.x,P.y=r.y,P.z=s.z;const N=$P;N.x=a.x,N.y=l.y,N.z=u.z;const k=d.midpoint(P,N,XP);let M=0;for(f=0;fM&&(M=U);const B=d.magnitudeSquared(d.subtract(i,C,xr));if(B>w){const S=Math.sqrt(B);v=(v+S)*.5,w=v*v;const D=S-v;C.x=(v*C.x+D*i.x)/S,C.y=(v*C.y+D*i.y)/S,C.z=(v*C.z+D*i.z)/S}}return v=l+s)return e.clone(n),n;if(s>=l+o)return t.clone(n),n;const u=(o+l+s)*.5,h=d.multiplyByScalar(a,(-o+u)/l,jee);return d.add(h,i,h),d.clone(h,n.center),n.radius=u,n};const Wee=new d;se.expand=function(e,t,n){A.typeOf.object("sphere",e),A.typeOf.object("point",t),n=se.clone(e,n);const i=d.magnitude(d.subtract(t,n.center,Wee));return i>n.radius&&(n.radius=i),n};se.intersectPlane=function(e,t){A.typeOf.object("sphere",e),A.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=d.dot(o,n)+t.distance;return r<-i?Bt.OUTSIDE:r maxHeight) { material.diffuse = vec3(0.0); material.alpha = 0.0; return material; } // Binary search to find heights above and below. int idxBelow = 0; int idxAbove = heightsDimensions.x; float heightBelow = minHeight; float heightAbove = maxHeight; // while loop not allowed, so use for loop with max iterations. // maxIterations of 16 supports a texture size up to 65536 (2^16). const int maxIterations = 16; for (int i = 0; i < maxIterations; i++) { if (idxBelow >= idxAbove - 1) { break; } int idxMid = (idxBelow + idxAbove) / 2; float heightTex = getHeight(idxMid, invTexSize); if (height > heightTex) { idxBelow = idxMid; heightBelow = heightTex; } else { idxAbove = idxMid; heightAbove = heightTex; } } float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow); vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5); vec4 color = texture(colors, colorUv); // undo preumultiplied alpha if (color.a > 0.0) { color.rgb /= color.a; } color.rgb = czm_gammaCorrect(color.rgb); material.diffuse = color.rgb; material.alpha = color.a; return material; } `,Tte=`uniform vec4 color; uniform float spacing; uniform float width; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); float distanceToContour = mod(materialInput.height, spacing); #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives)) float dxc = abs(dFdx(materialInput.height)); float dyc = abs(dFdy(materialInput.height)); float dF = max(dxc, dyc) * czm_pixelRatio * width; float alpha = (distanceToContour < dF) ? 1.0 : 0.0; #else // If no derivatives available (IE 10?), use pixel ratio float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0; #endif vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a)); material.diffuse = outColor.rgb; material.alpha = outColor.a; return material; } `,Ate=`uniform sampler2D image; uniform float minimumHeight; uniform float maximumHeight; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0); vec4 rampColor = texture(image, vec2(scaledHeight, 0.5)); rampColor = czm_gammaCorrect(rampColor); material.diffuse = rampColor.rgb; material.alpha = rampColor.a; return material; } `,xte=`uniform vec4 fadeInColor; uniform vec4 fadeOutColor; uniform float maximumDistance; uniform bool repeat; uniform vec2 fadeDirection; uniform vec2 time; float getTime(float t, float coord) { float scalar = 1.0 / maximumDistance; float q = distance(t, coord) * scalar; if (repeat) { float r = distance(t, coord + 1.0) * scalar; float s = distance(t, coord - 1.0) * scalar; q = min(min(r, s), q); } return clamp(q, 0.0, 1.0); } czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; float s = getTime(time.x, st.s) * fadeDirection.s; float t = getTime(time.y, st.t) * fadeDirection.t; float u = length(vec2(s, t)); vec4 color = mix(fadeInColor, fadeOutColor, u); color = czm_gammaCorrect(color); material.emission = color.rgb; material.alpha = color.a; return material; } `,Cte=`uniform vec4 color; uniform float cellAlpha; uniform vec2 lineCount; uniform vec2 lineThickness; uniform vec2 lineOffset; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; float scaledWidth = fract(lineCount.s * st.s - lineOffset.s); scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5)); float scaledHeight = fract(lineCount.t * st.t - lineOffset.t); scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5)); float value; // Fuzz Factor - Controls blurriness of lines #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives)) const float fuzz = 1.2; vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0; // From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13. vec2 dx = abs(dFdx(st)); vec2 dy = abs(dFdy(st)); vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount; value = min( smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth), smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight)); #else // If no derivatives available (IE 10?), revert to view-dependent fuzz const float fuzz = 0.05; vec2 range = 0.5 - (lineThickness * 0.05); value = min( 1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth), 1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight)); #endif // Edges taken from RimLightingMaterial.glsl // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC))); float sRim = smoothstep(0.8, 1.0, dRim); value *= (1.0 - sRim); vec4 halfColor; halfColor.rgb = color.rgb * 0.5; halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value)); halfColor = czm_gammaCorrect(halfColor); material.diffuse = halfColor.rgb; material.emission = halfColor.rgb; material.alpha = halfColor.a; return material; } `,Ete=`uniform sampler2D image; uniform float strength; uniform vec2 repeat; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec4 textureValue = texture(image, fract(repeat * materialInput.st)); vec3 normalTangentSpace = textureValue.channels; normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0; normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0); normalTangentSpace = normalize(normalTangentSpace); vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace; material.normal = normalEC; return material; } `,wte=`uniform vec4 color; float getPointOnLine(vec2 p0, vec2 p1, float x) { float slope = (p0.y - p1.y) / (p0.x - p1.x); return slope * (x - p0.x) + p0.y; } czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives)) float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio; #else // If no derivatives available (IE 10?), 2.5% of the line will be the arrow head float base = 0.975; #endif vec2 center = vec2(1.0, 0.5); float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s); float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s); float halfWidth = 0.15; float s = step(0.5 - halfWidth, st.t); s *= 1.0 - step(0.5 + halfWidth, st.t); s *= 1.0 - step(base, st.s); float t = step(base, materialInput.st.s); t *= 1.0 - step(ptOnUpperLine, st.t); t *= step(ptOnLowerLine, st.t); // Find the distance from the closest separator (region between two colors) float dist; if (st.s < base) { float d1 = abs(st.t - (0.5 - halfWidth)); float d2 = abs(st.t - (0.5 + halfWidth)); dist = min(d1, d2); } else { float d1 = czm_infinity; if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth) { d1 = abs(st.s - base); } float d2 = abs(st.t - ptOnUpperLine); float d3 = abs(st.t - ptOnLowerLine); dist = min(min(d1, d2), d3); } vec4 outsideColor = vec4(0.0); vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0)); vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist); outColor = czm_gammaCorrect(outColor); material.diffuse = outColor.rgb; material.alpha = outColor.a; return material; } `,Ste=`uniform vec4 color; uniform vec4 gapColor; uniform float dashLength; uniform float dashPattern; in float v_polylineAngle; const float maskLength = 16.0; mat2 rotate(float rad) { float c = cos(rad); float s = sin(rad); return mat2( c, s, -s, c ); } czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy; // Get the relative position within the dash from 0 to 1 float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio)); // Figure out the mask index. float maskIndex = floor(dashPosition * maskLength); // Test the bit mask. float maskTest = floor(dashPattern / pow(2.0, maskIndex)); vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color; if (fragColor.a < 0.005) { // matches 0/255 and 1/255 discard; } fragColor = czm_gammaCorrect(fragColor); material.emission = fragColor.rgb; material.alpha = fragColor.a; return material; } `,vte=`uniform vec4 color; uniform float glowPower; uniform float taperPower; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5); if (taperPower <= 0.99999) { glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5)); } vec4 fragColor; fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb); fragColor.a = clamp(0.0, 1.0, glow) * color.a; fragColor = czm_gammaCorrect(fragColor); material.emission = fragColor.rgb; material.alpha = fragColor.a; return material; } `,Ite=`uniform vec4 color; uniform vec4 outlineColor; uniform float outlineWidth; in float v_width; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width; float b = step(0.5 - halfInteriorWidth, st.t); b *= 1.0 - step(0.5 + halfInteriorWidth, st.t); // Find the distance from the closest separator (region between two colors) float d1 = abs(st.t - (0.5 - halfInteriorWidth)); float d2 = abs(st.t - (0.5 + halfInteriorWidth)); float dist = min(d1, d2); vec4 currentColor = mix(outlineColor, color, b); vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist); outColor = czm_gammaCorrect(outColor); material.diffuse = outColor.rgb; material.alpha = outColor.a; return material; } `,Dte=`uniform vec4 color; uniform vec4 rimColor; uniform float width; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)); float s = smoothstep(1.0 - width, 1.0, d); vec4 outColor = czm_gammaCorrect(color); vec4 outRimColor = czm_gammaCorrect(rimColor); material.diffuse = outColor.rgb; material.emission = outRimColor.rgb * s; material.alpha = mix(outColor.a, outRimColor.a, s); return material; } `,Pte=`uniform sampler2D image; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); vec4 rampColor = texture(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5)); rampColor = czm_gammaCorrect(rampColor); material.diffuse = rampColor.rgb; material.alpha = rampColor.a; return material; } `,Ote=`uniform vec4 evenColor; uniform vec4 oddColor; uniform float offset; uniform float repeat; uniform bool horizontal; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); // Based on the Stripes Fragment Shader in the Orange Book (11.1.2) float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal)); float value = fract((coord - offset) * (repeat * 0.5)); float dist = min(value, min(abs(value - 0.5), 1.0 - value)); vec4 currentColor = mix(evenColor, oddColor, step(0.5, value)); vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist); color = czm_gammaCorrect(color); material.diffuse = color.rgb; material.alpha = color.a; return material; } `,Lte=`// Thanks for the contribution Jonas // http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog uniform sampler2D specularMap; uniform sampler2D normalMap; uniform vec4 baseWaterColor; uniform vec4 blendColor; uniform float frequency; uniform float animationSpeed; uniform float amplitude; uniform float specularIntensity; uniform float fadeFactor; czm_material czm_getMaterial(czm_materialInput materialInput) { czm_material material = czm_getDefaultMaterial(materialInput); float time = czm_frameNumber * animationSpeed; // fade is a function of the distance from the fragment and the frequency of the waves float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor); float specularMapValue = texture(specularMap, materialInput.st).r; // note: not using directional motion at this time, just set the angle to 0.0; vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0); vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude)); // fade out the normal perturbation as we move further from the water surface normalTangentSpace.xy /= fade; // attempt to fade out the normal perturbation as we approach non water areas (low specular map value) normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue); normalTangentSpace = normalize(normalTangentSpace); // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0); // fade out water effect as specular map value decreases material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue; // base color is a blend of the water and non-water color based on the value from the specular map // may need a uniform blend factor to better control this material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue); // diffuse highlights are based on how perturbed the normal is material.diffuse += (0.1 * tsPerturbationRatio); material.diffuse = material.diffuse; material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace); material.specular = specularIntensity; material.shininess = 10.0; return material; } `;function Se(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=y(e.minificationFilter,en.LINEAR),this._magnificationFilter=y(e.magnificationFilter,Yo.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,Rte(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),c(Se._uniformList[this.type])||(Se._uniformList[this.type]=Object.keys(this._uniforms))}Se._uniformList={};Se.fromType=function(e,t){if(!c(Se._materialCache.getMaterial(e)))throw new E(`material with type '${e}' does not exist.`);const n=new Se({fabric:{type:e}});if(c(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};Se.prototype.isTranslucent=function(){if(c(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i-1)return!0;return!1}function Ute(e){const t=e._template.components,n=e._template.source;if(c(n))e.shaderSource+=`${n} `;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput) { `,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput); `,c(t)){const i=Object.keys(e._template.materials).length>0;for(const o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){const s=i&&zte(t[o],e)?t[o]:`czm_gammaCorrect(${t[o]})`;e.shaderSource+=`material.${o} = ${s}; `}else o==="alpha"?e.shaderSource+=`material.alpha = ${t.alpha}; `:e.shaderSource+=`material.${o} = ${t[o]}; `}e.shaderSource+=`return material; } `}}const vR={mat2:Xe,mat3:$,mat4:L},kte=/\.ktx2$/i;function Vte(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!c(r)||r===Se.DefaultImageId;t=r;let l=n._textures[e],u,h;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&c(l)&&(l!==i.defaultTexture&&l.destroy(),l=void 0),!c(l)||l===i.defaultTexture){const _=new un({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});l=new xt({context:i,source:r,sampler:_}),n._textures[e]=l;return}l.copyFrom({source:r})}else c(l)||(n._textures[e]=i.defaultTexture);return}if(r instanceof xt&&r!==l){n._texturePaths[e]=void 0;const _=n._textures[e];c(_)&&_!==n._defaultTexture&&_.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(h=o[u],h.x=r._width,h.y=r._height);return}if(s&&c(l)&&a&&(l!==n._defaultTexture&&l.destroy(),l=void 0),c(l)||(n._texturePaths[e]=void 0,l=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(h=o[u],h.x=l._width,h.y=l._height)),a)return;const f=r instanceof Ae;if(!c(n._texturePaths[e])||f&&r.url!==n._texturePaths[e].url||!f&&r!==n._texturePaths[e]){if(typeof r=="string"||f){const _=f?r:Ae.createIfNeeded(r);let g;kte.test(_.url)?g=Op(_.url):g=_.fetchImage(),Promise.resolve(g).then(function(m){n._loadedImages.push({id:e,image:m})}).catch(function(){c(l)&&l!==n._defaultTexture&&l.destroy(),n._textures[e]=n._defaultTexture})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}function Hte(e){return function(t,n){const i=t.uniforms[e];if(i instanceof Sl){const r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(c(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===Se.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const r=[Ae.createIfNeeded(i.positiveX).fetchImage(),Ae.createIfNeeded(i.negativeX).fetchImage(),Ae.createIfNeeded(i.positiveY).fetchImage(),Ae.createIfNeeded(i.negativeY).fetchImage(),Ae.createIfNeeded(i.positiveZ).fetchImage(),Ae.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function Gte(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&Gk(e,n)}function Gk(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=jte(o);if(!c(r))throw new E(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=Zy(e,t,o,!1),s===0&&n)throw new E(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){const u=`${t}Dimensions`;qte(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},Gk(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}const l=`${t}_${e._count++}`;if(s=Zy(e,t,l),s===1&&n)throw new E(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(Vte(t));else if(r==="samplerCube")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(Hte(t));else if(r.indexOf("mat")!==-1){const u=new vR[r];e._uniforms[l]=function(){return vR[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[l]=function(){return e.uniforms[t]}}}function jte(e){let t=e.type;if(!c(t)){const n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Ae||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===Se.DefaultCubeMapId?t="samplerCube":t="sampler2D";else if(n==="object")if(Array.isArray(e))(e.length===4||e.length===9||e.length===16)&&(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(const o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function Wte(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new Se({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=jt(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;Zy(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;const a=`${s}(materialInput)`;if(Zy(e,i,a)===0&&t)throw new E(`strict: shader source does not use material '${i}'.`)}}function Zy(e,t,n,i){i=y(i,!0);let o=0;const r="([\\w])?",s=`([\\w${i?".":""}])?`,a=new RegExp(s+t+r,"g");return e.shaderSource=e.shaderSource.replace(a,function(l,u,h){return u||h?l:(o+=1,n)}),o}function qte(e,t,n){return Zy(e,t,t,n)}Se._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};Se.DefaultImageId="czm_defaultImage";Se.DefaultCubeMapId="czm_defaultCubeMap";Se.ColorType="Color";Se._materialCache.addMaterial(Se.ColorType,{fabric:{type:Se.ColorType,uniforms:{color:new z(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Se.ImageType="Image";Se._materialCache.addMaterial(Se.ImageType,{fabric:{type:Se.ImageType,uniforms:{image:Se.DefaultImageId,repeat:new H(1,1),color:new z(1,1,1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Se.DiffuseMapType="DiffuseMap";Se._materialCache.addMaterial(Se.DiffuseMapType,{fabric:{type:Se.DiffuseMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Se.AlphaMapType="AlphaMap";Se._materialCache.addMaterial(Se.AlphaMapType,{fabric:{type:Se.AlphaMapType,uniforms:{image:Se.DefaultImageId,channel:"a",repeat:new H(1,1)},components:{alpha:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});Se.SpecularMapType="SpecularMap";Se._materialCache.addMaterial(Se.SpecularMapType,{fabric:{type:Se.SpecularMapType,uniforms:{image:Se.DefaultImageId,channel:"r",repeat:new H(1,1)},components:{specular:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});Se.EmissionMapType="EmissionMap";Se._materialCache.addMaterial(Se.EmissionMapType,{fabric:{type:Se.EmissionMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{emission:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Se.BumpMapType="BumpMap";Se._materialCache.addMaterial(Se.BumpMapType,{fabric:{type:Se.BumpMapType,uniforms:{image:Se.DefaultImageId,channel:"r",strength:.8,repeat:new H(1,1)},source:_te},translucent:!1});Se.NormalMapType="NormalMap";Se._materialCache.addMaterial(Se.NormalMapType,{fabric:{type:Se.NormalMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",strength:.8,repeat:new H(1,1)},source:Ete},translucent:!1});Se.GridType="Grid";Se._materialCache.addMaterial(Se.GridType,{fabric:{type:Se.GridType,uniforms:{color:new z(0,1,0,1),cellAlpha:.1,lineCount:new H(8,8),lineThickness:new H(1,1),lineOffset:new H(0,0)},source:Cte},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});Se.StripeType="Stripe";Se._materialCache.addMaterial(Se.StripeType,{fabric:{type:Se.StripeType,uniforms:{horizontal:!0,evenColor:new z(1,1,1,.5),oddColor:new z(0,0,1,.5),offset:0,repeat:5},source:Ote},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});Se.CheckerboardType="Checkerboard";Se._materialCache.addMaterial(Se.CheckerboardType,{fabric:{type:Se.CheckerboardType,uniforms:{lightColor:new z(1,1,1,.5),darkColor:new z(0,0,0,.5),repeat:new H(5,5)},source:gte},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Se.DotType="Dot";Se._materialCache.addMaterial(Se.DotType,{fabric:{type:Se.DotType,uniforms:{lightColor:new z(1,1,0,.75),darkColor:new z(0,1,1,.75),repeat:new H(5,5)},source:yte},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Se.WaterType="Water";Se._materialCache.addMaterial(Se.WaterType,{fabric:{type:Se.WaterType,uniforms:{baseWaterColor:new z(.2,.3,.6,1),blendColor:new z(0,1,.699,1),specularMap:Se.DefaultImageId,normalMap:Se.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:Lte},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});Se.RimLightingType="RimLighting";Se._materialCache.addMaterial(Se.RimLightingType,{fabric:{type:Se.RimLightingType,uniforms:{color:new z(1,0,0,.7),rimColor:new z(1,1,1,.4),width:.3},source:Dte},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});Se.FadeType="Fade";Se._materialCache.addMaterial(Se.FadeType,{fabric:{type:Se.FadeType,uniforms:{fadeInColor:new z(1,0,0,1),fadeOutColor:new z(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new H(.5,.5)},source:xte},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});Se.PolylineArrowType="PolylineArrow";Se._materialCache.addMaterial(Se.PolylineArrowType,{fabric:{type:Se.PolylineArrowType,uniforms:{color:new z(1,1,1,1)},source:wte},translucent:!0});Se.PolylineDashType="PolylineDash";Se._materialCache.addMaterial(Se.PolylineDashType,{fabric:{type:Se.PolylineDashType,uniforms:{color:new z(1,0,1,1),gapColor:new z(0,0,0,0),dashLength:16,dashPattern:255},source:Ste},translucent:!0});Se.PolylineGlowType="PolylineGlow";Se._materialCache.addMaterial(Se.PolylineGlowType,{fabric:{type:Se.PolylineGlowType,uniforms:{color:new z(0,.5,1,1),glowPower:.25,taperPower:1},source:vte},translucent:!0});Se.PolylineOutlineType="PolylineOutline";Se._materialCache.addMaterial(Se.PolylineOutlineType,{fabric:{type:Se.PolylineOutlineType,uniforms:{color:new z(1,1,1,1),outlineColor:new z(1,0,0,1),outlineWidth:1},source:Ite},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});Se.ElevationContourType="ElevationContour";Se._materialCache.addMaterial(Se.ElevationContourType,{fabric:{type:Se.ElevationContourType,uniforms:{spacing:100,color:new z(1,0,0,1),width:1},source:Tte},translucent:!1});Se.ElevationRampType="ElevationRamp";Se._materialCache.addMaterial(Se.ElevationRampType,{fabric:{type:Se.ElevationRampType,uniforms:{image:Se.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:Ate},translucent:!1});Se.SlopeRampMaterialType="SlopeRamp";Se._materialCache.addMaterial(Se.SlopeRampMaterialType,{fabric:{type:Se.SlopeRampMaterialType,uniforms:{image:Se.DefaultImageId},source:Pte},translucent:!1});Se.AspectRampMaterialType="AspectRamp";Se._materialCache.addMaterial(Se.AspectRampMaterialType,{fabric:{type:Se.AspectRampMaterialType,uniforms:{image:Se.DefaultImageId},source:mte},translucent:!1});Se.ElevationBandType="ElevationBand";Se._materialCache.addMaterial(Se.ElevationBandType,{fabric:{type:Se.ElevationBandType,uniforms:{heights:Se.DefaultImageId,colors:Se.DefaultImageId},source:bte},translucent:!0});function oo(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.materialSupport,oo.MaterialSupport.TEXTURED);this.material=c(e.material)?e.material:Se.fromType(Se.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=y(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=y(e.flat,!1),this._faceForward=y(e.faceForward,!n)}Object.defineProperties(oo.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}}});oo.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;oo.prototype.isTranslucent=Lo.prototype.isTranslucent;oo.prototype.getRenderState=Lo.prototype.getRenderState;oo.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ee.POSITION_AND_NORMAL,vertexShaderSource:cte,fragmentShaderSource:ate}),TEXTURED:Object.freeze({vertexFormat:Ee.POSITION_NORMAL_AND_ST,vertexShaderSource:ute,fragmentShaderSource:lte}),ALL:Object.freeze({vertexFormat:Ee.ALL,vertexShaderSource:ste,fragmentShaderSource:rte})};const Yte=`in vec3 v_positionEC; in vec3 v_normalEC; in vec4 v_color; void main() { vec3 positionToEyeEC = -v_positionEC; vec3 normalEC = normalize(v_normalEC); #ifdef FACE_FORWARD normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC); #endif vec4 color = czm_gammaCorrect(v_color); czm_materialInput materialInput; materialInput.normalEC = normalEC; materialInput.positionToEyeEC = positionToEyeEC; czm_material material = czm_getDefaultMaterial(materialInput); material.diffuse = color.rgb; material.alpha = color.a; out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC); } `,$te=`in vec3 position3DHigh; in vec3 position3DLow; in vec3 normal; in vec4 color; in float batchId; out vec3 v_positionEC; out vec3 v_normalEC; out vec4 v_color; void main() { vec4 p = czm_computePosition(); v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates v_normalEC = czm_normal * normal; // normal in eye coordinates v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; } `,jk=`in vec4 v_color; void main() { out_FragColor = czm_gammaCorrect(v_color); } `,Xte=`in vec3 position3DHigh; in vec3 position3DLow; in vec4 color; in float batchId; out vec4 v_color; void main() { vec4 p = czm_computePosition(); v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; } `;function tn(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.flat,!1),o=i?Xte:$te,r=i?jk:Yte,s=i?tn.FLAT_VERTEX_FORMAT:tn.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,o),this._fragmentShaderSource=y(e.fragmentShaderSource,r),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=y(e.faceForward,!n)}Object.defineProperties(tn.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}}});tn.VERTEX_FORMAT=Ee.POSITION_AND_NORMAL;tn.FLAT_VERTEX_FORMAT=Ee.POSITION_ONLY;tn.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;tn.prototype.isTranslucent=Lo.prototype.isTranslucent;tn.prototype.getRenderState=Lo.prototype.getRenderState;function kt(e){this._definitionChanged=new Le,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(kt.prototype,{isConstant:{get:function(){return K.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ue("color")});kt.prototype.getType=function(e){return"Color"};kt.prototype.getValue=function(e,t){return c(t)||(t={}),t.color=K.getValueOrClonedDefault(this._color,e,z.WHITE,t.color),t};kt.prototype.equals=function(e){return this===e||e instanceof kt&&K.equals(this._color,e._color)};function Yr(e){e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._rectangle=y(e.rectangle,ce.MAX_VALUE),this._projection=new co(this._ellipsoid),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Yr.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Yr.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=o&&(u=o-1);let h=(i.north-e.latitude)/a|0;return h>=r&&(h=r-1),c(n)?(n.x=u,n.y=h,n):new H(u,h)};const IR=new d,DR=new d,PR=new he,sw=new d,Qte=new d,OR=new se,Kte=new Yr,bg=[new he,new he,new he,new he],Tg=new H,Xi={};Xi.initialize=function(){let e=Xi._initPromise;return c(e)||(e=Ae.fetchJson(Zt("Assets/approximateTerrainHeights.json")).then(function(t){Xi._terrainHeights=t}),Xi._initPromise=e),e};Xi.getMinimumMaximumHeights=function(e,t){if(A.defined("rectangle",e),!c(Xi._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=y(t,ae.WGS84);const n=Wk(e);let i=Xi._defaultMinTerrainHeight,o=Xi._defaultMaxTerrainHeight;if(c(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Xi._terrainHeights[r];c(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(ce.northeast(e,PR),IR),t.cartographicToCartesian(ce.southwest(e,PR),DR),d.midpoint(DR,IR,sw);const a=t.scaleToGeodeticSurface(sw,Qte);if(c(a)){const l=d.distance(sw,a);i=Math.min(i,-l)}else i=Xi._defaultMinTerrainHeight}return i=Math.max(Xi._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};Xi.getBoundingSphere=function(e,t){if(A.defined("rectangle",e),!c(Xi._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=y(t,ae.WGS84);const n=Wk(e);let i=Xi._defaultMaxTerrainHeight;if(c(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Xi._terrainHeights[r];c(s)&&(i=s[1])}const o=se.fromRectangle3D(e,t,0);return se.fromRectangle3D(e,t,i,OR),se.union(o,OR,o)};function Wk(e){he.fromRadians(e.east,e.north,0,bg[0]),he.fromRadians(e.west,e.north,0,bg[1]),he.fromRadians(e.east,e.south,0,bg[2]),he.fromRadians(e.west,e.south,0,bg[3]);let t=0,n=0,i=0,o=0;const r=Xi._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let a=!1;for(let l=0;l<4;++l){const u=bg[l];if(Kte.positionToTileXY(u,s,Tg),l===0)i=Tg.x,o=Tg.y;else if(i!==Tg.x||o!==Tg.y){a=!0;break}}if(a)break;t=i,n=o}if(s!==0)return{x:t,y:n,level:s>r?r:s-1}}Xi._terrainHeightsMaxLevel=6;Xi._defaultMaxTerrainHeight=9e3;Xi._defaultMinTerrainHeight=-1e5;Xi._terrainHeights=void 0;Xi._initPromise=void 0;Object.defineProperties(Xi,{initialized:{get:function(){return c(Xi._terrainHeights)}}});const Ti=Xi;function Gr(e,t,n){this.minimum=d.clone(y(e,d.ZERO)),this.maximum=d.clone(y(t,d.ZERO)),c(n)?n=d.clone(n):n=d.midpoint(this.minimum,this.maximum,new d),this.center=n}Gr.fromCorners=function(e,t,n){return A.defined("minimum",e),A.defined("maximum",t),c(n)||(n=new Gr),n.minimum=d.clone(e,n.minimum),n.maximum=d.clone(t,n.maximum),n.center=d.midpoint(e,t,n.center),n};Gr.fromPoints=function(e,t){if(c(t)||(t=new Gr),!c(e)||e.length===0)return t.minimum=d.clone(d.ZERO,t.minimum),t.maximum=d.clone(d.ZERO,t.maximum),t.center=d.clone(d.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z;const l=e.length;for(let f=1;f0?Bt.INSIDE:r+o<0?Bt.OUTSIDE:Bt.INTERSECTING};Gr.prototype.clone=function(e){return Gr.clone(this,e)};Gr.prototype.intersectPlane=function(e){return Gr.intersectPlane(this,e)};Gr.prototype.equals=function(e){return Gr.equals(this,e)};const QP={};QP.computeDiscriminant=function(e,t,n){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");return t*t-4*e*n};function LR(e,t,n){const i=e+t;return R.sign(e)!==R.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))u&&u/l0?[a/e,n/a]:[n/a,a/e]};const Ku=QP,KP={};KP.computeDiscriminant=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");const o=e*e,r=t*t,s=n*n,a=i*i;return 18*e*t*n*i+r*s-27*o*a-4*(e*s*n+r*t*i)};function aw(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,l=o*s,u=r*a,h=r*r,f=s*s,_=o*s-h,g=o*a-r*s,m=r*a-f,b=4*_*m-g*g;let T,x;if(b<0){let X,q,ee;h*u>=l*f?(X=o,q=_,ee=-2*r*_+o*g):(X=a,q=m,ee=-a*g+2*s*m);const ne=-(ee<0?-1:1)*Math.abs(X)*Math.sqrt(-b);x=-ee+ne;const Q=x/2,le=Q<0?-Math.pow(-Q,1/3):Math.pow(Q,1/3),pe=x===ne?-le:-q/le;return T=q<=0?le+pe:-ee/(le*le+pe*pe+q),h*u>=l*f?[(T-r)/o]:[-a/(T+s)]}const C=_,w=-2*r*_+o*g,v=m,P=-a*g+2*s*m,N=Math.sqrt(b),k=Math.sqrt(3)/2;let M=Math.abs(Math.atan2(o*N,-w)/3);T=2*Math.sqrt(-C);let U=Math.cos(M);x=T*U;let B=T*(-U/2-k*Math.sin(M));const S=x+B>2*r?x-r:B-r,D=o,p=S/D;M=Math.abs(Math.atan2(a*N,-P)/3),T=2*Math.sqrt(-v),U=Math.cos(M),x=T*U,B=T*(-U/2-k*Math.sin(M));const I=-a,O=x+B<2*s?x+s:B+s,F=I/O,V=D*O,G=-S*O-D*I,j=S*I,W=(s*G-r*j)/(-r*G+s*V);return p<=W?p<=F?W<=F?[p,W,F]:[p,F,W]:[F,p,W]:p<=F?[W,p,F]:W<=F?[W,F,p]:[F,W,p]}KP.computeRealRoots=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");let o,r;if(e===0)return Ku.computeRealRoots(t,n,i);if(t===0){if(n===0){if(i===0)return[0,0,0];r=-i/e;const s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[s,s,s]}else if(i===0)return o=Ku.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return aw(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):aw(e,t,0,i);if(i===0)return o=Ku.computeRealRoots(e,t,n),o.length===0?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]}return aw(e,t,n,i)};const ZP=KP,JP={};JP.computeDiscriminant=function(e,t,n,i,o){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");if(typeof o!="number")throw new E("e is a required number.");const r=e*e,s=r*e,a=t*t,l=a*t,u=n*n,h=u*n,f=i*i,_=f*i,g=o*o,m=g*o;return a*u*f-4*l*_-4*e*h*f+18*e*t*n*_-27*r*f*f+256*s*m+o*(18*l*n*i-4*a*h+16*e*u*u-80*e*t*u*i-6*e*a*f+144*r*n*f)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function Yc(e,t,n,i){const o=e*e,r=t-3*o/8,s=n-t*e/2+o*e/8,a=i-n*e/4+t*o/16-3*o*o/256,l=ZP.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(l.length>0){const u=-e/4,h=l[l.length-1];if(Math.abs(h)=0&&g>=0){const b=Math.sqrt(_),T=Math.sqrt(g);return[u-T,u-b,u+b,u+T]}else{if(_>=0&&g<0)return m=Math.sqrt(_),[u-m,u+m];if(_<0&&g>=0)return m=Math.sqrt(g),[u-m,u+m]}}return[]}else if(h>0){const f=Math.sqrt(h),_=(r+h-s/f)/2,g=(r+h+s/f)/2,m=Ku.computeRealRoots(1,f,_),b=Ku.computeRealRoots(1,-f,g);return m.length!==0?(m[0]+=u,m[1]+=u,b.length!==0?(b[0]+=u,b[1]+=u,m[1]<=b[0]?[m[0],m[1],b[0],b[1]]:b[1]<=m[0]?[b[0],b[1],m[0],m[1]]:m[0]>=b[0]&&m[1]<=b[1]?[b[0],m[0],m[1],b[1]]:b[0]>=m[0]&&b[1]<=m[1]?[m[0],b[0],b[1],m[1]]:m[0]>b[0]&&m[0]0){const f=h[0],_=t-f,g=_*_,m=e/2,b=_/2,T=g-4*i,x=g+4*Math.abs(i),C=s-4*f,w=s+4*Math.abs(f);let v,P;if(f<0||T*w=S[0]&&B[1]<=S[1]?[S[0],B[0],B[1],S[1]]:S[0]>=B[0]&&S[1]<=B[1]?[B[0],S[0],S[1],B[1]]:B[0]>S[0]&&B[0]h)||(_=d.cross(f,a,NR),m=d.dot(s,_),m<0||g+m>h))return;b=d.dot(l,_)/h}else{if(Math.abs(h)1||(_=d.cross(f,a,NR),m=d.dot(s,_)*T,m<0||g+m>1))return;b=d.dot(l,_)*T}return b};_i.rayTriangle=function(e,t,n,i,o,r){const s=_i.rayTriangleParametric(e,t,n,i,o);if(!(!c(s)||s<0))return c(r)||(r=new d),d.multiplyByScalar(e.direction,s,r),d.add(e.origin,r,r)};const tne=new nn;_i.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!c(e))throw new E("v0 is required.");if(!c(t))throw new E("v1 is required.");if(!c(n))throw new E("p0 is required.");if(!c(i))throw new E("p1 is required.");if(!c(o))throw new E("p2 is required.");const a=tne;d.clone(e,a.origin),d.subtract(t,e,a.direction),d.normalize(a.direction,a.direction);const l=_i.rayTriangleParametric(a,n,i,o,r);if(!(!c(l)||l<0||l>d.distance(e,t)))return c(s)||(s=new d),d.multiplyByScalar(a.direction,l,s),d.add(a.origin,s,s)};function nne(e,t,n,i){const o=t*t-4*e*n;if(o<0)return;if(o>0){const s=1/(2*e),a=Math.sqrt(o),l=(-t+a)*s,u=(-t-a)*s;return ls))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};const rne=new d,sne=new d;_i.rayEllipsoid=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");const n=t.oneOverRadii,i=d.multiplyComponents(n,e.origin,rne),o=d.multiplyComponents(n,e.direction,sne),r=d.magnitudeSquared(i),s=d.dot(i,o);let a,l,u,h,f;if(r>1){if(s>=0)return;const _=s*s;if(a=r-1,l=d.magnitudeSquared(o),u=l*a,_u){h=s*s-u,f=-s+Math.sqrt(h);const m=f/l,b=a/f;return m0?g.push(new d(i,o*U,o*-D)):D!==0?(g.push(new d(i,o*U,o*-D)),g.push(new d(i,o*U,o*D)),++M):g.push(new d(i,o*U,o*D))}return g};const cw=new d,MR=new d,FR=new d,Hb=new d,ane=new d,cne=new $,lne=new $,une=new $,dne=new $,hne=new $,BR=new $,zR=new $,UR=new d,fne=new d,pne=new he;_i.grazingAltitudeLocation=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");const n=e.origin,i=e.direction;if(!d.equals(n,d.ZERO)){const N=t.geodeticSurfaceNormal(n,cw);if(d.dot(i,N)>=0)return n}const o=c(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,cw),s=d.normalize(r,r),a=d.mostOrthogonalAxis(r,Hb),l=d.normalize(d.cross(a,s,MR),MR),u=d.normalize(d.cross(s,l,FR),FR),h=cne;h[0]=s.x,h[1]=s.y,h[2]=s.z,h[3]=l.x,h[4]=l.y,h[5]=l.z,h[6]=u.x,h[7]=u.y,h[8]=u.z;const f=$.transpose(h,lne),_=$.fromScale(t.radii,une),g=$.fromScale(t.oneOverRadii,dne),m=hne;m[0]=0,m[1]=-i.z,m[2]=i.y,m[3]=i.z,m[4]=0,m[5]=-i.x,m[6]=-i.y,m[7]=i.x,m[8]=0;const b=$.multiply($.multiply(f,g,BR),m,BR),T=$.multiply($.multiply(b,_,zR),h,zR),x=$.multiplyByVector(b,n,ane),C=_i.quadraticVectorExpression(T,d.negate(x,cw),0,0,1);let w,v;const P=C.length;if(P>0){let N=d.clone(d.ZERO,fne),k=Number.NEGATIVE_INFINITY;for(let U=0;Uk&&(k=S,N=d.clone(w,N))}const M=t.cartesianToCartographic(N,pne);return k=R.clamp(k,0,1),v=d.magnitude(d.subtract(N,n,Hb))*Math.sqrt(1-k*k),v=o?-v:v,M.height=v,t.cartographicToCartesian(M,new d)}};const mne=new d;_i.lineSegmentPlane=function(e,t,n,i){if(!c(e))throw new E("endPoint0 is required.");if(!c(t))throw new E("endPoint1 is required.");if(!c(n))throw new E("plane is required.");c(i)||(i=new d);const o=d.subtract(t,e,mne),r=n.normal,s=d.dot(r,o);if(Math.abs(s)1))return d.multiplyByScalar(o,l,i),d.add(e,i,i),i};_i.trianglePlaneIntersection=function(e,t,n,i){if(!c(e)||!c(t)||!c(n)||!c(i))throw new E("p0, p1, p2, and plane are required.");const o=i.normal,r=i.distance,s=d.dot(o,e)+r<0,a=d.dot(o,t)+r<0,l=d.dot(o,n)+r<0;let u=0;u+=s?1:0,u+=a?1:0,u+=l?1:0;let h,f;if((u===1||u===2)&&(h=new d,f=new d),u===1){if(s)return _i.lineSegmentPlane(e,t,i,h),_i.lineSegmentPlane(e,n,i,f),{positions:[e,t,n,h,f],indices:[0,3,4,1,2,4,1,4,3]};if(a)return _i.lineSegmentPlane(t,n,i,h),_i.lineSegmentPlane(t,e,i,f),{positions:[e,t,n,h,f],indices:[1,3,4,2,0,4,2,4,3]};if(l)return _i.lineSegmentPlane(n,e,i,h),_i.lineSegmentPlane(n,t,i,f),{positions:[e,t,n,h,f],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!l)return _i.lineSegmentPlane(e,n,i,h),_i.lineSegmentPlane(t,n,i,f),{positions:[e,t,n,h,f],indices:[0,1,4,0,4,3,2,3,4]}}else return _i.lineSegmentPlane(n,t,i,h),_i.lineSegmentPlane(e,t,i,f),{positions:[e,t,n,h,f],indices:[2,0,4,2,4,3,1,3,4]};else return _i.lineSegmentPlane(t,e,i,h),_i.lineSegmentPlane(n,e,i,f),{positions:[e,t,n,h,f],indices:[1,2,4,1,4,3,0,3,4]}};const Ei=_i,lw=new te;function Co(e,t){if(A.defined("origin",e),t=y(t,ae.WGS84),e=t.scaleToGeodeticSurface(e),!c(e))throw new E("origin must not be at the center of the ellipsoid.");const n=zt.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=d.fromCartesian4(L.getColumn(n,0,lw)),this._yAxis=d.fromCartesian4(L.getColumn(n,1,lw));const i=d.fromCartesian4(L.getColumn(n,2,lw));this._plane=_t.fromPointNormal(e,i)}Object.defineProperties(Co.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 _ne=new Gr;Co.fromPoints=function(e,t){A.defined("cartesians",e);const n=Gr.fromPoints(e,_ne);return new Co(n.center,t)};const $k=new nn,Sx=new d;Co.prototype.projectPointOntoPlane=function(e,t){A.defined("cartesian",e);const n=$k;n.origin=e,d.normalize(e,n.direction);let i=Ei.rayPlane(n,this._plane,Sx);if(c(i)||(d.negate(n.direction,n.direction),i=Ei.rayPlane(n,this._plane,Sx)),c(i)){const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return c(t)?(t.x=r,t.y=s,t):new H(r,s)}};Co.prototype.projectPointsOntoPlane=function(e,t){A.defined("cartesians",e),c(t)||(t=[]);let n=0;const i=e.length;for(let o=0;oR.TWO_PI)throw new E("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>R.PI)throw new E("Rectangle height must be between 0 and pi");if(c(i)&&!R.equalsEpsilon(i.radii.x,i.radii.y,R.EPSILON15))throw new E("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");t=y(t,0),n=y(n,0),i=y(i,ae.WGS84);let r,s,a,l,u,h,f;if(e.width<=R.PI){const k=ce.center(e,VR),M=i.cartographicToCartesian(k,vne),U=new Co(M,i);f=U.plane;const B=k.longitude,S=e.south<0&&e.north>0?0:k.latitude,D=he.fromRadians(B,e.north,n,Ine),p=he.fromRadians(e.west,e.north,n,Dne),I=he.fromRadians(e.west,S,n,Pne),O=he.fromRadians(e.west,e.south,n,One),F=he.fromRadians(B,e.south,n,Lne),V=i.cartographicToCartesian(D,Rne);let G=i.cartographicToCartesian(p,HR);const j=i.cartographicToCartesian(I,Nne);let W=i.cartographicToCartesian(O,GR);const X=i.cartographicToCartesian(F,Mne),q=U.projectPointToNearestOnPlane(V,Fne),ee=U.projectPointToNearestOnPlane(G,Bne),Y=U.projectPointToNearestOnPlane(j,zne),ne=U.projectPointToNearestOnPlane(W,Une),Q=U.projectPointToNearestOnPlane(X,kne);return r=Math.min(ee.x,Y.x,ne.x),s=-r,l=Math.max(ee.y,q.y),a=Math.min(ne.y,Q.y),p.height=O.height=t,G=i.cartographicToCartesian(p,HR),W=i.cartographicToCartesian(O,GR),u=Math.min(_t.getPointDistance(f,G),_t.getPointDistance(f,W)),h=n,kR(U.origin,U.xAxis,U.yAxis,U.zAxis,r,s,a,l,u,h,o)}const _=e.south>0,g=e.north<0,m=_?e.south:g?e.north:0,b=ce.center(e,VR).longitude,T=d.fromRadians(b,m,n,i,Vne);T.z=0;const C=Math.abs(T.x)=l?Bt.INSIDE:Bt.INTERSECTING};const Qk=new d,Kk=new d,Zk=new d,Qne=new d,jR=new d,Kne=new d;Ct.distanceSquaredTo=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("cartesian is required.");const n=d.subtract(t,e.center,Xk),i=e.halfAxes;let o=$.getColumn(i,0,Qk),r=$.getColumn(i,1,Kk),s=$.getColumn(i,2,Zk);const a=d.magnitude(o),l=d.magnitude(r),u=d.magnitude(s);let h=!0,f=!0,_=!0;a>0?d.divideByScalar(o,a,o):h=!1,l>0?d.divideByScalar(r,l,r):f=!1,u>0?d.divideByScalar(s,u,s):_=!1;const g=!h+!f+!_;let m,b,T;if(g===1){let v=o;m=r,b=s,f?_||(v=s,b=o):(v=r,m=o),T=d.cross(m,b,jR),v===o?o=T:v===r?r=T:v===s&&(s=T)}else if(g===2){m=o,f?m=r:_&&(m=s);let v=d.UNIT_Y;v.equalsEpsilon(m,R.EPSILON3)&&(v=d.UNIT_X),b=d.cross(m,v,Qne),d.normalize(b,b),T=d.cross(m,b,jR),d.normalize(T,T),m===o?(r=b,s=T):m===r?(s=b,o=T):m===s&&(o=b,r=T)}else g===3&&(o=d.UNIT_X,r=d.UNIT_Y,s=d.UNIT_Z);const x=Kne;x.x=d.dot(n,o),x.y=d.dot(n,r),x.z=d.dot(n,s);let C=0,w;return x.x<-a?(w=x.x+a,C+=w*w):x.x>a&&(w=x.x-a,C+=w*w),x.y<-l?(w=x.y+l,C+=w*w):x.y>l&&(w=x.y-l,C+=w*w),x.z<-u?(w=x.z+u,C+=w*w):x.z>u&&(w=x.z-u,C+=w*w),C};const Zne=new d,Jne=new d;Ct.computePlaneDistances=function(e,t,n,i){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("position is required.");if(!c(n))throw new E("direction is required.");c(i)||(i=new Yu);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,l=$.getColumn(a,0,Qk),u=$.getColumn(a,1,Kk),h=$.getColumn(a,2,Zk),f=d.add(l,u,Zne);d.add(f,h,f),d.add(f,s,f);const _=d.subtract(f,t,Jne);let g=d.dot(n,_);return o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.add(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.subtract(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.subtract(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.add(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.add(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.subtract(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.subtract(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};const eie=new d,tie=new d,nie=new d;Ct.computeCorners=function(e,t){A.typeOf.object("box",e),c(t)||(t=[new d,new d,new d,new d,new d,new d,new d,new d]);const n=e.center,i=e.halfAxes,o=$.getColumn(i,0,eie),r=$.getColumn(i,1,tie),s=$.getColumn(i,2,nie);return d.clone(n,t[0]),d.subtract(t[0],o,t[0]),d.subtract(t[0],r,t[0]),d.subtract(t[0],s,t[0]),d.clone(n,t[1]),d.subtract(t[1],o,t[1]),d.subtract(t[1],r,t[1]),d.add(t[1],s,t[1]),d.clone(n,t[2]),d.subtract(t[2],o,t[2]),d.add(t[2],r,t[2]),d.subtract(t[2],s,t[2]),d.clone(n,t[3]),d.subtract(t[3],o,t[3]),d.add(t[3],r,t[3]),d.add(t[3],s,t[3]),d.clone(n,t[4]),d.add(t[4],o,t[4]),d.subtract(t[4],r,t[4]),d.subtract(t[4],s,t[4]),d.clone(n,t[5]),d.add(t[5],o,t[5]),d.subtract(t[5],r,t[5]),d.add(t[5],s,t[5]),d.clone(n,t[6]),d.add(t[6],o,t[6]),d.add(t[6],r,t[6]),d.subtract(t[6],s,t[6]),d.clone(n,t[7]),d.add(t[7],o,t[7]),d.add(t[7],r,t[7]),d.add(t[7],s,t[7]),t};const iie=new $;Ct.computeTransformation=function(e,t){A.typeOf.object("box",e),c(t)||(t=new L);const n=e.center,i=$.multiplyByUniformScale(e.halfAxes,2,iie);return L.fromRotationTranslation(i,n,t)};const oie=new se;Ct.isOccluded=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("occluder is required.");const n=se.fromOrientedBoundingBox(e,oie);return!t.isBoundingSphereVisible(n)};Ct.prototype.intersectPlane=function(e){return Ct.intersectPlane(this,e)};Ct.prototype.distanceSquaredTo=function(e){return Ct.distanceSquaredTo(this,e)};Ct.prototype.computePlaneDistances=function(e,t,n){return Ct.computePlaneDistances(this,e,t,n)};Ct.prototype.computeCorners=function(e){return Ct.computeCorners(this,e)};Ct.prototype.computeTransformation=function(e){return Ct.computeTransformation(this,e)};Ct.prototype.isOccluded=function(e){return Ct.isOccluded(this,e)};Ct.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&$.equals(e.halfAxes,t.halfAxes)};Ct.prototype.clone=function(e){return Ct.clone(this,e)};Ct.prototype.equals=function(e){return Ct.equals(this,e)};const vx={};vx.getHeight=function(e,t,n){if(!Number.isFinite(t))throw new E("scale must be a finite number.");if(!Number.isFinite(n))throw new E("relativeHeight must be a finite number.");return(e-n)*t+n};const rie=new he;vx.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,rie);if(!c(r))return d.clone(e,o);const s=vx.getHeight(r.height,n,i);return d.fromRadians(r.longitude,r.latitude,s,t,o)};const oa=vx,sie=`in vec3 position3DHigh; in vec3 position3DLow; in float batchId; #ifdef EXTRUDED_GEOMETRY in vec3 extrudeDirection; uniform float u_globeMinimumAltitude; #endif // EXTRUDED_GEOMETRY #ifdef PER_INSTANCE_COLOR out vec4 v_color; #endif // PER_INSTANCE_COLOR #ifdef TEXTURE_COORDINATES #ifdef SPHERICAL out vec4 v_sphericalExtents; #else // SPHERICAL out vec2 v_inversePlaneExtents; out vec4 v_westPlane; out vec4 v_southPlane; #endif // SPHERICAL out vec3 v_uvMinAndSphericalLongitudeRotation; out vec3 v_uMaxAndInverseDistance; out vec3 v_vMaxAndInverseDistance; #endif // TEXTURE_COORDINATES void main() { vec4 position = czm_computePosition(); #ifdef EXTRUDED_GEOMETRY float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz)); delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0; //extrudeDirection is zero for the top layer position = position + vec4(extrudeDirection * delta, 0.0); #endif #ifdef TEXTURE_COORDINATES #ifdef SPHERICAL v_sphericalExtents = czm_batchTable_sphericalExtents(batchId); v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId); #else // SPHERICAL #ifdef COLUMBUS_VIEW_2D vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId); vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId); // If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w): // - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts) // - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w) // - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow) vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w)); bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0; planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w); planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w); // - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0) // - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x) // - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow) idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0; idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x)); planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x); planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x); vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz; vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz; vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz; #else // COLUMBUS_VIEW_2D // 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz; vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner; vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner; #endif // COLUMBUS_VIEW_2D vec3 eastWard = southEastCorner - southWestCorner; float eastExtent = length(eastWard); eastWard /= eastExtent; vec3 northWard = northWestCorner - southWestCorner; float northExtent = length(northWard); northWard /= northExtent; v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner)); v_southPlane = vec4(northWard, -dot(northWard, southWestCorner)); v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent); #endif // SPHERICAL vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId); vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId); v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z); v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w); v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy; #endif // TEXTURE_COORDINATES #ifdef PER_INSTANCE_COLOR v_color = czm_batchTable_color(batchId); #endif gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position); } `,wI=`#ifdef VECTOR_TILE uniform vec4 u_highlightColor; #endif void main(void) { #ifdef VECTOR_TILE out_FragColor = czm_gammaCorrect(u_highlightColor); #else out_FragColor = vec4(1.0); #endif czm_writeDepthClamp(); } `,Jk={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};Jk.NUMBER_OF_CLASSIFICATION_TYPES=3;const Ui=Object.freeze(Jk),aie={NEVER:J.NEVER,LESS:J.LESS,EQUAL:J.EQUAL,LESS_OR_EQUAL:J.LEQUAL,GREATER:J.GREATER,NOT_EQUAL:J.NOTEQUAL,GREATER_OR_EQUAL:J.GEQUAL,ALWAYS:J.ALWAYS},lp=Object.freeze(aie);function cie(e,t){if(!c(e))throw new E("array is required.");if(!c(t)||t<1)throw new E("numberOfArrays must be greater than 0.");const n=[],i=e.length;let o=0;for(;o=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");const i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o;let a;this._packFloats&&i[t].componentDatatype!==Me.UNSIGNED_BYTE?a=hie(this._batchValues,s,WR):a=te.unpack(this._batchValues,s,WR);const l=eV(i,t);return c(l.fromCartesian4)?l.fromCartesian4(a,n):c(l.clone)?l.clone(a,n):a.x};const pie=[void 0,void 0,new H,new d,new te],mie=new te;uu.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");if(!c(n))throw new E("value is required.");const i=this._attributes,o=pie[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=eV(this._attributes,t);if(c(s.equals)?s.equals(r,n):r===n)return;const l=mie;l.x=c(n.x)?n.x:n,l.y=c(n.y)?n.y:0,l.z=c(n.z)?n.z:0,l.w=c(n.w)?n.w:0;const u=this._offsets[t],f=4*this._stride*e+4*u;this._packFloats&&i[t].componentDatatype!==Me.UNSIGNED_BYTE?fie(l,this._batchValues,f):te.pack(l,this._batchValues,f),this._batchValuesDirty=!0};function _ie(e,t){const n=e._textureDimensions;e._texture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:un.NEAREST,flipY:!1})}function gie(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}uu.prototype.update=function(e){c(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,c(this._texture)||_ie(this,e.context),gie(this))};uu.prototype.getUniformMapCallback=function(){const e=this;return function(t){return e._attributes.length===0?t:jt(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function yie(e){const t=e._stride;return e._textureDimensions.y===1?`uniform vec4 batchTextureStep; vec2 computeSt(float batchId) { float stepX = batchTextureStep.x; float centerX = batchTextureStep.y; float numberOfAttributes = float(${t}); return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); } `:`uniform vec4 batchTextureStep; uniform vec2 batchTextureDimensions; vec2 computeSt(float batchId) { float stepX = batchTextureStep.x; float centerX = batchTextureStep.y; float stepY = batchTextureStep.z; float centerY = batchTextureStep.w; float numberOfAttributes = float(${t}); float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); } `}function bie(e){return e===1?"float":`vec${e}`}function Tie(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function Aie(e,t){const i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=bie(o),a=Tie(o),l=e._offsets[t];let u=`${s} ${r}(float batchId) { vec2 st = computeSt(batchId); st.x += batchTextureStep.x * float(${l}); `;return e._packFloats&&i.componentDatatype!==Me.UNSIGNED_BYTE?u+=`vec4 textureValue; textureValue.x = czm_unpackFloat(texture(batchTexture, st)); textureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0))); textureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); textureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); `:u+=` vec4 textureValue = texture(batchTexture, st); `,u+=` ${s} value = textureValue${a}; `,e._pixelDatatype===Me.UNSIGNED_BYTE&&i.componentDatatype===Z.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0; `:e._pixelDatatype===Me.FLOAT&&i.componentDatatype===Z.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0; `),u+=` return value; } `,u}uu.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture; `;t+=`${yie(this)} `;const n=e.length;for(let i=0;iR.EPSILON6)throw new E("vector must be normalized.");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 o=n.x,r=n.y;n.x=(1-Math.abs(r))*R.signNotZero(o),n.y=(1-Math.abs(o))*R.signNotZero(r)}return n.x=R.toSNorm(n.x,t),n.y=R.toSNorm(n.y,t),n};ii.octEncode=function(e,t){return ii.octEncodeInRange(e,255,t)};const xg=new H,$R=new Uint8Array(1);function Gb(e){return $R[0]=e,$R[0]}ii.octEncodeToCartesian4=function(e,t){return ii.octEncodeInRange(e,65535,xg),t.x=Gb(xg.x*qR),t.y=Gb(xg.x),t.z=Gb(xg.y*qR),t.w=Gb(xg.y),t};ii.octDecodeInRange=function(e,t,n,i){if(A.defined("result",i),e<0||e>n||t<0||t>n)throw new E(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=R.fromSNorm(e,n),i.y=R.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const o=i.x;i.x=(1-Math.abs(i.y))*R.signNotZero(o),i.y=(1-Math.abs(o))*R.signNotZero(i.y)}return d.normalize(i,i)};ii.octDecode=function(e,t,n){return ii.octDecodeInRange(e,t,255,n)};ii.octDecodeFromCartesian4=function(e,t){A.typeOf.object("encoded",e),A.typeOf.object("result",t);const n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new E("x, y, z, and w must be unsigned normalized integers between 0 and 255");const s=n*YR+i,a=o*YR+r;return ii.octDecodeInRange(s,a,65535,t)};ii.octPackFloat=function(e){return A.defined("encoded",e),256*e.x+e.y};const SI=new H;ii.octEncodeFloat=function(e){return ii.octEncode(e,SI),ii.octPackFloat(SI)};ii.octDecodeFloat=function(e,t){A.defined("value",e);const n=e/256,i=Math.floor(n),o=(n-i)*256;return ii.octDecode(i,o,t)};ii.octPack=function(e,t,n,i){A.defined("v1",e),A.defined("v2",t),A.defined("v3",n),A.defined("result",i);const o=ii.octEncodeFloat(e),r=ii.octEncodeFloat(t),s=ii.octEncode(n,SI);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};ii.octUnpack=function(e,t,n,i){A.defined("packed",e),A.defined("v1",t),A.defined("v2",n),A.defined("v3",i);let o=e.x/65536;const r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;const a=Math.floor(o),l=(o-a)*65536;ii.octDecodeFloat(s,t),ii.octDecodeFloat(l,n),ii.octDecode(r,a,i)};ii.compressTextureCoordinates=function(e){A.defined("textureCoordinates",e);const t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};ii.decompressTextureCoordinates=function(e,t){A.defined("compressed",e),A.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function uw(e){return e>>1^-(e&1)}ii.zigZagDeltaDecode=function(e,t,n){A.defined("uBuffer",e),A.defined("vBuffer",t),A.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),c(n)&&A.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);const i=e.length;let o=0,r=0,s=0;for(let a=0;a>11,f=u>>5&r,_=u&o,g=3*l;t[g]=h*s,t[g+1]=f*a,t[g+2]=_*s}return t};const En=ii,XR=new d,QR=new d,KR=new d;function xie(e,t,n,i,o){A.defined("point",e),A.defined("p0",t),A.defined("p1",n),A.defined("p2",i),c(o)||(o=new d);let r,s,a,l,u,h,f,_;if(c(t.z)){if(d.equalsEpsilon(e,t,R.EPSILON14))return d.clone(d.UNIT_X,o);if(d.equalsEpsilon(e,n,R.EPSILON14))return d.clone(d.UNIT_Y,o);if(d.equalsEpsilon(e,i,R.EPSILON14))return d.clone(d.UNIT_Z,o);r=d.subtract(n,t,XR),s=d.subtract(i,t,QR),a=d.subtract(e,t,KR),l=d.dot(r,r),u=d.dot(r,s),h=d.dot(r,a),f=d.dot(s,s),_=d.dot(s,a)}else{if(H.equalsEpsilon(e,t,R.EPSILON14))return d.clone(d.UNIT_X,o);if(H.equalsEpsilon(e,n,R.EPSILON14))return d.clone(d.UNIT_Y,o);if(H.equalsEpsilon(e,i,R.EPSILON14))return d.clone(d.UNIT_Z,o);r=H.subtract(n,t,XR),s=H.subtract(i,t,QR),a=H.subtract(e,t,KR),l=H.dot(r,r),u=H.dot(r,s),h=H.dot(r,a),f=H.dot(s,s),_=H.dot(s,a)}o.y=f*h-u*_,o.z=l*_-u*h;const g=l*f-u*u;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}const eO={};eO.calculateACMR=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.indices;let n=e.maximumIndex;const i=y(e.cacheSize,24);if(!c(t))throw new E("indices is required.");const o=t.length;if(o<3||o%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");if(!c(n)){n=0;let a=0,l=t[a];for(;an&&(n=l),++a,l=t[a]}const r=[];for(let a=0;ai&&(r[t[a]]=s,++s);return(s-i+1)/(o/3)};eO.tipsify=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.indices,n=e.maximumIndex,i=y(e.cacheSize,24);let o;function r(S,D,p,I){for(;D.length>=1;){const O=D[D.length-1];if(D.splice(D.length-1,1),S[O].numLiveTriangles>0)return O}for(;o0)return++o,o-1;++o}return-1}function s(S,D,p,I,O,F,V){let G=-1,j,W=-1,X=0;for(;XW||W===-1)&&(W=j,G=q)),++X}return G===-1?r(I,F,S,V):G}if(!c(t))throw new E("indices is required.");const a=t.length;if(a<3||a%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");let l=0,u=0,h=t[u];const f=a;if(c(n))l=n+1;else{for(;ul&&(l=h),++u,h=t[u];if(l===-1)return 0;++l}const _=[];let g;for(g=0;gi&&(w.timeStamp=T,++T),++u}b=s(t,i,x,_,T,C,l)}return N};const Cie=eO,Vs={};function Ix(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function Eie(e){const t=e.length,n=t/3*6,i=je.createTypedArray(t,n);let o=0;for(let r=0;r=3){const n=(t-2)*6,i=je.createTypedArray(t,n);Ix(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r0){const t=e.length-1,n=(t-1)*6,i=je.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;so&&(o=n[r]);e.indices=Cie.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function ZR(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)){const i=e[n];t[n]=new Ie({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function vie(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){const o=t[i];for(let r=0;r=R.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=ZR(e.attributes);const a=e.indices,l=a.length;let u;e.primitiveType===ze.TRIANGLES?u=3:e.primitiveType===ze.LINES?u=2:e.primitiveType===ze.POINTS&&(u=1);for(let h=0;h=R.SIXTY_FOUR_KILOBYTES&&(t.push(new Tt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=ZR(e.attributes))}o.length!==0&&t.push(new Tt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const JR=new d,Iie=new he;Vs.projectTo2D=function(e,t,n,i,o){if(!c(e))throw new E("geometry is required.");if(!c(t))throw new E("attributeName is required.");if(!c(n))throw new E("attributeName3D is required.");if(!c(i))throw new E("attributeName2D is required.");if(!c(e.attributes[t]))throw new E(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==Z.DOUBLE)throw new E("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const r=e.attributes[t];o=c(o)?o:new co;const s=o.ellipsoid,a=r.values,l=new Float64Array(a.length);let u=0;for(let h=0;hT&&(T=C)}return new Tt({attributes:h,indices:m,primitiveType:u,boundingSphere:c(b)?new se(b,T):void 0})}Vs.combineInstances=function(e){if(!c(e)||e.length<1)throw new E("instances is required and must have length greater than zero.");const t=[],n=[],i=e.length;for(let r=0;r0&&o.push(pw(t,"geometry")),n.length>0&&(o.push(pw(n,"westHemisphereGeometry")),o.push(pw(n,"eastHemisphereGeometry"))),o};const Xa=new d,Cg=new d,cm=new d,lm=new d;Vs.computeNormal=function(e){if(!c(e))throw new E("geometry is required.");if(!c(e.attributes.position)||!c(e.attributes.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(e.indices))throw new E("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==ze.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const t=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,r=t.length,s=new Array(o),a=new Array(r/3),l=new Array(r);let u;for(u=0;u0){for(h=0;h<_.count;h++)d.add(Xa,a[l[_.indexOffset+h]],Xa);d.equalsEpsilon(d.ZERO,Xa,R.EPSILON10)&&d.clone(a[l[_.indexOffset]],Xa)}d.equalsEpsilon(d.ZERO,Xa,R.EPSILON10)&&(Xa.z=1),d.normalize(Xa,Xa),g[m]=Xa.x,g[m+1]=Xa.y,g[m+2]=Xa.z}return e.attributes.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g}),e};const Oie=new d,eN=new d,Lie=new d;Vs.computeTangentAndBitangent=function(e){if(!c(e))throw new E("geometry is required.");const t=e.attributes,n=e.indices;if(!c(t.position)||!c(t.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(t.normal)||!c(t.normal.values))throw new E("geometry.attributes.normal.values is required.");if(!c(t.st)||!c(t.st.values))throw new E("geometry.attributes.st.values is required.");if(!c(n))throw new E("geometry.indices is required.");if(n.length<2||n.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==ze.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const i=e.attributes.position.values,o=e.attributes.normal.values,r=e.attributes.st.values,s=e.attributes.position.values.length/3,a=n.length,l=new Array(s*3);let u;for(u=0;u3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let o=3;oo?i>r?s=R.sign(e.y):s=R.sign(n.y):o>r?s=R.sign(t.y):s=R.sign(n.y);const a=s<0;ih(e,a),ih(t,a),ih(n,a)}const iN=new d;function Qa(e,t,n,i){d.add(e,d.multiplyByScalar(d.subtract(t,e,iN),e.y/(e.y-t.y),iN),n),d.clone(n,i),ih(n,!0),ih(i,!1)}const df=new d,hf=new d,ff=new d,pf=new d,mw={positions:new Array(7),indices:new Array(3*3)};function Vie(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;kie(e,t,n);const i=e.y<0,o=t.y<0,r=n.y<0;let s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;const a=mw.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Qa(e,t,df,ff),Qa(e,n,hf,pf),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Qa(t,n,df,ff),Qa(t,e,hf,pf),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Qa(n,e,df,ff),Qa(n,t,hf,pf),a[0]=2,a[3]=0,a[4]=1,a[6]=0)):s===2&&(a[2]=4,a[4]=4,a[5]=3,a[7]=5,a[8]=6,i?o?r||(Qa(n,e,df,ff),Qa(n,t,hf,pf),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Qa(t,n,df,ff),Qa(t,e,hf,pf),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Qa(e,t,df,ff),Qa(e,n,hf,pf),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const l=mw.positions;return l[0]=e,l[1]=t,l[2]=n,l.length=3,(s===1||s===2)&&(l[3]=df,l[4]=hf,l[5]=ff,l[6]=pf,l.length=7),mw}function oN(e,t){const n=e.attributes;if(n.position.values.length===0)return;for(const o in n)if(n.hasOwnProperty(o)&&c(n[o])&&c(n[o].values)){const r=n[o];r.values=Z.createTypedArray(r.componentDatatype,r.values)}const i=Tt.computeNumberOfVertices(e);return e.indices=je.createTypedArray(i,e.indices),t&&(e.boundingSphere=se.fromVertices(n.position.values)),e}function I_(e){const t=e.attributes,n={};for(const i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){const o=t[i];n[i]=new Ie({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new Tt({attributes:n,indices:[],primitiveType:e.primitiveType})}function tO(e,t,n){const i=c(e.geometry.boundingSphere);t=oN(t,i),n=oN(n,i),c(n)&&!c(t)?e.geometry=n:!c(n)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function nO(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,l,u,h,f,_){const g=e.fromArray(u,r*t,n),m=e.fromArray(u,s*t,i),b=e.fromArray(u,a*t,o);e.multiplyByScalar(g,l.x,g),e.multiplyByScalar(m,l.y,m),e.multiplyByScalar(b,l.z,b);const T=e.add(g,m,g);e.add(T,b,T),_&&e.normalize(T,T),e.pack(T,h,f*t)}}const Hie=nO(te,4),zA=nO(d,3),tV=nO(H,2),Gie=function(e,t,n,i,o,r,s){const a=o[e]*i.x,l=o[t]*i.y,u=o[n]*i.z;r[s]=a+l+u>R.EPSILON6?1:0},Dy=new d,vI=new d,II=new d,jie=new d;function Yb(e,t,n,i,o,r,s,a,l,u,h,f,_,g,m,b){if(!c(r)&&!c(s)&&!c(a)&&!c(l)&&!c(u)&&g===0)return;const T=d.fromArray(o,e*3,Dy),x=d.fromArray(o,t*3,vI),C=d.fromArray(o,n*3,II),w=xie(i,T,x,C,jie);if(!!c(w)){if(c(r)&&zA(e,t,n,w,r,f.normal.values,b,!0),c(u)){const v=d.fromArray(u,e*3,Dy),P=d.fromArray(u,t*3,vI),N=d.fromArray(u,n*3,II);d.multiplyByScalar(v,w.x,v),d.multiplyByScalar(P,w.y,P),d.multiplyByScalar(N,w.z,N);let k;!d.equals(v,d.ZERO)||!d.equals(P,d.ZERO)||!d.equals(N,d.ZERO)?(k=d.add(v,P,v),d.add(k,N,k),d.normalize(k,k)):(k=Dy,k.x=0,k.y=0,k.z=0),d.pack(k,f.extrudeDirection.values,b*3)}if(c(h)&&Gie(e,t,n,w,h,f.applyOffset.values,b),c(s)&&zA(e,t,n,w,s,f.tangent.values,b,!0),c(a)&&zA(e,t,n,w,a,f.bitangent.values,b,!0),c(l)&&tV(e,t,n,w,l,f.st.values,b),g>0)for(let v=0;v3){const I=p.positions,O=p.indices,F=O.length;for(let V=0;V0)continue;const l=d.unpack(i,s,oV);(a.y<0&&l.y>0||a.y>0&&l.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):d.pack(a,i,s));const u=d.unpack(o,s,DI);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+30||se.intersectPlane(n,_t.ORIGIN_ZX_PLANE)!==Bt.INTERSECTING))return e;if(t.geometryType!==Wm.NONE)switch(t.geometryType){case Wm.POLYLINES:eoe(e);break;case Wm.TRIANGLES:rN(e);break;case Wm.LINES:sN(e);break}else Uie(t),t.primitiveType===ze.TRIANGLES?rN(e):t.primitiveType===ze.LINES&&sN(e);return e};const ti=Vs;function vn(e){this._ellipsoid=y(e,ae.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(vn.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});vn.mercatorAngleToGeodeticLatitude=function(e){return R.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};vn.geodeticLatitudeToMercatorAngle=function(e){e>vn.MaximumLatitude?e=vn.MaximumLatitude:e<-vn.MaximumLatitude&&(e=-vn.MaximumLatitude);const t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};vn.MaximumLatitude=vn.mercatorAngleToGeodeticLatitude(Math.PI);vn.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=vn.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};vn.prototype.unproject=function(e,t){if(!c(e))throw new E("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=vn.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};function toe(e,t,n){let i=!n;const o=e.length;let r;if(!i&&o>1){const s=e[0].modelMatrix;for(r=1;r=0){const u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;const l=e.length;for(let u=0;ur&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:_}),o+=_}}function ooe(e,t){const n=[];return gw(e,"geometry",t,n),gw(e,"westHemisphereGeometry",t,n),gw(e,"eastHemisphereGeometry",t,n),n}const ld={};ld.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=ioe(e),t.length>0&&(n=ti.createAttributeLocations(t[0]),e.createPickOffsets&&(r=ooe(i,t))),c(i[0].attributes)&&c(i[0].attributes.offset)&&(s=new Array(o),a=!0));const l=new Array(o),u=new Array(o);for(let h=0;h0&&(n.set(l.indices,s),s+=m)}return t.push(n.buffer),{stringTable:i,packedData:n}};ld.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const o=new Array(n[0]);let r=0,s=1;for(;s0){const P=T.length/x;for(v=je.createTypedArray(P,b),i=0;i= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; gl_Position *= show; }`,`${i} ${o}`};function pN(e,t){if(!e.compressVertices)return t;const n=t.search(/in\s+vec3\s+normal;/g)!==-1,i=t.search(/in\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;const o=t.search(/in\s+vec3\s+tangent;/g)!==-1,r=t.search(/in\s+vec3\s+bitangent;/g)!==-1;let s=i&&n?2:1;s+=o||r?1:0;const a=s>1?`vec${s}`:"float",l="compressedAttributes",u=`in ${a} ${l};`;let h="",f="";if(i){h+=`vec2 st; `;const m=s>1?`${l}.x`:l;f+=` st = czm_decompressTextureCoordinates(${m}); `}n&&o&&r?(h+=`vec3 normal; vec3 tangent; vec3 bitangent; `,f+=` czm_octDecode(${l}.${i?"yz":"xy"}, normal, tangent, bitangent); `):(n&&(h+=`vec3 normal; `,f+=` normal = czm_octDecode(${l}${s>1?`.${i?"y":"x"}`:""}); `),o&&(h+=`vec3 tangent; `,f+=` tangent = czm_octDecode(${l}.${i&&n?"z":"y"}); `),r&&(h+=`vec3 bitangent; `,f+=` bitangent = czm_octDecode(${l}.${i&&n?"z":"y"}); `));let _=t;_=_.replace(/in\s+vec3\s+normal;/g,""),_=_.replace(/in\s+vec2\s+st;/g,""),_=_.replace(/in\s+vec3\s+tangent;/g,""),_=_.replace(/in\s+vec3\s+bitangent;/g,""),_=Oe.replaceMain(_,"czm_non_compressed_main");const g=`void main() { ${f} czm_non_compressed_main(); }`;return[u,h,_,g].join(` `)}function boe(e){let t=Oe.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() { czm_non_depth_clamp_main(); gl_Position = czm_depthClamp(gl_Position);} `,t}function Toe(e){let t=Oe.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() { czm_non_depth_clamp_main(); #if defined(LOG_DEPTH) czm_writeLogDepth(); #else czm_writeDepthClamp(); #endif } `,t}function mN(e,t){const n=e.vertexAttributes;for(const i in n)if(n.hasOwnProperty(i)&&!c(t[i]))throw new E(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function Aoe(e,t){return function(){return e[t]}}const yw=Math.max(Yt.hardwareConcurrency-1,1);let Xb;const xoe=new Kn("combineGeometry");function Coe(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===Uo.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const a=e._numberOfInstances=n.length,l=[];let u=[];for(o=0;o0){const b=new Float64Array(f);for(m=[b.buffer],r=0;r0?(e._recomputeBoundingSpheres=!0,e._state=Uo.COMBINED):Py(e,t,Uo.FAILED,void 0)}).catch(function(f){Py(e,t,Uo.FAILED,f)})}}function Eoe(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds;let s,a,l=0;for(a=0;a0?(e._recomputeBoundingSpheres=!0,e._state=Uo.COMBINED):Py(e,t,Uo.FAILED,void 0)}function woe(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!c(n)){e._recomputeBoundingSpheres=!1;return}let i;const o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length;let a=e._tempBoundingSpheres;if(!c(a)){for(a=new Array(s),i=0;i0||se.intersectPlane(b,_t.ORIGIN_ZX_PLANE)!==Bt.INTERSECTING?l.push(b):(u.push(b),h.push(b))}let f=l[0],_=h[0],g=u[0];for(i=1;i0){if(pt.maximumVertexTextureImageUnits===0)throw new Te("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!==Uo.COMPLETE&&this._state!==Uo.COMBINED&&(this.asynchronous?Coe(this,e):Eoe(this,e)),this._state===Uo.COMBINED&&(Soe(this,e),gN(this,e),Ioe(this,e)),!this.show||this._state!==Uo.COMPLETE)return;this._batchTableOffsetsUpdated||gN(this,e),this._recomputeBoundingSpheres&&woe(this,e);const n=this.appearance,i=n.material;let o=!1,r=!1;this._appearance!==n?(this._appearance=n,this._material=i,o=!0,r=!0):this._material!==i&&(this._material=i,r=!0);const s=this.depthFailAppearance,a=c(s)?s.material:void 0;this._depthFailAppearance!==s?(this._depthFailAppearance=s,this._depthFailMaterial=a,o=!0,r=!0):this._depthFailMaterial!==a&&(this._depthFailMaterial=a,r=!0);const l=this._appearance.isTranslucent();this._translucent!==l&&(this._translucent=l,o=!0),c(this._material)&&this._material.update(t);const u=n.closed&&l;o&&y(this._createRenderStatesFunction,Doe)(this,t,n,u),r&&y(this._createShaderProgramFunction,Poe)(this,e,n),(o||r)&&y(this._createCommandsFunction,Ooe)(this,n,i,l,u,this._colorCommands,this._pickCommands,e),y(this._updateAndQueueCommandsFunction,Loe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};const Roe=new se,Noe=new se;function uV(e,t,n){if(n===Kt.TOP){const i=se.clone(e,Roe),o=se.clone(e,Noe);o.center=d.add(o.center,t,o.center),e=se.union(i,o,e)}else n===Kt.ALL&&(e.center=d.add(e.center,t,e.center));return e}function Moe(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=Z.createTypedArray(o.componentDatatype,r);return c(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function Foe(e,t,n,i,o){return function(r){if(!c(r)||!c(r.length)||r.length<1||r.length>4)throw new E("value must be and array with length between 1 and 4.");const s=sV(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const Boe=new d;function zoe(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(c(i)){i=i.clone();const o=e.modelMatrix,r=t.offset;c(r)&&uV(i,d.fromArray(r.get(),0,Boe),e._offsetInstanceExtend[n]),c(o)&&(i=se.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function Uoe(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}Mt.prototype.getGeometryInstanceAttributes=function(e){if(!c(e))throw new E("id is required");if(!c(this._batchTable))throw new E("must call update before calling getGeometryInstanceAttributes");let t=this._perInstanceAttributeCache.get(e);if(c(t))return t;let n=-1;const i=this._lastPerInstanceAttributeIndex,o=this._instanceIds,r=o.length;for(let u=0;u4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.value))throw new E("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.value=e.value}const dV=`#ifdef TEXTURE_COORDINATES #ifdef SPHERICAL in vec4 v_sphericalExtents; #else // SPHERICAL in vec2 v_inversePlaneExtents; in vec4 v_westPlane; in vec4 v_southPlane; #endif // SPHERICAL in vec3 v_uvMinAndSphericalLongitudeRotation; in vec3 v_uMaxAndInverseDistance; in vec3 v_vMaxAndInverseDistance; #endif // TEXTURE_COORDINATES #ifdef PER_INSTANCE_COLOR in vec4 v_color; #endif #ifdef NORMAL_EC vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) { vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth); return eyeCoordinate.xyz / eyeCoordinate.w; } vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) { vec2 glFragCoordXY = gl_FragCoord.xy; // Sample depths at both offset and negative offset float upOrRightLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw)); float downOrLeftLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw)); // Explicitly evaluate both paths // Necessary for multifrustum and for edges of the screen bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw); float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y); float useDownOrLeft = float(useUpOrRight == 0.0); vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth); vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth); return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft; } #endif // NORMAL_EC void main(void) { #ifdef REQUIRES_EC float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)); vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); #endif #ifdef REQUIRES_WC vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate; vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w; #endif #ifdef TEXTURE_COORDINATES vec2 uv; #ifdef SPHERICAL // Treat world coords as a sphere normal for spherical coordinates vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate); sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z; sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi); uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w; uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z; #else // SPHERICAL // Unpack planes and transform to eye space uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x; uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y; #endif // SPHERICAL #endif // TEXTURE_COORDINATES #ifdef PICK #ifdef CULL_FRAGMENTS // When classifying translucent geometry, logDepthOrDepth == 0.0 // indicates a region that should not be classified, possibly due to there // being opaque pixels there in another buffer. // Check for logDepthOrDepth != 0.0 to make sure this should be classified. if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) { out_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource czm_writeDepthClamp(); } #else // CULL_FRAGMENTS out_FragColor.a = 1.0; #endif // CULL_FRAGMENTS #else // PICK #ifdef CULL_FRAGMENTS // When classifying translucent geometry, logDepthOrDepth == 0.0 // indicates a region that should not be classified, possibly due to there // being opaque pixels there in another buffer. if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) { discard; } #endif #ifdef NORMAL_EC // Compute normal by sampling adjacent pixels in 2x2 block in screen space vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0)); vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0)); vec3 normalEC = normalize(cross(leftRight, downUp)); #endif #ifdef PER_INSTANCE_COLOR vec4 color = czm_gammaCorrect(v_color); #ifdef FLAT out_FragColor = color; #else // FLAT czm_materialInput materialInput; materialInput.normalEC = normalEC; materialInput.positionToEyeEC = -eyeCoordinate.xyz; czm_material material = czm_getDefaultMaterial(materialInput); material.diffuse = color.rgb; material.alpha = color.a; out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC); #endif // FLAT // Premultiply alpha. Required for classification primitives on translucent globe. out_FragColor.rgb *= out_FragColor.a; #else // PER_INSTANCE_COLOR // Material support. // USES_ is distinct from REQUIRES_, because some things are dependencies of each other or // dependencies for culling but might not actually be used by the material. czm_materialInput materialInput; #ifdef USES_NORMAL_EC materialInput.normalEC = normalEC; #endif #ifdef USES_POSITION_TO_EYE_EC materialInput.positionToEyeEC = -eyeCoordinate.xyz; #endif #ifdef USES_TANGENT_TO_EYE materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC); #endif #ifdef USES_ST // Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired // texture coordinate system, which typically forms a tight oriented bounding box around the geometry. // Shader is provided a set of reference points for remapping. materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z; materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z; #endif czm_material material = czm_getMaterial(materialInput); #ifdef FLAT out_FragColor = vec4(material.diffuse + material.emission, material.alpha); #else // FLAT out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC); #endif // FLAT // Premultiply alpha. Required for classification primitives on translucent globe. out_FragColor.rgb *= out_FragColor.a; #endif // PER_INSTANCE_COLOR czm_writeDepthClamp(); #endif // PICK } `;function Sr(e,t,n){A.typeOf.bool("extentsCulling",e),A.typeOf.bool("planarExtents",t),A.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new OI;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new OI;if(o.requiresTextureCoordinates=e,n instanceof tn)i.requiresNormalEC=!n.flat;else{const r=`${n.material.shaderSource} ${n.fragmentShaderSource}`;i.normalEC=r.indexOf("materialInput.normalEC")!==-1||r.indexOf("czm_getDefaultMaterial")!==-1,i.positionToEyeEC=r.indexOf("materialInput.positionToEyeEC")!==-1,i.tangentToEyeMatrix=r.indexOf("materialInput.tangentToEyeMatrix")!==-1,i.st=r.indexOf("materialInput.st")!==-1}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Sr.prototype.createFragmentShader=function(e){A.typeOf.bool("columbusView2D",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 tn&&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 o="";return t instanceof tn||(o=t.material.shaderSource),new Oe({defines:i,sources:[o,dV]})};Sr.prototype.createPickFragmentShader=function(e){A.typeOf.bool("columbusView2D",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 Oe({defines:n,sources:[dV],pickColorQualifier:"in"})};Sr.prototype.createVertexShader=function(e,t,n,i){return A.defined("defines",e),A.typeOf.string("vertexShaderSource",t),A.typeOf.bool("columbusView2D",n),A.defined("mapProjection",i),hV(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Sr.prototype.createPickVertexShader=function(e,t,n,i){return A.defined("defines",e),A.typeOf.string("vertexShaderSource",t),A.typeOf.bool("columbusView2D",n),A.defined("mapProjection",i),hV(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const TN=new d,AN=new he,xN={high:0,low:0};function hV(e,t,n,i,o,r,s,a){const l=i.slice();if(a.eastMostYhighDefine===""){const u=AN;u.longitude=R.PI,u.latitude=0,u.height=0;const h=s.project(u,TN);let f=rn.encode(h.x,xN);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`;const _=AN;_.longitude=-R.PI,_.latitude=0,_.height=0;const g=s.project(_,TN);f=rn.encode(g.x,xN),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`}return n&&(l.push(a.eastMostYhighDefine),l.push(a.eastMostYlowDefine),l.push(a.westMostYhighDefine),l.push(a.westMostYlowDefine)),c(r)&&r instanceof tn&&l.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(l.push("TEXTURE_COORDINATES"),t||n||l.push("SPHERICAL"),n&&l.push("COLUMBUS_VIEW_2D")),new Oe({defines:l,sources:[o]})}function OI(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}Object.defineProperties(OI.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}}});function CN(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)/H.distance(t,e)}const koe=[new H,new H,new H,new H];function fV(e,t){const n=koe,i=H.unpack(t,0,n[0]),o=H.unpack(t,2,n[1]),r=H.unpack(t,4,n[2]);e.uMaxVmax=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/CN(i,o,r),a=1/CN(i,r,o);e.uvMinAndExtents=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const pV=new he,mV=new d,Voe=new d,Hoe=new d,Qb={high:0,low:0};function _V(e,t,n){const i=pV;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,mV);i.latitude=e.north;const r=t.project(i,Voe);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,Hoe),a=[0,0,0,0],l=[0,0,0,0];let u=rn.encode(o.x,Qb);a[0]=u.high,l[0]=u.low,u=rn.encode(o.y,Qb),a[1]=u.high,l[1]=u.low,u=rn.encode(r.y,Qb),a[2]=u.high,l[2]=u.low,u=rn.encode(s.x,Qb),a[3]=u.high,l[3]=u.low,n.planes2D_HIGH=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:l})}const Goe=new L,joe=new L,EN=new d,Woe=new he,qoe=[new he,new he,new he,new he,new he,new he,new he,new he];function Yoe(e,t,n,i,o,r){const s=ce.center(e,Woe);s.height=n;const a=he.toCartesian(s,t,EN),l=zt.eastNorthUpToFixedFrame(a,t,Goe),u=L.inverse(l,joe),h=e.west,f=e.east,_=e.north,g=e.south,m=qoe;m[0].latitude=g,m[0].longitude=h,m[1].latitude=_,m[1].longitude=h,m[2].latitude=_,m[2].longitude=f,m[3].latitude=g,m[3].longitude=f;const b=(h+f)*.5,T=(_+g)*.5;m[4].latitude=g,m[4].longitude=b,m[5].latitude=_,m[5].longitude=b,m[6].latitude=T,m[6].longitude=h,m[7].latitude=T,m[7].longitude=f;let x=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,w=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;for(let M=0;M<8;M++){m[M].height=n;const U=he.toCartesian(m[M],t,EN);L.multiplyByPoint(u,U,U),U.z=0,x=Math.min(x,U.x),C=Math.max(C,U.x),w=Math.min(w,U.y),v=Math.max(v,U.y)}const P=i;P.x=x,P.y=w,P.z=0,L.multiplyByPoint(l,P,P);const N=o;N.x=C,N.y=w,N.z=0,L.multiplyByPoint(l,N,N),d.subtract(N,P,o);const k=r;k.x=x,k.y=v,k.z=0,L.multiplyByPoint(l,k,k),d.subtract(k,P,r)}const $oe=new d,Xoe=new d,Qoe=new rn;Sr.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){A.typeOf.object("boundingRectangle",e),A.defined("textureCoordinateRotationPoints",t),A.typeOf.object("ellipsoid",n),A.typeOf.object("projection",i);const r=mV,s=$oe,a=Xoe;Yoe(e,n,y(o,0),r,s,a);const l={};fV(l,t);const u=rn.fromCartesian(r,Qoe);return l.southWest_HIGH=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.high,[0,0,0])}),l.southWest_LOW=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.low,[0,0,0])}),l.eastward=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(s,[0,0,0])}),l.northward=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(a,[0,0,0])}),_V(e,i,l),l};const Koe=new d;function wN(e,t,n,i){const o=pV;o.latitude=e,o.longitude=t,o.height=0;const r=he.toCartesian(o,n,Koe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=R.fastApproximateAtan2(s,r.z),l=R.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=l,i}const SN=new H;Sr.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){A.typeOf.object("boundingRectangle",e),A.defined("textureCoordinateRotationPoints",t),A.typeOf.object("ellipsoid",n),A.typeOf.object("projection",i);const o=wN(e.south,e.west,n,SN);let r=o.x,s=o.y;const a=wN(e.north,e.east,n,SN);let l=a.x,u=a.y,h=0;s>u&&(h=R.PI-s,s=-R.PI,u+=h),r-=R.EPSILON5,s-=R.EPSILON5,l+=R.EPSILON5,u+=R.EPSILON5;const f=1/(u-s),_=1/(l-r),g={sphericalExtents:new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,_,f]}),longitudeRotation:new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:1,normalize:!1,value:[h]})};return fV(g,t),_V(e,i,g),g};Sr.hasAttributesForTextureCoordinatePlanes=function(e){return c(e.southWest_HIGH)&&c(e.southWest_LOW)&&c(e.northward)&&c(e.eastward)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};Sr.hasAttributesForSphericalExtents=function(e){return c(e.sphericalExtents)&&c(e.longitudeRotation)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};function Zoe(e){return Math.max(e.width,e.height)>Sr.MAX_WIDTH_FOR_PLANAR_EXTENTS}Sr.shouldUseSphericalCoordinates=function(e){return A.typeOf.object("rectangle",e),Zoe(e)};Sr.MAX_WIDTH_FOR_PLANAR_EXTENTS=R.toRadians(1);const Joe={NEVER:J.NEVER,LESS:J.LESS,EQUAL:J.EQUAL,LESS_OR_EQUAL:J.LEQUAL,GREATER:J.GREATER,NOT_EQUAL:J.NOTEQUAL,GREATER_OR_EQUAL:J.GEQUAL,ALWAYS:J.ALWAYS},Pn=Object.freeze(Joe),ere={ZERO:J.ZERO,KEEP:J.KEEP,REPLACE:J.REPLACE,INCREMENT:J.INCR,DECREMENT:J.DECR,INVERT:J.INVERT,INCREMENT_WRAP:J.INCR_WRAP,DECREMENT_WRAP:J.DECR_WRAP},nt=Object.freeze(ere),UA={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};UA.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:Pn.ALWAYS,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.REPLACE},backFunction:Pn.ALWAYS,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.REPLACE},reference:UA.CESIUM_3D_TILE_MASK,mask:UA.CESIUM_3D_TILE_MASK}};const At=Object.freeze(UA);function Qh(e){e=y(e,y.EMPTY_OBJECT);const t=e.geometryInstances;this.geometryInstances=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ui.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=y(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._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:y(e.vertexCacheOptimize,!1),interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:y(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(Qh.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}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}});Qh.isSupported=function(e){return e.context.stencilBuffer};function qm(e,t){const n=t?Pn.EQUAL:Pn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:nt.KEEP,zFail:nt.DECREMENT_WRAP,zPass:nt.KEEP},backFunction:n,backOperation:{fail:nt.KEEP,zFail:nt.INCREMENT_WRAP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},depthMask:!1}}function LI(e){return{stencilTest:{enabled:e,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND}}const tre={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function nre(e,t,n,i){if(c(e._rsStencilDepthPass))return;const o=!e.debugShowShadowVolume;e._rsStencilDepthPass=Ue.fromCache(qm(o,!1)),e._rsStencilDepthPass3DTiles=Ue.fromCache(qm(o,!0)),e._rsColorPass=Ue.fromCache(LI(o)),e._rsPickPass=Ue.fromCache(tre)}function ire(e,t){if(!e.compressVertices)return t;if(t.search(/in\s+vec3\s+extrudeDirection;/g)!==-1){const n="compressedAttributes",i=`in vec2 ${n};`,o=`vec3 extrudeDirection; `,r=` extrudeDirection = czm_octDecode(${n}, 65535.0); `;let s=t;s=s.replace(/in\s+vec3\s+extrudeDirection;/g,""),s=Oe.replaceMain(s,"czm_non_compressed_main");const a=`void main() { ${r} czm_non_compressed_main(); }`;return[i,o,s,a].join(` `)}}function ore(e,t){const n=t.context,i=e._primitive;let o=sie;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Mt._appendDistanceDisplayConditionToShader(i,o),o=Mt._modifyShaderPosition(e,o,t.scene3DOnly),o=Mt._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=ire(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let l=new Oe({defines:[a],sources:[o]});const u=new Oe({sources:[wI]}),h=e._primitive._attributeLocations,f=new Sr(s,r,e.appearance);if(e._spStencil=Jt.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h}),e._primitive.allowPicking){let m=Oe.createPickVertexShaderSource(o);m=Mt._appendShowToShader(i,m),m=Mt._updatePickColorAttribute(m);const b=f.createPickFragmentShader(!1),T=f.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=Jt.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:h}),s){let x=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!c(x)){const C=f.createPickFragmentShader(!0),w=f.createPickVertexShader([a],m,!0,t.mapProjection);x=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:w,fragmentShaderSource:C,attributeLocations:h})}e._spPick2D=x}}else e._spPick=Jt.fromCache({context:n,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h});o=Mt._appendShowToShader(i,o),l=new Oe({defines:[a],sources:[o]}),e._sp=Jt.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h});const _=f.createFragmentShader(!1),g=f.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Jt.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:h}),s){let m=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!c(m)){const b=f.createFragmentShader(!0),T=f.createVertexShader([a],o,!0,t.mapProjection);m=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:h})}e._spColor2D=m}}function rre(e,t){const n=e._primitive;let i=n._va.length*2;t.length=i;let o,r,s,a=0,l=n._batchTable.getUniformMapCallback()(e._uniformMap);const u=e._needs2DShader;for(o=0;o0&&(l=o[0].attributes,_=Sr.hasAttributesForSphericalExtents(l),g=Sr.hasAttributesForTextureCoordinatePlanes(l),f=l.color),s=0;s{c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Qh.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Qh.prototype.isDestroyed=function(){return!1};Qh.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,ve(this)};const lre={u_globeMinimumAltitude:function(){return 55e3}};function sr(e){e=y(e,y.EMPTY_OBJECT);let t=e.appearance;const n=e.geometryInstances;if(!c(t)&&c(n)){const o=Array.isArray(n)?n:[n],r=o.length;for(let s=0;s{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};sr.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};sr.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};sr.prototype.isDestroyed=function(){return!1};sr.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};sr._supportsMaterials=function(e){return e.depthTexture};sr.supportsMaterials=function(e){return A.typeOf.object("scene",e),sr._supportsMaterials(e.frameState.context)};function Go(){E.throwInstantiationError()}Object.defineProperties(Go.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});Go.prototype.getType=E.throwInstantiationError;Go.prototype.getValue=E.throwInstantiationError;Go.prototype.equals=E.throwInstantiationError;Go.getValue=function(e,t,n){let i;return c(t)&&(i=t.getType(e),c(i))?((!c(n)||n.type!==i)&&(n=Se.fromType(i)),t.getValue(e,n.uniforms),n):((!c(n)||n.type!==Se.ColorType)&&(n=Se.fromType(Se.ColorType)),z.clone(z.WHITE,n.uniforms.color),n)};function On(e,t,n){A.defined("geometryUpdater",e),A.defined("primitives",t),A.defined("orderedGroundPrimitives",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}On.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!K.getValueOrDefault(t.show,n,!0)};On.prototype._setOptions=E.throwInstantiationError;On.prototype.update=function(e){A.defined("time",e);const t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,o=this._orderedGroundPrimitives;n?o.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;const a=this._geometryUpdater.shadowsProperty.getValue(e),l=this._options;if(!c(s.fill)||s.fill.getValue(e)){const u=t.fillMaterialProperty,h=u instanceof kt;let f;const _=t._getIsClosed(l);if(h)f=new tn({closed:_,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const g=Go.getValue(e,u,this._material);this._material=g,f=new oo({material:g,translucent:g.isTranslucent(),closed:_})}if(n)l.vertexFormat=tn.VERTEX_FORMAT,this._primitive=o.add(new sr({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:f,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),K.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{l.vertexFormat=f.vertexFormat;const g=this._geometryUpdater.createFillGeometryInstance(e);h&&(f.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Mt({geometryInstances:g,appearance:f,asynchronous:!1,shadows:a}))}}if(!n&&c(s.outline)&&s.outline.getValue(e)){const u=this._geometryUpdater.createOutlineGeometryInstance(e),h=K.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Mt({geometryInstances:u,appearance:new tn({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(h)}}),asynchronous:!1,shadows:a}))}};On.prototype.getBoundingSphere=function(e){if(!c(e))throw new E("result is required.");const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let o;return c(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))||c(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))?(se.clone(o.boundingSphere,e),rt.DONE):c(n)&&!n.ready||c(i)&&!i.ready?rt.PENDING:rt.FAILED};On.prototype.isDestroyed=function(){return!1};On.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),ve(this)};const yre={NONE:0,GEODESIC:1,RHUMB:2},cn=Object.freeze(yre),LN=R.EPSILON10;function gs(e,t,n,i){if(A.defined("equalsEpsilon",t),!c(e))return;n=y(n,!1);const o=c(i),r=e.length;if(r<2)return e;let s,a=e[0],l,u,h=0,f=-1;for(s=1;sR.EPSILON12);const D=B*(t*t-n*n)/(n*n),p=1+D*(4096+D*(D*(320-175*D)-768))/16384,I=D*(256+D*(D*(74-47*D)-128))/1024,O=S*S,F=I*U*(S+I*(M*(2*O-1)-I*S*(4*U*U-3)*(4*O-3)/6)/4),V=n*p*(k-F),G=Math.atan2(g*N,T-C*P),j=Math.atan2(f*N,T*P-C);e._distance=V,e._startHeading=G,e._endHeading=j,e._uSquared=D}const xre=new d,Cw=new d;function yV(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,Cw),xre),r=d.normalize(i.cartographicToCartesian(n,Cw),Cw);A.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125),Are(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=he.clone(t,e._start),e._end=he.clone(n,e._end),e._start.height=0,e._end.height=0,bre(e)}function Mp(e,t,n){const i=y(n,ae.WGS84);this._ellipsoid=i,this._start=new he,this._end=new he,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,c(e)&&c(t)&&yV(this,e,t,i)}Object.defineProperties(Mp.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return A.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return A.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return A.defined("distance",this._distance),this._endHeading}}});Mp.prototype.setEndPoints=function(e,t){A.defined("start",e),A.defined("end",t),yV(this,e,t,this._ellipsoid)};Mp.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};Mp.prototype.interpolateUsingSurfaceDistance=function(e,t){A.defined("distance",this._distance);const n=this._constants,i=n.distanceRatio+e/n.b,o=Math.cos(2*i),r=Math.cos(4*i),s=Math.cos(6*i),a=Math.sin(2*i),l=Math.sin(4*i),u=Math.sin(6*i),h=Math.sin(8*i),f=i*i,_=i*f,g=n.u8Over256,m=n.u2Over4,b=n.u6Over64,T=n.u4Over16;let x=2*_*g*o/3+i*(1-m+7*T/4-15*b/4+579*g/64-(T-15*b/4+187*g/16)*o-(5*b/4-115*g/16)*r-29*g*s/16)+(m/2-T+71*b/32-85*g/16)*a+(5*T/16-5*b/4+383*g/96)*l-f*((b-11*g/2)*a+5*g*l/2)+(29*b/96-29*g/16)*u+539*g*h/1536;const C=Math.asin(Math.sin(x)*n.cosineAlpha),w=Math.atan(n.a/n.b*Math.tan(C));x=x-n.sigma;const v=Math.cos(2*n.sigma+x),P=Math.sin(x),N=Math.cos(x),k=n.cosineU*N,M=n.sineU*P,B=Math.atan2(P*n.sineHeading,k-M*n.cosineHeading)-gV(n.f,n.sineAlpha,n.cosineSquaredAlpha,x,P,N,v);return c(t)?(t.longitude=this._start.longitude+B,t.latitude=w,t.height=0,t):new he(this._start.longitude+B,w,0)};function RI(e,t,n){if(e===0)return t*n;const i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,l=a*i,u=n,h=Math.sin(2*u),f=Math.sin(4*u),_=Math.sin(6*u),g=Math.sin(8*u),m=Math.sin(10*u),b=Math.sin(12*u);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*l/1048576)*u-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*l/524288)*h+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*l/8388608)*f-(35*r/3072+175*s/12288+3675*a/262144+13475*l/1048576)*_+(315*s/131072+2205*a/524288+43659*l/8388608)*g-(693*a/1310720+6237*l/5242880)*m+1001*l/8388608*b)}function Cre(e,t,n){const i=e/n;if(t===0)return i;const o=i*i,r=o*i,s=r*i,a=t,l=a*a,u=l*l,h=u*l,f=h*l,_=f*l,g=_*l,m=Math.sin(2*i),b=Math.cos(2*i),T=Math.sin(4*i),x=Math.cos(4*i),C=Math.sin(6*i),w=Math.cos(6*i),v=Math.sin(8*i),P=Math.cos(8*i),N=Math.sin(10*i),k=Math.cos(10*i),M=Math.sin(12*i);return i+i*l/4+7*i*u/64+15*i*h/256+579*i*f/16384+1515*i*_/65536+16837*i*g/1048576+(3*i*u/16+45*i*h/256-i*(32*o-561)*f/4096-i*(232*o-1677)*_/16384+i*(399985-90560*o+512*s)*g/5242880)*b+(21*i*h/256+483*i*f/4096-i*(224*o-1969)*_/16384-i*(33152*o-112599)*g/1048576)*x+(151*i*f/4096+4681*i*_/65536+1479*i*g/16384-453*r*g/32768)*w+(1097*i*_/65536+42783*i*g/1048576)*P+8011*i*g/1048576*k+(3*l/8+3*u/16+213*h/2048-3*o*h/64+255*f/4096-33*o*f/512+20861*_/524288-33*o*_/512+s*_/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*m+(21*u/256+21*h/256+533*f/8192-21*o*f/512+197*_/4096-315*o*_/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*T+(151*h/6144+151*f/4096+5019*_/131072-453*o*_/16384+26965*g/786432-8607*o*g/131072)*C+(1097*f/131072+1097*_/65536+225797*g/10485760-1097*o*g/65536)*v+(8011*_/2621440+8011*g/1048576)*N+293393*g/251658240*M}function D_(e,t){if(e===0)return Math.log(Math.tan(.5*(R.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(R.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function Ere(e,t,n,i,o){const r=D_(e._ellipticity,n),s=D_(e._ellipticity,o);return Math.atan2(R.negativePiToPi(i-t),s-r)}function wre(e,t,n,i,o,r,s){const a=e._heading,l=r-i;let u=0;if(R.equalsEpsilon(Math.abs(a),R.PI_OVER_TWO,R.EPSILON8))if(t===n)u=t*Math.cos(o)*R.negativePiToPi(l);else{const h=Math.sin(o);u=t*Math.cos(o)*R.negativePiToPi(l)/Math.sqrt(1-e._ellipticitySquared*h*h)}else{const h=RI(e._ellipticity,t,o);u=(RI(e._ellipticity,t,s)-h)/Math.cos(a)}return Math.abs(u)}const Sre=new d,Ew=new d;function bV(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,Ew),Sre),r=d.normalize(i.cartographicToCartesian(n,Ew),Ew);A.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125);const s=i.maximumRadius,a=i.minimumRadius,l=s*s,u=a*a;e._ellipticitySquared=(l-u)/l,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=he.clone(t,e._start),e._start.height=0,e._end=he.clone(n,e._end),e._end.height=0,e._heading=Ere(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=wre(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function TV(e,t,n,i,o,r){if(n===0)return he.clone(e,r);const s=o*o;let a,l,u;if(Math.abs(R.PI_OVER_TWO-Math.abs(t))>R.EPSILON8){const h=RI(o,i,e.latitude),f=n*Math.cos(t),_=h+f;if(l=Cre(_,o,i),Math.abs(t)0?a=R.negativePiToPi(e.longitude+u):a=R.negativePiToPi(e.longitude-u)}return c(r)?(r.longitude=a,r.latitude=l,r.height=0,r):new he(a,l,0)}function vr(e,t,n){const i=y(n,ae.WGS84);this._ellipsoid=i,this._start=new he,this._end=new he,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,c(e)&&c(t)&&bV(this,e,t,i)}Object.defineProperties(vr.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return A.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return A.defined("distance",this._distance),this._heading}}});vr.fromStartHeadingDistance=function(e,t,n,i,o){A.defined("start",e),A.defined("heading",t),A.defined("distance",n),A.typeOf.number.greaterThan("distance",n,0);const r=y(i,ae.WGS84),s=r.maximumRadius,a=r.minimumRadius,l=s*s,u=a*a,h=Math.sqrt((l-u)/l);t=R.negativePiToPi(t);const f=TV(e,t,n,r.maximumRadius,h);return!c(o)||c(i)&&!i.equals(o.ellipsoid)?new vr(e,f,r):(o.setEndPoints(e,f),o)};vr.prototype.setEndPoints=function(e,t){A.defined("start",e),A.defined("end",t),bV(this,e,t,this._ellipsoid)};vr.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};vr.prototype.interpolateUsingSurfaceDistance=function(e,t){if(A.typeOf.number("distance",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");return TV(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};vr.prototype.findIntersectionWithLongitude=function(e,t){if(A.typeOf.number("intersectionLongitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=R.negativePiToPi(e),R.equalsEpsilon(Math.abs(e),Math.PI,R.EPSILON14)&&(e=R.sign(r.longitude)*Math.PI),c(t)||(t=new he),Math.abs(R.PI_OVER_TWO-o)<=R.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(R.equalsEpsilon(Math.abs(R.PI_OVER_TWO-o),R.PI_OVER_TWO,R.EPSILON8))return R.equalsEpsilon(e,r.longitude,R.EPSILON12)?void 0:(t.longitude=e,t.latitude=R.PI_OVER_TWO*R.sign(R.PI_OVER_TWO-i),t.height=0,t);const s=r.latitude,a=n*Math.sin(s),l=Math.tan(.5*(R.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a);let h=r.latitude,f;do{f=h;const _=n*Math.sin(f),g=(1+_)/(1-_);h=2*Math.atan(l*Math.pow(g/u,n/2))-R.PI_OVER_TWO}while(!R.equalsEpsilon(h,f,R.EPSILON12));return t.longitude=e,t.latitude=h,t.height=0,t};vr.prototype.findIntersectionWithLatitude=function(e,t){if(A.typeOf.number("intersectionLatitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=this._start;if(R.equalsEpsilon(Math.abs(i),R.PI_OVER_TWO,R.EPSILON8))return;const r=D_(n,o.latitude),s=D_(n,e),a=Math.tan(i)*(s-r),l=R.negativePiToPi(o.longitude+a);return c(t)?(t.longitude=l,t.latitude=e,t.height=0,t):new he(l,e,0)};const iO=[co,vn],vre=iO.length,AV=Math.cos(R.toRadians(30)),RN=Math.cos(R.toRadians(150)),xV=0,CV=1e3;function ud(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions;if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(c(e.arcType)&&e.arcType!==cn.GEODESIC&&e.arcType!==cn.RHUMB)throw new E("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=y(e.width,1),this._positions=t,this.granularity=y(e.granularity,9999),this.loop=y(e.loop,!1),this.arcType=y(e.arcType,cn.GEODESIC),this._ellipsoid=ae.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ud.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+ae.packedLength+1+1}}});ud.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;iAV||rR.PI_OVER_TWO&&(a=!0,s=d.subtract(r,n,VN),u=l.cartesianToCartographic(s,kN)),u.height=0;const h=e.project(u,o);return o=d.subtract(h,i,o),o.z=0,o=d.normalize(o,o),a&&d.negate(o,o),o}const Yre=new d,HN=new d;function GN(e,t,n,i,o,r){const s=d.subtract(t,e,Yre);d.normalize(s,s);const a=n-xV;let l=d.multiplyByScalar(s,a,HN);d.add(e,l,o);const u=i-CV;l=d.multiplyByScalar(s,u,HN),d.add(t,l,r)}const $re=new d;function Jb(e,t){const n=_t.getPointDistance(Dx,e),i=_t.getPointDistance(Dx,t);let o=$re;R.equalsEpsilon(n,0,R.EPSILON2)?(o=dd(t,e,o),d.multiplyByScalar(o,R.EPSILON2,o),d.add(e,o,e)):R.equalsEpsilon(i,0,R.EPSILON2)&&(o=dd(e,t,o),d.multiplyByScalar(o,R.EPSILON2,o),d.add(t,o,t))}function Xre(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(R.equalsEpsilon(n,R.PI,R.EPSILON11)){const o=R.sign(t.longitude);return e.longitude=o*(n-R.EPSILON11),1}else if(R.equalsEpsilon(i,R.PI,R.EPSILON11)){const o=R.sign(e.longitude);return t.longitude=o*(i-R.EPSILON11),2}return 0}const wV=new he,SV=new he,jN=new d,Iw=new d,WN=new d,qN=new d,Qre=new d,YN=new d,Kre=[wV,SV],Zre=new ce,Jre=new d,ese=new d,tse=new d,nse=new d,ise=new d,ose=new d,Dw=new d,Pw=new d,rse=new d,sse=new d,ase=new d,$N=new d,cse=new d,lse=new d,use=new rn,dse=new rn,XN=new d,hse=new d,QN=new d,fse=[new se,new se],vV=[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],KN=vV.length;function pse(e,t,n,i,o,r,s){let a,l;const u=t._ellipsoid,h=n.length/3-1,f=h*8,_=f*4,g=h*36,m=f>65535?new Uint32Array(g):new Uint16Array(g),b=new Float64Array(f*3),T=new Float32Array(_),x=new Float32Array(_),C=new Float32Array(_),w=new Float32Array(_),v=new Float32Array(_);let P,N,k,M;s&&(P=new Float32Array(_),N=new Float32Array(_),k=new Float32Array(_),M=new Float32Array(f*2));const U=r.length/2;let B=0;const S=wV;S.height=0;const D=SV;D.height=0;let p=jN,I=Iw;if(s)for(l=0,a=1;aAV?(We=hy(t,S,Pe,lt,Dw),Fe=hy(t,D,ne,ft,Pw)):Ln===1?(Fe=hy(t,D,ne,ft,Pw),We.x=0,We.y=R.sign(S.longitude-Math.abs(D.longitude)),We.z=0):(We=hy(t,S,Pe,lt,Dw),Fe.x=0,Fe.y=R.sign(S.longitude-D.longitude),Fe.z=0)}const Dt=d.distance(we,Y),st=rn.fromCartesian(Ce,use),et=d.subtract(ee,Ce,rse),hn=d.normalize(et,$N);let ot=d.subtract(we,Ce,sse);ot=d.normalize(ot,ot);let at=d.cross(hn,ot,$N);at=d.normalize(at,at);let Xt=d.cross(ot,Pe,cse);Xt=d.normalize(Xt,Xt);let it=d.subtract(Y,ee,ase);it=d.normalize(it,it);let fi=d.cross(ne,it,lse);fi=d.normalize(fi,fi);const Hi=Dt/F,Ss=Q/F;let Qo=0,No,Gi,Ni,wi=0,$r=0;if(s){Qo=d.distance(lt,ft),No=rn.fromCartesian(lt,dse),Gi=d.subtract(ft,lt,XN),Ni=d.normalize(Gi,hse);const Ln=Ni.x;Ni.x=Ni.y,Ni.y=-Ln,wi=Qo/B,$r=le/B}for(V=0;V<8;V++){const Ln=X+V*4,Zo=j+V*2,ho=Ln+3,qs=V<4?1:-1,pi=V===2||V===3||V===6||V===7?1:-1;d.pack(st.high,T,Ln),T[ho]=et.x,d.pack(st.low,x,Ln),x[ho]=et.y,d.pack(Xt,C,Ln),C[ho]=et.z,d.pack(fi,w,Ln),w[ho]=Hi*qs,d.pack(at,v,Ln);let ji=Ss*pi;ji===0&&pi<0&&(ji=9),v[ho]=ji,s&&(P[Ln]=No.high.x,P[Ln+1]=No.high.y,P[Ln+2]=No.low.x,P[Ln+3]=No.low.y,k[Ln]=-We.y,k[Ln+1]=We.x,k[Ln+2]=Fe.y,k[Ln+3]=-Fe.x,N[Ln]=Gi.x,N[Ln+1]=Gi.y,N[Ln+2]=Ni.x,N[Ln+3]=Ni.y,M[Zo]=wi*qs,ji=$r*pi,ji===0&&pi<0&&(ji=9),M[Zo+1]=ji)}const zn=tse,ci=nse,Si=Jre,Ko=ese,ri=ce.fromCartographicArray(Kre,Zre),fr=Ti.getMinimumMaximumHeights(ri,u),ha=fr.minimumTerrainHeight,fa=fr.maximumTerrainHeight;pe+=Math.abs(ha),pe+=Math.abs(fa),GN(Ce,we,ha,fa,zn,Si),GN(ee,Y,ha,fa,ci,Ko);let So=d.multiplyByScalar(at,R.EPSILON5,QN);d.add(zn,So,zn),d.add(ci,So,ci),d.add(Si,So,Si),d.add(Ko,So,Ko),Jb(zn,ci),Jb(Si,Ko),d.pack(zn,b,W),d.pack(ci,b,W+3),d.pack(Ko,b,W+6),d.pack(Si,b,W+9),So=d.multiplyByScalar(at,-2*R.EPSILON5,QN),d.add(zn,So,zn),d.add(ci,So,ci),d.add(Si,So,Si),d.add(Ko,So,Ko),Jb(zn,ci),Jb(Si,Ko),d.pack(zn,b,W+12),d.pack(ci,b,W+15),d.pack(Ko,b,W+18),d.pack(Si,b,W+21),G+=2,l+=3,j+=16,W+=24,X+=32,Q+=Dt,le+=Qo}l=0;let re=0;for(a=0;a halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) { #ifdef DEBUG_SHOW_VOLUME out_FragColor = vec4(1.0, 0.0, 0.0, 0.5); return; #else // DEBUG_SHOW_VOLUME discard; #endif // DEBUG_SHOW_VOLUME } // Check distance of the eye coordinate against start and end planes with normals in the right plane. // For computing unskewed lengthwise texture coordinate. // Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking. // aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward" vec3 alignedPlaneNormal; // start aligned plane alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz); alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz)); distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz); // end aligned plane alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz); alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz)); distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz); #ifdef PER_INSTANCE_COLOR out_FragColor = czm_gammaCorrect(v_color); #else // PER_INSTANCE_COLOR // Clamp - distance to aligned planes may be negative due to mitering, // so fragment texture coordinate might be out-of-bounds. float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0); s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y; float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth); czm_materialInput materialInput; materialInput.s = s; materialInput.st = vec2(s, t); materialInput.str = vec3(s, t, 0.0); czm_material material = czm_getMaterial(materialInput); out_FragColor = vec4(material.diffuse + material.emission, material.alpha); #endif // PER_INSTANCE_COLOR // Premultiply alpha. Required for classification primitives on translucent globe. out_FragColor.rgb *= out_FragColor.a; czm_writeDepthClamp(); } `,_se=`in vec3 v_forwardDirectionEC; in vec3 v_texcoordNormalizationAndHalfWidth; in float v_batchId; #ifdef PER_INSTANCE_COLOR in vec4 v_color; #else in vec2 v_alignedPlaneDistances; in float v_texcoordT; #endif float rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) { // We don't expect the ray to ever be parallel to the plane return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction); } void main(void) { vec4 eyeCoordinate = gl_FragCoord; eyeCoordinate /= eyeCoordinate.w; #ifdef PER_INSTANCE_COLOR out_FragColor = czm_gammaCorrect(v_color); #else // PER_INSTANCE_COLOR // Use distances for planes aligned with segment to prevent skew in dashing float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x); float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y); // Clamp - distance to aligned planes may be negative due to mitering distanceFromStart = max(0.0, distanceFromStart); distanceFromEnd = max(0.0, distanceFromEnd); float s = distanceFromStart / (distanceFromStart + distanceFromEnd); s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y; czm_materialInput materialInput; materialInput.s = s; materialInput.st = vec2(s, v_texcoordT); materialInput.str = vec3(s, v_texcoordT, 0.0); czm_material material = czm_getMaterial(materialInput); out_FragColor = vec4(material.diffuse + material.emission, material.alpha); #endif // PER_INSTANCE_COLOR } `,gse=`in vec3 position3DHigh; in vec3 position3DLow; in vec4 startHiAndForwardOffsetX; in vec4 startLoAndForwardOffsetY; in vec4 startNormalAndForwardOffsetZ; in vec4 endNormalAndTextureCoordinateNormalizationX; in vec4 rightNormalAndTextureCoordinateNormalizationY; in vec4 startHiLo2D; in vec4 offsetAndRight2D; in vec4 startEndNormals2D; in vec2 texcoordNormalization2D; in float batchId; out vec3 v_forwardDirectionEC; out vec3 v_texcoordNormalizationAndHalfWidth; out float v_batchId; // For materials #ifdef WIDTH_VARYING out float v_width; #endif #ifdef ANGLE_VARYING out float v_polylineAngle; #endif #ifdef PER_INSTANCE_COLOR out vec4 v_color; #else out vec2 v_alignedPlaneDistances; out float v_texcoordT; #endif // Morphing planes using SLERP or NLERP doesn't seem to work, so instead draw the material directly on the shadow volume. // Morph views are from very far away and aren't meant to be used precisely, so this should be sufficient. void main() { v_batchId = batchId; // Start position vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw)); vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz); vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime); vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz; vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz; vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz; // Start plane vec4 startPlane2D; vec4 startPlane3D; startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy); startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz; startPlane2D.w = -dot(startPlane2D.xyz, posEc2D); startPlane3D.w = -dot(startPlane3D.xyz, posEc3D); // Right plane vec4 rightPlane2D; vec4 rightPlane3D; rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw); rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz; rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D); rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D); // End position posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0); posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0); posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime); posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz; posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz; vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz; vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w)); vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy)); // End plane vec4 endPlane2D; vec4 endPlane3D; endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw); endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz; endPlane2D.w = -dot(endPlane2D.xyz, posEc2D); endPlane3D.w = -dot(endPlane3D.xyz, posEc3D); // Forward direction v_forwardDirectionEC = normalize(endEC - startEC); vec2 cleanTexcoordNormalization2D; cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x); cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y)); vec2 cleanTexcoordNormalization3D; cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w); cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w; cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y)); v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime); #ifdef PER_INSTANCE_COLOR v_color = czm_batchTable_color(batchId); #else // PER_INSTANCE_COLOR // For computing texture coordinates v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC); v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC); #endif // PER_INSTANCE_COLOR #ifdef WIDTH_VARYING float width = czm_batchTable_width(batchId); float halfWidth = width * 0.5; v_width = width; v_texcoordNormalizationAndHalfWidth.z = halfWidth; #else float halfWidth = 0.5 * czm_batchTable_width(batchId); v_texcoordNormalizationAndHalfWidth.z = halfWidth; #endif // Compute a normal along which to "push" the position out, extending the miter depending on view distance. // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes. // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be. // Since this is morphing, compute both 3D and 2D positions and then blend. // ****** 3D ****** // Check distance to the end plane and start plane, pick the plane that is closer vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz)); float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz)); vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz); vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane. vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too. // Nudge the top vertex upwards to prevent flickering vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D)); geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0); geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT; positionEc3D.xyz += geodeticSurfaceNormal; // Determine if this vertex is on the "left" or "right" normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w); // A "perfect" implementation would push along normals according to the angle against forward. // In practice, just pushing the normal out by halfWidth is sufficient for morph views. positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera) // ****** 2D ****** // Check distance to the end plane and start plane, pick the plane that is closer vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz)); absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz)); planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz); upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane. normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too. // Nudge the top vertex upwards to prevent flickering geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D)); geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0); geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT; positionEc2D.xyz += geodeticSurfaceNormal; // Determine if this vertex is on the "left" or "right" normalEC *= sign(texcoordNormalization2D.x); #ifndef PER_INSTANCE_COLOR // Use vertex's sidedness to compute its texture coordinate. v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0); #endif // A "perfect" implementation would push along normals according to the angle against forward. // In practice, just pushing the normal out by halfWidth is sufficient for morph views. positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera) // Blend for actual position gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime); #ifdef ANGLE_VARYING // Approximate relative screen space direction of the line. vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y)); approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y); v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y); #endif } `,yse=`in vec3 position3DHigh; in vec3 position3DLow; // In 2D and in 3D, texture coordinate normalization component signs encodes: // * X sign - sidedness relative to right plane // * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume #ifndef COLUMBUS_VIEW_2D in vec4 startHiAndForwardOffsetX; in vec4 startLoAndForwardOffsetY; in vec4 startNormalAndForwardOffsetZ; in vec4 endNormalAndTextureCoordinateNormalizationX; in vec4 rightNormalAndTextureCoordinateNormalizationY; #else in vec4 startHiLo2D; in vec4 offsetAndRight2D; in vec4 startEndNormals2D; in vec2 texcoordNormalization2D; #endif in float batchId; out vec4 v_startPlaneNormalEcAndHalfWidth; out vec4 v_endPlaneNormalEcAndBatchId; out vec4 v_rightPlaneEC; out vec4 v_endEcAndStartEcX; out vec4 v_texcoordNormalizationAndStartEcYZ; // For materials #ifdef WIDTH_VARYING out float v_width; #endif #ifdef ANGLE_VARYING out float v_polylineAngle; #endif #ifdef PER_INSTANCE_COLOR out vec4 v_color; #endif void main() { #ifdef COLUMBUS_VIEW_2D vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz; vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy); vec3 ecEnd = forwardDirectionEC + ecStart; forwardDirectionEC = normalize(forwardDirectionEC); // Right plane v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw); v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart); // start plane vec4 startPlaneEC; startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy); startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart); // end plane vec4 endPlaneEC; endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw); endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd); v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x); v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y; #else // COLUMBUS_VIEW_2D vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz; vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w); vec3 ecEnd = ecStart + offset; vec3 forwardDirectionEC = normalize(offset); // start plane vec4 startPlaneEC; startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz; startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart); // end plane vec4 endPlaneEC; endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz; endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd); // Right plane v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz; v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart); v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w); v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w; #endif // COLUMBUS_VIEW_2D v_endEcAndStartEcX.xyz = ecEnd; v_endEcAndStartEcX.w = ecStart.x; v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz; #ifdef PER_INSTANCE_COLOR v_color = czm_batchTable_color(batchId); #endif // PER_INSTANCE_COLOR // Compute a normal along which to "push" the position out, extending the miter depending on view distance. // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes. // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be. vec4 positionRelativeToEye = czm_computePosition(); // Check distance to the end plane and start plane, pick the plane that is closer vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz)); float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz)); vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz); vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane. vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too. // Extrude bottom vertices downward for far view distances, like for GroundPrimitives upOrDown = cross(forwardDirectionEC, normalEC); upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown; upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown; upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown; positionEC.xyz += upOrDown; v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y)); // Determine distance along normalEC to push for a volume of appropriate width. // Make volumes about double pixel width for a conservative fit - in practice the // extra cost here is minimal compared to the loose volume heights. // // N = normalEC (guaranteed "right-facing") // R = rightEC // p = angle between N and R // w = distance to push along R if R == N // d = distance to push along N // // N R // { p| } * cos(p) = dot(N, R) = w / d // d | |w * d = w / dot(N, R) // { | } // o---------- polyline segment ----> // float width = czm_batchTable_width(batchId); #ifdef WIDTH_VARYING v_width = width; #endif v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz; v_startPlaneNormalEcAndHalfWidth.w = width * 0.5; v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz; v_endPlaneNormalEcAndBatchId.w = batchId; width = width * max(0.0, czm_metersPerPixel(positionEC)); // width = distance to push along R width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N // Determine if this vertex is on the "left" or "right" #ifdef COLUMBUS_VIEW_2D normalEC *= sign(texcoordNormalization2D.x); #else normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w); #endif positionEC.xyz += width * normalEC; gl_Position = czm_depthClamp(czm_projection * positionEC); #ifdef ANGLE_VARYING // Approximate relative screen space direction of the line. vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y)); approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y); v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y); #endif } `,bse=`in vec3 position3DHigh; in vec3 position3DLow; in vec3 prevPosition3DHigh; in vec3 prevPosition3DLow; in vec3 nextPosition3DHigh; in vec3 nextPosition3DLow; in vec2 expandAndWidth; in vec4 color; in float batchId; out vec4 v_color; void main() { float expandDir = expandAndWidth.x; float width = abs(expandAndWidth.y) + 0.5; bool usePrev = expandAndWidth.y < 0.0; vec4 p = czm_computePosition(); vec4 prev = czm_computePrevPosition(); vec4 next = czm_computeNextPosition(); float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; v_color = color; } `,M0=`void clipLineSegmentToNearPlane( vec3 p0, vec3 p1, out vec4 positionWC, out bool clipped, out bool culledByNearPlane, out vec4 clippedPositionEC) { culledByNearPlane = false; clipped = false; vec3 p0ToP1 = p1 - p0; float magnitude = length(p0ToP1); vec3 direction = normalize(p0ToP1); // Distance that p0 is behind the near plane. Negative means p0 is // in front of the near plane. float endPoint0Distance = czm_currentFrustum.x + p0.z; // Camera looks down -Z. // When moving a point along +Z: LESS VISIBLE // * Points in front of the camera move closer to the camera. // * Points behind the camrea move farther away from the camera. // When moving a point along -Z: MORE VISIBLE // * Points in front of the camera move farther away from the camera. // * Points behind the camera move closer to the camera. // Positive denominator: -Z, becoming more visible // Negative denominator: +Z, becoming less visible // Nearly zero: parallel to near plane float denominator = -direction.z; if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7) { // p0 is behind the near plane and the line to p1 is nearly parallel to // the near plane, so cull the segment completely. culledByNearPlane = true; } else if (endPoint0Distance > 0.0) { // p0 is behind the near plane, and the line to p1 is moving distinctly // toward or away from it. // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction) float t = endPoint0Distance / denominator; if (t < 0.0 || t > magnitude) { // Near plane intersection is not between the two points. // We already confirmed p0 is behind the naer plane, so now // we know the entire segment is behind it. culledByNearPlane = true; } else { // Segment crosses the near plane, update p0 to lie exactly on it. p0 = p0 + t * direction; // Numerical noise might put us a bit on the wrong side of the near plane. // Don't let that happen. p0.z = min(p0.z, -czm_currentFrustum.x); clipped = true; } } clippedPositionEC = vec4(p0, 1.0); positionWC = czm_eyeToWindowCoordinates(clippedPositionEC); } vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle) { // expandDirection +1 is to the _left_ when looking from positionEC toward nextEC. #ifdef POLYLINE_DASH // Compute the window coordinates of the points. vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC); vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC); vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC); // Determine the relative screen space direction of the line. vec2 lineDir; if (usePrevious) { lineDir = normalize(positionWindow.xy - previousWindow.xy); } else { lineDir = normalize(nextWindow.xy - positionWindow.xy); } angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0) // Quantize the angle so it doesn't change rapidly between segments. angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour; #endif vec4 clippedPrevWC, clippedPrevEC; bool prevSegmentClipped, prevSegmentCulled; clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC); vec4 clippedNextWC, clippedNextEC; bool nextSegmentClipped, nextSegmentCulled; clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC); bool segmentClipped, segmentCulled; vec4 clippedPositionWC, clippedPositionEC; clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC); if (segmentCulled) { return vec4(0.0, 0.0, 0.0, 1.0); } vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy); vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy); // If a segment was culled, we can't use the corresponding direction // computed above. We should never see both of these be true without // \`segmentCulled\` above also being true. if (prevSegmentCulled) { directionToPrevWC = -directionToNextWC; } else if (nextSegmentCulled) { directionToNextWC = -directionToPrevWC; } vec2 thisSegmentForwardWC, otherSegmentForwardWC; if (usePrevious) { thisSegmentForwardWC = -directionToPrevWC; otherSegmentForwardWC = directionToNextWC; } else { thisSegmentForwardWC = directionToNextWC; otherSegmentForwardWC = -directionToPrevWC; } vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x); vec2 leftWC = thisSegmentLeftWC; float expandWidth = width * 0.5; // When lines are split at the anti-meridian, the position may be at the // same location as the next or previous position, and we need to handle // that to avoid producing NaNs. if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1)) { vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x); vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC; float leftSumLength = length(leftSumWC); leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength); // The sine of the angle between the two vectors is given by the formula // |a x b| = |a||b|sin(theta) // which is // float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0))); // Because the z components of both vectors are zero, the x and y coordinate will be zero. // Therefore, the sine of the angle is just the z component of the cross product. vec2 u = -thisSegmentForwardWC; vec2 v = leftWC; float sinAngle = abs(u.x * v.y - u.y * v.x); expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0); } vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio; return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w; } vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle) { vec4 positionEC = czm_modelViewRelativeToEye * position; vec4 prevEC = czm_modelViewRelativeToEye * previous; vec4 nextEC = czm_modelViewRelativeToEye * next; return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle); } `;let MI=`${M0} ${bse}`;const Tse=jk;Yt.isInternetExplorer()||(MI=`#define CLIP_POLYLINE ${MI}`);function ds(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=!1,i=ds.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,MI),this._fragmentShaderSource=y(e.fragmentShaderSource,Tse),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(ds.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}}});ds.VERTEX_FORMAT=Ee.POSITION_ONLY;ds.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;ds.prototype.isTranslucent=Lo.prototype.isTranslucent;ds.prototype.getRenderState=Lo.prototype.getRenderState;const Ase=`in vec3 position3DHigh; in vec3 position3DLow; in vec3 prevPosition3DHigh; in vec3 prevPosition3DLow; in vec3 nextPosition3DHigh; in vec3 nextPosition3DLow; in vec2 expandAndWidth; in vec2 st; in float batchId; out float v_width; out vec2 v_st; out float v_polylineAngle; void main() { float expandDir = expandAndWidth.x; float width = abs(expandAndWidth.y) + 0.5; bool usePrev = expandAndWidth.y < 0.0; vec4 p = czm_computePosition(); vec4 prev = czm_computePrevPosition(); vec4 next = czm_computeNextPosition(); float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; v_width = width; v_st.s = st.s; v_st.t = czm_writeNonPerspective(st.t, gl_Position.w); v_polylineAngle = angle; } `,IV=`#ifdef VECTOR_TILE uniform vec4 u_highlightColor; #endif in vec2 v_st; void main() { czm_materialInput materialInput; vec2 st = v_st; st.t = czm_readNonPerspective(st.t, gl_FragCoord.w); materialInput.s = st.s; materialInput.st = st; materialInput.str = vec3(st, 0.0); czm_material material = czm_getMaterial(materialInput); out_FragColor = vec4(material.diffuse + material.emission, material.alpha); #ifdef VECTOR_TILE out_FragColor *= u_highlightColor; #endif czm_writeLogDepth(); } `;let FI=`${M0} ${Ase}`;const xse=IV;Yt.isInternetExplorer()||(FI=`#define CLIP_POLYLINE ${FI}`);function Ur(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=!1,i=Ur.VERTEX_FORMAT;this.material=c(e.material)?e.material:Se.fromType(Se.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,FI),this._fragmentShaderSource=y(e.fragmentShaderSource,xse),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Ur.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&(e=`#define POLYLINE_DASH ${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}}});Ur.VERTEX_FORMAT=Ee.POSITION_AND_ST;Ur.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;Ur.prototype.isTranslucent=Lo.prototype.isTranslucent;Ur.prototype.getRenderState=Lo.prototype.getRenderState;function Sc(e){e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;c(t)||(t=new Ur),this.appearance=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ui.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=ZN(!1),this._renderState3DTiles=ZN(!0),this._renderStateMorph=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},depthTest:{enabled:!0},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(Sc.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}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});Sc.initializeTerrainHeights=function(){return Ti.initialize()};function Cse(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()(yse);s=Mt._appendShowToShader(o,s),s=Mt._appendDistanceDisplayConditionToShader(o,s),s=Mt._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(gse);a=Mt._appendShowToShader(o,a),a=Mt._appendDistanceDisplayConditionToShader(o,a),a=Mt._modifyShaderPosition(e,a,t.scene3DOnly);let l=o._batchTable.getVertexShaderCallback()(mse);const u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let h="",f="";c(n.material)?(f=c(n.material)?n.material.shaderSource:"",f.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),f.search(/in\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):h="PER_INSTANCE_COLOR",u.push(h);const _=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",h]:[h],g=new Oe({defines:u,sources:[s]}),m=new Oe({defines:_,sources:[f,l]});e._sp=Jt.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:r});let b=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!c(b)){const x=new Oe({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});b=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:x,fragmentShaderSource:m,attributeLocations:r})}e._sp2D=b;let T=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!c(T)){const x=new Oe({defines:u.concat([`MAX_TERRAIN_HEIGHT ${Ti._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});l=o._batchTable.getVertexShaderCallback()(_se);const C=new Oe({defines:_,sources:[f,l]});T=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:x,fragmentShaderSource:C,attributeLocations:r})}e._spMorph=T}function ZN(e){return Ue.fromCache({cull:{enabled:!0},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.EQUAL,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})}function Ese(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const u=t instanceof ds?{}:n._uniforms,h=s._batchTable.getUniformMapCallback()(u);for(let f=0;f{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Sc.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Sc.isSupported=function(e){return e.frameState.context.depthTexture};Sc.prototype.isDestroyed=function(){return!1};Sc.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,ve(this)};const Sse=new H(1,1),vse=!1,Ise=z.WHITE;function P_(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Le,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}Object.defineProperties(P_.prototype,{isConstant:{get:function(){return K.isConstant(this._image)&&K.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:ue("image"),repeat:ue("repeat"),color:ue("color"),transparent:ue("transparent")});P_.prototype.getType=function(e){return"Image"};P_.prototype.getValue=function(e,t){return c(t)||(t={}),t.image=K.getValueOrUndefined(this._image,e),t.repeat=K.getValueOrClonedDefault(this._repeat,e,Sse,t.repeat),t.color=K.getValueOrClonedDefault(this._color,e,Ise,t.color),K.getValueOrDefault(this._transparent,e,vse)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};P_.prototype.equals=function(e){return this===e||e instanceof P_&&K.equals(this._image,e._image)&&K.equals(this._repeat,e._repeat)&&K.equals(this._color,e._color)&&K.equals(this._transparent,e._transparent)};function Dse(e){if(e instanceof z)return new kt(e);if(typeof e=="string"||e instanceof Ae||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new P_;return t.image=e,t}throw new E(`Unable to infer material type: ${e}`)}function Ma(e,t){return ue(e,t,Dse)}function Jy(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(Jy.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),dimensions:ue("dimensions"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});Jy.prototype.clone=function(e){return c(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 Jy(this)};Jy.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.dimensions=y(this.dimensions,e.dimensions),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};const Pse={FIXED:0,INERTIAL:1},Bs=Object.freeze(Pse);function Kh(){E.throwInstantiationError()}Object.defineProperties(Kh.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError},referenceFrame:{get:E.throwInstantiationError}});Kh.prototype.getValue=E.throwInstantiationError;Kh.prototype.getValueInReferenceFrame=E.throwInstantiationError;Kh.prototype.equals=E.throwInstantiationError;const Ow=new $;Kh.convertToReferenceFrame=function(e,t,n,i,o){if(!c(t))return t;if(c(o)||(o=new d),n===i)return d.clone(t,o);let r=zt.computeIcrfToFixedMatrix(e,Ow);if(c(r)||(r=zt.computeTemeToPseudoFixedMatrix(e,Ow)),n===Bs.INERTIAL)return $.multiplyByVector(r,t,o);if(n===Bs.FIXED)return $.multiplyByVector($.transpose(r,Ow),t,o)};function hd(e,t){this._definitionChanged=new Le,this._value=d.clone(e),this._referenceFrame=y(t,Bs.FIXED)}Object.defineProperties(hd.prototype,{isConstant:{get:function(){return!c(this._value)||this._referenceFrame===Bs.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});hd.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};hd.prototype.setValue=function(e,t){let n=!1;d.equals(this._value,e)||(n=!0,this._value=d.clone(e)),c(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};hd.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");return Kh.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};hd.prototype.equals=function(e){return this===e||e instanceof hd&&d.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};function e0(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(e0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),positions:ue("positions"),width:ue("width"),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),cornerType:ue("cornerType"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});e0.prototype.clone=function(e){return c(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 e0(this)};e0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.width=y(this.width,e.width),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=y(this.cornerType,e.cornerType),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function Ose(e){return e}function BI(e,t){return ue(e,t,Ose)}function t0(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(t0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),length:ue("length"),topRadius:ue("topRadius"),bottomRadius:ue("bottomRadius"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),numberOfVerticalLines:ue("numberOfVerticalLines"),slices:ue("slices"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});t0.prototype.clone=function(e){return c(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 t0(this)};t0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.length=y(this.length,e.length),this.topRadius=y(this.topRadius,e.topRadius),this.bottomRadius=y(this.bottomRadius,e.bottomRadius),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=y(this.slices,e.slices),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function n0(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(n0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),semiMajorAxis:ue("semiMajorAxis"),semiMinorAxis:ue("semiMinorAxis"),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),rotation:ue("rotation"),stRotation:ue("stRotation"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),numberOfVerticalLines:ue("numberOfVerticalLines"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});n0.prototype.clone=function(e){return c(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 n0(this)};n0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.semiMajorAxis=y(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=y(this.semiMinorAxis,e.semiMinorAxis),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=y(this.rotation,e.rotation),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function i0(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(i0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),radii:ue("radii"),innerRadii:ue("innerRadii"),minimumClock:ue("minimumClock"),maximumClock:ue("maximumClock"),minimumCone:ue("minimumCone"),maximumCone:ue("maximumCone"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),stackPartitions:ue("stackPartitions"),slicePartitions:ue("slicePartitions"),subdivisions:ue("subdivisions"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});i0.prototype.clone=function(e){return c(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 i0(this)};i0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.radii=y(this.radii,e.radii),this.innerRadii=y(this.innerRadii,e.innerRadii),this.minimumClock=y(this.minimumClock,e.minimumClock),this.maximumClock=y(this.maximumClock,e.maximumClock),this.minimumCone=y(this.minimumCone,e.minimumCone),this.maximumCone=y(this.maximumCone,e.maximumCone),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.stackPartitions=y(this.stackPartitions,e.stackPartitions),this.slicePartitions=y(this.slicePartitions,e.slicePartitions),this.subdivisions=y(this.subdivisions,e.subdivisions),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function o0(e){this._definitionChanged=new Le,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(o0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),text:ue("text"),font:ue("font"),style:ue("style"),scale:ue("scale"),showBackground:ue("showBackground"),backgroundColor:ue("backgroundColor"),backgroundPadding:ue("backgroundPadding"),pixelOffset:ue("pixelOffset"),eyeOffset:ue("eyeOffset"),horizontalOrigin:ue("horizontalOrigin"),verticalOrigin:ue("verticalOrigin"),heightReference:ue("heightReference"),fillColor:ue("fillColor"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),translucencyByDistance:ue("translucencyByDistance"),pixelOffsetScaleByDistance:ue("pixelOffsetScaleByDistance"),scaleByDistance:ue("scaleByDistance"),distanceDisplayCondition:ue("distanceDisplayCondition"),disableDepthTestDistance:ue("disableDepthTestDistance")});o0.prototype.clone=function(e){return c(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 o0(this)};o0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.text=y(this.text,e.text),this.font=y(this.font,e.font),this.style=y(this.style,e.style),this.scale=y(this.scale,e.scale),this.showBackground=y(this.showBackground,e.showBackground),this.backgroundColor=y(this.backgroundColor,e.backgroundColor),this.backgroundPadding=y(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=y(this.pixelOffset,e.pixelOffset),this.eyeOffset=y(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=y(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=y(this.verticalOrigin,e.verticalOrigin),this.heightReference=y(this.heightReference,e.heightReference),this.fillColor=y(this.fillColor,e.fillColor),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=y(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=y(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=y(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this.disableDepthTestDistance,e.disableDepthTestDistance)};const Lse=new d(1,1,1),Rse=d.ZERO,Nse=_e.IDENTITY;function TC(e,t,n){this.translation=d.clone(y(e,Rse)),this.rotation=_e.clone(y(t,Nse)),this.scale=d.clone(y(n,Lse))}TC.prototype.equals=function(e){return this===e||c(e)&&d.equals(this.translation,e.translation)&&_e.equals(this.rotation,e.rotation)&&d.equals(this.scale,e.scale)};const Lw=new TC;function r0(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Le,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}Object.defineProperties(r0.prototype,{isConstant:{get:function(){return K.isConstant(this._translation)&&K.isConstant(this._rotation)&&K.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:ue("translation"),rotation:ue("rotation"),scale:ue("scale")});r0.prototype.getValue=function(e,t){return c(t)||(t=new TC),t.translation=K.getValueOrClonedDefault(this._translation,e,Lw.translation,t.translation),t.rotation=K.getValueOrClonedDefault(this._rotation,e,Lw.rotation,t.rotation),t.scale=K.getValueOrClonedDefault(this._scale,e,Lw.scale,t.scale),t};r0.prototype.equals=function(e){return this===e||e instanceof r0&&K.equals(this._translation,e._translation)&&K.equals(this._rotation,e._rotation)&&K.equals(this._scale,e._scale)};function Fa(e,t){this._propertyNames=[],this._definitionChanged=new Le,c(e)&&this.merge(e,t)}Object.defineProperties(Fa.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t{this._terrainHeight=a.height,this.definitionChanged.raiseEvent()};this._removeCallbackFunc=e.updateHeight(o,s,this._heightReference)};Fp.prototype.getValue=function(e,t){const n=K.getValueOrDefault(this._heightReference,e,gt.NONE),i=K.getValueOrDefault(this._extrudedHeightReference,e,gt.NONE);if(n===gt.NONE&&!zP(i))return this._position=d.clone(d.ZERO,this._position),d.clone(d.ZERO,t);if(this._positionProperty.isConstant)return d.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,NV);if(!c(r)||d.equals(r,d.ZERO)||!c(o.globe))return d.clone(d.ZERO,t);if(d.equalsEpsilon(this._position,r,R.EPSILON10))return d.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=d.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return d.multiplyByScalar(s,this._terrainHeight,t)};Fp.prototype.isDestroyed=function(){return!1};Fp.prototype.destroy=function(){return c(this._removeEventListener)&&this._removeEventListener(),c(this._removeModeListener)&&this._removeModeListener(),c(this._removeCallbackFunc)&&this._removeCallbackFunc(),ve(this)};function oO(e,t,n,i){if(dn.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!c(o))return;c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference;if(c(r)){const s=new up(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new Fp(this._scene,s,r)}}const MV=d.ZERO,FV=new d,Kse=new d,BV=new z;function Zse(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function Ea(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new Zse(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}c(Object.create)&&(Ea.prototype=Object.create(dn.prototype),Ea.prototype.constructor=Ea);Object.defineProperties(Ea.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Ea.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof kt){let a;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,BV)),c(a)||(a=z.WHITE),s.color=$t.fromColor(a)}return c(this._options.offsetAttribute)&&(s.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,MV,FV))),new Gt({id:t,geometry:rr.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};Ea.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,BV),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,MV,FV))),new Gt({id:t,geometry:Na.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};Ea.prototype._computeCenter=function(e,t){return K.getValueOrUndefined(this._entity.position,e,t)};Ea.prototype._isHidden=function(e,t){return!c(t.dimensions)||!c(e.position)||dn.prototype._isHidden.call(this,e,t)};Ea.prototype._isDynamic=function(e,t){return!e.position.isConstant||!K.isConstant(e.orientation)||!t.dimensions.isConstant||!K.isConstant(t.outlineWidth)};Ea.prototype._setStaticOptions=function(e,t){const n=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(Ke.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==gt.NONE?Kt.ALL:void 0};Ea.prototype._onEntityPropertyChanged=oO;Ea.DynamicGeometryUpdater=i_;function i_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(i_.prototype=Object.create(On.prototype),i_.prototype.constructor=i_);i_.prototype._isHidden=function(e,t,n){const i=K.getValueOrUndefined(e.position,n,Kse),o=this._options.dimensions;return!c(i)||!c(o)||On.prototype._isHidden.call(this,e,t,n)};i_.prototype._setOptions=function(e,t,n){const i=K.getValueOrDefault(t.heightReference,n,gt.NONE),o=this._options;o.dimensions=K.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==gt.NONE?Kt.ALL:void 0};/*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */const{entries:zV,setPrototypeOf:eM,isFrozen:Jse,getPrototypeOf:eae,getOwnPropertyDescriptor:tae}=Object;let{freeze:zs,seal:vc,create:UV}=Object,{apply:kI,construct:VI}=typeof Reflect<"u"&&Reflect;zs||(zs=function(t){return t});vc||(vc=function(t){return t});kI||(kI=function(t,n,i){return t.apply(n,i)});VI||(VI=function(t,n){return new t(...n)});const eT=Ba(Array.prototype.forEach),tM=Ba(Array.prototype.pop),Sg=Ba(Array.prototype.push),VA=Ba(String.prototype.toLowerCase),Rw=Ba(String.prototype.toString),nM=Ba(String.prototype.match),vg=Ba(String.prototype.replace),nae=Ba(String.prototype.indexOf),iae=Ba(String.prototype.trim),el=Ba(Object.prototype.hasOwnProperty),Is=Ba(RegExp.prototype.test),Ig=oae(TypeError);function iM(e){return typeof e=="number"&&isNaN(e)}function Ba(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:VA;eM&&eM(e,null);let i=t.length;for(;i--;){let o=t[i];if(typeof o=="string"){const r=n(o);r!==o&&(Jse(t)||(t[i]=r),o=r)}e[o]=!0}return e}function rae(e){for(let t=0;t/gm),uae=vc(/\${[\w\W]*}/gm),dae=vc(/^data-[\-\w.\u00B7-\uFFFF]/),hae=vc(/^aria-[\-\w]+$/),kV=vc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fae=vc(/^(?:\w+script|data):/i),pae=vc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),VV=vc(/^html$/i),mae=vc(/^[a-z][.\w]*(-[.\w]+)+$/i);var cM=Object.freeze({__proto__:null,MUSTACHE_EXPR:cae,ERB_EXPR:lae,TMPLIT_EXPR:uae,DATA_ATTR:dae,ARIA_ATTR:hae,IS_ALLOWED_URI:kV,IS_SCRIPT_OR_DATA:fae,ATTR_WHITESPACE:pae,DOCTYPE_NAME:VV,CUSTOM_ELEMENT:mae});const mf={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_ae=function(){return typeof window>"u"?null:window},gae=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(i=n.getAttribute(o));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function HV(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_ae();const t=Et=>HV(Et);if(t.version="3.1.4",t.removed=[],!e||!e.document||e.document.nodeType!==mf.document)return t.isSupported=!1,t;let{document:n}=e;const i=n,o=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:_,trustedTypes:g}=e,m=l.prototype,b=tT(m,"cloneNode"),T=tT(m,"nextSibling"),x=tT(m,"childNodes"),C=tT(m,"parentNode");if(typeof s=="function"){const Et=n.createElement("template");Et.content&&Et.content.ownerDocument&&(n=Et.content.ownerDocument)}let w,v="";const{implementation:P,createNodeIterator:N,createDocumentFragment:k,getElementsByTagName:M}=n,{importNode:U}=i;let B={};t.isSupported=typeof zV=="function"&&typeof C=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:S,ERB_EXPR:D,TMPLIT_EXPR:p,DATA_ATTR:I,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:G}=cM;let{IS_ALLOWED_URI:j}=cM,W=null;const X=An({},[...oM,...Nw,...Mw,...Fw,...rM]);let q=null;const ee=An({},[...sM,...Bw,...aM,...nT]);let Y=Object.seal(UV(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}})),ne=null,Q=null,le=!0,pe=!0,re=!1,de=!0,fe=!1,ye=!0,Ce=!1,we=!1,Pe=!1,lt=!1,ft=!1,We=!1,Fe=!0,Dt=!1;const st="user-content-";let et=!0,hn=!1,ot={},at=null;const Xt=An({},["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"]);let it=null;const fi=An({},["audio","video","img","source","image","track"]);let Hi=null;const Ss=An({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qo="http://www.w3.org/1998/Math/MathML",No="http://www.w3.org/2000/svg",Gi="http://www.w3.org/1999/xhtml";let Ni=Gi,wi=!1,$r=null;const zn=An({},[Qo,No,Gi],Rw);let ci=null;const Si=["application/xhtml+xml","text/html"],Ko="text/html";let ri=null,fr=null;const ha=255,fa=n.createElement("form"),So=function(be){return be instanceof RegExp||be instanceof Function},Ln=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(fr&&fr===be)){if((!be||typeof be!="object")&&(be={}),be=Ff(be),ci=Si.indexOf(be.PARSER_MEDIA_TYPE)===-1?Ko:be.PARSER_MEDIA_TYPE,ri=ci==="application/xhtml+xml"?Rw:VA,W=el(be,"ALLOWED_TAGS")?An({},be.ALLOWED_TAGS,ri):X,q=el(be,"ALLOWED_ATTR")?An({},be.ALLOWED_ATTR,ri):ee,$r=el(be,"ALLOWED_NAMESPACES")?An({},be.ALLOWED_NAMESPACES,Rw):zn,Hi=el(be,"ADD_URI_SAFE_ATTR")?An(Ff(Ss),be.ADD_URI_SAFE_ATTR,ri):Ss,it=el(be,"ADD_DATA_URI_TAGS")?An(Ff(fi),be.ADD_DATA_URI_TAGS,ri):fi,at=el(be,"FORBID_CONTENTS")?An({},be.FORBID_CONTENTS,ri):Xt,ne=el(be,"FORBID_TAGS")?An({},be.FORBID_TAGS,ri):{},Q=el(be,"FORBID_ATTR")?An({},be.FORBID_ATTR,ri):{},ot=el(be,"USE_PROFILES")?be.USE_PROFILES:!1,le=be.ALLOW_ARIA_ATTR!==!1,pe=be.ALLOW_DATA_ATTR!==!1,re=be.ALLOW_UNKNOWN_PROTOCOLS||!1,de=be.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=be.SAFE_FOR_TEMPLATES||!1,ye=be.SAFE_FOR_XML!==!1,Ce=be.WHOLE_DOCUMENT||!1,lt=be.RETURN_DOM||!1,ft=be.RETURN_DOM_FRAGMENT||!1,We=be.RETURN_TRUSTED_TYPE||!1,Pe=be.FORCE_BODY||!1,Fe=be.SANITIZE_DOM!==!1,Dt=be.SANITIZE_NAMED_PROPS||!1,et=be.KEEP_CONTENT!==!1,hn=be.IN_PLACE||!1,j=be.ALLOWED_URI_REGEXP||kV,Ni=be.NAMESPACE||Gi,Y=be.CUSTOM_ELEMENT_HANDLING||{},be.CUSTOM_ELEMENT_HANDLING&&So(be.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=be.CUSTOM_ELEMENT_HANDLING.tagNameCheck),be.CUSTOM_ELEMENT_HANDLING&&So(be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),be.CUSTOM_ELEMENT_HANDLING&&typeof be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),fe&&(pe=!1),ft&&(lt=!0),ot&&(W=An({},rM),q=[],ot.html===!0&&(An(W,oM),An(q,sM)),ot.svg===!0&&(An(W,Nw),An(q,Bw),An(q,nT)),ot.svgFilters===!0&&(An(W,Mw),An(q,Bw),An(q,nT)),ot.mathMl===!0&&(An(W,Fw),An(q,aM),An(q,nT))),be.ADD_TAGS&&(W===X&&(W=Ff(W)),An(W,be.ADD_TAGS,ri)),be.ADD_ATTR&&(q===ee&&(q=Ff(q)),An(q,be.ADD_ATTR,ri)),be.ADD_URI_SAFE_ATTR&&An(Hi,be.ADD_URI_SAFE_ATTR,ri),be.FORBID_CONTENTS&&(at===Xt&&(at=Ff(at)),An(at,be.FORBID_CONTENTS,ri)),et&&(W["#text"]=!0),Ce&&An(W,["html","head","body"]),W.table&&(An(W,["tbody"]),delete ne.tbody),be.TRUSTED_TYPES_POLICY){if(typeof be.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ig('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof be.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ig('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=be.TRUSTED_TYPES_POLICY,v=w.createHTML("")}else w===void 0&&(w=gae(g,o)),w!==null&&typeof v=="string"&&(v=w.createHTML(""));zs&&zs(be),fr=be}},Zo=An({},["mi","mo","mn","ms","mtext"]),ho=An({},["foreignobject","annotation-xml"]),qs=An({},["title","style","font","a","script"]),pi=An({},[...Nw,...Mw,...sae]),ji=An({},[...Fw,...aae]),cf=function(be){let Ge=C(be);(!Ge||!Ge.tagName)&&(Ge={namespaceURI:Ni,tagName:"template"});const wt=VA(be.tagName),ln=VA(Ge.tagName);return $r[be.namespaceURI]?be.namespaceURI===No?Ge.namespaceURI===Gi?wt==="svg":Ge.namespaceURI===Qo?wt==="svg"&&(ln==="annotation-xml"||Zo[ln]):Boolean(pi[wt]):be.namespaceURI===Qo?Ge.namespaceURI===Gi?wt==="math":Ge.namespaceURI===No?wt==="math"&&ho[ln]:Boolean(ji[wt]):be.namespaceURI===Gi?Ge.namespaceURI===No&&!ho[ln]||Ge.namespaceURI===Qo&&!Zo[ln]?!1:!ji[wt]&&(qs[wt]||!pi[wt]):!!(ci==="application/xhtml+xml"&&$r[be.namespaceURI]):!1},vi=function(be){Sg(t.removed,{element:be});try{be.parentNode.removeChild(be)}catch{be.remove()}},pr=function(be,Ge){try{Sg(t.removed,{attribute:Ge.getAttributeNode(be),from:Ge})}catch{Sg(t.removed,{attribute:null,from:Ge})}if(Ge.removeAttribute(be),be==="is"&&!q[be])if(lt||ft)try{vi(Ge)}catch{}else try{Ge.setAttribute(be,"")}catch{}},Rd=function(be){let Ge=null,wt=null;if(Pe)be=""+be;else{const Rr=nM(be,/^[\r\n\t ]+/);wt=Rr&&Rr[0]}ci==="application/xhtml+xml"&&Ni===Gi&&(be=''+be+"");const ln=w?w.createHTML(be):be;if(Ni===Gi)try{Ge=new _().parseFromString(ln,ci)}catch{}if(!Ge||!Ge.documentElement){Ge=P.createDocument(Ni,"template",null);try{Ge.documentElement.innerHTML=wi?v:ln}catch{}}const Qr=Ge.body||Ge.documentElement;return be&&wt&&Qr.insertBefore(n.createTextNode(wt),Qr.childNodes[0]||null),Ni===Gi?M.call(Ge,Ce?"html":"body")[0]:Ce?Ge.documentElement:Qr},Lr=function(be){return N.call(be.ownerDocument||be,be,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Xr=function(be){return be instanceof f&&(typeof be.__depth<"u"&&typeof be.__depth!="number"||typeof be.__removalCount<"u"&&typeof be.__removalCount!="number"||typeof be.nodeName!="string"||typeof be.textContent!="string"||typeof be.removeChild!="function"||!(be.attributes instanceof h)||typeof be.removeAttribute!="function"||typeof be.setAttribute!="function"||typeof be.namespaceURI!="string"||typeof be.insertBefore!="function"||typeof be.hasChildNodes!="function")},Jp=function(be){return typeof a=="function"&&be instanceof a},Jn=function(be,Ge,wt){!B[be]||eT(B[be],ln=>{ln.call(t,Ge,wt,fr)})},qa=function(be){let Ge=null;if(Jn("beforeSanitizeElements",be,null),Xr(be))return vi(be),!0;const wt=ri(be.nodeName);if(Jn("uponSanitizeElement",be,{tagName:wt,allowedTags:W}),be.hasChildNodes()&&!Jp(be.firstElementChild)&&Is(/<[/\w]/g,be.innerHTML)&&Is(/<[/\w]/g,be.textContent)||be.nodeType===mf.progressingInstruction||ye&&be.nodeType===mf.comment&&Is(/<[/\w]/g,be.data))return vi(be),!0;if(!W[wt]||ne[wt]){if(!ne[wt]&&lf(wt)&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,wt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(wt)))return!1;if(et&&!at[wt]){const ln=C(be)||be.parentNode,Qr=x(be)||be.childNodes;if(Qr&&ln){const Rr=Qr.length;for(let Ys=Rr-1;Ys>=0;--Ys){const $s=b(Qr[Ys],!0);$s.__removalCount=(be.__removalCount||0)+1,ln.insertBefore($s,T(be))}}}return vi(be),!0}return be instanceof l&&!cf(be)||(wt==="noscript"||wt==="noembed"||wt==="noframes")&&Is(/<\/no(script|embed|frames)/i,be.innerHTML)?(vi(be),!0):(fe&&be.nodeType===mf.text&&(Ge=be.textContent,eT([S,D,p],ln=>{Ge=vg(Ge,ln," ")}),be.textContent!==Ge&&(Sg(t.removed,{element:be.cloneNode()}),be.textContent=Ge)),Jn("afterSanitizeElements",be,null),!1)},Ya=function(be,Ge,wt){if(Fe&&(Ge==="id"||Ge==="name")&&(wt in n||wt in fa||wt==="__depth"||wt==="__removalCount"))return!1;if(!(pe&&!Q[Ge]&&Is(I,Ge))){if(!(le&&Is(O,Ge))){if(!q[Ge]||Q[Ge]){if(!(lf(be)&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,be)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(be))&&(Y.attributeNameCheck instanceof RegExp&&Is(Y.attributeNameCheck,Ge)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(Ge))||Ge==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,wt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(wt))))return!1}else if(!Hi[Ge]){if(!Is(j,vg(wt,V,""))){if(!((Ge==="src"||Ge==="xlink:href"||Ge==="href")&&be!=="script"&&nae(wt,"data:")===0&&it[be])){if(!(re&&!Is(F,vg(wt,V,"")))){if(wt)return!1}}}}}}return!0},lf=function(be){return be!=="annotation-xml"&&nM(be,G)},fo=function(be){Jn("beforeSanitizeAttributes",be,null);const{attributes:Ge}=be;if(!Ge)return;const wt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q};let ln=Ge.length;for(;ln--;){const Qr=Ge[ln],{name:Rr,namespaceURI:Ys,value:$s}=Qr,ug=ri(Rr);let vs=Rr==="value"?$s:iae($s);if(wt.attrName=ug,wt.attrValue=vs,wt.keepAttr=!0,wt.forceKeepAttr=void 0,Jn("uponSanitizeAttribute",be,wt),vs=wt.attrValue,wt.forceKeepAttr||(pr(Rr,be),!wt.keepAttr))continue;if(!de&&Is(/\/>/i,vs)){pr(Rr,be);continue}if(ye&&Is(/((--!?|])>)|<\/(style|title)/i,vs)){pr(Rr,be);continue}fe&&eT([S,D,p],pL=>{vs=vg(vs,pL," ")});const fL=ri(be.nodeName);if(!!Ya(fL,ug,vs)){if(Dt&&(ug==="id"||ug==="name")&&(pr(Rr,be),vs=st+vs),w&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ys)switch(g.getAttributeType(fL,ug)){case"TrustedHTML":{vs=w.createHTML(vs);break}case"TrustedScriptURL":{vs=w.createScriptURL(vs);break}}try{Ys?be.setAttributeNS(Ys,Rr,vs):be.setAttribute(Rr,vs),Xr(be)?vi(be):tM(t.removed)}catch{}}}Jn("afterSanitizeAttributes",be,null)},Mo=function Et(be){let Ge=null;const wt=Lr(be);for(Jn("beforeSanitizeShadowDOM",be,null);Ge=wt.nextNode();){if(Jn("uponSanitizeShadowNode",Ge,null),qa(Ge))continue;const ln=C(Ge);Ge.nodeType===mf.element&&(ln&&ln.__depth?Ge.__depth=(Ge.__removalCount||0)+ln.__depth+1:Ge.__depth=1),(Ge.__depth>=ha||Ge.__depth<0||iM(Ge.__depth))&&vi(Ge),Ge.content instanceof r&&(Ge.content.__depth=Ge.__depth,Et(Ge.content)),fo(Ge)}Jn("afterSanitizeShadowDOM",be,null)};return t.sanitize=function(Et){let be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ge=null,wt=null,ln=null,Qr=null;if(wi=!Et,wi&&(Et=""),typeof Et!="string"&&!Jp(Et))if(typeof Et.toString=="function"){if(Et=Et.toString(),typeof Et!="string")throw Ig("dirty is not a string, aborting")}else throw Ig("toString is not a function");if(!t.isSupported)return Et;if(we||Ln(be),t.removed=[],typeof Et=="string"&&(hn=!1),hn){if(Et.nodeName){const $s=ri(Et.nodeName);if(!W[$s]||ne[$s])throw Ig("root node is forbidden and cannot be sanitized in-place")}}else if(Et instanceof a)Ge=Rd(""),wt=Ge.ownerDocument.importNode(Et,!0),wt.nodeType===mf.element&&wt.nodeName==="BODY"||wt.nodeName==="HTML"?Ge=wt:Ge.appendChild(wt);else{if(!lt&&!fe&&!Ce&&Et.indexOf("<")===-1)return w&&We?w.createHTML(Et):Et;if(Ge=Rd(Et),!Ge)return lt?null:We?v:""}Ge&&Pe&&vi(Ge.firstChild);const Rr=Lr(hn?Et:Ge);for(;ln=Rr.nextNode();){if(qa(ln))continue;const $s=C(ln);ln.nodeType===mf.element&&($s&&$s.__depth?ln.__depth=(ln.__removalCount||0)+$s.__depth+1:ln.__depth=1),(ln.__depth>=ha||ln.__depth<0||iM(ln.__depth))&&vi(ln),ln.content instanceof r&&(ln.content.__depth=ln.__depth,Mo(ln.content)),fo(ln)}if(hn)return Et;if(lt){if(ft)for(Qr=k.call(Ge.ownerDocument);Ge.firstChild;)Qr.appendChild(Ge.firstChild);else Qr=Ge;return(q.shadowroot||q.shadowrootmode)&&(Qr=U.call(i,Qr,!0)),Qr}let Ys=Ce?Ge.outerHTML:Ge.innerHTML;return Ce&&W["!doctype"]&&Ge.ownerDocument&&Ge.ownerDocument.doctype&&Ge.ownerDocument.doctype.name&&Is(VV,Ge.ownerDocument.doctype.name)&&(Ys=" `+Ys),fe&&eT([S,D,p],$s=>{Ys=vg(Ys,$s," ")}),w&&We?w.createHTML(Ys):Ys},t.setConfig=function(){let Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ln(Et),we=!0},t.clearConfig=function(){fr=null,we=!1},t.isValidAttribute=function(Et,be,Ge){fr||Ln({});const wt=ri(Et),ln=ri(be);return Ya(wt,ln,Ge)},t.addHook=function(Et,be){typeof be=="function"&&(B[Et]=B[Et]||[],Sg(B[Et],be))},t.removeHook=function(Et){if(B[Et])return tM(B[Et])},t.removeHooks=function(Et){B[Et]&&(B[Et]=[])},t.removeAllHooks=function(){B={}},t}var yae=HV();let bae=0;const zw={};function Wt(e,t){A.typeOf.string("html",e);let n;const i=e;c(zw[i])?n=zw[i]:(n=bae++,zw[i]=n),t=y(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Wt.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!c(this._element)){const e=yae.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 i=0;i (textureSize.y / textureSize.x)) { mipLevel = 1.0; if (uv.y - pixel.y > yMipLevel1) { mipLevel = 2.0; if (uv.y - pixel.y * 3.0 > yMipLevel2) { mipLevel = 3.0; if (uv.y - pixel.y * 5.0 > yMipLevel3) { mipLevel = 4.0; if (uv.y - pixel.y * 7.0 > yMipLevel4) { mipLevel = 5.0; } } } } } if (mipLevel > 0.0) { float scale = pow(2.0, mipLevel); uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0); uv.x *= ((textureSize.x - 2.0) / textureSize.y); uv.x -= 1.0 + pixel.x; uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0))); uv *= scale; } else { uv.x *= (textureSize.x / textureSize.y); } if(mipLevel == 0.0) { out_FragColor = texture(texture0, uv); } else if(mipLevel == 1.0) { out_FragColor = texture(texture1, uv); } else if(mipLevel == 2.0) { out_FragColor = texture(texture2, uv); } else if(mipLevel == 3.0) { out_FragColor = texture(texture3, uv); } else if(mipLevel == 4.0) { out_FragColor = texture(texture4, uv); } else if(mipLevel == 5.0) { out_FragColor = texture(texture5, uv); } else { out_FragColor = vec4(0.0); } } `,Aae=`in vec3 v_cubeMapCoordinates; uniform samplerCube cubeMap; void main() { vec4 rgba = czm_textureCube(cubeMap, v_cubeMapCoordinates); #ifdef RGBA_NORMALIZED out_FragColor = vec4(rgba.rgb, 1.0); #else float m = rgba.a * 16.0; vec3 r = rgba.rgb * m; out_FragColor = vec4(r * r, 1.0); #endif } `,xae=`in vec4 position; in vec3 cubeMapCoordinates; out vec3 v_cubeMapCoordinates; void main() { gl_Position = position; v_cubeMapCoordinates = cubeMapCoordinates; } `;function yl(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._errorEvent=new Le}Object.defineProperties(yl.prototype,{url:{get:function(){return this._url}},errorEvent:{get:function(){return this._errorEvent}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}}});yl.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const Cae=new d(1,0,0),Eae=new d(0,0,1),wae=new d(-1,0,0),Sae=new d(0,0,-1),iT=new d(0,1,0),vae=new d(0,-1,0),GV=[iT,wae,Eae,vae,Cae,iT,Sae,iT,iT],jV=GV.length,WV=new Float32Array(jV*3);let lM=0;for(let e=0;e0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return c(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return c(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}});function Oae(e,t){if(!!yl.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),c(e._specularEnvironmentMaps)){const n=new yl(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,e._removeErrorListener=n.errorEvent.addEventListener(i=>{console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}G_.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;H.equals(n,i)||(this._shouldRegenerateShaders=n.x>0&&i.x===0||n.x===0&&i.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||n.y>0&&i.y===0||n.y===0&&i.y>0,this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||c(this._luminanceAtZenith)!==c(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||c(this._previousSphericalHarmonicCoefficients)!==c(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(Oae(this,t),this._specularEnvironmentMapAtlasDirty=!1),c(this._specularEnvironmentMapAtlas)&&(this._specularEnvironmentMapAtlas.update(e),this._specularEnvironmentMapAtlas.ready&&(this._specularEnvironmentMapLoaded=!0));const o=!c(this._specularEnvironmentMapAtlas)&&c(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!c(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!c(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!c(this._specularEnvironmentMapAtlas)&&c(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)};G_.prototype.isDestroyed=function(){return!1};G_.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._removeErrorListener=this._removeErrorListener&&this._removeErrorListener(),ve(this)};let Uw;const qV="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYzAzYzE4NS0yZmJiLTQ5NzUtOWJlYS0zNjdkMzc2ODBmZDgiLCJpZCI6MjU5LCJpYXQiOjE3MTQ1NzE1MDN9.tIhlyfC7MHSWrQmoAqkvQdXMbg3igaC2HIbQp1HKCVM",AC={};AC.defaultAccessToken=qV;AC.defaultServer=new Ae({url:"https://api.cesium.com/"});AC.getDefaultTokenCredit=function(e){if(e===qV){if(!c(Uw)){const t=` This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at https://cesium.com.`;Uw=new Wt(t,!0)}return Uw}};const Zf=AC;function ar(e,t){A.defined("endpoint",e),A.defined("endpointResource",t);let n;const i=e.externalType,o=c(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:Lae};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new Te("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");Ae.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Ec(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}c(Object.create)&&(ar.prototype=Object.create(Ae.prototype),ar.prototype.constructor=ar);ar.fromAssetId=function(e,t){const n=ar._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new ar(i,n)})};Object.defineProperties(ar.prototype,{credits:{get:function(){return c(this._ionRoot)?this._ionRoot.credits:c(this._credits)?this._credits:(this._credits=ar.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});ar.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(Wt.getIonCredit),i=Zf.getDefaultTokenCredit(t.queryParameters.access_token);return c(i)&&n.push(Wt.clone(i)),n};ar.prototype.clone=function(e){const t=y(this._ionRoot,this);return c(e)||(e=new ar(t._ionEndpoint,t._ionEndpointResource)),e=Ae.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};ar.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},c(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Ae.prototype.fetchImage.call(this,e)};ar.prototype._makeRequest=function(e){return this._isExternal||new Ec(this.url).authority()!==this._ionEndpointDomain?Ae.prototype._makeRequest.call(this,e):(c(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,e.headers["X-Cesium-Client"]="CesiumJS",typeof CESIUM_VERSION<"u"&&(e.headers["X-Cesium-Client-Version"]=CESIUM_VERSION),Ae.prototype._makeRequest.call(this,e))};ar._createEndpointResource=function(e,t){A.defined("assetId",e),t=y(t,y.EMPTY_OBJECT);let n=y(t.server,Zf.defaultServer);const i=y(t.accessToken,Zf.defaultAccessToken);n=Ae.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return c(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function Lae(e,t){const n=y(e._ionRoot,e),i=n._ionEndpointResource,o=typeof Image<"u";return!c(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(c(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then(function(r){return n._ionEndpoint=r,r}).finally(function(r){return n._pendingPromise=void 0,r})),n._pendingPromise.then(function(r){return e._ionEndpoint=r,!0}))}function jr(e){e=y(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(jr.prototype,{length:{get:function(){return this._length},set:function(e){A.typeOf.number.greaterThanOrEquals("length",e,0);const t=this._array,n=this._length;if(et.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}});jr.prototype.get=function(e){return A.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};jr.prototype.set=function(e,t){A.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};jr.prototype.peek=function(){return this._array[this._length-1]};jr.prototype.push=function(e){const t=this.length++;this._array[t]=e};jr.prototype.pop=function(){if(this._length===0)return;const e=this._array[this._length-1];return--this.length,e};jr.prototype.reserve=function(e){A.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};jr.prototype.resize=function(e){A.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};jr.prototype.trim=function(e){e=y(e,this._length),this._array.length=e};const fd={X:0,Y:1,Z:2};fd.Y_UP_TO_Z_UP=L.fromRotationTranslation($.fromArray([1,0,0,0,0,1,0,-1,0]));fd.Z_UP_TO_Y_UP=L.fromRotationTranslation($.fromArray([1,0,0,0,0,-1,0,1,0]));fd.X_UP_TO_Z_UP=L.fromRotationTranslation($.fromArray([0,0,1,0,1,0,-1,0,0]));fd.Z_UP_TO_X_UP=L.fromRotationTranslation($.fromArray([0,0,-1,0,1,0,1,0,0]));fd.X_UP_TO_Y_UP=L.fromRotationTranslation($.fromArray([0,1,0,-1,0,0,0,0,1]));fd.Y_UP_TO_X_UP=L.fromRotationTranslation($.fromArray([0,-1,0,1,0,0,0,0,1]));fd.fromName=function(e){return A.typeOf.string("name",e),fd[e]};const Cr=Object.freeze(fd);function rO(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(rO.prototype,{metadata:{get:function(){return this._metadata}}});function Ta(e,t,n){if(!c(e))throw new E("uint8Array is required.");if(t<0)throw new E("byteOffset cannot be negative.");if(n<0)throw new E("byteLength cannot be negative.");if(t+n>e.byteLength)throw new E("sub-region exceeds array bounds.");return t=y(t,0),n=y(n,e.byteLength-t),e=e.subarray(t,t+n),Ta.decode(e)}Ta.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};Ta.decodeWithFromCharCode=function(e){let t="";const n=Rae(e),i=n.length;for(let o=0;o>10)+55296,(r&1023)+56320))}return t};function Dg(e,t,n){return t<=e&&e<=n}function Rae(e){let t=0,n=0,i=0,o=128,r=191;const s=[],a=e.length;for(let l=0;l0){const o=Math.min(t,pt.maximumTextureSize),r=Math.ceil(t/pt.maximumTextureSize),s=1/o,a=s*.5,l=1/r,u=l*.5;n=new H(o,r),i=new te(s,a,l,u)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}Object.defineProperties(Bi.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return c(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),c(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}}});Bi.DEFAULT_COLOR_VALUE=z.WHITE;Bi.DEFAULT_SHOW_VALUE=!0;function YV(e){const t=e._textureDimensions;return t.x*t.y*4}function $V(e){if(!c(e._batchValues)){const t=YV(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function XV(e){if(!c(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function F0(e,t){if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}Bi.prototype.setShow=function(e,t){if(F0(e,this._featuresLength),A.typeOf.bool("show",t),t&&!c(this._showAlphaProperties))return;const n=XV(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;const r=$V(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};Bi.prototype.setAllShow=function(e){A.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n0){const i=e._pickIds,o=YV(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let l=0;l=a)throw new E(`Parent index ${t} exceeds the total number of instances: ${a}`);if(n.indexOf(t)>-1)throw new E("Circular dependency detected in the batch table hierarchy.");n.push(t);const l=c(i)?i[t]:1,u=c(i)?r[t]:t;for(let h=0;h0;){if(t=h.pop(),l[t]===u)continue;l[t]=u;const f=n(e,t);if(c(f))return f;const _=o[t],g=s[t];for(let m=0;m<_;++m){const b=r[g+m];b!==t&&h.push(b)}}}function $ae(e,t,n){let i=!0;for(;i;){const o=n(e,t);if(c(o))return o;const r=e._parentIds[t];i=r!==t,t=r}}function B0(e,t,n){const i=e._parentCounts,o=e._parentIds;if(c(o)){if(c(i))return Yae(e,t,n)}else return n(e,t);return $ae(e,t,n)}du.prototype.hasProperty=function(e,t){const n=B0(this,e,function(i,o){const r=i._classIds[o],s=i._classes[r].instances;if(c(s[t]))return!0});return c(n)};du.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i=t)throw new E(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Hn.prototype.isClass=function(e,t){j_(e,this.featuresLength),A.typeOf.string("className",t);const n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};Hn.prototype.isExactClass=function(e,t){return A.typeOf.string("className",t),this.getExactClassName(e)===t};Hn.prototype.getExactClassName=function(e){j_(e,this.featuresLength);const t=this._batchTableHierarchy;if(!!c(t))return t.getClassName(e)};Hn.prototype.hasProperty=function(e,t){return j_(e,this.featuresLength),A.typeOf.string("name",t),c(this._properties[t])||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};Hn.prototype.hasPropertyBySemantic=function(){return!1};Hn.prototype.getPropertyIds=function(e,t){j_(e,this.featuresLength),t=c(t)?t:[],t.length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};Hn.prototype.getPropertyBySemantic=function(e,t){};Hn.prototype.getProperty=function(e,t){if(j_(e,this.featuresLength),A.typeOf.string("name",t),c(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(c(i))return nce(i,e)}const n=this._properties[t];if(c(n))return Je(n[e],!0);if(c(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(c(i))return i}};Hn.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(j_(e,i),A.typeOf.string("name",t),c(this._batchTableBinaryProperties)){const r=this._batchTableBinaryProperties[t];if(c(r)){ice(r,e,n);return}}if(c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];c(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=Je(n,!0)};function oce(e){return e._batchTexture.textureDimensions.y===1?`uniform vec4 tile_textureStep; vec2 computeSt(float batchId) { float stepX = tile_textureStep.x; float centerX = tile_textureStep.y; return vec2(centerX + (batchId * stepX), 0.5); } `:`uniform vec4 tile_textureStep; uniform vec2 tile_textureDimensions; vec2 computeSt(float batchId) { float stepX = tile_textureStep.x; float centerX = tile_textureStep.y; float stepY = tile_textureStep.z; float centerY = tile_textureStep.w; float xId = mod(batchId, tile_textureDimensions.x); float yId = floor(batchId / tile_textureDimensions.x); return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); } `}Hn.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;const i=this;return function(o){const r=JV(o,n,!1);let s;return pt.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand; `),s+=`uniform sampler2D tile_batchTexture; out vec4 tile_featureColor; out vec2 tile_featureSt; void main() { vec2 st = computeSt(${t}); vec4 featureProperties = texture(tile_batchTexture, st); tile_color(featureProperties); float show = ceil(featureProperties.a); gl_Position *= show; `,e&&(s+=` bool isStyleTranslucent = (featureProperties.a != 1.0); if (czm_pass == czm_passTranslucent) { if (!isStyleTranslucent && !tile_translucentCommand) { gl_Position *= 0.0; } } else { if (isStyleTranslucent) { gl_Position *= 0.0; } } `),s+=` tile_featureColor = featureProperties; tile_featureSt = st; }`):s=`out vec2 tile_featureSt; void main() { tile_color(vec4(1.0)); tile_featureSt = computeSt(${t}); }`,`${r} ${oce(i)}${s}`}};function dM(e,t){return e=Oe.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend; void tile_color(vec4 tile_featureColor) { tile_main(); tile_featureColor = czm_gammaCorrect(tile_featureColor); out_FragColor.a *= tile_featureColor.a; float highlight = ceil(tile_colorBlend); out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); } `:`${e}void tile_color(vec4 tile_featureColor) { tile_main(); } `}function rce(e,t){const n=`texture(${t}`;let i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u0?(i+=`uniform sampler2D tile_pickTexture; in vec2 tile_featureSt; in vec4 tile_featureColor; void main() { tile_color(tile_featureColor); `,n&&(i+=` out_FragColor.rgb *= out_FragColor.a; `),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand; `),i+=`uniform sampler2D tile_pickTexture; uniform sampler2D tile_batchTexture; in vec2 tile_featureSt; void main() { vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); if (featureProperties.a == 0.0) { discard; } `,e&&(i+=` bool isStyleTranslucent = (featureProperties.a != 1.0); if (czm_pass == czm_passTranslucent) { if (!isStyleTranslucent && !tile_translucentCommand) { discard; } } else { if (isStyleTranslucent) { discard; } } `),i+=` tile_color(featureProperties); `,n&&(i+=` out_FragColor.rgb *= out_FragColor.a; `),i+=`} `),i}};Hn.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=Oe.replaceMain(e,"tile_main"),pt.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture; in vec2 tile_featureSt; in vec4 tile_featureColor; void main() { tile_main(); out_FragColor = tile_featureColor; out_FragColor.rgb *= out_FragColor.a; }`:e+=`uniform sampler2D tile_batchTexture; uniform sampler2D tile_pickTexture; in vec2 tile_featureSt; void main() { tile_main(); vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); if (featureProperties.a == 0.0) { discard; } out_FragColor = featureProperties; out_FragColor.rgb *= out_FragColor.a; } `,e}};function sce(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===HA.HIGHLIGHT)return 0;if(n===HA.REPLACE)return 1;if(n===HA.MIX)return R.clamp(i,R.EPSILON4,1);throw new E(`Invalid color blend mode "${n}".`)}Hn.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;const e=this;return function(t){return jt(t,{tile_batchTexture:function(){return y(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return sce(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};Hn.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};const sh={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};Hn.prototype.addDerivedCommands=function(e,t){const n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s.isSkippingLevelOfDetail&&s.hasMixedContent&&e.context.stencilBuffer,l=ace(this);for(let u=t;u>>At.SKIP_LOD_BIT_SHIFT}function mce(e){const t=Je(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=Zn.ALPHA_BLEND,t.stencilTest=At.setCesium3DTileBit(),t.stencilMask=At.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}function _ce(e){const t=Je(e,!0);return t.stencilTest=At.setCesium3DTileBit(),t.stencilMask=At.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}Hn.prototype.update=function(e,t){this._batchTexture.update(e,t)};Hn.prototype.isDestroyed=function(){return!1};Hn.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),ve(this)};function Px(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}const hM=`in vec3 position; in float a_batchId; uniform mat4 u_modifiedModelViewProjection; void main() { gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0)); } `;function Ir(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Ir.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 c(this._color)||(this._color=new z),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(!!c(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)}}});Ir.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Ir.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Ir.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Ir.getPropertyInherited=function(e,t,n){const i=e.batchTable;if(c(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}const o=e.metadata;if(c(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}const r=e.tile,s=r.metadata;if(c(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(c(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),c(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}const l=c(e.group)?e.group.metadata:void 0;if(c(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}const u=e.tileset.metadata;if(c(u)){if(u.hasPropertyBySemantic(n))return u.getPropertyBySemantic(n);if(u.hasProperty(n))return u.getProperty(n)}};Ir.prototype.getPropertyInherited=function(e){return Ir.getPropertyInherited(this._content,this._batchId,e)};Ir.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Ir.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Ir.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Ir.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};class gce{add(t,n,i){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][i?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(i){i.call(n&&n.context?n.context:n,n)})}}class yce{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class De{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+De.version}static addUnaryOp(t){return De.max_unop_len=Math.max(t.length,De.max_unop_len),De.unary_ops[t]=1,De}static addBinaryOp(t,n,i){return De.max_binop_len=Math.max(t.length,De.max_binop_len),De.binary_ops[t]=n,i?De.right_associative.add(t):De.right_associative.delete(t),De}static addIdentifierChar(t){return De.additional_identifier_chars.add(t),De}static addLiteral(t,n){return De.literals[t]=n,De}static removeUnaryOp(t){return delete De.unary_ops[t],t.length===De.max_unop_len&&(De.max_unop_len=De.getMaxKeyLen(De.unary_ops)),De}static removeAllUnaryOps(){return De.unary_ops={},De.max_unop_len=0,De}static removeIdentifierChar(t){return De.additional_identifier_chars.delete(t),De}static removeBinaryOp(t){return delete De.binary_ops[t],t.length===De.max_binop_len&&(De.max_binop_len=De.getMaxKeyLen(De.binary_ops)),De.right_associative.delete(t),De}static removeAllBinaryOps(){return De.binary_ops={},De.max_binop_len=0,De}static removeLiteral(t){return delete De.literals[t],De}static removeAllLiterals(){return De.literals={},De}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new De(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return De.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!De.binary_ops[String.fromCharCode(t)]||De.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return De.isIdentifierStart(t)||De.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(De.hooks[t]){const i={context:this,node:n};return De.hooks.run(t,i),i.node}return n}searchHook(t){if(De.hooks[t]){const n={context:this};return De.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===De.SPACE_CODE||t===De.TAB_CODE||t===De.LF_CODE||t===De.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:De.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],i,o;for(;this.index0;){if(De.binary_ops.hasOwnProperty(t)&&(!De.isIdentifierStart(this.code)||this.index+t.lengthr.right_a&&f.right_a?i>f.prec:i<=f.prec;for(;o.length>2&&h(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:De.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),o.push(r,t)}for(l=o.length-1,t=o[l];l>1;)t={type:De.BINARY_EXP,operator:o[l-1].value,left:o[l-2],right:t},l-=2;return t}gobbleToken(){let t,n,i,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,De.isDecimalDigit(t)||t===De.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===De.SQUOTE_CODE||t===De.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===De.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,De.max_unop_len),i=n.length;i>0;){if(De.unary_ops.hasOwnProperty(n)&&(!De.isIdentifierStart(this.code)||this.index+n.length=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===De.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===De.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===De.CBRACK_CODE)for(let s=n.length;s":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});De.max_unop_len=De.getMaxKeyLen(De.unary_ops);De.max_binop_len=De.getMaxKeyLen(De.binary_ops);const ep=e=>new De(e).parse(),Tce=Object.getOwnPropertyNames(De);Tce.forEach(e=>{ep[e]===void 0&&e!=="prototype"&&(ep[e]=De[e])});ep.Jsep=De;const Ace="ConditionalExpression";var xce={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:Ace,test:i,consequent:o,alternate:r},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=i}}else this.throwError("Expected :")}})}};ep.plugins.register(xce);const Cce={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},$e=Object.freeze(Cce);function bl(e,t){A.typeOf.string("expression",e),this._expression=e,e=Fce(e,t),e=zce(Bce(e)),ep.addBinaryOp("=~",0),ep.addBinaryOp("!~",0);let n;try{n=ep(e)}catch(i){throw new Te(i)}this._runtimeAst=yn(this,n)}Object.defineProperties(bl.prototype,{expression:{get:function(){return this._expression}}});const Vt={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new H],cartesian3Array:[new d],cartesian4Array:[new te],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 H),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new d),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new te),this.cartesian4Array[this.cartesian4Index++]}};bl.prototype.evaluate=function(e,t){Vt.reset();const n=this._runtimeAst.evaluate(e);return t instanceof z&&n instanceof te?z.fromCartesian4(n,t):n instanceof H||n instanceof d||n instanceof te?n.clone(t):n};bl.prototype.evaluateColor=function(e,t){Vt.reset();const n=this._runtimeAst.evaluate(e);return z.fromCartesian4(n,t)};bl.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e} { return ${o}; } `,o};bl.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};bl.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};const Ece=["!","-","+"],fM=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],Ox=/\${(.*?)}/g,wce=/\\/g,Sce="@#%",vce=/@#%/g,CC=new z,EC={abs:Jo(Math.abs),sqrt:Jo(Math.sqrt),cos:Jo(Math.cos),sin:Jo(Math.sin),tan:Jo(Math.tan),acos:Jo(Math.acos),asin:Jo(Math.asin),atan:Jo(Math.atan),radians:Jo(R.toRadians),degrees:Jo(R.toDegrees),sign:Jo(R.sign),floor:Jo(Math.floor),ceil:Jo(Math.ceil),round:Jo(Math.round),exp:Jo(Math.exp),exp2:Jo(Dce),log:Jo(Math.log),log2:Jo(Pce),fract:Jo(Ice),length:Oce,normalize:Lce},wC={atan2:oT(Math.atan2,!1),pow:oT(Math.pow,!1),min:oT(Math.min,!0),max:oT(Math.max,!0),distance:Rce,dot:Nce,cross:Mce},sO={clamp:pM(R.clamp,!0),mix:pM(R.lerp,!0)};function Ice(e){return e-Math.floor(e)}function Dce(e){return Math.pow(2,e)}function Pce(e){return R.log2(e)}function Jo(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof H)return H.fromElements(e(n.x),e(n.y),Vt.getCartesian2());if(n instanceof d)return d.fromElements(e(n.x),e(n.y),e(n.z),Vt.getCartesian3());if(n instanceof te)return te.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Vt.getCartesian4());throw new Te(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function oT(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof H)return H.fromElements(e(i.x,o),e(i.y,o),Vt.getCartesian2());if(i instanceof d)return d.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Vt.getCartesian3());if(i instanceof te)return te.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Vt.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x),e(i.y,o.y),Vt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Vt.getCartesian3());if(i instanceof te&&o instanceof te)return te.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Vt.getCartesian4());throw new Te(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function pM(e,t){return function(n,i,o,r){if(t&&typeof r=="number"){if(typeof i=="number"&&typeof o=="number")return e(i,o,r);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),Vt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Vt.getCartesian3());if(i instanceof te&&o instanceof te)return te.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),Vt.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof H&&o instanceof H&&r instanceof H)return H.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),Vt.getCartesian2());if(i instanceof d&&o instanceof d&&r instanceof d)return d.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Vt.getCartesian3());if(i instanceof te&&o instanceof te&&r instanceof te)return te.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),Vt.getCartesian4());throw new Te(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function Oce(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof H)return H.magnitude(t);if(t instanceof d)return d.magnitude(t);if(t instanceof te)return te.magnitude(t);throw new Te(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function Lce(e,t){if(typeof t=="number")return 1;if(t instanceof H)return H.normalize(t,Vt.getCartesian2());if(t instanceof d)return d.normalize(t,Vt.getCartesian3());if(t instanceof te)return te.normalize(t,Vt.getCartesian4());throw new Te(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function Rce(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof H&&n instanceof H)return H.distance(t,n);if(t instanceof d&&n instanceof d)return d.distance(t,n);if(t instanceof te&&n instanceof te)return te.distance(t,n);throw new Te(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function Nce(e,t,n){if(typeof t=="number"&&typeof n=="number")return t*n;if(t instanceof H&&n instanceof H)return H.dot(t,n);if(t instanceof d&&n instanceof d)return d.dot(t,n);if(t instanceof te&&n instanceof te)return te.dot(t,n);throw new Te(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function Mce(e,t,n){if(t instanceof d&&n instanceof d)return d.cross(t,n,Vt.getCartesian3());throw new Te(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function qe(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,$ce(this)}function Fce(e,t){if(!c(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;c(o)&&(e=e.replace(i,o))}return e}function Bce(e){return e.replace(wce,Sce)}function GI(e){return e.replace(vce,"\\")}function zce(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const o=t.indexOf("'"),r=t.indexOf('"');let s;if(o>=0&&o=0&&r=0?new qe($e.VARIABLE_IN_STRING,e.value):new qe($e.LITERAL_STRING,GI(e.value))}function kce(e,t){const n=t.arguments,i=n.length;let o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;const l=t.callee.object;if(o==="test"||o==="exec"){if(!c(l.callee)||l.callee.name!=="regExp")throw new Te(`${o} is not a function.`);return i===0?o==="test"?new qe($e.LITERAL_BOOLEAN,!1):new qe($e.LITERAL_NULL,null):(s=yn(e,l),a=yn(e,n[0]),new qe($e.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=yn(e,l),new qe($e.FUNCTION_CALL,o,r);throw new Te(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new qe($e.LITERAL_COLOR,o);if(r=yn(e,n[0]),c(n[1])){const l=yn(e,n[1]);return new qe($e.LITERAL_COLOR,o,[r,l])}return new qe($e.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new Te(`${o} requires three arguments.`);return r=[yn(e,n[0]),yn(e,n[1]),yn(e,n[2])],new qe($e.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new Te(`${o} requires four arguments.`);return r=[yn(e,n[0]),yn(e,n[1]),yn(e,n[2]),yn(e,n[3])],new qe($e.LITERAL_COLOR,o,r)}else if(o==="vec2"||o==="vec3"||o==="vec4"){r=new Array(i);for(let l=0;l1)throw new Te(`${o} requires exactly one argument.`);return r=yn(e,n[0]),new qe($e.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new Te(`${o} does not take any argument.`);return new qe($e.UNARY,o)}else if(c(EC[o])){if(i!==1)throw new Te(`${o} requires exactly one argument.`);return r=yn(e,n[0]),new qe($e.UNARY,o,r)}else if(c(wC[o])){if(i!==2)throw new Te(`${o} requires exactly two arguments.`);return s=yn(e,n[0]),a=yn(e,n[1]),new qe($e.BINARY,o,s,a)}else if(c(sO[o])){if(i!==3)throw new Te(`${o} requires exactly three arguments.`);s=yn(e,n[0]),a=yn(e,n[1]);const l=yn(e,n[2]);return new qe($e.TERNARY,o,s,a,l)}else{if(o==="Boolean")return i===0?new qe($e.LITERAL_BOOLEAN,!1):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="Number")return i===0?new qe($e.LITERAL_NUMBER,0):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="String")return i===0?new qe($e.LITERAL_STRING,""):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="regExp")return Vce(e,t)}}throw new Te(`Unexpected function call "${o}".`)}function Vce(e,t){const n=t.arguments;if(n.length===0)return new qe($e.LITERAL_REGEX,new RegExp);const i=yn(e,n[0]);let o;if(n.length>1){const r=yn(e,n[1]);if(Hw(i)&&Hw(r)){try{o=new RegExp(GI(String(i._value)),r._value)}catch(s){throw new Te(s)}return new qe($e.LITERAL_REGEX,o)}return new qe($e.REGEX,i,r)}if(Hw(i)){try{o=new RegExp(GI(String(i._value)))}catch(r){throw new Te(r)}return new qe($e.LITERAL_REGEX,o)}return new qe($e.REGEX,i)}function Hce(e){if(qce(e.name)){const t=Yce(e.name);return t.substr(0,8)==="tiles3d_"?new qe($e.BUILTIN_VARIABLE,t):new qe($e.VARIABLE,t)}else{if(e.name==="NaN")return new qe($e.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new qe($e.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new qe($e.LITERAL_UNDEFINED,void 0)}throw new Te(`${e.name} is not defined.`)}function Gce(e){const t=e.property.name;if(t==="PI")return new qe($e.LITERAL_NUMBER,Math.PI);if(t==="E")return new qe($e.LITERAL_NUMBER,Math.E)}function jce(e){if(e.property.name==="POSITIVE_INFINITY")return new qe($e.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function Wce(e,t){if(t.object.name==="Math")return Gce(t);if(t.object.name==="Number")return jce(t);let n;const i=yn(e,t.object);return t.computed?(n=yn(e,t.property),new qe($e.MEMBER,"brackets",i,n)):(n=new qe($e.LITERAL_STRING,t.property.name),new qe($e.MEMBER,"dot",i,n))}function Hw(e){return e._type>=$e.LITERAL_NULL}function qce(e){return e.substr(0,4)==="czm_"}function Yce(e){return e.substr(4)}function yn(e,t){let n,i,o,r;if(t.type==="Literal")n=Uce(t);else if(t.type==="CallExpression")n=kce(e,t);else if(t.type==="Identifier")n=Hce(t);else if(t.type==="UnaryExpression"){i=t.operator;const s=yn(e,t.argument);if(Ece.indexOf(i)>-1)n=new qe($e.UNARY,i,s);else throw new Te(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=yn(e,t.left),r=yn(e,t.right),fM.indexOf(i)>-1)n=new qe($e.BINARY,i,o,r);else throw new Te(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=yn(e,t.left),r=yn(e,t.right),fM.indexOf(i)>-1&&(n=new qe($e.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){const s=yn(e,t.test);o=yn(e,t.consequent),r=yn(e,t.alternate),n=new qe($e.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=Wce(e,t);else if(t.type==="ArrayExpression"){const s=[];for(let a=0;a"?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:c(wC[e._value])&&(e.evaluate=Kce(e._value)):e._type===$e.TERNARY?e.evaluate=Zce(e._value):e._type===$e.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===$e.ARRAY?e.evaluate=e._evaluateArray:e._type===$e.VARIABLE?e.evaluate=e._evaluateVariable:e._type===$e.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===$e.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===$e.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===$e.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===$e.REGEX?e.evaluate=e._evaluateRegExp:e._type===$e.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=Xce):e.evaluate=e._evaluateLiteral}function Xce(e){return c(e)?e.content.tileset.timeSinceLoad:0}function Qce(e){const t=EC[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function Kce(e){const t=wC[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function Zce(e){const t=sO[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}function SC(e,t){if(c(e))return e.getPropertyInherited(t)}qe.prototype._evaluateLiteral=function(){return this._value};qe.prototype._evaluateLiteralColor=function(e){const t=CC,n=this._left;if(this._value==="color")c(n)?n.length>1?(z.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):z.fromCssColorString(n[0].evaluate(e),t):z.fromBytes(255,255,255,255,t);else if(this._value==="rgb")z.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if(this._value==="rgba"){const i=n[3].evaluate(e)*255;z.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return te.fromColor(t,Vt.getCartesian4())};qe.prototype._evaluateLiteralVector=function(e){const t=Vt.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a1)throw new Te(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new Te(`Invalid ${n} constructor. Too many arguments.`);if(r===1){const a=t[0];t.push(a,a,a)}if(n==="vec2")return H.fromArray(t,0,Vt.getCartesian2());if(n==="vec3")return d.fromArray(t,0,Vt.getCartesian3());if(n==="vec4")return te.fromArray(t,0,Vt.getCartesian4())};qe.prototype._evaluateLiteralString=function(){return this._value};qe.prototype._evaluateVariableString=function(e){let t=this._value,n=Ox.exec(t);for(;n!==null;){const i=n[0],o=n[1];let r=SC(e,o);c(r)||(r=""),t=t.replace(i,r),n=Ox.exec(t)}return t};qe.prototype._evaluateVariable=function(e){return SC(e,this._value)};function tp(e){return e._value==="feature"}qe.prototype._evaluateMemberDot=function(e){if(tp(this._left))return SC(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!c(t))return;const n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof te){if(n==="r")return t.x;if(n==="g")return t.y;if(n==="b")return t.z;if(n==="a")return t.w}return t[n]};qe.prototype._evaluateMemberBrackets=function(e){if(tp(this._left))return SC(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!c(t))return;const n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof te){if(n===0||n==="r")return t.x;if(n===1||n==="g")return t.y;if(n===2||n==="b")return t.z;if(n===3||n==="a")return t.w}return t[n]};qe.prototype._evaluateArray=function(e){const t=[];for(let n=0;n" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};qe.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Te(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};qe.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Te(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Te(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};qe.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Te(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Te(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};qe.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.add(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.add(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.add(t,n,Vt.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new Te(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.subtract(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.subtract(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.subtract(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new Te(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.multiplyComponents(t,n,Vt.getCartesian2());if(n instanceof H&&typeof t=="number")return H.multiplyByScalar(n,t,Vt.getCartesian2());if(t instanceof H&&typeof n=="number")return H.multiplyByScalar(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.multiplyComponents(t,n,Vt.getCartesian3());if(n instanceof d&&typeof t=="number")return d.multiplyByScalar(n,t,Vt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.multiplyByScalar(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.multiplyComponents(t,n,Vt.getCartesian4());if(n instanceof te&&typeof t=="number")return te.multiplyByScalar(n,t,Vt.getCartesian4());if(t instanceof te&&typeof n=="number")return te.multiplyByScalar(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new Te(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.divideComponents(t,n,Vt.getCartesian2());if(t instanceof H&&typeof n=="number")return H.divideByScalar(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.divideComponents(t,n,Vt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.divideByScalar(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.divideComponents(t,n,Vt.getCartesian4());if(t instanceof te&&typeof n=="number")return te.divideByScalar(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new Te(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.fromElements(t.x%n.x,t.y%n.y,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new Te(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof te&&t instanceof te?t.equals(n):t===n};qe.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof te&&t instanceof te?!t.equals(n):t!==n};qe.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if(typeof t!="boolean")throw new Te(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};qe.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};qe.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};qe.prototype._evaluateIsExactClass=function(e){return c(e)?e.isExactClass(this._left.evaluate(e)):!1};qe.prototype._evaluateIsClass=function(e){return c(e)?e.isClass(this._left.evaluate(e)):!1};qe.prototype._evaluateGetExactClassName=function(e){if(c(e))return e.getExactClassName()};qe.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};qe.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};qe.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};qe.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n="";c(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new Te(o)}return i};qe.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Te(`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)};qe.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return t.test(n);if(n instanceof RegExp&&typeof t=="string")return n.test(t);throw new Te(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return!t.test(n);if(n instanceof RegExp&&typeof t=="string")return!n.test(t);throw new Te(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Te(`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 c(i)?i[1]:null};qe.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof H||t instanceof d||t instanceof te)return String(t);throw new Te(`Unexpected function call "${this._value}".`)};function mM(e){const t=e._left,n=t.length;for(let a=0;a1){const _=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${_}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(l==="rgb")return i=_M(this),c(i)?rT(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, 1.0)`;if(l==="rgba")return u[3]!=="1.0"&&(t.translucent=!0),i=_M(this),c(i)?rT(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(l==="hsl")return i=mM(this),c(i)?rT(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(l==="hsla")return i=mM(this),c(i)?(i.alpha!==1&&(t.translucent=!0),rT(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case $e.LITERAL_VECTOR:if(!c(o))throw new E("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");h=o.length,f=`${l}(`;for(let _=0;_0;){const h=t.pop();if(z.equals(h.color,a.color))u=Gw(n,s,u,i,o,h.batchIds,r),a.batchIds=a.batchIds.concat(h.batchIds),a.count=u-a.offset;else{const f=u;u=Gw(n,s,u,i,o,h.batchIds,r),h.offset=f,h.count=u-f,l.push(h),a=h}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=l}function jw(e,t,n,i,o,r,s){const a=e.bytesPerIndex,l=r.length;for(let u=0;u0;){const f=t.pop();if(z.equals(f.color,r.color))u=jw(a,l,u,n,i,f.batchIds,o),r.batchIds=r.batchIds.concat(f.batchIds),r.count=u-r.offset;else{const _=u;u=jw(a,l,u,n,i,f.batchIds,o),f.offset=_,f.count=u-_,s.push(f),r=f}}const h=e._va;e._va=e._vaSwap,e._vaSwap=h,e._batchedIndices=s}function lle(e,t){return t.color.toRgba()-e.color.toRgba()}function ule(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let o=!1;const r={};for(let s=0;s=b&&s{e.isDestroyed()||(e._error=m)}):void 0}}function Sle(e){c(e._primitive)||(e._primitive=new hu({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:y(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)}kr.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};kr.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};kr.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};kr.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};kr.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=wle(this)),c(this._error)){const t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};kr.prototype.isDestroyed=function(){return!1};kr.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};function fu(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,Dle(this,i,o)}Object.defineProperties(fu.prototype,{featuresLength:{get:function(){return c(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return c(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return c(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function vle(e){return function(t,n){c(e._geometries)&&e._geometries.updateCommands(t,n)}}function Ile(e,t){let n,i,o,r,s;const a=y(e.BOXES_LENGTH,0),l=y(e.CYLINDERS_LENGTH,0),u=y(e.ELLIPSOIDS_LENGTH,0),h=y(e.SPHERES_LENGTH,0);if(a>0&&c(e.BOX_BATCH_IDS)){const m=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,m,a)}if(l>0&&c(e.CYLINDER_BATCH_IDS)){const m=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,m,l)}if(u>0&&c(e.ELLIPSOID_BATCH_IDS)){const m=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,m,u)}if(h>0&&c(e.SPHERE_BATCH_IDS)){const m=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,m,h)}const f=c(n)||c(i)||c(o)||c(r),_=a>0&&!c(n)||l>0&&!c(i)||u>0&&!c(o)||h>0&&!c(r);if(f&&_)throw new Te("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)&&!c(r)){let m=0;if(!c(n)&&a>0)for(n=new Uint16Array(a),s=0;s0)for(i=new Uint16Array(l),s=0;s0)for(o=new Uint16Array(u),s=0;s0)for(r=new Uint16Array(h),s=0;s0&&(g=sa(i,n,u),n+=u,h>0&&(m=new Uint8Array(t,n,h),m=new Uint8Array(m)));const b=y(f.BOXES_LENGTH,0),T=y(f.CYLINDERS_LENGTH,0),x=y(f.ELLIPSOIDS_LENGTH,0),C=y(f.SPHERES_LENGTH,0),w=b+T+x+C,v=new Hn(e,w,g,m,vle(e));if(e._batchTable=v,w===0)return;const P=e.tile.computedTransform;let N;c(f.RTC_CENTER)&&(N=d.unpack(f.RTC_CENTER),L.multiplyByPoint(P,N,N));const k=Ile(f,_);if(b>0||T>0||x>0||C>0){let M,U,B,S;if(b>0){const D=_.byteOffset+f.BOXES.byteOffset;M=new Float32Array(_.buffer,D,kr.packedBoxLength*b)}if(T>0){const D=_.byteOffset+f.CYLINDERS.byteOffset;U=new Float32Array(_.buffer,D,kr.packedCylinderLength*T)}if(x>0){const D=_.byteOffset+f.ELLIPSOIDS.byteOffset;B=new Float32Array(_.buffer,D,kr.packedEllipsoidLength*x)}if(C>0){const D=_.byteOffset+f.SPHERES.byteOffset;S=new Float32Array(_.buffer,D,kr.packedSphereLength*C)}return e._geometries=new kr({boxes:M,boxBatchIds:k.boxes,cylinders:U,cylinderBatchIds:k.cylinders,ellipsoids:B,ellipsoidBatchIds:k.ellipsoids,spheres:S,sphereBatchIds:k.spheres,center:N,modelMatrix:P,batchTable:v,boundingVolume:e.tile.boundingVolume.boundingVolume}),e}return Promise.resolve(e)}function e4(e){const t=e.featuresLength;if(!c(e._features)&&t>0){const n=new Array(t);c(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}fu.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};fu.prototype.getFeature=function(e){const t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return e4(this),this._features[e]};fu.prototype.applyDebugSettings=function(e,t){c(this._geometries)&&this._geometries.applyDebugSettings(e,t)};fu.prototype.applyStyle=function(e){e4(this),c(this._geometries)&&this._geometries.applyStyle(e,this._features)};fu.prototype.update=function(e,t){c(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),c(this._batchTable)&&this._geometries.ready&&(this._batchTable.update(e,t),this._ready=!0)};fu.prototype.pick=function(e,t,n){};fu.prototype.isDestroyed=function(){return!1};fu.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),ve(this)};const aO={};aO.encode2D=function(e,t,n){const i=Math.pow(2,e);if(A.typeOf.number("level",e),A.typeOf.number("x",t),A.typeOf.number("y",n),e<1)throw new E("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new E("Invalid coordinates for given level.");const o={x:t,y:n};let r,s,a,l=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,l+=BigInt((3*r^s)*a*a),t4(i,o,r,s);return l};aO.decode2D=function(e,t){if(A.typeOf.number("level",e),A.typeOf.bigint("index",t),e<1)throw new E("Hilbert level cannot be less than 1.");if(t=BigInt(Math.pow(4,e)))throw new E("Hilbert index exceeds valid maximum for given level.");const n=Math.pow(2,e),i={x:0,y:0};let o,r,s,a;for(s=1,a=t;s>>0,cO=2*Zh+1,oh=4,n4=[],i4=[],Lle=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],uh=1,Ym=2,sT=[uh,0,0,uh|Ym];function ui(e){if(!Yt.supportsBigInt())throw new Te("S2 required BigInt support");if(!c(e))throw new E("cell ID is required.");if(!ui.isValidId(e))throw new E("cell ID is invalid.");this._cellId=e,this._level=ui.getLevel(e)}ui.fromToken=function(e){if(A.typeOf.string("token",e),!ui.isValidToken(e))throw new E("token is invalid.");return new ui(ui.getIdFromToken(e))};ui.isValidId=function(e){return A.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(cO)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};ui.isValidToken=function(e){return A.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?ui.isValidId(ui.getIdFromToken(e)):!1};ui.getIdFromToken=function(e){return A.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};ui.getTokenFromId=function(e){A.typeOf.bigint("cellId",e);const t=Math.floor(Hle(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};ui.getLevel=function(e){if(A.typeOf.bigint("cellId",e),!ui.isValidId(e))throw new E;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return Zh-(t>>1)};ui.prototype.getChild=function(e){if(A.typeOf.number("index",e),e<0||e>3)throw new E("child index must be in the range [0-3].");if(this._level===30)throw new E("cannot get child of leaf cell.");const t=s4(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new ui(n)};ui.prototype.getParent=function(){if(this._level===0)throw new E("cannot get parent of root cell.");const e=s4(this._cellId)<3)throw new E("vertex index must be in the range [0-3].");t=y(t,ae.WGS84);let n=Nle(this._cellId,this._level,e);n=d.normalize(n,n);const i=new he.fromCartesian(n,ae.UNIT_SPHERE);return he.toCartesian(i,t,new d)};ui.fromFacePositionLevel=function(e,t,n){if(A.typeOf.bigint("position",t),e<0||e>5)throw new E("Invalid S2 Face (must be within 0-5)");if(n<0||n>Zh)throw new E("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new E("Invalid Hilbert position for level");const i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),o=t.toString(2),r=Array(2*n-o.length+1).join("0"),s=Array(cO-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new ui(a)};function Rle(e,t){const n=Mle(e,t);return Fle(n[0],n[1],n[2])}function Nle(e,t,n){const i=o4(e),o=Ble([i[1],i[2]],t),r=n>>1&1;return r4(i[0],o[0][r^n&1],o[1][r])}function Mle(e,t){const n=o4(e),i=n[0],o=n[1],r=n[2],s=t===30,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),l=s?1:a?2:0,u=(o<<1)+l,h=(r<<1)+l;return[i,u,h]}function o4(e){n4.length===0&&Ule();const t=Number(e>>BigInt(cO));let n=t&uh;const i=(1<=0;s--){const l=(1<<2*(s===7?Zh-7*oh:oh))-1;n+=Number(e>>BigInt(s*2*oh+1)&BigInt(l))<<2,n=i4[n];const u=s*oh;o+=n>>oh+2<>2&i)<=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function CM(e){return 1/Ole*e}function Ble(e,t){const n=[[],[]],i=zle(t);for(let o=0;o<2;++o){const r=e[o]&-i,s=r+i;n[o][0]=Lx(EM(r)),n[o][1]=Lx(EM(s))}return n}function zle(e){return 1<>>0}function EM(e){return 1/Ple*e}function dh(e,t,n,i,o,r){if(e===oh){const s=(t<>1),n+(s[0]&1),i,o,r^sT[0]),dh(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^sT[1]),dh(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^sT[2]),dh(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^sT[3])}}function Ule(){dh(0,0,0,0,0,0),dh(0,0,0,uh,0,uh),dh(0,0,0,Ym,0,Ym),dh(0,0,0,uh|Ym,0,uh|Ym)}function s4(e){return e&~e+BigInt(1)}function kle(e){return BigInt(1)<>3,r=i%8;n+=e[o]>>r&1}return n}Object.defineProperties(Rx.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});Rx.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new E("Bit index out of bounds.");if(c(this._constant))return this._constant;const t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};function pu(e){e=y(e,y.EMPTY_OBJECT);const t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;A.typeOf.object("options.metadataTable",t),A.typeOf.object("options.class",n),A.typeOf.number("options.entityId",i),A.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(pu.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});pu.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};pu.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};pu.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};pu.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};pu.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};pu.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};pu.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const GA={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};GA.getBranchingFactor=function(e){switch(e){case GA.OCTREE:return 8;case GA.QUADTREE:return 4;default:throw new E("subdivisionScheme is not a valid value.")}};const jo=Object.freeze(GA);function Rt(){}Object.defineProperties(Rt.prototype,{class:{get:function(){E.throwInstantiationError()}}});Rt.prototype.hasProperty=function(e){E.throwInstantiationError()};Rt.prototype.hasPropertyBySemantic=function(e){E.throwInstantiationError()};Rt.prototype.getPropertyIds=function(e){E.throwInstantiationError()};Rt.prototype.getProperty=function(e){E.throwInstantiationError()};Rt.prototype.setProperty=function(e,t){E.throwInstantiationError()};Rt.prototype.getPropertyBySemantic=function(e){E.throwInstantiationError()};Rt.prototype.setPropertyBySemantic=function(e,t){E.throwInstantiationError()};Rt.hasProperty=function(e,t,n){if(A.typeOf.string("propertyId",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n),c(t[e]))return!0;const i=n.properties;if(!c(i))return!1;const o=i[e];return!!(c(o)&&c(o.default))};Rt.hasPropertyBySemantic=function(e,t,n){A.typeOf.string("semantic",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!c(i))return!1;const o=i[e];return c(o)};Rt.getPropertyIds=function(e,t,n){A.typeOf.object("properties",e),A.typeOf.object("classDefinition",t),n=c(n)?n:[],n.length=0;for(const o in e)e.hasOwnProperty(o)&&c(e[o])&&n.push(o);const i=t.properties;if(c(i))for(const o in i)i.hasOwnProperty(o)&&!c(e[o])&&c(i[o].default)&&n.push(o);return n};Rt.getProperty=function(e,t,n){if(A.typeOf.string("propertyId",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n),!c(n.properties[e]))throw new E(`Class definition missing property ${e}`);const i=n.properties[e];let o=t[e];Array.isArray(o)&&(o=o.slice());const r=!0;if(o=i.handleNoData(o),!c(o)&&c(i.default))return o=Je(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(!!c(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};Rt.setProperty=function(e,t,n,i){if(A.typeOf.string("propertyId",e),A.defined("value",t),A.typeOf.object("properties",n),A.typeOf.object("classDefinition",i),!c(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o;const r=i.properties;c(r)&&(o=r[e]);const s=!0;return c(o)&&(t=o.packVectorAndMatrixTypes(t,s),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};Rt.getPropertyBySemantic=function(e,t,n){A.typeOf.string("semantic",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!c(i))return;const o=i[e];if(c(o))return Rt.getProperty(o.id,t,n)};Rt.setPropertyBySemantic=function(e,t,n,i){A.typeOf.string("semantic",e),A.defined("value",t),A.typeOf.object("properties",n),A.typeOf.object("classDefinition",i);const o=i.propertiesBySemantic;if(!c(o))return!1;const r=i.propertiesBySemantic[e];return c(r)?Rt.setProperty(r.id,t,n,i):!1};function bd(e){e=y(e,y.EMPTY_OBJECT);const t=e.subtreeMetadata,n=e.class;A.typeOf.object("options.subtreeMetadata",t),A.typeOf.object("options.class",n);const i=c(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(bd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});bd.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};bd.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};bd.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};bd.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};bd.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};bd.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};bd.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};const tt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};tt.getMinimum=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:return-128;case tt.UINT8:return 0;case tt.INT16:return-32768;case tt.UINT16:return 0;case tt.INT32:return-2147483648;case tt.UINT32:return 0;case tt.INT64:return Yt.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case tt.UINT64:return Yt.supportsBigInt()?BigInt(0):0;case tt.FLOAT32:return-34028234663852886e22;case tt.FLOAT64:return-Number.MAX_VALUE}};tt.getMaximum=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:return 127;case tt.UINT8:return 255;case tt.INT16:return 32767;case tt.UINT16:return 65535;case tt.INT32:return 2147483647;case tt.UINT32:return 4294967295;case tt.INT64:return Yt.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case tt.UINT64:return Yt.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case tt.FLOAT32:return 34028234663852886e22;case tt.FLOAT64:return Number.MAX_VALUE}};tt.isIntegerType=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:case tt.UINT8:case tt.INT16:case tt.UINT16:case tt.INT32:case tt.UINT32:case tt.INT64:case tt.UINT64:return!0;default:return!1}};tt.isUnsignedIntegerType=function(e){switch(A.typeOf.string("type",e),e){case tt.UINT8:case tt.UINT16:case tt.UINT32:case tt.UINT64:return!0;default:return!1}};tt.isVectorCompatible=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:case tt.UINT8:case tt.INT16:case tt.UINT16:case tt.INT32:case tt.UINT32:case tt.FLOAT32:case tt.FLOAT64:return!0;default:return!1}};tt.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new E("value must be a number or a BigInt");if(!tt.isIntegerType(t))throw new E("type must be an integer type");return Math.max(Number(e)/Number(tt.getMaximum(t)),-1)};tt.unnormalize=function(e,t){if(A.typeOf.number("value",e),!tt.isIntegerType(t))throw new E("type must be an integer type");const n=tt.getMaximum(t),i=tt.isUnsignedIntegerType(t)?0:-n;return e=R.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===tt.INT64||t===tt.UINT64)&&Yt.supportsBigInt()&&(e=BigInt(e)),e>n?n:e1;if(!n&&o===1)return e;if(!n)return new Array(o).fill(e);if(!r)return new Array(i).fill(e);if(!t)return new Array(this._arrayLength*o).fill(e);const s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)};dr.prototype.handleNoData=function(e){const t=this._noData;if(!c(t))return e;if(!a4(e,t))return e};function a4(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n1;return c(n)?t&&r?e.map(function(s){return n.unpack(s)}):i?n.unpackArray(e):n.unpack(e):e};dr.prototype.packVectorAndMatrixTypes=function(e,t){t=y(t,!1);const n=bt.getMathType(this._type),i=this._isArray,o=bt.getComponentCount(this._type),r=i&&o>1;return c(n)?t&&r?e.map(function(s){return n.pack(s,[])}):i?n.packArray(e,[]):n.pack(e,[]):e};dr.prototype.validate=function(e){if(!(!c(e)&&c(this._default)))return this._required&&!c(e)?"required property must have a value":this._isArray?qle(this,e):c4(this,e)};function qle(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;io?wM(e,t,n):void 0}if(eOt.getMaximum(t))return wM(e,t,n)}function vM(e,t){return`value ${e} of type ${t} must be finite`}function lO(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i=n){const i=n-1;throw new E(`index is required and between zero and count - 1. Actual value: ${i}`)}}function Jle(e,t){d4(e)&&h4(e);const n=e._classProperty,i=n.isArray,o=n.type,r=bt.getComponentCount(o);if(c(e._unpackedValues)){const s=e._unpackedValues[t];return i?Je(s,!0):s}return!i&&r===1?e._getValue(t):u4(e,n,t)}function u4(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const s=bt.getComponentCount(t.type);i*=s,o*=s}else{const a=y(t.arrayLength,1)*e._vectorComponentCount;i=n*a,o=a}const r=new Array(o);for(let s=0;s>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function iue(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<0;let s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=l*Math.pow(256,a)}return r&&(o=-o),o}function rue(e,t){const n=t.dataView,i=e*8;let o=BigInt(0);const r=(n.getUint8(i+7)&128)>0;let s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=BigInt(l)*(BigInt(1)<96?T-97:T>64?T-39:T+4}for(var x=0,b=0;b=3),l(n.exports.meshopt_spatialSortRemap,g,g.length/m,m*4)},encodeVertexBuffer:function(g,m,b){r(b>0&&b<=256),r(b%4==0);var T=n.exports.meshopt_encodeVertexBufferBound(m,b);return u(n.exports.meshopt_encodeVertexBuffer,T,g,m,b)},encodeIndexBuffer:function(g,m,b){r(b==2||b==4),r(m%3==0);var T=f(g,b),x=n.exports.meshopt_encodeIndexBufferBound(m,h(T)+1);return u(n.exports.meshopt_encodeIndexBuffer,x,T,m,4)},encodeIndexSequence:function(g,m,b){r(b==2||b==4);var T=f(g,b),x=n.exports.meshopt_encodeIndexSequenceBound(m,h(T)+1);return u(n.exports.meshopt_encodeIndexSequence,x,T,m,4)},encodeGltfBuffer:function(g,m,b,T){var x={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(x[T]),x[T](g,m,b)},encodeFilterOct:function(g,m,b,T){return r(b==4||b==8),r(T>=1&&T<=16),_(n.exports.meshopt_encodeFilterOct,g,m,b,T,16)},encodeFilterQuat:function(g,m,b,T){return r(b==8),r(T>=4&&T<=16),_(n.exports.meshopt_encodeFilterQuat,g,m,b,T,16)},encodeFilterExp:function(g,m,b,T,x){r(b>0&&b%4==0),r(T>=1&&T<=24);var C={Separate:0,SharedVector:1,SharedComponent:2};return _(n.exports.meshopt_encodeFilterExp,g,m,b,T,b,x?C[x]:1)}}})();var _ue=function(){var e="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;d8Yqdbk:yzeHu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlcbhOinalgic9WfgAawcj;cbffhldndndndndnaHaAco4fRbbaOcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgAco4gCaCciSgCE86bbawcj;cbfaifglcGfaoclfaCfgCRbbaAcl4ciGgXaXciSgXE86bbalcVfaCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc7faCaXfgCRbbaAciGgAaAciSgAE86bbalctfaCaAfgCRbbaoRbegAco4gXaXciSgXE86bbalc91faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc4faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc93faCaXfgCRbbaAciGgAaAciSgAE86bbalc94faCaAfgCRbbaoRbdgAco4gXaXciSgXE86bbalc95faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc96faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc97faCaXfgCRbbaAciGgAaAciSgAE86bbalc98faCaAfgARbbaoRbigoco4gCaCciSgCE86bbalc99faAaCfgARbbaocl4ciGgCaCciSgCE86bbalc9:faAaCfgARbbaocd4ciGgCaCciSgCE86bbalcufaAaCfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgAcl4gCaCcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgCRbbaAcsGgAaAcsSgAE86bbalcVfaCaAfgARbbaoRbegCcl4gXaXcsSgXE86bbalc7faAaXfgARbbaCcsGgCaCcsSgCE86bbalctfaAaCfgARbbaoRbdgCcl4gXaXcsSgXE86bbalc91faAaXfgARbbaCcsGgCaCcsSgCE86bbalc4faAaCfgARbbaoRbigCcl4gXaXcsSgXE86bbalc93faAaXfgARbbaCcsGgCaCcsSgCE86bbalc94faAaCfgARbbaoRblgCcl4gXaXcsSgXE86bbalc95faAaXfgARbbaCcsGgCaCcsSgCE86bbalc96faAaCfgARbbaoRbvgCcl4gXaXcsSgXE86bbalc97faAaXfgARbbaCcsGgCaCcsSgCE86bbalc98faAaCfgARbbaoRbogCcl4gXaXcsSgXE86bbalc99faAaXfgARbbaCcsGgCaCcsSgCE86bbalc9:faAaCfgARbbaoRbrgocl4gCaCcsSgCE86bbalcufaAaCfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaOcdfhOaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhXdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkaCcefhCamcefgmad6hsamad9hmbkaXhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaXhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabaiavcdfciGfcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabaiavcufciGfcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabaiavciGfcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;b9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;e8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincbhHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAcd0hHalhOaAcefgAclSmdxekkcbhlaHceGTmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",n=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]),i=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(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(n)?t:e,r,s=WebAssembly.instantiate(a(o),{}).then(function(x){r=x.instance,r.exports.__wasm_call_ctors()});function a(x){for(var C=new Uint8Array(x.length),w=0;w96?v-97:v>64?v-39:v+4}for(var P=0,w=0;w0?b(x,C,w,h[v],u[P]):s.then(function(){var N=new Uint8Array(x*C);return l(r,r.exports[h[v]],N,x,C,w,r.exports[u[P]]),N})}}}();(function(){var e="b9H79Tebbbe9Ek9Geueu9Geub9Gbb9GPuuuuuuuuuuu99uueu9Gvuuuuub9Gluuuub9Gquuuuuuu99uueu9Gwuuuuuu99ueu9Giuuue999Gluuuueu9GiuuueuizsdilvoirwDbqqbeqlve9Weiiviebeoweuec:G;jekr:Tewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bbz9TW79O9V9Wt9F79P9T9W29P9M95bl8E9TW79O9V9Wt9F79P9T9W29P9M959x9Pt9OcttV9P9I91tW7bvQ9TW79O9V9Wt9F79P9T9W29P9M959q9V9P9Ut7boX9TW79O9V9Wt9F79P9T9W29P9M959t9J9H2Wbra9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9Wbwl79IV9RbDDwebcekdxmq::9Usdbk;i6iKuY99Ou8Jjjjjbc;W;ab9RgP8KjjjjbaPcwfcbc;Kbz:ljjjb8AaPcualcefgscdtascFFFFi0Ecbyd1:jjjbHjjjjbbgzBdwaPceBd9OaPazBdbaPcuadcitadcFFFFe0Ecbyd1:jjjbHjjjjbbgHBdxaPcdBd9OaPaHBdlaPaeadalcbz:cjjjbaPcualcdtgOalcFFFFi0EgAcbyd1:jjjbHjjjjbbgCBdzaPciBd9OaPaAcbyd1:jjjbHjjjjbbgXBdCaPclBd9Oalcd4alfhQcehLinaLgscethLasaQ6mbkcbhKaPcuascdtgLascFFFFi0Ecbyd1:jjjbHjjjjbbgQBdKaPcvBd9OaQcFeaLz:ljjjbhYdnalTmbavcd4h8AascufhEinaiaKa8A2cdtfg3ydlgscH4as7c:F:b:DD2a3ydbgscH4as7c;D;O:B8J27a3ydwgscH4as7c:3F;N8N27hQcbhsdndninaYaQaEGgQcdtfg5ydbgLcuSmeaiaLa8A2cdtfa3cxz:ojjjbTmdascefgsaQfhQasaE9nmbxdkka5aKBdbaKhLkaCaKcdtfaLBdbaKcefgKal9hmbkcbhsaXhLinaLasBdbaLclfhLalascefgs9hmbkcbhsaChLaXhQindnasaLydbgESmbaQaXaEcdtfgEydbBdbaEasBdbkaLclfhLaQclfhQalascefgs9hmbkkcbh8EaYcbyd:m:jjjbH:bjjjbbaPclBd9OaPalcbyd1:jjjbHjjjjbbgEBdKaPcvBd9OaPaAcbyd1:jjjbHjjjjbbgsBd3aPcoBd9OaPaAcbyd1:jjjbHjjjjbbgLBdaaPcrBd9OascFeaOz:ljjjbh8FaLcFeaOz:ljjjbhadnalTmbaHcwfhhindnaza8EgQcefg8Ecdtfydbg3azaQcdtgsfydbgLSmba3aL9RhOaHaLcitfhgaaasfh8Ja8FasfhKcbh8Aindndnaga8Acitfydbg5aQ9hmbaKaQBdba8JaQBdbxekdnaza5cdtg8KfgsclfydbgLasydbgsSmbaHascitg3fydbaQSmeaLas9Rh8Lascu7aLfhYaha3fhLcbhsinaYasSmeascefhsaLydbh3aLcwfhLa3aQ9hmbkasa8L6mekaaa8KfgsaQa5asydbcuSEBdbaKa5aQaKydbcuSEBdbka8Acefg8AaO9hmbkka8Eal9hmbkaChLaXhQaah3a8Fh8AcbhsindndnasaLydbg59hmbdnasaQydbg59hmba8Aydbh5dna3ydbgYcu9hmba5cu9hmbaEasfcb86bbxikaEasfhKdnasaYSmbasa5SmbaKce86bbxikaKcl86bbxdkdnasaXa5cdtgYfydb9hmbdna3ydbgKcuSmbasaKSmba8AydbgOcuSmbasaOSmbaaaYfydbggcuSmbaga5Smba8FaYfydbgYcuSmbaYa5SmbdnaCaKcdtfydbaCaYcdtfydb9hmbaCaOcdtfydbaCagcdtfydb9hmbaEasfcd86bbxlkaEasfcl86bbxikaEasfcl86bbxdkaEasfcl86bbxekaEasfaEa5fRbb86bbkaLclfhLaQclfhQa3clfh3a8Aclfh8Aalascefgs9hmbkaxceGTmbaEhsalhLindnasRbbce9hmbascl86bbkascefhsaLcufgLmbkkcualcx2alc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8JaPcwfaPyd9Ogscdtfa8JBdbaPascefgOBd9Oa8Jaialavz:djjjbdndnaDmbcbhvxekcbh5aPcwfaOcdtfcuaDal2gLcdtaLcFFFFi0Ecbyd1:jjjbHjjjjbbgvBdbaPascdfgOBd9OalTmbarcd4cdthYaDcdthKavh8AinaohsawhLa8AhQaDh3inaQasIdbaLIdbNUdbasclfhsaLclfhLaQclfhQa3cufg3mbkaoaYfhoa8AaKfh8Aa5cefg5al9hmbkkaPcwfaOcdtfcualc8S2gsalc;D;O;f8U0EgQcbyd1:jjjbHjjjjbbgLBdbaPaOcefg3Bd9OaLcbasz:ljjjbh8EdndndnaDTmbaPcwfa3cdtfaQcbyd1:jjjbHjjjjbbgoBdbaPaOcdfgLBd9Oaocbasz:ljjjb8AaPcwfaLcdtfcuaDal2gscltgLascFFFFb0Ecbyd1:jjjbHjjjjbbgwBdbaPaOcifBd9OawcbaLz:ljjjb8AadmexdkcbhocbhwadTmekcbh8AaehLindna8JaLclfydbg5cx2fgsIdba8JaLydbgYcx2fgQIdbg8M:tg8Na8JaLcwfydbgKcx2fg3IdlaQIdlgy:tg8PNa3Idba8M:tgIasIdlay:tg8RN:tg8Sa8SNa8Ra3IdwaQIdwgR:tg8UNa8PasIdwaR:tg8RN:tg8Pa8PNa8RaINa8Ua8NN:tg8Na8NNMM:rgIJbbbb9ETmba8SaI:vh8Sa8NaI:vh8Na8PaI:vh8Pka8EaCaYcdtfydbc8S2fgsa8PaI:rgIa8PNNg8RasIdbMUdbasa8NaIa8NNg8VNg8UasIdlMUdlasa8SaIa8SNg8WNg8XasIdwMUdwasa8Va8PNg8VasIdxMUdxasa8Wa8PNg8YasIdzMUdzasa8Wa8NNg8WasIdCMUdCasa8PaIa8SaRNa8Pa8MNaya8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asa8Sa8MNg8SasIdaMUdaasa8MayNg8MasId8KMUd8KasaIasIdyMUdya8EaCa5cdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdya8EaCaKcdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdyaLcxfhLa8Acifg8Aad6mbkcbh5aehYincbhLinaEaeaLc:G1jjbfydba5fcdtfydbgQfRbbhsdndnaEaYaLfydbg3fRbbg8Ac99fcFeGcpe0mbasceSmbascd9hmekdna8AcufcFeGce0mba8Fa3cdtfydbaQ9hmekdnascufcFeGce0mbaaaQcdtfydba39hmekdna8Acv2asfc:W1jjbfRbbTmbaCaQcdtfydbaCa3cdtfydb0mekJbbacJbbjZasceSEhIa8AceShOa8JaeaLc:K1jjbfydba5fcdtfydbcx2fhsdna8JaQcx2fg8AIdwa8Ja3cx2fgKIdwgy:tg8Pa8PNa8AIdbaKIdbgR:tg8Na8NNa8AIdlaKIdlg8R:tg8Sa8SNMM:rg8MJbbbb9ETmba8Pa8M:vh8Pa8Sa8M:vh8Sa8Na8M:vh8NkJbbacaIaOEh8WdnasIdway:tgIa8PaIa8PNasIdbaR:tg8Xa8NNa8SasIdla8R:tg8VNMMg8UN:tgIaINa8Xa8Na8UN:tg8Pa8PNa8Va8Sa8UN:tg8Na8NNMM:rg8SJbbbb9ETmbaIa8S:vhIa8Na8S:vh8Na8Pa8S:vh8Pka8EaCa3cdtfydbc8S2fgsa8Pa8Wa8MNg8Sa8PNNg8UasIdbMUdbasa8Na8Sa8NNg8WNg8XasIdlMUdlasaIa8SaINg8MNg8VasIdwMUdwasa8Wa8PNg8WasIdxMUdxasa8Ma8PNg8YasIdzMUdzasa8Ma8NNg8ZasIdCMUdCasa8Pa8SaIayNa8PaRNa8Ra8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asaIa8MNgIasIdaMUdaasa8MayNg8MasId8KMUd8Kasa8SasIdyMUdya8EaCaQcdtfydbc8S2fgsa8UasIdbMUdbasa8XasIdlMUdlasa8VasIdwMUdwasa8WasIdxMUdxasa8YasIdzMUdzasa8ZasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asaIasIdaMUdaasa8MasId8KMUd8Kasa8SasIdyMUdykaLclfgLcx9hmbkaYcxfhYa5cifg5ad6mbkaDTmbcbhYinJbbbbhRa8JaeaYcdtfgsclfydbgKcx2fgLIdwa8JasydbgOcx2fgQIdwg8V:tg8Na8NNaLIdbaQIdbg8Y:tgIaINaLIdlaQIdlg8Z:tg8Sa8SNMMg8Wa8Jascwfydbggcx2fgsIdwa8V:tg8MNa8Na8Na8MNaIasIdba8Y:tgyNa8SasIdla8Z:tg8RNMMg8PN:tJbbbbJbbjZa8Wa8Ma8MNayayNa8Ra8RNMMg8XNa8Pa8PN:tg8U:va8UJbbbb9BEg8UNh80a8Xa8NNa8Ma8PN:ta8UNh81a8Wa8RNa8Sa8PN:ta8UNhBa8Xa8SNa8Ra8PN:ta8UNh83a8WayNaIa8PN:ta8UNhUa8XaINaya8PN:ta8UNh85aIa8RNaya8SN:tg8Pa8PNa8Sa8MNa8Ra8NN:tg8Pa8PNa8NayNa8MaIN:tg8Pa8PNMM:r:rh8PavaOaD2cdtfhLavagaD2cdtfhQavaKaD2cdtfh3a8V:mh86a8Z:mh87a8Y:mh88cbh8AaDh5Jbbbbh8RJbbbbh8UJbbbbh8WJbbbbh8XJbbbbh8VJbbbbh8YJbbbbh8ZJbbbbh89Jbbbbh8:inaPc;Wbfa8Afgscwfa8Pa81a3IdbaLIdbg8M:tg8SNa80aQIdba8M:tgyNMg8NNUdbasclfa8Pa83a8SNaBayNMgINUdbasa8Pa85a8SNaUayNMg8SNUdbascxfa8Pa86a8NNa87aINa8Ma88a8SNMMMg8MNUdba8Pa8NaINNa8XMh8Xa8Pa8Na8SNNa8VMh8Va8PaIa8SNNa8YMh8Ya8Pa8Ma8MNNaRMhRa8Pa8Na8MNNa8RMh8Ra8PaIa8MNNa8UMh8Ua8Pa8Sa8MNNa8WMh8Wa8Pa8Na8NNNa8ZMh8Za8PaIaINNa89Mh89a8Pa8Sa8SNNa8:Mh8:aLclfhLa3clfh3aQclfhQa8Aczfh8Aa5cufg5mbkaoaCaOcdtfydbgLc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCaKcdtfydbgKc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCagcdtfydbgOc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyawaLaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaKaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaOaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkaYcifgYad6mbkkdnabaeSmbabaeadcdtz:kjjjb8AkaPydbhZcbhsdnalTmbaZclfhsaZydbh3aEhLalh8AcbhQincbasydbg5a39RaLRbbcpeGEaQfhQaLcefhLasclfhsa5h3a8Acufg8AmbkaQce4hskcuadas9Rcifgrcx2arc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8LaPcwfaPyd9Ogscdtfa8LBdbaPascefgLBd9OaPcwfaLcdtfcuarcdtarcFFFFi0Ecbyd1:jjjbHjjjjbbgxBdbaPascdfgLBd9OaPcwfaLcdtfaAcbyd1:jjjbHjjjjbbgHBdbaPascifgLBd9OaPcwfaLcdtfalcbyd1:jjjbHjjjjbbgnBdbaPasclfBd9OJbbbbh8Ydnadaq9nmbdnarci6mbakakNh8VaDclthca8Lcwfh9cJbbbbh8YinaPabadghalaCz:cjjjbabhOcbhzcbhKincbhsindnaCaOasfydbgQcdtgYfydbg8AaCabasc;m1jjbfydbaKfcdtfydbgLcdtfydbg5SmbaEaLfRbbgecv2aEaQfRbbg3fc;G1jjbfRbbg8Ka3cv2aefggc;G1jjbfRbbgiVcFeGTmbdnagc:W1jjbfRbbTmba5a8A0mekdna3ae9hmba3cufcFeGce0mba8FaYfydbaL9hmeka8Lazcx2fg3aLaQaicFeGg8AEBdla3aQaLa8AEBdba3a8Aa8KGcb9hBdwazcefhzkasclfgscx9hmbkdnaKcifgKah9pmbaOcxfhOazcifar9nmekkdnazmbahhdxikcbheinJbbbbJbbjZa8EaCa8Laecx2fg3ydlg8Aa3ydbg5a3ydwgLEgKcdtfydbg8Kc8S2gifgsIdyg8P:va8PJbbbb9BEasIdwa8Ja5a8AaLEgYcx2fgLIdwg8SNasIdzaLIdbg8MNasIdaMg8Pa8PMMa8SNasIdlaLIdlgyNasIdCa8SNasId3Mg8Pa8PMMayNasIdba8MNasIdxayNasIdKMg8Pa8PMMa8MNasId8KMMM:lNh8WJbbbbJbbjZa8EaCa5cdtfydbgdc8S2gQfgsIdyg8P:va8PJbbbb9BEasIdwa8Ja8Acx2fgLIdwgINasIdzaLIdbgRNasIdaMg8Pa8PMMaINasIdlaLIdlg8RNasIdCaINasId3Mg8Pa8PMMa8RNasIdbaRNasIdxa8RNasIdKMg8Pa8PMMaRNasId8KMMM:lNh8Xa3cwfhOa3clfhgdnaDTmbaoaQfgQIdwaINaQIdzaRNaQIdaMg8Pa8PMMaINaQIdla8RNaQIdCaINaQId3Mg8Pa8PMMa8RNaQIdbaRNaQIdxa8RNaQIdKMg8Pa8PMMaRNaQId8KMMMh8Nava8AaD2cdtfhLawadaD2cltfhsaQIdyh8UaDhQinaLIdbg8PJbbb;aNascxfIdbaIascwfIdbNaRasIdbNa8RasclfIdbNMMMNa8Pa8PNa8UNa8NMMh8NaLclfhLasczfhsaQcufgQmbkaoaifgQIdwa8SNaQIdza8MNaQIdaMg8Pa8PMMa8SNaQIdlayNaQIdCa8SNaQId3Mg8Pa8PMMayNaQIdba8MNaQIdxayNaQIdKMg8Pa8PMMa8MNaQId8KMMMhIavaYaD2cdtfhLawa8KaD2cltfhsaQIdyhRaDhQinaLIdbg8PJbbb;aNascxfIdba8SascwfIdbNa8MasIdbNayasclfIdbNMMMNa8Pa8PNaRNaIMMhIaLclfhLasczfhsaQcufgQmbka8WaI:lMh8Wa8Xa8N:lMh8Xkaga8AaYa8Xa8W9FgsEBdba3a5aKasEBdbaOa8Xa8WasEUdbaecefgeaz9hmbkaPc;Wbfcbcj;abz:ljjjb8Aa9chsazhLinaPc;WbfasydbcO4c;8ZGfgQaQydbcefBdbascxfhsaLcufgLmbkcbhscbhLinaPc;WbfasfgQydbh3aQaLBdba3aLfhLasclfgscj;ab9hmbkcbhsa9chLinaPc;WbfaLydbcO4c;8ZGfgQaQydbgQcefBdbaxaQcdtfasBdbaLcxfhLazascefgs9hmbkahaq9RgQci9UhJdnalTmbcbhsaHhLinaLasBdbaLclfhLalascefgs9hmbkkcbh9eancbalz:ljjjbhTaQcO9UhSaJce4h9haPydlh9icbhicbhgdnina8Laxagcdtfydbcx2fgOIdwg8Na8V9EmeaiaJ9pmeJFFuuh8Pdna9haz9pmba8Laxa9hcdtfydbcx2fIdwJbb;aZNh8Pkdna8Na8P9ETmbaiaS0mdkdnaTaCaOydlg6cdtg9kfydbg3fg0RbbaTaCaOydbgKcdtg9mfydbg9nfg9oRbbVmbdnaZa9ncdtfgsclfydbgLasydbgsSmbaLas9Rh5a9iascitfhsa8Ja3cx2fgYcwfhdaYclfhAa8Ja9ncx2fg8Kcwfh9pa8Kclfh9qcbhLcehednindnaHasydbcdtfydbgQa3SmbaHasclfydbcdtfydbg8Aa3SmbaQa8ASmba8Ja8Acx2fg8AIdba8JaQcx2fgQIdbgI:tg8Pa9qIdbaQIdlg8S:tg8MNa8KIdbaI:tgya8AIdla8S:tg8NN:ta8PaAIdba8S:tgRNaYIdbaI:tg8Ra8NN:tNa8Na9pIdbaQIdwg8S:tg8UNa8Ma8AIdwa8S:tgIN:ta8NadIdba8S:tg8SNaRaIN:tNaIayNa8Ua8PN:taIa8RNa8Sa8PN:tNMMJbbbb9FmdkascwfhsaLcefgLa56hea5aL9hmbkkaeceGTmba9hcefh9hxeka8Ea3c8S2gQfgsa8Ea9nc8S2g8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdydnaDTmbaoaQfgsaoa8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdyaca9n2heaca32hYawhLaDh8AinaLaYfgsaLaefgQIdbasIdbMUdbasclfg5aQclfIdba5IdbMUdbascwfg5aQcwfIdba5IdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa8Acufg8AmbkkaOcwfhLdndndndnaEaKfgQRbbc9:fPdebdkaKhsinaHascdtgsfa3BdbaXasfydbgsaK9hmbxikkaXa9kfydbhsaXa9mfydbhKaHa9mfa6Bdbash6kaHaKcdtfa6Bdbka9oce86bba0ce86bbaLIdbg8Pa8Ya8Ya8P9DEh8Ya9ecefh9ececdaQRbbceSEaifhikagcefggaz9hmbkkdna9embahhdxikdnalTmbcbhLa8FhsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmba8Fa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkcbhLaahsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmbaaa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkkcbhdabhscbh8AindnaHasydbcdtfydbgLaHasclfydbcdtfydbgQSmbaLaHascwfydbcdtfydbg3SmbaQa3Smbabadcdtfg5aLBdba5clfaQBdba5cwfa3Bdbadcifhdkascxfhsa8Acifg8Aah6mbkadaq9nmdxbkkaPabadalaCz:cjjjbkdnamTmbama8Y:rUdbkaPyd9OgscdtaPcwffc98fhCdninasTmeaCydbcbyd:m:jjjbH:bjjjbbaCc98fhCascufhsxbkkaPc;W;abf8Kjjjjbadk;:ieouabydlhvabydbclfcbaicdtz:ljjjbhoadci9UhrdnadTmbdnalTmbaehwadhDinaoalawydbcdtfydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbxdkkaehwadhDinaoawydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbkkdnaiTmbcbhDaohwinawydbhqawaDBdbawclfhwaqaDfhDaicufgimbkkdnadci6mbarcearce0EhdinaecwfydbhwaeclfydbhDaeydbhidnalTmbalawcdtfydbhwalaDcdtfydbhDalaicdtfydbhikavaoaicdtfgqydbcitfaDBdbavaqydbcitfawBdlaqaqydbcefBdbavaoaDcdtfgqydbcitfawBdbavaqydbcitfaiBdlaqaqydbcefBdbavaoawcdtfgwydbcitfaiBdbavawydbcitfaDBdlawawydbcefBdbaecxfheadcufgdmbkkabydbcbBdbk:Zldouv998Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdnadTmbaicd4hvdnabTmbavcdthocbhraehwinabarcx2fgiaearav2cdtfgDIdbUdbaiaDIdlUdlaiaDIdwUdwcbhiinalczfaifgDawaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkawaofhwarcefgrad9hmbxdkkavcdthrcbhwincbhiinalczfaifgDaeaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkaearfheawcefgwad9hmbkkdnabTmbadTmbJbbbbJbbjZalIdbalIdzgk:tJbbbb:xgqalIdlalIdCgx:tgmamaq9DEgqalIdwalIdKgm:tgPaPaq9DEgq:vaqJbbbb9BEhqinabaqabIdbak:tNUdbabclfgiaqaiIdbax:tNUdbabcwfgiaqaiIdbam:tNUdbabcxfhbadcufgdmbkkk8KbabaeadaialavcbcbcbcbaoarawaDz:bjjjbk8KbabaeadaialavaoarawaDaqakaxamz:bjjjbk;lOowud99wue99iul998Jjjjjbc;Wb9Rgw8KjjjjbdndnarmbcbhDxekawcwfcbc;Kbz:ljjjb8Aawcuadcx2adc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbgqBdwawceBd9Oaqaeadaiz:djjjbawcuadcdtadcFFFFi0Egkcbyd1:jjjbHjjjjbbgxBdxawcdBd9Oadcd4adfhmceheinaegicetheaiam6mbkcbhmawcuaicdtgPaicFFFFi0Ecbyd1:jjjbHjjjjbbgsBdzawciBd9Odndnar:Zgz:rJbbbZMgH:lJbbb9p9DTmbaH:Ohexekcjjjj94hekaicufhOc:bwhAcbhCcbhXadhQinaChLaeaAgKcufaeaK9iEamgDcefaeaD9kEhYdndnadTmbaYcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbh3cbh5indnaEaxa5cdtfydbgAcm4aA7c:v;t;h;Ev2gics4ai7aOGgmcdtfgCydbgecuSmbaeaASmbcehiinaEamaifaOGgmcdtfgCydbgecuSmeaicefhiaeaA9hmbkkaCaABdba3aecuSfh3a5cefg5ad9hmbxdkkascFeaPz:ljjjb8Acbh3kaDaYa3ar0giEhmaLa3aiEhCdna3arSmbaYaKaiEgAam9Rcd9imbdndnaXcl0mbdnaQ:ZgHaL:Zg8A:taY:Yg8EaD:Y:tg8Fa8EaK:Y:tgaa3:Zghaz:tNNNaHaz:taaNa8Aah:tNa8Aaz:ta8FNahaH:tNM:va8EMJbbbZMgH:lJbbb9p9DTmbaH:Ohexdkcjjjj94hexekamaAfcd9Theka3aQaiEhQaXcefgXcs9hmekkdndnaCmbcihicbhDxekcbhiawakcbyd1:jjjbHjjjjbbg5BdCawclBd9OdndnadTmbamcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbhDcbh3inaxa3cdtgYfydbgAcm4aA7c:v;t;h;Ev2gics4ai7hecbhidndninaEaeaOGgmcdtfgCydbgecuSmednaxaecdtgCfydbaASmbaicefgiamfheaiaO9nmekka5aCfydbhixekaCa3BdbaDhiaDcefhDka5aYfaiBdba3cefg3ad9hmbkcuaDc32giaDc;j:KM;jb0EhexekascFeaPz:ljjjb8AcbhDcbhekawaecbyd1:jjjbHjjjjbbgeBdKawcvBd9Oaecbaiz:ljjjbhOavcd4hxdnadTmbaxcdth3a5hmalhAaqheadhEinaOamydbc32fgiaeIdbaiIdbMUdbaiaeclfIdbaiIdlMUdlaiaecwfIdbaiIdwMUdwaiaAc;81jjbalEgCIdbaiIdxMUdxaiaCIdlaiIdzMUdzaiaCIdwaiIdCMUdCaiaiIdKJbbjZMUdKamclfhmaAa3fhAaecxfheaEcufgEmbkkdnaDTmbaOcxfhiaDheinaictfgmamIdbJbbbbJbbjZaicxfIdbgH:vaHJbbbb9BEgHNUdbaic94fgmaHamIdbNUdbaic98fgmaHamIdbNUdbaiaHaiIdbNUdbaiclfgmaHamIdbNUdbaicwfgmaHamIdbNUdbaic3fhiaecufgembkkcbhAawcuaDcdtgYaDcFFFFi0Egicbyd1:jjjbHjjjjbbgeBd3awcoBd9Oawaicbyd1:jjjbHjjjjbbgEBdaaecFeaYz:ljjjbh3dnadTmbaoaoNh8Aaxcdthxalheina8Aaec;81jjbalEgmIdwaOa5ydbgCc32fgiIdC:tgHaHNamIdbaiIdx:tgHaHNamIdlaiIdz:tgHaHNMMNaqcwfIdbaiIdw:tgHaHNaqIdbaiIdb:tgHaHNaqclfIdbaiIdl:tgHaHNMMMhHdndna3aCcdtgifgmydbcuSmbaEaifIdbaH9ETmekamaABdbaEaifaHUdbka5clfh5aeaxfheaqcxfhqadaAcefgA9hmbkkaba3aYz:kjjjb8AcrhikaicdthiinaiTmeaic98fgiawcwffydbcbyd:m:jjjbH:bjjjbbxbkkawc;Wbf8KjjjjbaDk:Qdidui99ducbhi8Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdndnaembJbbjFhvJbbjFhoJbbjFhrxekadcd4cdthwincbhdinalczfadfgDabadfIdbgoaDIdbgrarao9EEUdbaladfgDaoaDIdbgrarao9DEUdbadclfgdcx9hmbkabawfhbaicefgiae9hmbkalIdwalIdK:thralIdlalIdC:thoalIdbalIdz:thvkavJbbbb:xgvaoaoav9DEgoararao9DEk9DeeuabcFeaicdtz:ljjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcifc98GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcrfc94GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:q:jjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:q:jjjbfgdBd:q:jjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk6eiucbhidnadTmbdninabRbbglaeRbbgv9hmeaecefheabcefhbadcufgdmbxdkkalav9Rhikaikk:Iedbcjwk1eFFuuFFuuFFuuFFuFFFuFFFuFbbbbbbbbebbbdbbbbbbbebbbeeebeebebbeeebebbbbbebebbbbbebbbdbbbbbbbbbbbbbbbeeeeebebbbbbebbbbbeebbbbbbbbbbbbbbbbbbbbbc1Dkxebbbdbbb:G9Kbb",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(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var b=new Uint8Array(m.length),T=0;T96?x-97:x>64?x-39:x+4}for(var C=0,T=0;T=3),r(x>=0&&x<=m.length),r(x%3==0),r(C>=0&&C<=1);for(var v=0,P=0;P<(w?w.length:0);++P)v|=g[w[P]];var N=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),k=u(n.exports.meshopt_simplify,N,m.length,b,b.length/T,T*4,x,C,v);return k[0]=m instanceof Uint32Array?k[0]:new m.constructor(k[0]),k},simplifyWithAttributes:function(m,b,T,x,C,w,v,P,N){r(this.useExperimentalFeatures),r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(b instanceof Float32Array),r(b.length%T==0),r(T>=3),r(x instanceof Float32Array),r(x.length%C==0),r(C>=0),r(v>=0&&v<=m.length),r(v%3==0),r(P>=0&&P<=1),r(Array.isArray(w)),r(C>=w.length),r(w.length<=16);for(var k=0,M=0;M<(N?N.length:0);++M)k|=g[N[M]];var U=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),B=h(n.exports.meshopt_simplifyWithAttributes,U,m.length,b,b.length/T,T*4,x,C*4,new Float32Array(w),v,P,k);return B[0]=m instanceof Uint32Array?B[0]:new m.constructor(B[0]),B},getScale:function(m,b){return r(m instanceof Float32Array),r(m.length%b==0),r(b>=3),f(n.exports.meshopt_simplifyScale,m,m.length/b,b*4)},simplifyPoints:function(m,b,T,x,C,w){return r(this.useExperimentalFeatures),r(m instanceof Float32Array),r(m.length%b==0),r(b>=3),r(T>=0&&T<=m.length/b),x?(r(x instanceof Float32Array),r(x.length%C==0),r(C>=3),r(m.length/b==x.length/C),_(n.exports.meshopt_simplifyPoints,m,m.length/b,b*4,x,C*4,w,T)):_(n.exports.meshopt_simplifyPoints,m,m.length/b,b*4,void 0,0,0,T)}}})();function yh(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.bufferViewId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let l=a.buffer,u=a.byteOffset,h=a.byteLength,f=!1,_,g,m,b;if(To(a,"EXT_meshopt_compression")){const x=a.extensions.EXT_meshopt_compression;l=x.buffer,u=y(x.byteOffset,0),h=x.byteLength,f=!0,_=x.byteStride,g=x.count,m=x.mode,b=y(x.filter,"NONE")}const T=n.buffers[l];this._hasMeshopt=f,this._meshoptByteStride=_,this._meshoptCount=g,this._meshoptMode=m,this._meshoptFilter=b,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=T,this._bufferId=l,this._byteOffset=u,this._byteLength=h,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(yh.prototype=Object.create(wo.prototype),yh.prototype.constructor=yh);Object.defineProperties(yh.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});async function gue(e){try{const t=yue(e);if(e._bufferLoader=t,await t.load(),e.isDestroyed())return;const n=t.typedArray,i=new Uint8Array(n.buffer,n.byteOffset+e._byteOffset,e._byteLength);if(e.unload(),e._typedArray=i,e._hasMeshopt){const o=e._meshoptCount,r=e._meshoptByteStride,s=new Uint8Array(o*r);_ue.decodeGltfBuffer(s,o,r,e._typedArray,e._meshoptMode,e._meshoptFilter),e._typedArray=s}return e._state=ut.READY,e}catch(t){if(e.isDestroyed())return;e.unload(),e._state=ut.FAILED;const n="Failed to load buffer view";throw e.getError(n,t)}}yh.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=gue(this),this._promise)};function yue(e){const t=e._resourceCache,n=e._buffer;if(c(n.uri)){const o=e._baseResource.getDerivedResource({url:n.uri});return t.getExternalBufferLoader({resource:o})}return t.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:e._bufferId})}yh.prototype.unload=function(){c(this._bufferLoader)&&!this._bufferLoader.isDestroyed()&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};function Fi(){}Fi._maxDecodingConcurrency=Math.max(Yt.hardwareConcurrency-1,1);Fi._decoderTaskProcessor=void 0;Fi._taskProcessorReady=!1;Fi._error=void 0;Fi._getDecoderTaskProcessor=function(){if(!c(Fi._decoderTaskProcessor)){const e=new Kn("decodeDraco",Fi._maxDecodingConcurrency);e.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(t){t?Fi._taskProcessorReady=!0:Fi._error=new Te("Draco decoder could not be initialized.")}).catch(t=>{Fi._error=t}),Fi._decoderTaskProcessor=e}return Fi._decoderTaskProcessor};Fi.decodePointCloud=function(e){const t=Fi._getDecoderTaskProcessor();if(c(Fi._error))throw Fi._error;if(!!Fi._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};Fi.decodeBufferView=function(e){const t=Fi._getDecoderTaskProcessor();if(c(Fi._error))throw Fi._error;if(!!Fi._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};function Zu(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.object("options.draco",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._draco=i,this._cacheKey=s,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=ut.UNLOADED,this._promise=void 0,this._dracoError=void 0}c(Object.create)&&(Zu.prototype=Object.create(wo.prototype),Zu.prototype.constructor=Zu);Object.defineProperties(Zu.prototype,{cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});async function bue(e){const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._draco.bufferView,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,await n.load(),e.isDestroyed()?void 0:(e._bufferViewTypedArray=n.typedArray,e._state=ut.PROCESSING,e)}catch(n){if(e.isDestroyed())return;f4(e,n)}}Zu.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=bue(this),this._promise)};function f4(e,t){e.unload(),e._state=ut.FAILED;const n="Failed to load Draco";throw e.getError(n,t)}async function Tue(e,t){try{const n=await t;return e.isDestroyed()?void 0:(e.unload(),e._decodedData={indices:n.indexArray,vertexAttributes:n.attributeData},e._state=ut.READY,e._baseResource)}catch(n){if(e.isDestroyed())return;e._dracoError=n}}Zu.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.PROCESSING||(c(this._dracoError)&&f4(this,this._dracoError),!c(this._bufferViewTypedArray))||c(this._decodePromise))return!1;const t=this._draco,i=this._gltf.bufferViews,o=t.bufferView,r=i[o],s=t.attributes,a={array:new Uint8Array(this._bufferViewTypedArray),bufferView:r,compressedAttributes:s,dequantizeInShader:!0},l=Fi.decodeBufferView(a);if(!c(l))return!1;this._decodePromise=Tue(this,l)};Zu.prototype.unload=function(){c(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0};function Aue(e){const t=e.uint8Array,n=e.format,i=e.request,o=y(e.flipY,!1),r=y(e.skipColorSpaceConversion,!1);A.typeOf.object("uint8Array",t),A.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return Ae.supportsImageBitmapOptions().then(function(l){return l?Promise.resolve(Ae.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new Ae({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(l){return c(a)&&window.URL.revokeObjectURL(a),l}).catch(function(l){return c(a)&&window.URL.revokeObjectURL(a),Promise.reject(l)})}function Zl(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.imageId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r);const a=n.images[i],l=a.bufferView,u=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=l,this._uri=u,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Zl.prototype=Object.create(wo.prototype),Zl.prototype.constructor=Zl);Object.defineProperties(Zl.prototype,{cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}});Zl.prototype.load=function(){return c(this._promise)?this._promise:c(this._bufferViewId)?(this._promise=xue(this),this._promise):(this._promise=Cue(this),this._promise)};function p4(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map(function(n){return n.bufferView}),e=e[0]),{image:e,mipLevels:t}}async function xue(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;const i=n.typedArray,o=await wue(i);if(e.isDestroyed())return;const r=p4(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=ut.READY,e}catch(n){return e.isDestroyed()?void 0:m4(e,n,"Failed to load embedded image")}}async function Cue(e){e._state=ut.LOADING;const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});try{const o=await vue(i);if(e.isDestroyed())return;const r=p4(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=ut.READY,e}catch(o){return e.isDestroyed()?void 0:m4(e,o,`Failed to load image: ${n}`)}}function m4(e,t,n){return e.unload(),e._state=ut.FAILED,Promise.reject(e.getError(n,t))}function Eue(e){const t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===137&&t[1]===80)return"image/png";if(t[0]===171&&t[1]===75)return"image/ktx2";if(n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&i[0]===87&&i[1]===69&&i[2]===66&&i[3]===80)return"image/webp";throw new Te("Image format is not recognized")}async function wue(e){const t=Eue(e);if(t==="image/ktx2"){const n=new Uint8Array(e);return Op(n)}return Zl._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}const Sue=/(^data:image\/ktx2)|(\.ktx2$)/i;function vue(e){const t=e.getUrlComponent(!1,!0);return Sue.test(t)?Op(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}Zl.prototype.unload=function(){c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&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};Zl._loadImageFromTypedArray=Aue;const Iue={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},nl=Object.freeze(Iue);function Ju(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,l=y(e.asynchronous,!0),u=y(e.loadBuffer,!1),h=y(e.loadTypedArray,!1);if(A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.accessorId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),!u&&!h)throw new E("At least one of loadBuffer and loadTypedArray must be true.");const f=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=f,this._draco=s,this._cacheKey=a,this._asynchronous=l,this._loadBuffer=u,this._loadTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Ju.prototype=Object.create(wo.prototype),Ju.prototype.constructor=Ju);Object.defineProperties(Ju.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}});const Due=new dO;Ju.prototype.load=async function(){return c(this._promise)?this._promise:c(this._draco)?(this._promise=Pue(this),this._promise):(this._promise=Oue(this),this._promise)};async function Pue(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getDracoLoader({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,await n.load(),e.isDestroyed()?void 0:(e._state=ut.LOADED,e)}catch(n){if(e.isDestroyed())return;uO(e,n)}}async function Oue(e){const t=e._gltf,n=e._accessorId,o=t.accessors[n].bufferView;e._state=ut.LOADING;const r=e._resourceCache;try{const s=r.getBufferViewLoader({gltf:t,bufferViewId:o,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=s,await s.load(),e.isDestroyed())return;const a=s.typedArray;return e._typedArray=Lue(e,a),e._state=ut.PROCESSING,e}catch(s){if(e.isDestroyed())return;uO(e,s)}}function Lue(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=je.getSizeInBytes(s);let l=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){const f=r*a,_=new Uint8Array(l,u,f);l=new Uint8Array(_).buffer,u=0,Xh("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let h;return s===je.UNSIGNED_BYTE?h=new Uint8Array(l,u,r):s===je.UNSIGNED_SHORT?h=new Uint16Array(l,u,r):s===je.UNSIGNED_INT&&(h=new Uint32Array(l,u,r)),h}function uO(e,t){e.unload(),e._state=ut.FAILED;const n="Failed to load index buffer";throw e.getError(n,t)}function dO(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}dO.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};dO.prototype.execute=function(){this.buffer=_4(this.typedArray,this.indexDatatype,this.context)};function _4(e,t,n){const i=ct.createIndexBuffer({typedArray:e,context:n,usage:ke.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}Ju.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.LOADED&&this._state!==ut.PROCESSING)return!1;let t=this._typedArray,n=this._indexDatatype;if(c(this._dracoLoader))try{this._dracoLoader.process(e)&&(t=this._dracoLoader.decodedData.indices.typedArray,this._typedArray=t,n=Z.fromTypedArray(t),this._indexDatatype=n)}catch(o){uO(this,o)}if(!c(t))return!1;let i;if(this._loadBuffer&&this._asynchronous){const o=Due;if(o.set(t,n,e.context),!e.jobScheduler.execute(o,nl.BUFFER))return!1;i=o.buffer}else this._loadBuffer&&(i=_4(t,n,e.context));return this.unload(),this._buffer=i,this._typedArray=this._loadTypedArray?t:void 0,this._state=ut.READY,this._resourceCache.statistics.addGeometryLoader(this),!0};Ju.prototype.unload=function(){c(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),c(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};function ul(e,t,n){if(n=y(n,!1),n){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function cr(e,t){return c(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function me(){}me.objectLegacy=function(e,t){if(c(e)){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(c(o))return o}}};me.object=function(e,t){if(c(e)){const n=e.length;for(let i=0;i0)return i.byteStride}return Z.getSizeInBytes(t.componentType)*U0(t.type)}function Rue(e){me.accessor(e,function(n){c(n.bufferView)&&(n.byteOffset=y(n.byteOffset,0))}),me.bufferView(e,function(n){c(n.buffer)&&(n.byteOffset=y(n.byteOffset,0))}),me.mesh(e,function(n){me.meshPrimitive(n,function(i){if(i.mode=y(i.mode,J.TRIANGLES),!c(i.material)){c(e.materials)||(e.materials=[]);const o={name:"default"};i.material=ul(e.materials,o)}})}),me.accessorContainingVertexAttributeData(e,function(n){const i=e.accessors[n],o=i.bufferView;if(i.normalized=y(i.normalized,!1),c(o)){const r=e.bufferViews[o];r.byteStride=W_(e,i),r.target=J.ARRAY_BUFFER}}),me.accessorContainingIndexData(e,function(n){const o=e.accessors[n].bufferView;if(c(o)){const r=e.bufferViews[o];r.target=J.ELEMENT_ARRAY_BUFFER}}),me.material(e,function(n){const i=y(n.extensions,y.EMPTY_OBJECT),o=i.KHR_materials_common;if(c(o)){const l=o.technique,u=c(o.values)?o.values:{};o.values=u,u.ambient=c(u.ambient)?u.ambient:[0,0,0,1],u.emission=c(u.emission)?u.emission:[0,0,0,1],u.transparency=y(u.transparency,1),l!=="CONSTANT"&&(u.diffuse=c(u.diffuse)?u.diffuse:[0,0,0,1],l!=="LAMBERT"&&(u.specular=c(u.specular)?u.specular:[0,0,0,1],u.shininess=y(u.shininess,0))),o.transparent=y(o.transparent,!1),o.doubleSided=y(o.doubleSided,!1);return}n.emissiveFactor=y(n.emissiveFactor,[0,0,0]),n.alphaMode=y(n.alphaMode,"OPAQUE"),n.doubleSided=y(n.doubleSided,!1),n.alphaMode==="MASK"&&(n.alphaCutoff=y(n.alphaCutoff,.5));const r=i.KHR_techniques_webgl;c(r)&&me.materialValue(n,function(l){c(l.index)&&yf(l)}),yf(n.emissiveTexture),yf(n.normalTexture),yf(n.occlusionTexture);const s=n.pbrMetallicRoughness;c(s)&&(s.baseColorFactor=y(s.baseColorFactor,[1,1,1,1]),s.metallicFactor=y(s.metallicFactor,1),s.roughnessFactor=y(s.roughnessFactor,1),yf(s.baseColorTexture),yf(s.metallicRoughnessTexture));const a=i.KHR_materials_pbrSpecularGlossiness;c(a)&&(a.diffuseFactor=y(a.diffuseFactor,[1,1,1,1]),a.specularFactor=y(a.specularFactor,[1,1,1]),a.glossinessFactor=y(a.glossinessFactor,1),yf(a.specularGlossinessTexture))}),me.animation(e,function(n){me.animationSampler(n,function(i){i.interpolation=y(i.interpolation,"LINEAR")})});const t=Nue(e);return me.node(e,function(n,i){c(t[i])||c(n.translation)||c(n.rotation)||c(n.scale)?(n.translation=y(n.translation,[0,0,0]),n.rotation=y(n.rotation,[0,0,0,1]),n.scale=y(n.scale,[1,1,1])):n.matrix=y(n.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),me.sampler(e,function(n){n.wrapS=y(n.wrapS,J.REPEAT),n.wrapT=y(n.wrapT,J.REPEAT)}),c(e.scenes)&&!c(e.scene)&&(e.scene=0),e}function Nue(e){const t={};return me.animation(e,function(n){me.animationChannel(n,function(i){const o=i.target,r=o.node,s=o.path;(s==="translation"||s==="rotation"||s==="scale")&&(t[r]=!0)})}),t}function yf(e){c(e)&&(e.texCoord=y(e.texCoord,0))}function hO(e){return me.shader(e,function(t){aT(t)}),me.buffer(e,function(t){aT(t)}),me.image(e,function(t){aT(t)}),aT(e),e}function aT(e){e.extras=c(e.extras)?e.extras:{},e.extras._pipeline=c(e.extras._pipeline)?e.extras._pipeline:{}}function Mue(e,t){const n=e.extensionsRequired;if(c(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}function g4(e,t){const n=e.extensionsUsed;if(c(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),Mue(e,t),n.length===0&&delete e.extensionsUsed}}const Fue=4;function Bue(e){if(xC(e)!=="glTF")throw new Te("File is not valid binary glTF");const n=y4(e,0,5),i=n[1];if(i!==1&&i!==2)throw new Te("Binary glTF version is not 1 or 2");return i===1?zue(e,n):Uue(e,n)}function y4(e,t,n){const i=new DataView(e.buffer),o=new Array(n);for(let r=0;r0){const f=y(h.binary_glTF,h.KHR_binary_glTF);c(f)&&(f.extras._pipeline.source=u,delete f.uri)}return g4(l,"KHR_binary_glTF"),l}function Uue(e,t){const n=t[2];let i=12,o,r;for(;i0){const a=s[0];a.extras._pipeline.source=r}}return o}function kue(e){return me.shader(e,function(t){cT(t)}),me.buffer(e,function(t){cT(t)}),me.image(e,function(t){cT(t)}),cT(e),e}function cT(e){!c(e.extras)||(c(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}function k0(e,t){let n=e.extensionsUsed;c(n)||(n=[],e.extensionsUsed=n),ul(n,t,!0)}function fO(e){switch(e){case Z.BYTE:return function(t,n,i,o,r){for(let s=0;s-1:!1}const Gue=[J.ZERO,J.ONE,J.SRC_COLOR,J.ONE_MINUS_SRC_COLOR,J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.DST_ALPHA,J.ONE_MINUS_DST_ALPHA,J.DST_COLOR,J.ONE_MINUS_DST_COLOR];function jue(e,t){if(!c(e))return t;for(let n=0;n<4;n++)if(Gue.indexOf(e[n])===-1)return t;return e}function Wue(e){const t={},n={},i=e.techniques;return c(i)&&(me.technique(e,function(o,r){const s=o.states;if(c(s)){const a=n[r]={};if(DM(s,J.BLEND)){a.alphaMode="BLEND";const l=s.functions;c(l)&&(c(l.blendEquationSeparate)||c(l.blendFuncSeparate))&&(t[r]={blendEquation:y(l.blendEquationSeparate,Vue),blendFactors:jue(l.blendFuncSeparate,Hue)})}DM(s,J.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(c(e.extensions)||(e.extensions={}),k0(e,"KHR_blend")),me.material(e,function(o){if(c(o.technique)){const r=n[o.technique];me.objectLegacy(r,function(a,l){o[l]=a});const s=t[o.technique];c(s)&&(c(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}function que(e,t){let n=e.extensionsRequired;c(n)||(n=[],e.extensionsRequired=n),ul(n,t,!0),k0(e,t)}function Yue(e){const t=e.techniques,n={},i={},o={};if(c(t)){const r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,me.technique(e,function(a,l){const u={name:a.name,program:void 0,attributes:{},uniforms:{}};let h;if(me.techniqueAttribute(a,function(f,_){h=a.parameters[f],u.attributes[_]={semantic:h.semantic}}),me.techniqueUniform(a,function(f,_){h=a.parameters[f],u.uniforms[_]={count:h.count,node:h.node,type:h.type,semantic:h.semantic,value:h.value},c(n[l])||(n[l]={}),n[l][f]=_}),c(o[a.program]))u.program=o[a.program];else{const f=e.programs[a.program],_={name:f.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[f.fragmentShader];_.fragmentShader=ul(r.shaders,g,!0);const m=e.shaders[f.vertexShader];_.vertexShader=ul(r.shaders,m,!0),u.program=ul(r.programs,_),o[a.program]=u.program}i[l]=ul(r.techniques,u)}),r.techniques.length>0&&(c(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,k0(e,"KHR_techniques_webgl"),que(e,"KHR_techniques_webgl"))}return me.material(e,function(r){if(c(r.technique)){const s={technique:i[r.technique]};me.objectLegacy(r.values,function(a,l){c(s.values)||(s.values={});const u=n[r.technique][l];c(u)&&(s.values[u]=a)}),c(r.extensions)||(r.extensions={}),r.extensions.KHR_techniques_webgl=s}delete r.technique,delete r.values}),delete e.techniques,delete e.programs,delete e.shaders,e}function b4(e,t){A.typeOf.object("material",e),A.defined("handler",t);const n=e.pbrMetallicRoughness;if(c(n)){if(c(n.baseColorTexture)){const o=n.baseColorTexture,r=t(o.index,o);if(c(r))return r}if(c(n.metallicRoughnessTexture)){const o=n.metallicRoughnessTexture,r=t(o.index,o);if(c(r))return r}}if(c(e.extensions)){const o=e.extensions.KHR_materials_pbrSpecularGlossiness;if(c(o)){if(c(o.diffuseTexture)){const s=o.diffuseTexture,a=t(s.index,s);if(c(a))return a}if(c(o.specularGlossinessTexture)){const s=o.specularGlossinessTexture,a=t(s.index,s);if(c(a))return a}}const r=e.extensions.KHR_materials_common;if(c(r)&&c(r.values)){const s=r.values.diffuse,a=r.values.ambient,l=r.values.emission,u=r.values.specular;if(c(s)&&c(s.index)){const h=t(s.index,s);if(c(h))return h}if(c(a)&&c(a.index)){const h=t(a.index,a);if(c(h))return h}if(c(l)&&c(l.index)){const h=t(l.index,l);if(c(h))return h}if(c(u)&&c(u.index)){const h=t(u.index,u);if(c(h))return h}}}const i=me.materialValue(e,function(o){if(c(o.index)){const r=t(o.index,o);if(c(r))return r}});if(c(i))return i;if(c(e.emissiveTexture)){const o=e.emissiveTexture,r=t(o.index,o);if(c(r))return r}if(c(e.normalTexture)){const o=e.normalTexture,r=t(o.index,o);if(c(r))return r}if(c(e.occlusionTexture)){const o=e.occlusionTexture,r=t(o.index,o);if(c(r))return r}}const PM=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function $ue(e,t){return t=y(t,PM),PM.forEach(function(n){t.indexOf(n)>-1&&Que(e,n)}),e}const Xue={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function Que(e,t){const n=Xue[t],i=e[n];if(c(i)){let o=0;const r=_u[t](e),s=i.length;for(let a=0;at&&o.attributes[l]--}),me.meshPrimitiveTarget(o,function(a){me.meshPrimitiveTargetAttribute(a,function(l,u){l>t&&a[u]--})});const r=o.indices;c(r)&&r>t&&o.indices--;const s=o.extensions;c(s)&&c(s.CESIUM_primitive_outline)&&s.CESIUM_primitive_outline.indices>t&&--s.CESIUM_primitive_outline.indices})}),me.skin(e,function(i){c(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),me.animation(e,function(i){me.animationSampler(i,function(o){c(o.input)&&o.input>t&&o.input--,c(o.output)&&o.output>t&&o.output--})})};mu.buffer=function(e,t){e.buffers.splice(t,1),me.bufferView(e,function(i){c(i.buffer)&&i.buffer>t&&i.buffer--,c(i.extensions)&&c(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};mu.bufferView=function(e,t){if(e.bufferViews.splice(t,1),me.accessor(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),me.shader(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),me.image(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),cr(e,"KHR_draco_mesh_compression")&&me.mesh(e,function(i){me.meshPrimitive(i,function(o){c(o.extensions)&&c(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),cr(e,"EXT_feature_metadata")){const o=e.extensions.EXT_feature_metadata.featureTables;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(c(a)){for(const l in a)if(a.hasOwnProperty(l)){const u=a[l];c(u.bufferView)&&u.bufferView>t&&u.bufferView--,c(u.arrayOffsetBufferView)&&u.arrayOffsetBufferView>t&&u.arrayOffsetBufferView--,c(u.stringOffsetBufferView)&&u.stringOffsetBufferView>t&&u.stringOffsetBufferView--}}}}if(cr(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTables;if(c(o)){const r=o.length;for(let s=0;st&&h.values--,c(h.arrayOffsets)&&h.arrayOffsets>t&&h.arrayOffsets--,c(h.stringOffsets)&&h.stringOffsets>t&&h.stringOffsets--}}}}};mu.image=function(e,t){e.images.splice(t,1),me.texture(e,function(i){c(i.source)&&i.source>t&&--i.source;const o=i.extensions;c(o)&&c(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:c(o)&&c(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};mu.mesh=function(e,t){e.meshes.splice(t,1),me.node(e,function(i){c(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};mu.node=function(e,t){e.nodes.splice(t,1),me.skin(e,function(i){c(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),me.animation(e,function(i){me.animationChannel(i,function(o){c(o.target)&&c(o.target.node)&&o.target.node>t&&o.target.node--})}),me.technique(e,function(i){me.techniqueUniform(i,function(o){c(o.node)&&o.node>t&&o.node--})}),me.node(e,function(i){!c(i.children)||(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),me.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};mu.material=function(e,t){e.materials.splice(t,1),me.mesh(e,function(i){me.meshPrimitive(i,function(o){c(o.material)&&o.material>t&&o.material--})})};mu.sampler=function(e,t){e.samplers.splice(t,1),me.texture(e,function(i){c(i.sampler)&&i.sampler>t&&--i.sampler})};mu.texture=function(e,t){if(e.textures.splice(t,1),me.material(e,function(i){b4(i,function(o,r){r.index>t&&--r.index})}),cr(e,"EXT_feature_metadata")){me.mesh(e,function(r){me.meshPrimitive(r,function(s){const a=s.extensions;if(c(a)&&c(a.EXT_feature_metadata)){const u=a.EXT_feature_metadata.featureIdTextures;if(c(u)){const h=u.length;for(let f=0;ft&&--g.index}}}})});const o=e.extensions.EXT_feature_metadata.featureTextures;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(c(a)){for(const l in a)if(a.hasOwnProperty(l)){const h=a[l].texture;h.index>t&&--h.index}}}}if(cr(e,"EXT_mesh_features")&&me.mesh(e,function(i){me.meshPrimitive(i,function(o){const r=o.extensions;if(c(r)&&c(r.EXT_mesh_features)){const a=r.EXT_mesh_features.featureIds;if(c(a)){const l=a.length;for(let u=0;ut&&--h.texture.index}}}})}),cr(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTextures;if(c(o)){const r=o.length;for(let s=0;st&&--h.index}}}}};function _u(){}_u.accessor=function(e){const t={};return me.mesh(e,function(n){me.meshPrimitive(n,function(i){me.meshPrimitiveAttribute(i,function(r){t[r]=!0}),me.meshPrimitiveTarget(i,function(r){me.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});const o=i.indices;c(o)&&(t[o]=!0)})}),me.skin(e,function(n){c(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),me.animation(e,function(n){me.animationSampler(n,function(i){c(i.input)&&(t[i.input]=!0),c(i.output)&&(t[i.output]=!0)})}),cr(e,"EXT_mesh_gpu_instancing")&&me.node(e,function(n){c(n.extensions)&&c(n.extensions.EXT_mesh_gpu_instancing)&&Object.keys(n.extensions.EXT_mesh_gpu_instancing.attributes).forEach(function(i){const o=n.extensions.EXT_mesh_gpu_instancing.attributes[i];t[o]=!0})}),cr(e,"CESIUM_primitive_outline")&&me.mesh(e,function(n){me.meshPrimitive(n,function(i){const o=i.extensions;if(c(o)&&c(o.CESIUM_primitive_outline)){const s=o.CESIUM_primitive_outline.indices;c(s)&&(t[s]=!0)}})}),t};_u.buffer=function(e){const t={};return me.bufferView(e,function(n){c(n.buffer)&&(t[n.buffer]=!0),c(n.extensions)&&c(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};_u.bufferView=function(e){const t={};if(me.accessor(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),me.shader(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),me.image(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),cr(e,"KHR_draco_mesh_compression")&&me.mesh(e,function(n){me.meshPrimitive(n,function(i){c(i.extensions)&&c(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),cr(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(c(s)){for(const a in s)if(s.hasOwnProperty(a)){const l=s[a];c(l.bufferView)&&(t[l.bufferView]=!0),c(l.arrayOffsetBufferView)&&(t[l.arrayOffsetBufferView]=!0),c(l.stringOffsetBufferView)&&(t[l.stringOffsetBufferView]=!0)}}}}if(cr(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTables;if(c(i)){const o=i.length;for(let r=0;r0&&(t[n.mesh]=!0)}}),t};function T4(e,t,n){const i=e.nodes[t];return c(i.mesh)||c(i.camera)||c(i.skin)||c(i.weights)||c(i.extras)||c(i.extensions)&&Object.keys(i.extensions).length!==0||c(n[t])?!1:!c(i.children)||i.children.filter(function(o){return!T4(e,o,n)}).length===0}_u.node=function(e){const t={};return me.skin(e,function(n){c(n.skeleton)&&(t[n.skeleton]=!0),me.skinJoint(n,function(i){t[i]=!0})}),me.animation(e,function(n){me.animationChannel(n,function(i){c(i.target)&&c(i.target.node)&&(t[i.target.node]=!0)})}),me.technique(e,function(n){me.techniqueUniform(n,function(i){c(i.node)&&(t[i.node]=!0)})}),me.node(e,function(n,i){T4(e,i,t)||(t[i]=!0)}),t};_u.material=function(e){const t={};return me.mesh(e,function(n){me.meshPrimitive(n,function(i){c(i.material)&&(t[i.material]=!0)})}),t};_u.texture=function(e){const t={};if(me.material(e,function(n){b4(n,function(i){t[i]=!0})}),cr(e,"EXT_feature_metadata")){me.mesh(e,function(o){me.meshPrimitive(o,function(r){const s=r.extensions;if(c(s)&&c(s.EXT_feature_metadata)){const l=s.EXT_feature_metadata.featureIdTextures;if(c(l)){const u=l.length;for(let h=0;h0)for(s.mesh=n.meshes[l[0]],t=1;t0&&c(s.skin)){const h=e.skins[s.skin];h.skeleton=n.nodes[l[0]]}delete s.skeletons}c(s.jointName)&&delete s.jointName}),me.skin(e,function(s){c(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);const a=s.jointNames;if(c(a)){const l=[],u=a.length;for(t=0;t=0&&(a=r.substring(0,s),l=r.substring(s));let u;const h=yde[a];c(h)?(u=h+l,t[r]=u):c(gde[a])||(u=`_${r}`,t[r]=u)}});for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o],s=i.attributes[o];c(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),me.technique(e,function(n){me.techniqueParameter(n,function(i){const o=t[i.semantic];c(o)&&(i.semantic=o)})})}function Tde(e){me.camera(e,function(t){const n=t.perspective;if(c(n)){const i=n.aspectRatio;c(i)&&i===0&&delete n.aspectRatio;const o=n.yfov;c(o)&&o===0&&(n.yfov=1)}})}function qI(e,t){return c(t.byteStride)&&t.byteStride!==0?t.byteStride:W_(e,t)}function Ade(e){me.buffer(e,function(t){c(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),me.accessor(e,function(t){const n=t.bufferView;if(c(n)){const i=e.bufferViews[n],o=qI(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(y(i.byteLength,0),r)}})}function xde(e){let t,n,i;const o=e.bufferViews,r={};me.accessorContainingVertexAttributeData(e,function(a){const l=e.accessors[a];c(l.bufferView)&&(r[l.bufferView]=!0)});const s={};me.accessor(e,function(a){c(a.bufferView)&&(s[a.bufferView]=y(s[a.bufferView],[]),s[a.bufferView].push(a))});for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];const l=s[a];l.sort(function(_,g){return _.byteOffset-g.byteOffset});let u=0,h=0;const f=l.length;for(t=0;t=0;--r)if(i[r]===t){i.splice(r,1);return}}}),me.node(e,function(n,i){if(c(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),x4(n)&&C4(e,i))}}),delete e.nodes[t]}function Ede(e){return me.node(e,function(t,n){x4(t)&&C4(e,n)}),e}function wde(e){me.animation(e,function(t){me.animationSampler(t,function(n){const i=e.accessors[n.input];if(!c(i.min)||!c(i.max)){const o=pO(e,i);i.min=o.min,i.max=o.max}})})}function Sde(e){me.accessor(e,function(t){if(c(t.min)||c(t.max)){const n=pO(e,t);c(t.min)&&(t.min=n.min),c(t.max)&&(t.max=n.max)}})}function vde(e){e.asset=y(e.asset,{}),e.asset.version="2.0",A4(e),ade(e),Ede(e),cde(e),lde(e),dde(e),fde(e),Ade(e),xde(e),Cde(e),wde(e),Sde(e),pde(e),mde(e),_de(e),bde(e),Jue(e),Tde(e),Wue(e),Yue(e),ude(e)}const Ide=["u_tex","u_diffuse","u_emission","u_diffuse_tex"],Dde=["u_diffuse","u_diffuse_mat"];function YI(e){e.pbrMetallicRoughness=c(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function mO(e){return c(e.index)}function _O(e){return Array.isArray(e)&&e.length===4}function E4(e){const t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){const i=e[n];i<=.04045?t[n]=e[n]*.07739938080495357:t[n]=Math.pow((i+.055)*.9478672985781991,2.4)}return t}function Pde(e,t){t=y(t,y.EMPTY_OBJECT);const n=y(t.baseColorTextureNames,Ide),i=y(t.baseColorFactorNames,Dde);me.material(e,function(o){me.materialValue(o,function(r,s){n.indexOf(s)!==-1&&mO(r)?(YI(o),o.pbrMetallicRoughness.baseColorTexture=r):i.indexOf(s)!==-1&&_O(r)&&(YI(o),o.pbrMetallicRoughness.baseColorFactor=E4(r))})}),jI(e,"KHR_techniques_webgl"),jI(e,"KHR_blend")}function qw(e,t){c(t)&&(_O(t)?e.pbrMetallicRoughness.baseColorFactor=E4(t):mO(t)&&(e.pbrMetallicRoughness.baseColorTexture=t))}function LM(e,t){c(t)&&(_O(t)?e.emissiveFactor=t.slice(0,3):mO(t)&&(e.emissiveTexture=t))}function Ode(e){me.material(e,function(t){const n=y(t.extensions,y.EMPTY_OBJECT).KHR_materials_common;if(!c(n))return;const i=y(n.values,{}),o=i.ambient,r=i.diffuse,s=i.emission,a=i.transparency,l=n.doubleSided,u=n.transparent;YI(t),n.technique==="CONSTANT"?(k0(e,"KHR_materials_unlit"),t.extensions=c(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={},qw(t,s),qw(t,o)):(qw(t,r),LM(t,o),LM(t,s)),c(l)&&(t.doubleSided=l),c(a)&&(c(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=a:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,a]),c(u)&&(t.alphaMode=u?"BLEND":"OPAQUE")}),jI(e,"KHR_materials_common")}const sn={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function Lde(e){switch(e){case sn.POSITION:return"positionMC";case sn.NORMAL:return"normalMC";case sn.TANGENT:return"tangentMC";case sn.TEXCOORD:return"texCoord";case sn.COLOR:return"color";case sn.JOINTS:return"joints";case sn.WEIGHTS:return"weights";case sn.FEATURE_ID:return"featureId";default:throw new E("semantic is not a valid value.")}}sn.hasSetIndex=function(e){switch(A.typeOf.string("semantic",e),e){case sn.POSITION:case sn.NORMAL:case sn.TANGENT:return!1;case sn.TEXCOORD:case sn.COLOR:case sn.JOINTS:case sn.WEIGHTS:case sn.FEATURE_ID:return!0;default:throw new E("semantic is not a valid value.")}};sn.fromGltfSemantic=function(e){A.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return sn.POSITION;case"NORMAL":return sn.NORMAL;case"TANGENT":return sn.TANGENT;case"TEXCOORD":return sn.TEXCOORD;case"COLOR":return sn.COLOR;case"JOINTS":return sn.JOINTS;case"WEIGHTS":return sn.WEIGHTS;case"_FEATURE_ID":return sn.FEATURE_ID}};sn.fromPntsSemantic=function(e){switch(A.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return sn.POSITION;case"RGBA":case"RGB":case"RGB565":return sn.COLOR;case"NORMAL":case"NORMAL_OCT16P":return sn.NORMAL;case"BATCH_ID":return sn.FEATURE_ID;default:throw new E("pntsSemantic is not a valid value.")}};sn.getGlslType=function(e){switch(A.typeOf.string("semantic",e),e){case sn.POSITION:case sn.NORMAL:case sn.TANGENT:return"vec3";case sn.TEXCOORD:return"vec2";case sn.COLOR:return"vec4";case sn.JOINTS:return"ivec4";case sn.WEIGHTS:return"vec4";case sn.FEATURE_ID:return"int";default:throw new E("semantic is not a valid value.")}};sn.getVariableName=function(e,t){A.typeOf.string("semantic",e);let n=Lde(e);return c(t)&&(n+=`_${t}`),n};const ht=Object.freeze(sn);function Lt(){}Lt.getError=function(e,t,n){let i=`Failed to load ${e}: ${t}`;c(n)&&c(n.message)&&(i+=` ${n.message}`);const o=new Te(i);return c(n)&&(o.stack=`Original stack: ${n.stack} Handler stack: ${o.stack}`),o};Lt.getNodeTransform=function(e){return c(e.matrix)?e.matrix:L.fromTranslationQuaternionRotationScale(c(e.translation)?e.translation:d.ZERO,c(e.rotation)?e.rotation:_e.IDENTITY,c(e.scale)?e.scale:d.ONE)};Lt.getAttributeBySemantic=function(e,t,n){const i=e.attributes,o=i.length;for(let r=0;r=this._contentAvailabilityBitstreams.length)throw new E("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)};Dr.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};Dr.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};Dr.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};Dr.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};Dr.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===jo.OCTREE&&(t=3),e>>t};Dr.fromSubtreeJson=async function(e,t,n,i,o){if(A.typeOf.object("resource",e),c(t)===c(n))throw new E("One of json and subtreeView must be defined.");A.typeOf.object("implicitTileset",i),A.typeOf.object("implicitCoordinates",o);const r=new Dr(e,i,o);let s;c(t)?s={json:t,binary:void 0}:s=xhe(n);const a=s.json;r._subtreeJson=a;let l;if(To(a,"3DTILES_metadata"))l=a.extensions["3DTILES_metadata"];else if(c(a.tileMetadata)){const C=a.tileMetadata;l=a.propertyTables[C]}const u=[];if(c(a.contentMetadata)){const C=a.contentMetadata.length;for(let w=0;w0;h=h||f;for(let _=0;_>BigInt(61)),u=l%2===0?xM.encode2D(i,o,r):xM.encode2D(i,r,o),h=ui.fromFacePositionLevel(l,BigInt(u),i);let f,_;if(c(s)){const g=(a.maximumHeight+a.minimumHeight)/2;f=n<4?a.minimumHeight:g,_=n<4?g:a.maximumHeight}else f=a.minimumHeight,_=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:ui.getTokenFromId(h._cellId),minimumHeight:f,maximumHeight:_}}}}const Whe=new d,qhe=new d,$w=new d,Yhe=new $;function U4(e,t,n,i,o){if(A.typeOf.object("rootBox",e),A.typeOf.number("level",t),A.typeOf.number("x",n),A.typeOf.number("y",i),c(o)&&A.typeOf.number("z",o),t===0)return e;const r=d.unpack(e,0,qhe),s=$.unpack(e,3,Yhe),a=Math.pow(2,-t),l=-1+(2*n+1)*a,u=-1+(2*i+1)*a;let h=0;const f=d.fromElements(a,a,1,Whe);c(o)&&(h=-1+(2*o+1)*a,f.z=a);let _=d.fromElements(l,u,h,$w);_=$.multiplyByVector(s,_,$w),_=d.add(_,r,$w);let g=$.clone(s);g=$.multiplyByScale(g,f,g);const m=new Array(12);return d.pack(_,m),$.pack(g,m,3),m}const $he=new ce;function k4(e,t,n,i,o){if(A.typeOf.object("rootRegion",e),A.typeOf.number("level",t),A.typeOf.number("x",n),A.typeOf.number("y",i),c(o)&&A.typeOf.number("z",o),t===0)return e.slice();const r=ce.unpack(e,0,$he),s=e[4],a=e[5],l=Math.pow(2,-t),u=l*r.width,h=R.negativePiToPi(r.west+n*u),f=R.negativePiToPi(h+u),_=l*r.height,g=R.negativePiToPi(r.south+i*_),m=R.negativePiToPi(g+_);let b=s,T=a;if(c(o)){const x=l*(a-s);b+=o*x,T=b+x}return[h,g,f,m,b,T]}function Xhe(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=B4(i,o,n,!1,t),s=F4(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,l={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=V4(e,i.baseResource,l,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function V4(e,t,n,i){const o=e._tile.constructor;return new o(e._tileset,t,n,i)}ys.prototype.hasProperty=function(e,t){return!1};ys.prototype.getFeature=function(e){};ys.prototype.applyDebugSettings=function(e,t){};ys.prototype.applyStyle=function(e){};ys.prototype.update=function(e,t){};ys.prototype.pick=function(e,t,n){};ys.prototype.isDestroyed=function(){return!1};ys.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),ve(this)};ys._deriveBoundingBox=U4;ys._deriveBoundingRegion=k4;ys._deriveBoundingVolumeS2=z4;const Qhe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Wf=Object.freeze(Qhe);function Lh(e,t){A.typeOf.object("normal",e),A.typeOf.number("distance",t),this._distance=t,this._normal=new H4(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(Lh.prototype,{distance:{get:function(){return this._distance},set:function(e){A.typeOf.number("value",e),c(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){A.typeOf.object("value",e),c(this.onChangeCallback)&&!d.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),d.clone(e,this._normal._cartesian3)}}});Lh.fromPlane=function(e,t){return A.typeOf.object("plane",e),c(t)?(t.normal=e.normal,t.distance=e.distance):t=new Lh(e.normal,e.distance),t};Lh.clone=function(e,t){return c(t)?(t.normal=e.normal,t.distance=e.distance,t):new Lh(e.normal,e.distance)};function H4(e,t){this._clippingPlane=t,this._cartesian3=d.clone(e)}Object.defineProperties(H4.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){A.typeOf.number("value",e),c(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){A.typeOf.number("value",e),c(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){A.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});function Li(e){e=y(e,y.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=y(e.enabled,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.edgeColor=z.clone(y(e.edgeColor,z.WHITE)),this.edgeWidth=y(e.edgeWidth,0),this.planeAdded=new Le,this.planeRemoved=new Le,this._owner=void 0;const t=y(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?G4:j4,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(c(n)){const i=n.length;for(let o=0;o0&&(r=Bt.OUTSIDE);for(let s=0;s80*n){a=u=e[0],l=h=e[1];for(var m=n;mu&&(u=f),_>h&&(h=_);g=Math.max(u-a,h-l),g=g!==0?32767/g:0}return _0(r,s,n,a,l,g,0),s}function Y4(e,t,n,i,o){var r,s;if(o===ZI(e,t,n,i)>0)for(r=t;r=t;r-=i)s=UM(r,e[r],e[r+1],s);return s&&PC(s,s.next)&&(y0(s),s=s.next),s}function hp(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(PC(n,n.next)||ro(n.prev,n,n.next)===0)){if(y0(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function _0(e,t,n,i,o,r,s){if(!!e){!s&&r&&ufe(e,i,o,r);for(var a=e,l,u;e.prev!==e.next;){if(l=e.prev,u=e.next,r?nfe(e,i,o,r):tfe(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),y0(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=ife(hp(e),t,n),_0(e,t,n,i,o,r,2)):s===2&&ofe(e,t,n,i,o,r):_0(hp(e),t,n,i,o,r,1);break}}}}function tfe(e){var t=e.prev,n=e,i=e.next;if(ro(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,l=n.y,u=i.y,h=or?o>s?o:s:r>s?r:s,g=a>l?a>u?a:u:l>u?l:u,m=i.next;m!==t;){if(m.x>=h&&m.x<=_&&m.y>=f&&m.y<=g&&$m(o,a,r,l,s,u,m.x,m.y)&&ro(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function nfe(e,t,n,i){var o=e.prev,r=e,s=e.next;if(ro(o,r,s)>=0)return!1;for(var a=o.x,l=r.x,u=s.x,h=o.y,f=r.y,_=s.y,g=al?a>u?a:u:l>u?l:u,T=h>f?h>_?h:_:f>_?f:_,x=QI(g,m,t,n,i),C=QI(b,T,t,n,i),w=e.prevZ,v=e.nextZ;w&&w.z>=x&&v&&v.z<=C;){if(w.x>=g&&w.x<=b&&w.y>=m&&w.y<=T&&w!==o&&w!==s&&$m(a,h,l,f,u,_,w.x,w.y)&&ro(w.prev,w,w.next)>=0||(w=w.prevZ,v.x>=g&&v.x<=b&&v.y>=m&&v.y<=T&&v!==o&&v!==s&&$m(a,h,l,f,u,_,v.x,v.y)&&ro(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;w&&w.z>=x;){if(w.x>=g&&w.x<=b&&w.y>=m&&w.y<=T&&w!==o&&w!==s&&$m(a,h,l,f,u,_,w.x,w.y)&&ro(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=C;){if(v.x>=g&&v.x<=b&&v.y>=m&&v.y<=T&&v!==o&&v!==s&&$m(a,h,l,f,u,_,v.x,v.y)&&ro(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ife(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!PC(o,r)&&$4(o,i,i.next,r)&&g0(o,r)&&g0(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),y0(i),y0(i.next),i=e=r),i=i.next}while(i!==e);return hp(i)}function ofe(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ffe(s,a)){var l=X4(s,a);s=hp(s,s.next),l=hp(l,l.next),_0(s,t,n,i,o,r,0),_0(l,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function rfe(e,t,n,i){var o=[],r,s,a,l,u;for(r=0,s=t.length;r=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>r&&(r=a,s=n.x=n.x&&n.x>=u&&i!==n.x&&$m(os.x||n.x===s.x&&lfe(s,n)))&&(s=n,f=_)),n=n.next;while(n!==l);return s}function lfe(e,t){return ro(e.prev,e,t.prev)<0&&ro(t.next,e,e.next)<0}function ufe(e,t,n,i){var o=e;do o.z===0&&(o.z=QI(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,dfe(o)}function dfe(e){var t,n,i,o,r,s,a,l,u=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t0||l>0&&i;)a!==0&&(l===0||!i||n.z<=i.z)?(o=n,n=n.nextZ,a--):(o=i,i=i.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,u*=2}while(s>1);return e}function QI(e,t,n,i,o){return e=(e-n)*o|0,t=(t-i)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function hfe(e){var t=e,n=e;do(t.x=(e-s)*(r-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(r-a)>=(o-s)*(i-a)}function ffe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!pfe(e,t)&&(g0(e,t)&&g0(t,e)&&mfe(e,t)&&(ro(e.prev,e,t.prev)||ro(e,t.prev,t))||PC(e,t)&&ro(e.prev,e,e.next)>0&&ro(t.prev,t,t.next)>0)}function ro(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function PC(e,t){return e.x===t.x&&e.y===t.y}function $4(e,t,n,i){var o=hT(ro(e,t,n)),r=hT(ro(e,t,i)),s=hT(ro(n,i,e)),a=hT(ro(n,i,t));return!!(o!==r&&s!==a||o===0&&dT(e,n,t)||r===0&&dT(e,i,t)||s===0&&dT(n,e,i)||a===0&&dT(n,t,i))}function dT(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 hT(e){return e>0?1:e<0?-1:0}function pfe(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&&$4(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function g0(e,t){return ro(e.prev,e,e.next)<0?ro(e,t,e.next)>=0&&ro(e,e.prev,t)>=0:ro(e,t,e.prev)<0||ro(e,e.next,t)<0}function mfe(e,t){var n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function X4(e,t){var n=new KI(e.i,e.x,e.y),i=new KI(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function UM(e,t,n,i){var o=new KI(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function y0(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 KI(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}DC.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(ZI(e,0,r,n));if(o)for(var a=0,l=t.length;a0&&(i+=e[o-1].length,n.holes.push(i))}return n};const _fe=new d,gfe=new d,Rh={};Rh.computeArea2D=function(e){A.defined("positions",e),A.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);const t=e.length;let n=0;for(let i=t-1,o=0;o0?wc.COUNTER_CLOCKWISE:wc.CLOCKWISE};Rh.triangulate=function(e,t){A.defined("positions",e);const n=H.packArray(e);return CO.exports(n,t,2)};const Q4=new d,K4=new d,Z4=new d,kM=new d,VM=new d,HM=new d,Uu=new d,J4=new H,eH=new H,tH=new H,o_=new H;Rh.computeSubdivision=function(e,t,n,i,o){o=y(o,R.RADIANS_PER_DEGREE);const r=c(i);A.typeOf.object("ellipsoid",e),A.defined("positions",t),A.defined("indices",n),A.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),A.typeOf.number.equals("indices.length % 3","0",n.length%3,0),A.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const l=t.length,u=new Array(l*3),h=new Array(l*2);let f=0,_=0;for(a=0;a0;){const w=s.pop(),v=s.pop(),P=s.pop(),N=d.fromArray(u,P*3,Q4),k=d.fromArray(u,v*3,K4),M=d.fromArray(u,w*3,Z4);let U,B,S;r&&(U=H.fromArray(h,P*2,J4),B=H.fromArray(h,v*2,eH),S=H.fromArray(h,w*2,tH));const D=d.multiplyByScalar(d.normalize(N,kM),b,kM),p=d.multiplyByScalar(d.normalize(k,VM),b,VM),I=d.multiplyByScalar(d.normalize(M,HM),b,HM),O=d.magnitudeSquared(d.subtract(D,p,Uu)),F=d.magnitudeSquared(d.subtract(p,I,Uu)),V=d.magnitudeSquared(d.subtract(I,D,Uu)),G=Math.max(O,F,V);let j,W,X;G>x?O===G?(j=`${Math.min(P,v)} ${Math.max(P,v)}`,a=m[j],c(a)||(W=d.add(N,k,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(U,B,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(P,a,w),s.push(a,v,w)):F===G?(j=`${Math.min(v,w)} ${Math.max(v,w)}`,a=m[j],c(a)||(W=d.add(k,M,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(B,S,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(v,a,P),s.push(a,w,P)):V===G&&(j=`${Math.min(w,P)} ${Math.max(w,P)}`,a=m[j],c(a)||(W=d.add(M,N,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(S,U,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(w,a,v),s.push(a,P,v)):(g.push(P),g.push(v),g.push(w))}const C={attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:ze.TRIANGLES};return r&&(C.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:h})),new Tt(C)};const yfe=new he,bfe=new he,Tfe=new he,Xw=new he;Rh.computeRhumbLineSubdivision=function(e,t,n,i,o){o=y(o,R.RADIANS_PER_DEGREE);const r=c(i);A.typeOf.object("ellipsoid",e),A.defined("positions",t),A.defined("indices",n),A.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),A.typeOf.number.equals("indices.length % 3","0",n.length%3,0),A.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const l=t.length,u=new Array(l*3),h=new Array(l*2);let f=0,_=0;for(a=0;a0;){const P=s.pop(),N=s.pop(),k=s.pop(),M=d.fromArray(u,k*3,Q4),U=d.fromArray(u,N*3,K4),B=d.fromArray(u,P*3,Z4);let S,D,p;r&&(S=H.fromArray(h,k*2,J4),D=H.fromArray(h,N*2,eH),p=H.fromArray(h,P*2,tH));const I=e.cartesianToCartographic(M,yfe),O=e.cartesianToCartographic(U,bfe),F=e.cartesianToCartographic(B,Tfe);x.setEndPoints(I,O);const V=x.surfaceDistance;C.setEndPoints(O,F);const G=C.surfaceDistance;w.setEndPoints(F,I);const j=w.surfaceDistance,W=Math.max(V,G,j);let X,q,ee,Y,ne;W>T?V===W?(X=`${Math.min(k,N)} ${Math.max(k,N)}`,a=m[X],c(a)||(q=x.interpolateUsingFraction(.5,Xw),ee=(I.height+O.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(S,D,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(k,a,P),s.push(a,N,P)):G===W?(X=`${Math.min(N,P)} ${Math.max(N,P)}`,a=m[X],c(a)||(q=C.interpolateUsingFraction(.5,Xw),ee=(O.height+F.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(D,p,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(N,a,k),s.push(a,P,k)):j===W&&(X=`${Math.min(P,k)} ${Math.max(P,k)}`,a=m[X],c(a)||(q=w.interpolateUsingFraction(.5,Xw),ee=(F.height+I.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(p,S,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(P,a,N),s.push(a,k,N)):(g.push(k),g.push(N),g.push(P))}const v={attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:ze.TRIANGLES};return r&&(v.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:h})),new Tt(v)};Rh.scaleToGeodeticHeight=function(e,t,n,i){n=y(n,ae.WGS84);let o=_fe,r=gfe;if(t=y(t,0),i=y(i,!0),c(e)){const s=e.length;for(let a=0;a10&&t*2>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n};yu.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};yu.prototype.contains=function(e){return this._array.indexOf(e)!==-1};yu.prototype.clear=function(){this._array.length=this._offset=this._length=0};yu.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const Ii={};Ii.computeHierarchyPackedLength=function(e,t){let n=0;const i=[e];for(;i.length>0;){const o=i.pop();if(!c(o))continue;n+=2;const r=o.positions,s=o.holes;if(c(r)&&r.length>0&&(n+=r.length*t.packedLength),c(s)){const a=s.length;for(let l=0;l0;){const r=o.pop();if(!c(r))continue;const s=r.positions,a=r.holes;if(t[n++]=c(s)?s.length:0,t[n++]=c(a)?a.length:0,c(s)){const l=s.length;for(let u=0;u0?new Array(o):void 0;for(let a=0;aR.PI){const l=s;s=a,a=l}if(!(r.longitudea))return n.cartographicToCartesian(r)}function Pfe(e,t,n,i){if(i===cn.RHUMB)return Dfe(e,t,n);const o=Ei.lineSegmentPlane(e,t,_t.ORIGIN_XY_PLANE);if(!!c(o))return n.scaleToGeodeticSurface(o,o)}const Ofe=new he;function Lfe(e,t,n){const i=[];let o,r,s,a,l,u=0;for(;ut.cartesianToCartographic(f,Ofe).longitude;if(s===0)i.push({position:u,type:s,visited:!1,next:a,theta:h(o)});else if(a!==0){if(l=Pfe(o,r,t,n),++u,!c(l))continue;e.splice(u,0,l),i.push({position:u,type:s,visited:!1,next:a,theta:h(l)})}++u}return i}function iH(e,t,n,i,o,r,s){const a=[];let l=r;const u=f=>_=>_.position===f,h=[];do{const f=n[l];a.push(f);const _=i.findIndex(u(l)),g=i[_];if(!c(g)){++l;continue}const{visited:m,type:b,next:T}=g;if(g.visited=!0,b===0){if(T===0){const v=i[_-(s?1:-1)];if((v==null?void 0:v.position)===l+1)v.visited=!0;else{++l;continue}}if(!m&&s&&T>0||r===l&&!s&&T<0){++l;continue}}if(!(s?b>=0:b<=0)){++l;continue}m||h.push(l);const C=_+(s?1:-1),w=i[C];if(!c(w)){++l;continue}l=w.position}while(l=0&&l!==r&&a.lengthu.theta-h.theta);const l=s[0].z>=0;o=iH(i,o,s,a,1,0,l)}return i};Ii.polygonsFromHierarchy=function(e,t,n,i,o,r){const s=[],a=[],l=new yu;l.enqueue(e);let u=c(r);for(;l.length!==0;){const h=l.dequeue();let f=h.positions;const _=h.holes;let g,m;if(i)for(m=f.length,g=0;g1){for(const k of N)l.enqueue(new PV(k,_));continue}}let C=f.slice();const w=c(_)?_.length:0,v=[];let P;for(g=0;gMath.PI&&(e-=R.TWO_PI),e}}});const dm=new he,Ufe=new d;Mn.prototype.getLatitude=function(e){c(e)||(e=ae.WGS84),dm.latitude=this.conformalLatitude,dm.longitude=this.longitude,dm.height=0;const t=this.ellipsoid.cartographicToCartesian(dm,Ufe);return e.cartesianToCartographic(t,dm),dm.latitude};const kfe=new nn,Vfe=new d,Hfe=new d;Mn.fromCartesian=function(e,t){A.defined("cartesian",e);const n=R.signNotZero(e.z);let i=Mn.NORTH_POLE_TANGENT_PLANE,o=Mn.SOUTH_POLE;n<0&&(i=Mn.SOUTH_POLE_TANGENT_PLANE,o=Mn.NORTH_POLE);const r=kfe;r.origin=i.ellipsoid.scaleToGeocentricSurface(e,r.origin),r.direction=d.subtract(r.origin,o,Vfe),d.normalize(r.direction,r.direction);const s=Ei.rayPlane(r,i.plane,Hfe),a=d.subtract(s,o,s),l=d.dot(i.xAxis,a),u=n*d.dot(i.yAxis,a);return c(t)?(t.position=new H(l,u),t.tangentPlane=i,t):new Mn(new H(l,u),i)};Mn.fromCartesianArray=function(e,t){A.defined("cartesians",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i=0?s:s+R.TWO_PI;o.westOverIdl=Math.min(o.westOverIdl,a),o.eastOverIdl=Math.max(o.eastOverIdl,a),r.west=Math.min(r.west,s),r.east=Math.max(r.east,s);const l=e.getLatitude(n);let u=l;if(r.south=Math.min(r.south,l),r.north=Math.max(r.north,l),i!==cn.RHUMB){const _=H.subtract(t.position,e.position,spe),g=H.dot(t.position,_)/H.dot(_,_);if(g>0&&g<1){const m=H.add(t.position,H.multiplyByScalar(_,-g,_),ape),b=Mn.clone(t,cpe);b.position=m;const T=b.getLatitude(n);r.south=Math.min(r.south,T),r.north=Math.max(r.north,T),Math.abs(l)>Math.abs(T)&&(u=T)}}const h=t.x*e.y-e.x*t.y;let f=Math.sign(h);f!==0&&(f*=H.angleBetween(t.position,e.position)),u>=0&&(o.northAngle+=f),u<=0&&(o.southAngle+=f)}const QM=new Mn,lpe=new Mn,Ka={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};Us.computeRectangleFromPositions=function(e,t,n,i){if(A.defined("positions",e),c(i)||(i=new ce),e.length<3)return i;i.west=Number.POSITIVE_INFINITY,i.east=Number.NEGATIVE_INFINITY,i.south=Number.POSITIVE_INFINITY,i.north=Number.NEGATIVE_INFINITY,Ka.northAngle=0,Ka.southAngle=0,Ka.westOverIdl=Number.POSITIVE_INFINITY,Ka.eastOverIdl=Number.NEGATIVE_INFINITY;const o=e.length;let r=Mn.fromCartesian(e[0],lpe);for(let s=1;sKa.eastOverIdl-Ka.westOverIdl&&(i.west=Ka.westOverIdl,i.east=Ka.eastOverIdl,i.east>R.PI&&(i.east=i.east-R.TWO_PI),i.west>R.PI&&(i.west=i.west-R.TWO_PI)),R.equalsEpsilon(Math.abs(Ka.northAngle),R.TWO_PI,R.EPSILON10)&&(i.north=R.PI_OVER_TWO,i.east=R.PI,i.west=-R.PI),R.equalsEpsilon(Math.abs(Ka.southAngle),R.TWO_PI,R.EPSILON10)&&(i.south=-R.PI_OVER_TWO,i.east=R.PI,i.west=-R.PI),i};const upe=new Mn;function dpe(e,t,n){return e.height>=R.PI||e.width>=R.PI?Mn.fromCartesian(t[0],upe).tangentPlane:Co.fromPoints(t,n)}const oH=new he;function hpe(e,t,n){return(i,o)=>{if(e.height>=R.PI||e.width>=R.PI){if(e.south<0&&e.north>0){c(o)||(o=[]);for(let s=0;s=R.PI||e.width>=R.PI)return(o,r)=>{if(e.south<0&&e.north>0){const s=n.cartesianToCartographic(o,oH);return c(r)||(r=new H),r.x=s.longitude/R.PI,r.y=s.latitude/R.PI_OVER_TWO,r}return Mn.fromCartesian(o,r)};const i=Co.fromPoints(t,n);return(o,r)=>i.projectPointsOntoPlane(o,r)}function ppe(e,t,n,i){return(o,r)=>!i&&(e.height>=R.PI_OVER_TWO||e.width>=2*R.PI_OVER_THREE)?an.splitPolygonsOnEquator(o,t,n,r):o}function mpe(e,t,n,i){if(t.height>=R.PI||t.width>=R.PI)return Re.fromRectangle(t,void 0,qM);const o=e,r=Co.fromPoints(o,n);return an.computeBoundingRectangle(r.plane.normal,r.projectPointOntoPlane.bind(r),o,i,qM)}Us.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,l=e._closeBottom,u=e._arcType,h=e._textureCoordinates,f=c(h),_=r.positions;if(_.length<3)return;const g=e.rectangle,m=an.polygonsFromHierarchy(r,f,hpe(g,_,n),!s,n,ppe(g,n,u,s)),b=m.hierarchy,T=m.polygons,x=function(I){return I},C=f?an.polygonsFromHierarchy(h,!0,x,!1,n).polygons:void 0;if(b.length===0)return;const w=b[0].outerRing,v=mpe(w,g,n,o),P=[],N=e._height,k=e._extrudedHeight,M=e._perPositionHeightExtrude||!R.equalsEpsilon(N,k,0,R.EPSILON2),U={perPositionHeight:s,vertexFormat:t,geometry:void 0,rotationAxis:dpe(g,w,n).plane.normal,projectTo2d:fpe(g,w,n),boundingRectangle:v,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u};let B;if(M)for(U.extrude=!0,U.top=a,U.bottom=l,U.shadowVolume=e._shadowVolume,U.offsetAttribute=e._offsetAttribute,B=0;B 2) { dimension = ceil(log2(float(u_extentsLength))); } int regionIndex = getPolygonIndex(dimension, v_textureCoordinates); for (int polygonIndex = 0; polygonIndex < u_polygonsLength; polygonIndex++) { ivec2 positionsLengthAndExtents = getPositionsLengthAndExtentsIndex(lastPolygonIndex); int positionsLength = positionsLengthAndExtents.x; int polygonExtentsIndex = positionsLengthAndExtents.y; lastPolygonIndex += 1; // Only compute signed distance for the relevant part of the atlas if (polygonExtentsIndex == regionIndex) { float clipAmount = czm_infinity; vec4 extents = getExtents(polygonExtentsIndex); vec2 textureOffset = vec2(mod(float(polygonExtentsIndex), dimension), floor(float(polygonExtentsIndex) / dimension)) / dimension; vec2 p = getCoordinates((v_textureCoordinates - textureOffset) * dimension, extents); float s = 1.0; // Check each edge for absolute distance for (int i = 0, j = positionsLength - 1; i < positionsLength; j = i, i++) { vec2 a = getPolygonPosition(lastPolygonIndex + i); vec2 b = getPolygonPosition(lastPolygonIndex + j); vec2 ab = b - a; vec2 pa = p - a; float t = dot(pa, ab) / dot(ab, ab); t = clamp(t, 0.0, 1.0); vec2 pq = pa - t * ab; float d = length(pq); // Inside / outside computation to determine sign bvec3 cond = bvec3(p.y >= a.y, p.y < b.y, ab.x * pa.y > ab.y * pa.x); if (all(cond) || all(not(cond))) s = -s; if (abs(d) < abs(clipAmount)) { clipAmount = d; } } // Normalize the range to [0,1] vec4 result = (s * vec4(clipAmount * length(extents.zw))) / 2.0 + 0.5; // In the case where we've iterated through multiple polygons, take the minimum out_FragColor = min(out_FragColor, result); } lastPolygonIndex += positionsLength; } }`;function Di(e){e=y(e,y.EMPTY_OBJECT),this._polygons=[],this._totalPositions=0,this.enabled=y(e.enabled,!0),this.inverse=y(e.inverse,!1),this.polygonAdded=new Le,this.polygonRemoved=new Le,this._owner=void 0,this._float32View=void 0,this._extentsFloat32View=void 0,this._extentsCount=0,this._polygonsTexture=void 0,this._extentsTexture=void 0,this._signedDistanceTexture=void 0,this._signedDistanceComputeCommand=void 0;const t=e.polygons;if(c(t)){const n=t.length;for(let i=0;iNh.equals(t,e))};Di.prototype.remove=function(e){A.typeOf.object("polygon",e);const t=this._polygons,n=t.findIndex(i=>Nh.equals(i,e));return n===-1?!1:(t.splice(n,1),this.polygonRemoved.raiseEvent(e,n),!0)};const bpe=new ce;function Tpe(e){const t=[],n=[],i=e.length;for(let r=0;rce.union(e[T].computeSphericalExtents(bpe),b,b),a),t[_]=void 0,n[_]=void 0,l=Math.max(a.height*2.5,.001),u=Math.max(a.width*2.5,.001),h=ce.clone(a,h),h.south-=l,h.west-=u,h.north+=l,h.east+=u,h.south=Math.max(h.south,-Math.PI),h.west=Math.max(h.west,-Math.PI),h.north=Math.min(h.north,Math.PI),h.east=Math.min(h.east,Math.PI),_=-1}}t.push(h),n.push(f)}const o=new Map;return n.filter(c).forEach((r,s)=>r.forEach(a=>o.set(a,s))),{extentsList:t.filter(c),extentsIndexByPolygon:o}}Di.prototype.removeAll=function(){const e=this._polygons,t=e.length;for(let n=0;ns+a.length,0);if(n===this.totalPositions||(this._totalPositions=n,this.length===0))return;c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0,this._signedDistanceComputeCommand=void 0);let i=this._polygonsTexture,o=this._extentsTexture,r=this._signedDistanceTexture;if(c(i)){const s=i.width*i.height;(s{e._signedDistanceComputeCommand=void 0}})}const ZM=new ce,Cpe=new ce;Di.prototype.computeIntersectionWithBoundingVolume=function(e,t){var r;const n=this._polygons,i=n.length;let o=Bt.OUTSIDE;this.inverse&&(o=Bt.INSIDE);for(let s=0;s=this._count)throw new E(`index must be in the range [0, ${this._count})`);const n=this._properties[t];if(c(n))return Je(n[e],!0)};Bp.prototype.setProperty=function(e,t,n){if(A.typeOf.number("index",e),A.typeOf.string("propertyId",t),e<0||e>=this._count)throw new E(`index must be in the range [0, ${this._count})`);let i=this._properties[t];c(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=Je(n,!0)};function Ro(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.number("options.count",e.count),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}Object.defineProperties(Ro.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(c(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){let e=0;return c(this._metadataTable)&&(e+=this._metadataTable.byteLength),c(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});Ro.prototype.hasProperty=function(e,t){return A.typeOf.number("index",e),A.typeOf.string("propertyId",t),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(t)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};Ro.prototype.hasPropertyBySemantic=function(e,t){return A.typeOf.number("index",e),A.typeOf.string("semantic",t),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};Ro.prototype.propertyExists=function(e){return A.typeOf.string("propertyId",e),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(e)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};Ro.prototype.propertyExistsBySemantic=function(e){return A.typeOf.string("semantic",e),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};const Zw=[];Ro.prototype.getPropertyIds=function(e,t){return t=c(t)?t:[],t.length=0,c(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(Zw)),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,Zw)),c(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(Zw)),t};Ro.prototype.getProperty=function(e,t){let n;if(c(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),c(n))||c(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),c(n))||c(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),c(n)))return n};Ro.prototype.setProperty=function(e,t,n){c(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(c(this._jsonMetadataTable)||(this._jsonMetadataTable=new Bp({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};Ro.prototype.getPropertyBySemantic=function(e,t){if(c(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};Ro.prototype.setPropertyBySemantic=function(e,t,n){return c(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};Ro.prototype.getPropertyTypedArray=function(e){if(A.typeOf.string("propertyId",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};Ro.prototype.getPropertyTypedArrayBySemantic=function(e){if(A.typeOf.string("semantic",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function EO(e,t){if(!c(e)||e<0||e>=t)throw new E(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Ro.prototype.isClass=function(e,t){EO(e,this.count),A.typeOf.string("className",t);const n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};Ro.prototype.isExactClass=function(e,t){return EO(e,this.count),A.typeOf.string("className",t),this.getExactClassName(e)===t};Ro.prototype.getExactClassName=function(e){EO(e,this.count);const t=this._batchTableHierarchy;if(!!c(t))return t.getClassName(e)};function j0(e){e=y(e,y.EMPTY_OBJECT);const t=e.property,n=e.classProperty,i=e.textures;A.typeOf.object("options.property",t),A.typeOf.object("options.classProperty",n),A.typeOf.object("options.textures",i);const o=c(t.channels)?t.channels:[0],r=t,s=dp.createModelTextureReader({textureInfo:r,channels:Ipe(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,l=t.scale;const u=n.hasValueTransform||c(a)||c(l);a=y(a,n.offset),l=y(l,n.scale),a=n.unpackVectorAndMatrixTypes(a),l=n.unpackVectorAndMatrixTypes(l),this._offset=a,this._scale=l,this._hasValueTransform=u,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(j0.prototype,{textureReader:{get:function(){return this._textureReader}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});j0.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===bt.SCALAR&&n===Ot.UINT8:bt.isVectorType(t)||t===bt.SCALAR?n===Ot.UINT8:!1};const Spe=[void 0,"float","vec2","vec3","vec4"],vpe=[void 0,"int","ivec2","ivec3","ivec4"];j0.prototype.getGlslType=function(){const e=this._classProperty;let t=bt.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?Spe[t]:vpe[t]};j0.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function Ipe(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}function NC(e){e=y(e,y.EMPTY_OBJECT);const t=e.propertyTexture,n=e.class,i=e.textures;A.typeOf.object("options.propertyTexture",t),A.typeOf.object("options.class",n),A.typeOf.object("options.textures",i);const o=t.extensions,r=t.extras,s={};if(c(t.properties))for(const a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new j0({property:t.properties[a],classProperty:n.properties[a],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=s,this._extras=r,this._extensions=o}Object.defineProperties(NC.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});NC.prototype.getProperty=function(e){return A.typeOf.string("propertyId",e),this._properties[e]};function sH(e){e=y(e,y.EMPTY_OBJECT);const t=e.property,n=e.classProperty;A.typeOf.object("options.property",t),A.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale;const r=n.hasValueTransform||c(i)||c(o);i=y(i,n.offset),o=y(o,n.scale),i=n.unpackVectorAndMatrixTypes(i),o=n.unpackVectorAndMatrixTypes(o),this._offset=i,this._scale=o,this._hasValueTransform=r,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(sH.prototype,{attribute:{get:function(){return this._attribute}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function MC(e){e=y(e,y.EMPTY_OBJECT);const t=e.propertyAttribute,n=e.class;A.typeOf.object("options.propertyAttribute",t),A.typeOf.object("options.class",n);const i={};if(c(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new sH({property:t.properties[o],classProperty:n.properties[o]}));this._name=e.name,this._id=e.id,this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(MC.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});MC.prototype.getProperty=function(e){return A.typeOf.string("propertyId",e),this._properties[e]};function Dl(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.schema",e.schema),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=c(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}Object.defineProperties(Dl.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}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}},propertyTablesByteLength:{get:function(){if(!c(this._propertyTables))return 0;let e=0;const t=this._propertyTables.length;for(let n=0;n=r;)T=o[T-r];o.push(T),s[m]=b}b>qpe&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):b>Ype&&t instanceof Uint8Array&&(t=new Uint16Array(t)),m===l?(l=b,t[a]=b):m===u?(u=b,t[a+1]=b):(h=b,t[a+2]=b),m=JM(i,l,u,h,f,_,g)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function JM(e,t,n,i,o,r,s){const a=s?1:0,l=o?1:0,u=0,h=Jw(e,t,a,l,u);if(h===0)return t;const f=0,_=o?1:0,g=r?1:0,m=Jw(e,n,f,_,g);if(m===0)return n;const b=s?1:0,T=0,x=r?1:0,C=Jw(e,i,b,T,x);if(C===0)return i;const w=h&m&C;let v,P,N;if(w&1<<0)v=0,P=1,N=2;else if(w&1<<1)v=0,N=1,P=2;else if(w&1<<2)P=0,v=1,N=2;else if(w&1<<3)P=0,N=1,v=2;else if(w&1<<4)N=0,v=1,P=2;else if(w&1<<5)N=0,P=1,v=2;else{const B=eS(h),S=eS(m),D=eS(C);return B>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}W0.prototype.updateAttribute=function(e){const t=this._extraVertices,n=e.length,i=n/this._originalVertexCount,o=t.length,r=e.constructor,s=new r(e.length+o*i);s.set(e);for(let a=0;a1;)i>>=1,r.push(eF(i));const s=new xt({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:Ve.LUMINANCE,sampler:new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR_MIPMAP_LINEAR,magnificationFilter:Yo.LINEAR})});return t.outlineTexture=s,s};function eF(e){const t=new Uint8Array(e);return t[e-1]=192,e===8?t[e-1]=96:e===4?t[e-1]=48:e===2?t[e-1]=24:e===1&&(t[e-1]=12),t}function cH(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n{this._resourcesLoaded=!0}).catch(o=>{this._processError=o})),c(this._processError)){this._state=li.FAILED;const o=this._processError;this._processError=void 0,jA(this,o)}const t=this._textureErrors.pop();if(c(t)){const o=this.getError("Failed to load glTF texture",t);throw o.name="TextureError",o}if(this._state===li.FAILED)return!1;let n=!1;try{n=this._process(e)}catch(o){this._state=li.FAILED,jA(this,o)}let i=!1;try{i=this._processTextures(e)}catch(o){this._textureState=li.FAILED,jA(this,o)}return this._incrementallyLoadTextures?n:n&&i};function vme(e,t,n,i,o,r,s,a){const u=t.accessors[n].bufferView;return dt.getVertexBufferLoader({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:u,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s})}function Ime(e,t,n,i,o,r,s){return dt.getIndexBufferLoader({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r})}function Dme(e,t,n){const i=dt.getBufferViewLoader({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function fH(e,t,n){let i=t.byteOffset;const o=W_(e,t),r=t.count,s=U0(t.type),a=t.componentType,l=Z.getSizeInBytes(a),u=l*s,h=r*s;if(o===u)return n=new Uint8Array(n),Z.createArrayBufferView(a,n.buffer,n.byteOffset+i,h);const f=Z.createTypedArray(a,h),_=new DataView(n.buffer),g=new Array(s),m=fO(t.componentType);i=n.byteOffset+i;for(let b=0;b{c(o)&&c(o.attributes)&&c(o.attributes[h])?Vme(b,T,r,s):Hme(t,l,b,T,r,s)},b}function _H(e,t,n,i,o,r,s,a){const l=i.modelSemantic,u=l===ht.POSITION,h=l===ht.FEATURE_ID,f=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,_=u&&e._enablePick&&!a.context.webgl2,g=e._loadForClassification&&h,m=e._loadAttributesAsTypedArray,b=!m,T=m||f||_||g,w=mH(e,t,n,i,o,s?!1:b,s?!0:T,a),v=new q_.AttributeLoadPlan(w);return v.loadBuffer=b,v.loadTypedArray=T,v}function Gme(e,t,n,i,o,r){const s=c(i.ROTATION),a=c(i.TRANSLATION)&&c(t.accessors[i.TRANSLATION].min)&&c(t.accessors[i.TRANSLATION].max),l=wO(e,hs,o),u=l.modelSemantic,h=u===hs.TRANSLATION||u===hs.ROTATION||u===hs.SCALE,f=u===hs.TRANSLATION,_=e._loadAttributesAsTypedArray||s&&h||!r.context.instancedArrays,g=e._enablePick&&!r.context.webgl2,m=!_,b=e._loadAttributesFor2D&&!r.scene3DOnly;return mH(e,t,n,l,void 0,m,_||f&&(!a||b||g),r)}function jme(e,t,n,i,o,r,s){const a=t.accessors[n],l=a.bufferView;if(!c(i)&&!c(l))return;const u=new ime;u.count=a.count;const h=e._loadAttributesAsTypedArray,f=(e._loadIndicesForWireframe||e._enablePick)&&!s.context.webgl2,_=e._loadForClassification&&o,m=!h,b=h||f||_,C=Ime(e,t,n,i,r?!1:m,r?!0:b,s),w=e._geometryLoaders.length;e._geometryLoaders.push(C);const v=C.load();e._loaderPromises.push(v),e._geometryCallbacks[w]=()=>{u.indexDatatype=C.indexDatatype,u.buffer=C.buffer,u.typedArray=C.typedArray};const P=new q_.IndicesLoadPlan(u);return P.loadBuffer=m,P.loadTypedArray=b,P}function Fu(e,t,n,i,o,r){const s=dp.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!c(s))return;const a=dt.getTextureLoader({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous}),l=dp.createModelTextureReader({textureInfo:n}),u=e._textureLoaders.length;e._textureLoaders.push(a);const h=a.load().catch(f=>{if(!e.isDestroyed()){if(!e._incrementallyLoadTextures)throw f;e._textureState=li.FAILED,e._textureErrors.push(f)}});return e._texturesPromises.push(h),e._textureCallbacks[u]=()=>{l.texture=a.texture,c(r)&&(l.texture.sampler=r)},l}function Wme(e,t,n,i,o){const r=new Ame,s=y(n.extensions,y.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,l=n.pbrMetallicRoughness;if(r.unlit=c(s.KHR_materials_unlit),c(a)){const u=new Tme;r.specularGlossiness=u,c(a.diffuseTexture)&&(u.diffuseTexture=Fu(e,t,a.diffuseTexture,i,o)),c(a.specularGlossinessTexture)&&c(a.specularGlossinessTexture)&&(u.specularGlossinessTexture=Fu(e,t,a.specularGlossinessTexture,i,o)),u.diffuseFactor=pc(te,a.diffuseFactor),u.specularFactor=pc(d,a.specularFactor),u.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(c(l)){const u=new bme;c(l.baseColorTexture)&&(u.baseColorTexture=Fu(e,t,l.baseColorTexture,i,o)),c(l.metallicRoughnessTexture)&&(u.metallicRoughnessTexture=Fu(e,t,l.metallicRoughnessTexture,i,o)),u.baseColorFactor=pc(te,l.baseColorFactor),u.metallicFactor=l.metallicFactor,u.roughnessFactor=l.roughnessFactor,r.metallicRoughness=u}return c(n.emissiveTexture)&&(r.emissiveTexture=Fu(e,t,n.emissiveTexture,i,o)),c(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=Fu(e,t,n.normalTexture,i,o)),c(n.occlusionTexture)&&(r.occlusionTexture=Fu(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=pc(d,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function gH(e,t){const n=new uH;return n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.propertyTableId=e.propertyTable,n.setIndex=e.attribute,n.label=e.label,n.positionalLabel=t,n}function yH(e,t,n,i){const o=new uH,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=pH(r.attribute),o.positionalLabel=i,o}function bH(e,t){const n=new hH;return n.propertyTableId=e.propertyTable,n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.label=e.label,n.positionalLabel=t,n.offset=0,n.repeat=1,n}function TH(e,t,n,i){const o=new hH,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=y(r.constant,0);const s=y(r.divisor,0);return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function qme(e,t,n,i,o,r){const s=new dH;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;const a=n.texture;s.textureReader=Fu(e,t,a,i,o,un.NEAREST);const u=(c(a.channels)?a.channels:[0]).map(function(h){return"rgba".charAt(h)}).join("");return s.textureReader.channels=u,s}function Yme(e,t,n,i,o,r,s,a){const l=new dH,u=n.featureIds,h=u.texture;return l.featureCount=s,l.propertyTableId=i,l.textureReader=Fu(e,t,h,o,r,un.NEAREST),l.textureReader.channels=u.channels,l.positionalLabel=a,l}function $me(e,t,n,i,o,r){const s=new ome,a=void 0,l=!1;for(const u in n)if(n.hasOwnProperty(u)){const h=n[u],f=wO(e,ht,u),_=_H(e,t,h,f,a,l,i,r);s.attributes.push(_.attribute),o.attributePlans.push(_)}return s}function Xme(e,t,n,i,o,r){const s=new rme,a=new q_(s);e._primitiveLoadPlans.push(a);const l=n.material;c(l)&&(s.material=Wme(e,t,t.materials[l],o,r));const u=y(n.extensions,y.EMPTY_OBJECT);let h=!1;const f=u.CESIUM_primitive_outline;e._loadPrimitiveOutline&&c(f)&&(h=!0,a.needsOutlines=!0,a.outlineIndices=Qme(e,t,f));const _=e._loadForClassification,g=u.KHR_draco_mesh_compression;let m=!1;const b=n.attributes;if(c(b)){for(const k in b)if(b.hasOwnProperty(k)){const M=b[k],U=wO(e,ht,k),B=U.modelSemantic;if(_&&!kme(B))continue;B===ht.FEATURE_ID&&(m=!0);const S=_H(e,t,M,U,g,i,h,r);a.attributePlans.push(S),s.attributes.push(S.attribute)}}const T=n.targets;if(c(T)&&!_){const k=T.length;for(let M=0;M=s.clientWidth)u=!0;else{if(w.x>s.clientWidth*.5){a.width=w.x,l.frustum.right=_.x-x,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,nS),a.x+=w.x,l.position.x=-l.position.x;const v=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-v,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,iS)}else{a.x+=w.x,a.width-=w.x,l.frustum.left=-_.x-x,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,nS),a.x=a.x-a.width,l.position.x=-l.position.x;const v=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-v,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,iS)}d.clone(g,l.position),l.frustum=m.clone(),i=H.clone(nS,i),(i.x<0||i.x>s.clientWidth)&&(i.x=iS.x)}}if(o.mode!==oe.SCENE2D||u){if(Zr=Og(r,n,l,Zr),Zr.z<0&&!(l.frustum instanceof It)&&!(l.frustum instanceof Ki))return;i=zr.clipToGLWindowCoordinates(a,Zr,i)}return i.y=s.clientHeight-i.y,i};zr.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=zr.wgs84ToWindowCoordinates(e,t,n),!!c(n))return zr.transformWindowToDrawingBuffer(e,n,n)};const Pu=new d,M_e=new he;zr.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===oe.SCENE3D)return d.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,M_e);if(!c(r))return;if(o.project(r,Pu),i===oe.COLUMBUS_VIEW)return d.fromElements(Pu.z,Pu.x,Pu.y,n);if(i===oe.SCENE2D)return d.fromElements(0,Pu.x,Pu.y,n);const s=e.morphTime;return d.fromElements(R.lerp(Pu.z,t.x,s),R.lerp(Pu.x,t.y,s),R.lerp(Pu.y,t.z,s),n)};const iF=new d,oF=new d,rF=new L;zr.clipToGLWindowCoordinates=function(e,t,n){return d.divideByScalar(t,t.w,iF),L.computeViewportTransformation(e,0,1,rF),L.multiplyByPoint(rF,iF,oF),H.fromCartesian3(oF,n)};zr.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return H.fromElements(t.x*o,t.y*r,n)};const F_e=new te,sF=new te;zr.drawingBufferToWgs84Coordinates=function(e,t,n,i){const r=e.context.uniformState,s=r.currentFrustum,a=s.x,l=s.y;if(e.frameState.useLogDepth){const g=n*r.log2FarDepthFromNearPlusOne,m=Math.pow(2,g)-1;n=l*(1-a/(m+a))/(l-a)}const u=e.view.passState.viewport,h=te.clone(te.UNIT_W,F_e);h.x=(t.x-u.x)/u.width*2-1,h.y=(t.y-u.y)/u.height*2-1,h.z=n*2-1,h.w=1;let f,_=e.camera.frustum;if(c(_.fovy)){f=L.multiplyByVector(r.inverseViewProjection,h,sF);const g=1/f.w;d.multiplyByScalar(f,g,f)}else{const g=_.offCenterFrustum;c(g)&&(_=g),f=sF,f.x=(h.x*(_.right-_.left)+_.left+_.right)*.5,f.y=(h.y*(_.top-_.bottom)+_.bottom+_.top)*.5,f.z=(h.z*(a-l)-a-l)*.5,f.w=1,f=L.multiplyByVector(r.inverseView,f,f)}return d.fromCartesian4(f,i)};const Ao=zr,B_e={LEFT:-1,NONE:0,RIGHT:1},zp=Object.freeze(B_e),Xm={};Xm._deprecationWarning=Xh;const Ou=Uint32Array.BYTES_PER_ELEMENT;Xm.parse=function(e,t){const n=y(t,0);A.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=Ou;const r=o.getUint32(t,!0);if(r!==1)throw new Te(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=Ou;const s=o.getUint32(t,!0);t+=Ou;let a=o.getUint32(t,!0);t+=Ou;let l=o.getUint32(t,!0);t+=Ou;let u=o.getUint32(t,!0);t+=Ou;let h=o.getUint32(t,!0);t+=Ou;let f;u>=570425344?(t-=Ou*2,f=a,u=l,h=0,a=0,l=0,Xm._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-=Ou,f=u,u=a,h=l,a=0,l=0,Xm._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."));let _;a===0?_={BATCH_LENGTH:y(f,0)}:(_=sa(i,t,a),t+=a);const g=new Uint8Array(e,t,l);t+=l;let m,b;u>0&&(m=sa(i,t,u),t+=u,h>0&&(b=new Uint8Array(e,t,h),b=new Uint8Array(b),t+=h));const T=n+s-t;if(T===0)throw new Te("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,T):(Xm._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+T))),{batchLength:f,featureTableJson:_,featureTableBinary:g,batchTableJson:m,batchTableBinary:b,gltf:x}};const z_e=Xm;function ef(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function CH(e,t,n,i,o,r){const s=e._cachedTypedArrays;let a=s[t];return c(a)||(a=Z.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function U_e(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return c(r)||(r=Z.createTypedArray(n,i),o[t]=r),r}ef.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(!!c(i))return c(i.byteOffset)?(t=y(t,Z.UNSIGNED_INT),n=y(n,1),CH(this,e,t,n,1,i.byteOffset)):i};ef.prototype.hasProperty=function(e){return c(this.json[e])};ef.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(!!c(i))return c(i.byteOffset)?(c(i.componentType)&&(t=Z.fromName(i.componentType)),CH(this,e,t,n,this.featuresLength,i.byteOffset)):U_e(this,e,t,i)};ef.prototype.getProperty=function(e,t,n,i,o){const r=this.json[e];if(!c(r))return;const s=this.getPropertyArray(e,t,n);if(n===1)return s[i];for(let a=0;a0&&(m=sa(i,t,u),t+=u,h>0&&(b=new Uint8Array(e,t,h),b=new Uint8Array(b),t+=h));const T=n+s-t;if(T===0)throw new Te("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,T):(Hx._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+T))),{gltfFormat:f,featureTableJson:_,featureTableBinary:g,batchTableJson:m,batchTableBinary:b,gltf:x}};const sge=Hx,id={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},pT=yt.Attribute,age=yt.FeatureIdAttribute,IH=yt.Instances;function od(e){e=y(e,y.EMPTY_OBJECT);const t=e.i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const o=y(e.byteOffset,0),r=y(e.releaseGltfJson,!1),s=y(e.asynchronous,!0),a=y(e.incrementallyLoadTextures,!0),l=y(e.upAxis,Cr.Y),u=y(e.forwardAxis,Cr.X),h=y(e.loadAttributesAsTypedArray,!1),f=y(e.loadIndicesForWireframe,!1),_=y(e.loadPrimitiveOutline,!0),g=y(e.enablePick,!1);A.typeOf.object("options.i3dmResource",t),A.typeOf.object("options.arrayBuffer",n),i=c(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=l,this._forwardAxis=u,this._loadAttributesAsTypedArray=h,this._loadIndicesForWireframe=f,this._loadPrimitiveOutline=_,this._enablePick=g,this._state=id.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._buffers=[],this._components=void 0,this._transform=L.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}c(Object.create)&&(od.prototype=Object.create(wo.prototype),od.prototype.constructor=od);Object.defineProperties(od.prototype,{texturesLoaded:{get:function(){var e;return(e=this._gltfLoader)==null?void 0:e.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});od.prototype.load=function(){if(c(this._promise))return this._promise;const e=sge.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new ef(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!c(a))throw new Te("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;const l=s.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(l)&&(this._transform=L.fromTranslation(d.fromArray(l))),this._batchTable={json:i,binary:o};const u={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(r===0){let f=Ta(e.gltf);f=f.replace(/[\s\0]+$/,"");const _=this._baseResource.getDerivedResource({url:f});u.gltfResource=_,u.baseResource=_}else u.gltfResource=this._i3dmResource,u.typedArray=e.gltf;const h=new wa(u);return this._gltfLoader=h,this._state=id.LOADING,this._promise=h.load().then(()=>{if(!this.isDestroyed())return this._state=id.PROCESSING,this}).catch(f=>{if(!this.isDestroyed())throw cge(this,f)}),this._promise};function cge(e,t){e.unload(),e._state=id.FAILED;const n="Failed to load i3dm";return e.getError(n,t)}od.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===id.READY)return!0;const t=this._gltfLoader;let n=!1;if(this._state===id.PROCESSING&&(n=t.process(e)),!n)return!1;const i=t.components;return i.transform=L.multiplyTransformation(this._transform,i.transform,i.transform),dge(this,i,e),lge(this,i),this._components=i,this._arrayBuffer=void 0,this._state=id.READY,!0};function lge(e,t){const n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(c(n.json))o=Up({count:i,batchTable:n.json,binaryBody:n.binary});else{const r=new Ro({name:Ph.BATCH_TABLE_CLASS_NAME,count:i});o=new Dl({schema:{},propertyTables:[r]})}t.structuralMetadata=o}const mT=new d,JI=new Array(4),uge=new L;function dge(e,t,n){let i;const o=e._featureTable,r=e._instancesLength;if(r===0)return;const s=o.getGlobalProperty("RTC_CENTER",Z.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),l=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,u=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),h=fge(o);let f;l&&(f=new Float32Array(4*r));let _;u&&(_=new Float32Array(3*r));const g=new Float32Array(r),m=d.unpackArray(h);let b=new d;const T=new d,x=new d,C=new d,w=new $,v=new _e,P=new Array(4),N=new d,k=new Array(3),M=new L;if(!c(s)||d.equals(d.unpack(s),d.ZERO)){const G=se.fromPoints(m);for(i=0;i0&&(G.instances=V?hge(U):U,V=!0)}}function hge(e){const t=new IH;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;on[i-1])throw new E("time is out of range.");if(t=y(t,0),e>=n[t]){if(t+1=0&&e>=n[t-1])return t-1;let o;if(e>n[t])for(o=t;o=n[o]&&e=0&&!(e>=n[o]&&en&&(r=Math.floor((e-n)/o)+1,e-=r*o),e};Oi.prototype.clampTime=function(e){A.typeOf.number("time",e);const t=this.times;return R.clamp(e,t[0],t[t.length-1])};function Y_(e){this._value=e,this._valueType=Oi.getPointType(e)}Object.defineProperties(Y_.prototype,{value:{get:function(){return this._value}}});Y_.prototype.findTimeInterval=function(e){throw new E("findTimeInterval cannot be called on a ConstantSpline.")};Y_.prototype.wrapTime=function(e){return A.typeOf.number("time",e),0};Y_.prototype.clampTime=function(e){return A.typeOf.number("time",e),0};Y_.prototype.evaluate=function(e,t){A.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};function tf(e){e=y(e,y.EMPTY_OBJECT);const t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=Oi.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(tf.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});tf.prototype.findTimeInterval=Oi.prototype.findTimeInterval;tf.prototype.wrapTime=Oi.prototype.wrapTime;tf.prototype.clampTime=Oi.prototype.clampTime;tf.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);return this._pointType===Number?(1-r)*n[o]+r*n[o+1]:(c(t)||(t=new d),d.lerp(n[o],n[o+1],r,t))};const DH={};DH.solve=function(e,t,n,i){if(!c(e)||!(e instanceof Array))throw new E("The array lower is required.");if(!c(t)||!(t instanceof Array))throw new E("The array diagonal is required.");if(!c(n)||!(n instanceof Array))throw new E("The array upper is required.");if(!c(i)||!(i instanceof Array))throw new E("The array right is required.");if(t.length!==i.length)throw new E("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new E("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new E("lower and upper must be one less than the length of diagonal.");const o=new Array(n.length),r=new Array(i.length),s=new Array(i.length);let a;for(a=0;a=0;--a)s[a]=d.subtract(r[a],d.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};const PH=DH,OH=[],LH=[],RH=[],NH=[];function yge(e,t,n){const i=OH,o=RH,r=LH,s=NH;i.length=o.length=e.length-1,r.length=s.length=e.length;let a;i[0]=r[0]=1,o[0]=0;let l=s[0];for(c(l)||(l=s[0]=new d),d.clone(t,l),a=1;a=n.length||e.index<0))throw new E("options.index must be a valid animation index.");let i=e.index;if(c(i))return eD(this,n[i],e);const o=n.length;for(let r=0;r=this._runtimeAnimations.length||e<0)throw new E("index must be valid within the range of the collection");return this._runtimeAnimations[e]};const _T=[];function Ige(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}Td.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&ie.equals(e.time,this._previousTime))return!1;this._previousTime=ie.clone(e.time,this._previousTime);let i=!1;const o=e.time,r=this._model;for(let s=0;s0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Wf.REPEAT)g=g-Math.floor(g);else if(a.loop===Wf.MIRRORED_REPEAT){const x=Math.floor(g),C=g-x;g=x%2===1?1-C:C}a.reverse&&(g=1-g);let T=g*u*a.multiplier;T=R.clamp(T,a.localStartTime,a.localStopTime),a.animate(T),a.update.numberOfListeners>0&&(a._updateEventTime=T,e.afterRender.push(a._raiseUpdateEvent)),i=!0,b||(a._state=Fm.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&_T.push(a))}}n=_T.length;for(let s=0;ss||o<-s&&r>-s}function pm(e,t){if(!c(t))return;const n=ku.clone(t),i=Ze.shallowClone(t.command);return i.modelMatrix=e._modelMatrix2D,i.boundingVolume=e._boundingVolume2D,n.command=i,n.updateShadows=!1,n.is2D=!0,t.derivedCommand2D=n,e._derivedCommands.push(n),n}function jge(e){pm(e,e._originalCommand),pm(e,e._translucentCommand),pm(e,e._skipLodBackfaceCommand),pm(e,e._skipLodStencilCommand),pm(e,e._silhouetteModelCommand),pm(e,e._silhouetteColorCommand)}function Wge(e){const t=Ze.shallowClone(e);t.pass=xe.TRANSLUCENT;const n=Je(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=Zn.ALPHA_BLEND,t.renderState=Ue.fromCache(n),t}function qge(e,t){const n=t._silhouetteId%255,i=Ze.shallowClone(e),o=Je(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:J.ALWAYS,backFunction:J.ALWAYS,reference:n,mask:-1,frontOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.REPLACE},backOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=Ue.fromCache(o),i}function Yge(e,t){const n=t._silhouetteId%255,i=Ze.shallowClone(e),o=Je(e.renderState,!0);o.cull.enabled=!1,(e.pass===xe.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=xe.TRANSLUCENT,o.depthMask=!1,o.blending=Zn.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:J.NOTEQUAL,backFunction:J.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.KEEP},backOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.KEEP}};const s=Je(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=Ue.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function $ge(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=Xge(o);if(r!==s){const a=Qge(r),l=Je(o.renderState,!0);l.stencilTest.reference=a,o.renderState=Ue.fromCache(l),n&&(i.derivedCommand2D.renderState=l)}}function Xge(e){return(e.renderState.stencilTest.reference&At.SKIP_LOD_MASK)>>>At.SKIP_LOD_BIT_SHIFT}function Qge(e){return At.CESIUM_3D_TILE_MASK|e<R.EPSILON3}};const oye=zH,rye=`vec3 proceduralIBL( vec3 positionEC, vec3 normalEC, vec3 lightDirectionEC, vec3 lightColorHdr, czm_pbrParameters pbrParameters ) { vec3 v = -positionEC; vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0)); vec3 vWC = -normalize(positionWC); vec3 l = normalize(lightDirectionEC); vec3 n = normalEC; vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n))); float NdotL = clamp(dot(n, l), 0.001, 1.0); float NdotV = abs(dot(n, v)) + 0.001; // Figure out if the reflection vector hits the ellipsoid float vertexRadius = length(positionWC); float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius); float reflectionDotNadir = dot(r, normalize(positionWC)); // Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z. r.x = -r.x; r = -normalize(czm_temeToPseudoFixed * r); r.x = -r.x; vec3 diffuseColor = pbrParameters.diffuseColor; float roughness = pbrParameters.roughness; vec3 specularColor = pbrParameters.f0; float inverseRoughness = 1.04 - roughness; inverseRoughness *= inverseRoughness; vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, r).rgb * inverseRoughness; float atmosphereHeight = 0.05; float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir); float blendRegionOffset = roughness * -1.0; float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999); float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999); float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999); float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir); vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight); vec3 nadirColor = belowHorizonColor * 0.5; vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5); vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75); vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight); vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9); float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight; float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25)); vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0); float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8); vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough); specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness); specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness); // Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf #ifdef USE_SUN_LUMINANCE // Angle between sun and zenith float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0); float S = acos(LdotZenith); // Angle between zenith and current pixel float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0); // Angle between sun and current pixel float gamma = acos(NdotL); float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith))); float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32)); float luminance = model_luminanceAtZenith * (numerator / denominator); #endif vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg; vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y); float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z); vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0); iblColor *= lightColor; #ifdef USE_SUN_LUMINANCE iblColor *= luminance; #endif return iblColor; } #if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) vec3 textureIBL( vec3 positionEC, vec3 normalEC, vec3 lightDirectionEC, czm_pbrParameters pbrParameters ) { vec3 diffuseColor = pbrParameters.diffuseColor; float roughness = pbrParameters.roughness; vec3 specularColor = pbrParameters.f0; vec3 v = -positionEC; vec3 n = normalEC; vec3 l = normalize(lightDirectionEC); vec3 h = normalize(v + l); float NdotV = abs(dot(n, v)) + 0.001; float VdotH = clamp(dot(v, h), 0.0, 1.0); const mat3 yUpToZUp = mat3( -1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0 ); vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n))); #ifdef DIFFUSE_IBL #ifdef CUSTOM_SPHERICAL_HARMONICS vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); #else vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); #endif #else vec3 diffuseIrradiance = vec3(0.0); #endif #ifdef SPECULAR_IBL vec3 r0 = specularColor.rgb; float reflectance = max(max(r0.r, r0.g), r0.b); vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0)); vec3 F = fresnelSchlick2(r0, r90, VdotH); vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg; #ifdef CUSTOM_SPECULAR_IBL vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD); #else vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD); #endif specularIBL *= F * brdfLut.x + brdfLut.y; #else vec3 specularIBL = vec3(0.0); #endif return diffuseColor * diffuseIrradiance + specularColor * specularIBL; } #endif vec3 imageBasedLightingStage( vec3 positionEC, vec3 normalEC, vec3 lightDirectionEC, vec3 lightColorHdr, czm_pbrParameters pbrParameters ) { #if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) // Environment maps were provided, use them for IBL return textureIBL( positionEC, normalEC, lightDirectionEC, pbrParameters ); #else // Use the procedural IBL if there are no environment maps return proceduralIBL( positionEC, normalEC, lightDirectionEC, lightColorHdr, pbrParameters ); #endif }`,UH={name:"ImageBasedLightingPipelineStage"};UH.process=function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,ge.FRAGMENT),o.addUniform("vec2","model_iblFactor",ge.FRAGMENT),yl.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",ge.FRAGMENT),c(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,ge.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",ge.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),c(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,ge.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",ge.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",ge.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",ge.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT)),c(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,ge.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",ge.FRAGMENT)),o.addFragmentLines(rye);const r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=jt(r,e.uniformMap)};const sye=UH,aye=R.EPSILON16;function OO(e){e=y(e,y.EMPTY_OBJECT);const t=e.stage,n=e.runtimeArticulation;A.typeOf.object("options.stage",t),A.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(OO.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){A.typeOf.number("value",e),e=R.clamp(e,this.minimumValue,this.maximumValue),R.equalsEpsilon(this._currentValue,e,aye)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const cye=new d,oS=new $;OO.prototype.applyStageToMatrix=function(e){A.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=cye;let o;switch(t){case Zc.XROTATE:o=$.fromRotationX(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.YROTATE:o=$.fromRotationY(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.ZROTATE:o=$.fromRotationZ(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=L.multiplyByTranslation(e,i,e);break;case Zc.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=L.multiplyByTranslation(e,i,e);break;case Zc.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=L.multiplyByTranslation(e,i,e);break;case Zc.XSCALE:i.x=n,i.y=1,i.z=1,e=L.multiplyByScale(e,i,e);break;case Zc.YSCALE:i.x=1,i.y=n,i.z=1,e=L.multiplyByScale(e,i,e);break;case Zc.ZSCALE:i.x=1,i.y=1,i.z=n,e=L.multiplyByScale(e,i,e);break;case Zc.UNIFORMSCALE:e=L.multiplyByUniformScale(e,n,e);break}return e};function BC(e){e=y(e,y.EMPTY_OBJECT);const t=e.articulation,n=e.sceneGraph;A.typeOf.object("options.articulation",t),A.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,lye(this)}Object.defineProperties(BC.prototype,{articulation:{get:function(){return this._articulation}},sceneGraph:{get:function(){return this._sceneGraph}},name:{get:function(){return this._name}},runtimeStages:{get:function(){return this._runtimeStages}},runtimeNodes:{get:function(){return this._runtimeNodes}}});function lye(e){const n=e.articulation.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s 0.0 && clipDistance < clippingPlanesEdgeWidth) { color = clippingPlanesEdgeColor; } } `,kH={name:"ModelClippingPlanesPipelineStage"},pye=new H;kH.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,ge.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,ge.FRAGMENT),Li.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,ge.FRAGMENT);const s=Li.getTextureResolution(i,o,pye);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,ge.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",ge.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",ge.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",ge.FRAGMENT),r.addFragmentLines(fye);const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const l=z.clone(i.edgeColor);return l.alpha=i.edgeWidth,l},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=jt(a,e.uniformMap)};const mye=kH,_ye=`void modelClippingPolygonsStage(ProcessedAttributes attributes) { vec2 sphericalLatLong = czm_approximateSphericalCoordinates(v_positionWC); sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi); vec2 minDistance = vec2(czm_infinity); v_regionIndex = -1; v_clippingPosition = vec2(czm_infinity); for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) { vec4 extents = czm_unpackClippingExtents(model_clippingExtents, regionIndex); vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz; vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0)); vec2 distance = abs(rectUv - clamped) * extents.wz; if (minDistance.x > distance.x || minDistance.y > distance.y) { minDistance = distance; v_clippingPosition = rectUv; } float threshold = 0.01; if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) { v_regionIndex = regionIndex; } } } `,gye=`void modelClippingPolygonsStage() { vec2 clippingPosition = v_clippingPosition; int regionIndex = v_regionIndex; czm_clipPolygons(model_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex); } `,VH={name:"ModelClippingPolygonsPipelineStage"};VH.process=function(e,t,n){const i=t.clippingPolygons,o=e.shaderBuilder;o.addDefine("ENABLE_CLIPPING_POLYGONS",void 0,ge.BOTH),i.inverse&&o.addDefine("CLIPPING_INVERSE",void 0,ge.FRAGMENT),o.addDefine("CLIPPING_POLYGON_REGIONS_LENGTH",i.extentsCount,ge.BOTH),o.addUniform("sampler2D","model_clippingDistance",ge.FRAGMENT),o.addUniform("sampler2D","model_clippingExtents",ge.VERTEX),o.addVarying("vec2","v_clippingPosition"),o.addVarying("int","v_regionIndex","flat"),o.addVertexLines(_ye),o.addFragmentLines(gye);const r={model_clippingDistance:function(){return i.clippingTexture},model_clippingExtents:function(){return i.extentsTexture}};e.uniformMap=jt(r,e.uniformMap)};const yye=VH;function HH(e,t){A.typeOf.object("model",e),A.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(HH.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){c(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});const bye=`mat4 getInstancingTransform() { mat4 instancingTransform; #ifdef HAS_INSTANCE_MATRICES instancingTransform = mat4( a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1 a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2 a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3 a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0 // Column 4 ); #else vec3 translation = vec3(0.0, 0.0, 0.0); vec3 scale = vec3(1.0, 1.0, 1.0); #ifdef HAS_INSTANCE_TRANSLATION translation = a_instanceTranslation; #endif #ifdef HAS_INSTANCE_SCALE scale = a_instanceScale; #endif instancingTransform = mat4( scale.x, 0.0, 0.0, 0.0, 0.0, scale.y, 0.0, 0.0, 0.0, 0.0, scale.z, 0.0, translation.x, translation.y, translation.z, 1.0 ); #endif return instancingTransform; } #ifdef USE_2D_INSTANCING mat4 getInstancingTransform2D() { mat4 instancingTransform2D; #ifdef HAS_INSTANCE_MATRICES instancingTransform2D = mat4( a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0, // Column 1 a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0, // Column 2 a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0, // Column 3 a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0 // Column 4 ); #else vec3 translation2D = vec3(0.0, 0.0, 0.0); vec3 scale = vec3(1.0, 1.0, 1.0); #ifdef HAS_INSTANCE_TRANSLATION translation2D = a_instanceTranslation2D; #endif #ifdef HAS_INSTANCE_SCALE scale = a_instanceScale; #endif instancingTransform2D = mat4( scale.x, 0.0, 0.0, 0.0, 0.0, scale.y, 0.0, 0.0, 0.0, 0.0, scale.z, 0.0, translation2D.x, translation2D.y, translation2D.z, 1.0 ); #endif return instancingTransform2D; } #endif `,Tye=`void instancingStage(inout ProcessedAttributes attributes) { vec3 positionMC = attributes.positionMC; mat4 instancingTransform = getInstancingTransform(); attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz; #ifdef HAS_NORMALS vec3 normalMC = attributes.normalMC; attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz; #endif #ifdef USE_2D_INSTANCING mat4 instancingTransform2D = getInstancingTransform2D(); attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz; #endif } `,Aye=`void legacyInstancingStage( inout ProcessedAttributes attributes, out mat4 instanceModelView, out mat3 instanceModelViewInverseTranspose) { vec3 positionMC = attributes.positionMC; mat4 instancingTransform = getInstancingTransform(); mat4 instanceModel = instancingTransform * u_instance_nodeTransform; instanceModelView = u_instance_modifiedModelView; instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel); attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz; #ifdef USE_2D_INSTANCING mat4 instancingTransform2D = getInstancingTransform2D(); attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz; #endif } `,gT=new L,xye=new L,Cye=new L,GH={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:$H,_transformsToTypedArray:iD};GH.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(bye);const s=e.model,a=s.sceneGraph,l=e.runtimeNode,u=n.mode!==oe.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,h=s._enablePick&&!n.context.webgl2,f=[];Mye(e,n,i,f,u,h),zye(e,n,i,f);const _={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",ge.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",ge.VERTEX),_.u_instance_modifiedModelView=function(){let g=L.multiplyTransformation(s.modelMatrix,a.components.transform,gT);return u?L.multiplyTransformation(n.context.uniformState.view3D,g,gT):(n.mode!==oe.SCENE3D&&(g=zt.basisTo2D(n.mapProjection,g,gT)),L.multiplyTransformation(n.context.uniformState.view,g,gT))},_.u_instance_nodeTransform=function(){return L.multiplyTransformation(a.axisCorrectionMatrix,l.computedTransform,xye)},r.addVertexLines(Aye)):r.addVertexLines(Tye),u){r.addDefine("USE_2D_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_modelView2D",ge.VERTEX);const g=n.context,m=L.fromTranslation(l.instancingReferencePoint2D,new L);_.u_modelView2D=function(){return L.multiplyTransformation(g.uniformState.view,m,Cye)}}e.uniformMap=jt(_,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};const Ly=new L,Eye=new d;function wye(e,t,n,i,o){let r=L.multiplyTransformation(t,e,Ly);return r=L.multiplyTransformation(r,n,Ly),o=zt.basisTo2D(i.mapProjection,r,o),o}function Sye(e,t,n,i,o){const r=L.fromTranslation(e,Ly);let s=L.multiplyTransformation(t,r,Ly);s=L.multiplyTransformation(s,n,Ly);const a=L.getTranslation(s,Eye);return o=Ao.computeActualWgs84Position(i,a,o),o}function jH(e,t,n){const i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=L.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=L.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=L.clone(o.computedModelMatrix,t),t=L.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=L.clone(L.IDENTITY,n))}const WH=new L,qH=new L,vye=new L,Iye=new d;function Dye(e,t,n,i){const o=WH,r=qH;jH(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let u=0;u=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:qt.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}const Uye=GH,LO={};LO.name="ModelMatrixUpdateStage";LO.update=function(e,t,n){const i=n.mode!==oe.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){const o=i?t._computedModelMatrix2D:t._computedModelMatrix;XH(e,t,o,e.transformToRoot),e._transformDirty=!1}};function XH(e,t,n,i){let o;i=L.multiplyTransformation(i,e.transform,new L),e.updateComputedTransform();const r=e.runtimePrimitives.length;for(o=0;o=this.children.length)throw new E("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]};Q_.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,c(e.instances)&&t.push(Uye),t.push(Vye),n.push(kye)};Q_.prototype.updateComputedTransform=function(){this._computedTransform=L.multiply(this._transformToRoot,this._transform,this._computedTransform)};Q_.prototype.updateJointMatrices=function(){const e=this._runtimeSkin;if(!c(e))return;e.updateJointMatrices();const t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return l.textureDimensions}),e.uniformMap=jt(o,e.uniformMap)};const jye=e5,t5={name:"ClassificationPipelineStage"};t5.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,ge.BOTH);const o=e.runtimePrimitive;c(o.batchLengths)||Wye(t,o)};function Wye(e,t){const n=Lt.getAttributeBySemantic(e,ht.POSITION);if(!c(n))throw new Te("Primitives must have a position attribute to be used for classification.");let i;const o=e.indices,r=c(o);r&&(i=o.typedArray,o.typedArray=void 0);const s=r?o.count:n.count,a=Lt.getAttributeBySemantic(e,ht.FEATURE_ID,0);if(!c(a)){t.batchLengths=[s],t.batchOffsets=[0];return}const l=a.typedArray;a.typedArray=void 0;const u=[],h=[0],f=r?i[0]:0;let _=l[f],g=0;for(let b=1;bd0e(i,t,n)):[]}function d0e(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=Lt,s=e.class.id,a=n==null?void 0:n.classes[s],l=Object.entries(e.properties),u=new Array(l.length);for(let h=0;hf0e(n,t)):[]}function f0e(e,t){const{sanitizeGlslIdentifier:n}=Lt,i=e.class.id,o=t==null?void 0:t.classes[i],r=Object.entries(e.properties).filter(([a,l])=>l.isGpuCompatible()),s=new Array(r.length);for(let a=0;ah),n.addStructField(bn.STRUCT_ID_METADATA_FS,r,o);const g=`attributes.texCoord_${a}`;let m=g;if(c(f)&&!$.equals(f,$.IDENTITY)){const w=`${_}Transform`;n.addUniform("mat3",w,ge.FRAGMENT),i[w]=function(){return f},m=`vec2(${w} * vec3(${g}, 1.0))`}const b=`texture(${_}, ${m}).${l}`,T=s.unpackInShader(b),x=l5({valueExpression:T,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:ge.FRAGMENT,property:s}),C=`metadata.${o} = ${x};`;n.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,[C])}function s5(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=c5(bn.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(bn.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,s),ge.includesVertexShader(r)&&(e.addStructField(bn.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function a5(e,t){const{propertyStatistics:n}=t;if(!c(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===bt.ENUM)return;const s=bn.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,l=c5(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(bn.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,l),ge.includesVertexShader(t.shaderDestination)&&(e.addStructField(bn.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,l))}function c5(e,t,n,i){function o(r){const s=t[r.specName];if(c(s))return`${n}.${r.shaderName} = ${i}(${s});`}return c(t)?e.map(o).filter(c):[]}function l5(e){const{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;const i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:l,shaderDestination:u}=e;s.addUniform(l,o,u),s.addUniform(l,r,u);const{offset:h,scale:f}=n;return a[o]=()=>h,a[r]=()=>f,`czm_valueTransform(${o}, ${r}, ${t})`}const op=bn,x0e={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},rD=Object.freeze(x0e),Ar={name:"CustomShaderPipelineStage",STRUCT_ID_ATTRIBUTES_VS:"AttributesVS",STRUCT_ID_ATTRIBUTES_FS:"AttributesFS",STRUCT_NAME_ATTRIBUTES:"Attributes",STRUCT_ID_VERTEX_INPUT:"VertexInput",STRUCT_NAME_VERTEX_INPUT:"VertexInput",STRUCT_ID_FRAGMENT_INPUT:"FragmentInput",STRUCT_NAME_FRAGMENT_INPUT:"FragmentInput",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS:"initializeInputStructVS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS:"void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS:"initializeInputStructFS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS:"void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",_oneTimeWarning:$n};Ar.process=function(e,t,n){const{shaderBuilder:i,model:o,alphaOptions:r}=e,{customShader:s}=o,{lightingModel:a,translucencyMode:l}=s;c(a)&&(e.lightingOptions.lightingModel=a),l===rD.TRANSLUCENT?r.pass=xe.TRANSLUCENT:l===rD.OPAQUE&&(r.pass=void 0);const u=P0e(s,t);if(!u.customShaderEnabled)return;if(N0e(i,s,u),u.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,ge.BOTH),c(s.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ge.VERTEX),c(s.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ge.FRAGMENT);const _=RO.getDefineName(s.mode);i.addDefine(_,void 0,ge.FRAGMENT)}const h=s.uniforms;for(const _ in h)if(h.hasOwnProperty(_)){const g=h[_];i.addUniform(g.type,_)}const f=s.varyings;for(const _ in f)if(f.hasOwnProperty(_)){const g=f[_];i.addVarying(g,_)}e.uniformMap=jt(e.uniformMap,s.uniformMap)};function C0e(e){const t={};for(let n=0;n1?(m=e.attributeIndex,e.attributeIndex+=_):g&&!l?m=0:m=e.attributeIndex++,W0e(e,f,m,_,s,a)}ebe(i,t.attributes),t.primitiveType===ze.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(H0e),i.addFragmentLines(V0e)};function W0e(e,t,n,i,o,r){const s=e.shaderBuilder,a=Lt.getAttributeInfo(t),l=o&&!r;i>1?$0e(e,t,n,i):Y0e(e,t,n,l),Q0e(s,a,l),X0e(s,a),c(t.semantic)&&q0e(s,t),K0e(s,a,o),Z0e(s,a,l),J0e(s,a)}function q0e(e,t){const n=t.semantic,i=t.setIndex;switch(n){case ht.NORMAL:e.addDefine("HAS_NORMALS");break;case ht.TANGENT:e.addDefine("HAS_TANGENTS");break;case ht.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case ht.TEXCOORD:case ht.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function Y0e(e,t,n,i){const o=t.quantization;let r,s;c(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.semantic,l=t.setIndex;a===ht.FEATURE_ID&&l>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=l+1);const u=a===ht.POSITION,h=u?0:n,f=qt.getNumberOfComponents(r),_={index:h,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:f,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(_),!u||!i)return;const g=e.runtimePrimitive.positionBuffer2D,m={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:f,componentDatatype:Z.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(m)}function $0e(e,t,n,i){const o=t.quantization;let r,s;c(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.normalized,u=qt.getNumberOfComponents(r)/i,h=Z.getSizeInBytes(s),f=u*h,_=t.byteStride;for(let g=0;g0,u=!c(a)&&l;if(c(r)&&!u){const b=Dbe(a),T=Pbe(r,b);Obe(i,T);const C=Lbe(T).indexOf("normalMC")>=0,w=Lt.getAttributeBySemantic(t,ht.NORMAL);if(C&&!w)throw new Te("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,ge.VERTEX),T.styleTranslucent&&(e.alphaOptions.pass=xe.TRANSLUCENT)}const h=o.pointCloudShading;h.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,ge.VERTEX),h.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,ge.VERTEX);let f,_,g;bs.is3DTiles(o.type)&&(_=!0,f=o.content,g=f.tile.refine===Vr.ADD),i.addUniform("vec4","model_pointCloudParameters",ge.VERTEX),i.addVertexLines(Ebe);const m=e.uniformMap;m.model_pointCloudParameters=function(){const b=wbe;let T=1;_&&(T=g?5:f.tileset.memoryAdjustedScreenSpaceError),b.x=y(h.maximumAttenuation,T),b.x*=n.pixelRatio;const x=Sbe(e,t,h,f);b.y=x*h.geometricErrorScale;const C=n.context,w=n.camera.frustum;let v;return n.mode===oe.SCENE2D||w instanceof It?v=Number.POSITIVE_INFINITY:v=C.drawingBufferHeight/n.camera.frustum.sseDenominator,b.z=v,_&&(b.w=f.tileset.timeSinceLoad),b}};const _F=new d;function Sbe(e,t,n,i){if(c(i)){const h=i.tile.geometricError;if(h>0)return h}if(c(n.baseResolution))return n.baseResolution;const o=Lt.getAttributeBySemantic(t,ht.POSITION),r=o.count,s=e.runtimeNode.transform;let a=d.subtract(o.max,o.min,_F);a=L.multiplyByPointAsVector(s,a,_F);const l=a.x*a.y*a.z;return R.cbrt(l/r)}const vbe={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},Ibe={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function Dbe(e){const t=Je(Ibe);if(!c(e))return t;for(let n=0;n0,_=c(i.skin),g=c(r),b=!(g&&c(r.fragmentShaderText))||r.mode!==RO.REPLACE_MATERIAL,T=Lt.hasQuantizedAttributes(n.attributes),x=o.debugWireframe&&ze.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),C=o.pointCloudShading,w=c(C)&&C.attenuation,v=c(C)&&C.backFaceCulling,P=n.primitiveType===ze.POINTS&&(c(s)||w||v),N=o._enableShowOutline&&c(n.outlineCoordinates),k=dTe(o,i,n),M=c(o.classificationType);u&&t.push(Xbe),t.push(tbe),x&&t.push(uTe),M&&t.push(qye),f&&t.push(bbe),_&&t.push(Jbe),P&&t.push(Rbe),T&&t.push(k0e),b&&t.push(ube),t.push(NO),t.push(op),k.hasPropertyTable&&(t.push(sD),t.push(jye),t.push(Xye)),h&&t.push(nTe),g&&t.push(M0e),t.push(obe),o.allowPicking&&t.push(xbe),N&&t.push(Fbe),t.push(Gye),t.push(kbe)};function dTe(e,t,n){let i;return c(t.instances)&&(i=Lt.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(i))?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:(i=Lt.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),c(i)?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function FO(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.skin",e.skin),A.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;const t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],hTe(this)}Object.defineProperties(FO.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}});function hTe(e){const t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;const i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let l=0;l czm_splitPosition) discard; if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; #endif } `,WA={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};WA.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,ge.FRAGMENT),i.addFragmentLines(yTe);const o={};i.addUniform("float",WA.SPLIT_DIRECTION_UNIFORM_NAME,ge.FRAGMENT),o[WA.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=jt(o,e.uniformMap)};const bTe=WA;function TTe(e,t){A.typeOf.object("modelRenderResources",e),A.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=Je(e.uniformMap),this.alphaOptions=Je(e.alphaOptions),this.renderStateOptions=Je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}function ATe(e){e=y(e,y.EMPTY_OBJECT),this.lightingModel=y(e.lightingModel,Gx.UNLIT)}function xTe(e,t){A.typeOf.object("nodeRenderResources",e),A.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=Je(e.uniformMap),this.alphaOptions=Je(e.alphaOptions),this.renderStateOptions=Je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=c(n.indices)?n.indices.count:Lt.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=Lt.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=d.clone(i.min,new d),this.positionMax=d.clone(i.max,new d),this.boundingSphere=se.fromCornerPoints(this.positionMin,this.positionMax,new se),this.lightingOptions=new ATe,this.pickId=void 0}function Ha(e){e=y(e,y.EMPTY_OBJECT);const t=e.modelComponents;A.typeOf.object("options.model",e.model),A.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=L.clone(L.IDENTITY),this._computedModelMatrix2D=L.clone(L.IDENTITY),this._axisCorrectionMatrix=Lt.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new L),this._runtimeArticulations={},CTe(this)}Object.defineProperties(Ha.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});function CTe(e){const t=e._components,n=t.scene,o=e._model.modelMatrix;N5(e,o);const r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let C=0;C0&&(f=sa(n,t,a),t+=a,l>0&&(_=new Uint8Array(e,t,l),t+=l));const g=new ef(u,h),m=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=m,!c(m))throw new Te("Feature table global property: POINTS_LENGTH must be defined");let b=g.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(b)&&(b=d.unpack(b));const T=zTe(g,f);if(T.rtcCenter=b,T.pointsLength=m,!T.hasPositions){const x=UTe(g);T.positions=x,T.hasPositions=T.hasPositions||c(x)}if(!T.hasPositions)throw new Te("Either POSITION or POSITION_QUANTIZED must be defined.");if(!T.hasNormals){const x=VTe(g);T.normals=x,T.hasNormals=T.hasNormals||c(x)}if(!T.hasColors){const x=kTe(g);T.colors=x,T.hasColors=T.hasColors||c(x),T.hasConstantColor=c(T.constantColor),T.isTranslucent=c(x)&&x.isTranslucent}if(!T.hasBatchIds){const x=HTe(g);T.batchIds=x,T.hasBatchIds=T.hasBatchIds||c(x)}if(T.hasBatchIds){const x=g.getGlobalProperty("BATCH_LENGTH");if(!c(x))throw new Te("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");T.batchLength=x}return c(_)&&(_=new Uint8Array(_),T.batchTableJson=f,T.batchTableBinary=_),T};function zTe(e,t){const n=e.json;let i,o,r;const s=c(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=c(t)&&c(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;c(a)&&(r=a.properties);let l,u,h,f,_;if(c(s)){o=s.properties;const m=s.byteOffset,b=s.byteLength;if(!c(o)||!c(m)||!c(b))throw new Te("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(m,m+b),l=c(o.POSITION),u=c(o.RGB)||c(o.RGBA),h=c(o.NORMAL),f=c(o.BATCH_ID),_=c(o.RGBA)}let g;return c(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:jt(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:l,hasColors:u,isTranslucent:_,hasNormals:h,hasBatchIds:f}}function UTe(e){const t=e.json;let n;if(c(t.POSITION))return n=e.getPropertyArray("POSITION",Z.FLOAT,3),{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!1,componentDatatype:Z.FLOAT,type:qt.VEC3};if(c(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",Z.UNSIGNED_SHORT,3);const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Z.FLOAT,3);if(!c(i))throw new Te("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=(1<<16)-1,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Z.FLOAT,3);if(!c(r))throw new Te("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!0,componentDatatype:Z.FLOAT,type:qt.VEC3,quantizedRange:o,quantizedVolumeOffset:d.unpack(r),quantizedVolumeScale:d.unpack(i),quantizedComponentDatatype:Z.UNSIGNED_SHORT,quantizedType:qt.VEC3}}}function kTe(e){const t=e.json;let n;if(c(t.RGBA))return n=e.getPropertyArray("RGBA",Z.UNSIGNED_BYTE,4),{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(c(t.RGB))return n=e.getPropertyArray("RGB",Z.UNSIGNED_BYTE,3),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(c(t.RGB565))return n=e.getPropertyArray("RGB565",Z.UNSIGNED_SHORT,1),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.FLOAT,type:qt.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(c(t.CONSTANT_RGBA)){const i=e.getGlobalProperty("CONSTANT_RGBA",Z.UNSIGNED_BYTE,4),o=i[3],r=z.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,constantColor:r,componentDatatype:Z.FLOAT,type:qt.VEC4,isQuantized:!1,isTranslucent:s}}}function VTe(e){const t=e.json;let n;if(c(t.NORMAL))return n=e.getPropertyArray("NORMAL",Z.FLOAT,3),{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:Z.FLOAT,type:qt.VEC3};if(c(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",Z.UNSIGNED_BYTE,2);const i=8;return{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<0&&uAe(e,a,f,t),c(n.rtcCenter)&&(h.transform=L.multiplyByTranslation(h.transform,n.rtcCenter,h.transform));const _=n.positions;c(_)&&_.isQuantized&&(h.transform=L.multiplyByTranslation(h.transform,_.quantizedVolumeOffset,h.transform)),e._components=h,e._parsedContent=void 0,e._arrayBuffer=void 0}function uAe(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s=0&&(a=de)}}}}if(a!==Number.MAX_VALUE){if(s=nn.getPoint(t,a,s),n.mode!==oe.SCENE3D){d.fromElements(s.y,s.z,s.x,s);const h=n.mapProjection,f=h.ellipsoid,_=h.unproject(s,gAe);f.cartographicToCartesian(_,s)}return s}}function dS(e,t,n,i,o,r,s,a,l,u){const h=n+t*i;if(u.x=e[h],u.y=e[h+1],u.z=e[h+2],c(o))if(o.octEncoded){if(u=En.octDecodeInRange(u,o.normalizationRange,u),o.octEncodedZXY){const f=u.x;u.x=u.z,u.z=u.y,u.y=f}}else u=d.multiplyComponents(u,o.quantizedVolumeStepSize,u),u=d.add(u,o.quantizedVolumeOffset,u);return u=L.multiplyByPoint(r,u,u),s!==1&&oa.getPosition(u,l,s,a,u),u}function In(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.loader",e.loader),A.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=y(e.type,bs.GLTF),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(this.modelMatrix),this._scale=y(e.scale,1),this._minimumPixelSize=y(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=c(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=$.clone($.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new Td(this),this._clampAnimations=y(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=z.clone(e.color),this._colorBlendMode=y(e.colorBlendMode,RC.HIGHLIGHT),this._colorBlendAmount=y(e.colorBlendAmount,.5);const t=y(e.silhouetteColor,z.RED);this._silhouetteColor=z.clone(t),this._silhouetteSize=y(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=y(e.cull,!0),this._opaquePass=y(e.opaquePass,xe.OPAQUE),this._allowPicking=y(e.allowPicking,!0),this._show=y(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=y(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=y(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._pipelineResources=[],this._modelResources=[],this._pickIds=[],this._boundingSphere=new se,this._initialRadius=void 0,this._heightReference=y(e.heightReference,gt.NONE),this._heightDirty=this._heightReference!==gt.NONE,this._removeUpdateHeightCallback=void 0,this._verticalExaggerationOn=!1,this._clampedModelMatrix=void 0;const o=e.scene;c(o)&&c(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(()=>{this._heightDirty=!0})),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;const r=new q0(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;c(s)&&s.owner===void 0?Li.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=L.clone(L.IDENTITY);const a=e.clippingPolygons;c(a)&&a.owner===void 0?Di.setOwner(a,this,"_clippingPolygons"):this._clippingPolygons=a,this._clippingPolygonsState=0,this._lightColor=d.clone(e.lightColor),this._imageBasedLighting=c(e.imageBasedLighting)?e.imageBasedLighting:new G_,this._shouldDestroyImageBasedLighting=!c(e.imageBasedLighting),this._backFaceCulling=y(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=y(e.shadows,Vi.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=y(e.enableDebugWireframe,!1),this._enableShowOutline=y(e.enableShowOutline,!0),this._debugWireframe=y(e.debugWireframe,!1),this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===bs.GLTF&&$n("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.");let l=e.credit;typeof l=="string"&&(l=new Wt(l)),this._credits=[],this._credit=l,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=y(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=y(e.splitDirection,zp.NONE),this._enableShowOutline=y(e.enableShowOutline,!0),this.showOutline=y(e.showOutline,!0),this.outlineColor=y(e.outlineColor,z.BLACK),this._classificationType=e.classificationType,this._statistics=new K_,this._sceneMode=void 0,this._projectTo2D=y(e.projectTo2D,!1),this._enablePick=y(e.enablePick,!1),this._fogRenderable=void 0,this._skipLevelOfDetail=!1,this._ignoreCommands=y(e.ignoreCommands,!1),this._errorEvent=new Le,this._readyEvent=new Le,this._texturesReadyEvent=new Le,this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function hS(e,t){if(e._errorEvent.numberOfListeners>0){e._errorEvent.raiseEvent(t);return}console.log(t)}function TAe(e,t){const n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r0&&t===0||e===0&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");const e=c(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return V5(this,e),this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},debugWireframe:{get:function(){return this._debugWireframe},set:function(e){this._debugWireframe!==e&&this.resetDrawCommands(),this._debugWireframe=e,this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===bs.GLTF&&$n("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltfAsync, otherwise debugWireframe will be ignored.")}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),A.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),A.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(Li.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){e!==this._clippingPolygons&&(Di.setOwner(e,this,"_clippingPolygons"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){c(e)!==c(this._lightColor)&&this.resetDrawCommands(),this._lightColor=d.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){A.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen!==e&&(this._showCreditsOnScreenDirty=!0),this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}},classificationType:{get:function(){return this._classificationType}},pickIds:{get:function(){return this._pickIds}},styleCommandsNeeded:{get:function(){return this._styleCommandsNeeded}}});In.prototype.getNode=function(e){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return A.typeOf.string("name",e),this._nodesByName[e]};In.prototype.setArticulationStage=function(e,t){if(A.typeOf.number("value",t),!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)};In.prototype.applyArticulations=function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()};In.prototype.makeStyleDirty=function(){this._styleDirty=!0};In.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const xAe=new L,CAe=new $,EAe=new L;In.prototype.update=function(e){let t=!1;try{t=wAe(this,e)}catch(n){if(!this._loader.incrementallyLoadTextures&&n.name==="TextureError")hS(this,n);else{const i=Lt.getError("model",this._resource,n);hS(this,i)}}if(SAe(this,e),vAe(this,e),!this._resourcesLoaded&&t){this._resourcesLoaded=!0;const n=this._loader.components;if(!c(n)){if(this._loader.isUnloaded())return;const r=Lt.getError("model",this._resource,new Te("Failed to load model."));hS(r),this._rejectLoad=this._rejectLoad&&this._rejectLoad(r)}const i=n.structuralMetadata;c(i)&&i.propertyTableCount>0&&TAe(this,i);const o=new Ha({model:this,modelComponents:n});this._sceneGraph=o,this._gltfCredits=o.components.asset.credits}if(!(!this._resourcesLoaded||e.mode===oe.MORPHING)){if(IAe(this),DAe(this),PAe(this,e),OAe(this),LAe(this,e),RAe(this,e),NAe(this,e),MAe(this,e),FAe(this,e),BAe(this,e),zAe(this,e),this._defaultTexture=e.context.defaultTexture,UAe(this,e),kAe(this,e),VAe(this),HAe(this,e),WAe(this,e),!this._ready){e.afterRender.push(()=>{this._ready=!0,this._readyEvent.raiseEvent(this)});return}this._loader.incrementallyLoadTextures&&!this._texturesLoaded&&this._loader.texturesLoaded&&(this.resetDrawCommands(),this._texturesLoaded=!0,this._texturesReadyEvent.raiseEvent(this)),jAe(this),qAe(this,e),YAe(this),$Ae(this,e)}};function wAe(e,t){return!e._resourcesLoaded||e._loader.incrementallyLoadTextures&&!e._texturesLoaded?(t.afterRender.push(()=>!0),e._loader.process(t)):!0}function SAe(e,t){c(e._customShader)&&e._customShader.update(t)}function vAe(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function IAe(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;c(n)&&n.propertyTableCount>0&&(e.featureTableId=AAe(t,e),e._styleDirty=!0,e.resetDrawCommands())}function DAe(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function PAe(e,t){const n=e._featureTables,i=n.length;let o=!1;for(let r=0;r=i&&r<=o}function ZAe(e,t){const n=t.creditDisplay,i=e._credits,o=i.length;for(let r=0;r0&&e.alpha<1};In.prototype.isInvisible=function(){const e=this.color;return c(e)&&e.alpha===0};function H5(e){return e.context.stencilBuffer}In.prototype.hasSilhouette=function(e){return H5(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!c(this._classificationType)};In.prototype.hasSkipLevelOfDetail=function(e){if(!bs.is3DTiles(this.type))return!1;const t=e.context.stencilBuffer,n=this._content.tileset;return t&&n.isSkippingLevelOfDetail};In.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return c(e)&&e.enabled&&e.length!==0};In.prototype.pick=function(e,t,n,i,o){return bAe(this,e,t,n,i,o)};In.prototype.isClippingPolygonsEnabled=function(){const e=this._clippingPolygons;return c(e)&&e.enabled&&e.length!==0};In.prototype.isDestroyed=function(){return!1};In.prototype.destroy=function(){const e=this._loader;c(e)&&e.destroy();const t=this._featureTables;if(c(t)){const o=t.length;for(let r=0;r0,i=c(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=c(i)&&c(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),k5(this)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function Y0(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,minimumPixelSize:n.minimumPixelSize,maximumScale:n.maximumScale,id:n.id,allowPicking:n.allowPicking,clampAnimations:n.clampAnimations,shadows:n.shadows,debugShowBoundingVolume:n.debugShowBoundingVolume,enableDebugWireframe:n.enableDebugWireframe,debugWireframe:n.debugWireframe,cull:n.cull,opaquePass:n.opaquePass,customShader:n.customShader,content:n.content,heightReference:n.heightReference,scene:n.scene,distanceDisplayCondition:n.distanceDisplayCondition,color:n.color,colorBlendAmount:n.colorBlendAmount,colorBlendMode:n.colorBlendMode,silhouetteColor:n.silhouetteColor,silhouetteSize:n.silhouetteSize,enableShowOutline:n.enableShowOutline,showOutline:n.showOutline,outlineColor:n.outlineColor,clippingPlanes:n.clippingPlanes,clippingPolygons:n.clippingPolygons,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,enablePick:n.enablePick,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}function zi(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(zi.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return c(t)&&c(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return this._model.statistics.pointsLength}},trianglesLength:{get:function(){return this._model.statistics.trianglesLength}},geometryByteLength:{get:function(){return this._model.statistics.geometryByteLength}},texturesByteLength:{get:function(){return this._model.statistics.texturesByteLength}},batchTableByteLength:{get:function(){const e=this._model.statistics;return e.propertyTablesByteLength+e.batchTexturesByteLength}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},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(c(t)&&c(t[n]))return t[n]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});zi.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!c(n))throw new E("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");const i=t.featureTables[n];if(!c(i))throw new E("No feature table found for the selected feature ID set");const o=i.featuresLength;if(!c(e)||e<0||e>=o)throw new E(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)};zi.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;return c(i)?n.featureTables[i].hasProperty(e,t):!1};zi.prototype.applyDebugSettings=function(e,t){t=e?t:z.WHITE,this.featuresLength===0?this._model.color=t:c(this.batchTable)&&this.batchTable.setAllColor(t)};zi.prototype.applyStyle=function(e){this._model.style=e};zi.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.featureIdLabel=e.featureIdLabel,n.instanceFeatureIdLabel=e.instanceFeatureIdLabel,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.shadows=e.shadows,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection,n.debugWireframe=e.debugWireframe,n.showOutline=e.showOutline,n.outlineColor=e.outlineColor,n.pointCloudShading=e.pointCloudShading;const o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,c(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),c(o)&&c(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0);const r=e.clippingPolygons;c(r)&&i.clippingPolygonsDirty&&(n._clippingPolygons=r.enabled&&i._isClippedByPolygon?r:void 0),c(r)&&c(n._clippingPolygons)&&n._clippingPolygons!==r&&(n._clippingPolygons=r,n._clippingPolygonsState=0),n.update(t),!this._ready&&n.ready&&(n.activeAnimations.addAll({loop:Wf.REPEAT}),this._ready=!0)};zi.prototype.isDestroyed=function(){return!1};zi.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),ve(this)};zi.fromGltf=async function(e,t,n,i){const o=new zi(e,t,n),s=$0(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const l=await In.fromGltfAsync(s);return o._model=l,o};zi.fromB3dm=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=l;const u=await In.fromB3dm(a);return r._model=u,r};zi.fromI3dm=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await In.fromI3dm(a);return r._model=l,r};zi.fromPnts=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await In.fromPnts(a);return r._model=l,r};zi.fromGeoJson=async function(e,t,n,i){const o=new zi(e,t,n),s=$0(e,t,o,{geoJson:i,resource:n}),a=await In.fromGeoJson(s);return o._model=a,o};zi.prototype.pick=function(e,t,n){if(!c(this._model)||!this._ready)return;const i=t.verticalExaggeration,o=t.verticalExaggerationRelativeHeight;return this._model.pick(e,t,i,o,ae.WGS84,n)};function $0(e,t,n,i){const o={cull:!1,releaseGltfJson:!0,opaquePass:xe.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._modelUpAxis,forwardAxis:e._modelForwardAxis,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,clippingPlanes:e.clippingPlanes,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection,enableDebugWireframe:e._enableDebugWireframe,debugWireframe:e.debugWireframe,projectTo2D:e._projectTo2D,enablePick:e._enablePick,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor};return jt(i,o)}function Dc(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Dc.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(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});Dc.fromJson=function(e,t,n,i){const o=new Dc(e,t,n);return o._tileset.loadTileset(o._resource,i,o._tile),o._ready=!0,o};Dc.prototype.hasProperty=function(e,t){return!1};Dc.prototype.getFeature=function(e){};Dc.prototype.applyDebugSettings=function(e,t){};Dc.prototype.applyStyle=function(e){};Dc.prototype.update=function(e,t){};Dc.prototype.pick=function(e,t,n){};Dc.prototype.isDestroyed=function(){return!1};Dc.prototype.destroy=function(){return ve(this)};const exe=`uniform sampler2D u_atlas; #ifdef VECTOR_TILE uniform vec4 u_highlightColor; #endif in vec2 v_textureCoordinates; in vec4 v_pickColor; in vec4 v_color; #ifdef SDF in vec4 v_outlineColor; in float v_outlineWidth; #endif #ifdef FRAGMENT_DEPTH_CHECK in vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates in vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs) in vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize in mat2 v_rotationMatrix; const float SHIFT_LEFT12 = 4096.0; const float SHIFT_LEFT1 = 2.0; const float SHIFT_RIGHT12 = 1.0 / 4096.0; const float SHIFT_RIGHT1 = 1.0 / 2.0; float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize) { vec2 lookupVector = imageSize * (depthLookupST - adjustedST); lookupVector = v_rotationMatrix * lookupVector; vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y)); // aligns label glyph with bounding rectangle. Will be zero for billboards because dimensions and imageSize will be equal vec2 translation = v_originTextureCoordinateAndTranslate.zw; if (applyTranslate) { // this is only needed for labels where the horizontal origin is not LEFT // it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0)); } vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw; float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st)); if (logDepthOrDepth == 0.0) { return 0.0; // not on the globe } vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); return eyeCoordinate.z / eyeCoordinate.w; } #endif #ifdef SDF // Get the distance from the edge of a glyph at a given position sampling an SDF texture. float getDistance(vec2 position) { return texture(u_atlas, position).r; } // Samples the sdf texture at the given position and produces a color based on the fill color and the outline. vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing) { float distance = getDistance(position); if (outlineWidth > 0.0) { // Don't get the outline edge exceed the SDF_EDGE float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE); float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance); vec4 sdfColor = mix(outlineColor, v_color, outlineFactor); float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance); return vec4(sdfColor.rgb, sdfColor.a * alpha); } else { float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance); return vec4(v_color.rgb, v_color.a * alpha); } } #endif void main() { vec4 color = texture(u_atlas, v_textureCoordinates); #ifdef SDF float outlineWidth = v_outlineWidth; vec4 outlineColor = v_outlineColor; // Get the current distance float distance = getDistance(v_textureCoordinates); #if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives)) float smoothing = fwidth(distance); // Get an offset that is approximately half the distance to the neighbor pixels // 0.354 is approximately half of 1/sqrt(2) vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates)); // Sample the center point vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing); // Sample the 4 neighbors vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing); vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing); vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing); vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing); // Equally weight the center sample and the 4 neighboring samples color = (center + color1 + color2 + color3 + color4)/5.0; #else // If no derivatives available (IE 10?), just do a single sample float smoothing = 1.0/32.0; color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing); #endif color = czm_gammaCorrect(color); #else color = czm_gammaCorrect(color); color *= czm_gammaCorrect(v_color); #endif // Fully transparent parts of the billboard are not pickable. #if !defined(OPAQUE) && !defined(TRANSLUCENT) if (color.a < 0.005) // matches 0/255 and 1/255 { discard; } #else // The billboard is rendered twice. The opaque pass discards translucent fragments // and the translucent pass discards opaque fragments. #ifdef OPAQUE if (color.a < 0.995) // matches < 254/255 { discard; } #else if (color.a >= 0.995) // matches 254/255 and 255/255 { discard; } #endif #endif #ifdef VECTOR_TILE color *= u_highlightColor; #endif out_FragColor = color; #ifdef LOG_DEPTH czm_writeLogDepth(); #endif #ifdef FRAGMENT_DEPTH_CHECK float temp = v_compressed.y; temp = temp * SHIFT_RIGHT1; float temp2 = (temp - floor(temp)) * SHIFT_LEFT1; bool enableDepthTest = temp2 != 0.0; bool applyTranslate = floor(temp) != 0.0; if (enableDepthTest) { temp = v_compressed.z; temp = temp * SHIFT_RIGHT12; vec2 dimensions; dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12; dimensions.x = floor(temp); temp = v_compressed.w; temp = temp * SHIFT_RIGHT12; vec2 imageSize; imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12; imageSize.x = floor(temp); vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy; adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y); float epsilonEyeDepth = v_compressed.x + czm_epsilon1; float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize); // negative values go into the screen if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth) { float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth) { float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth) { discard; } } } } #endif } `,txe=`#ifdef INSTANCED in vec2 direction; #endif in vec4 positionHighAndScale; in vec4 positionLowAndRotation; in vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset) in vec4 compressedAttribute1; // aligned axis, translucency by distance, image width in vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free in vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range) in vec4 scaleByDistance; // near, nearScale, far, farScale in vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale in vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions in vec2 sdf; // sdf outline color (rgb) and width (w) #if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK) in vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates #endif #ifdef VECTOR_TILE in float a_batchId; #endif out vec2 v_textureCoordinates; #ifdef FRAGMENT_DEPTH_CHECK out vec4 v_textureCoordinateBounds; out vec4 v_originTextureCoordinateAndTranslate; out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize out mat2 v_rotationMatrix; #endif out vec4 v_pickColor; out vec4 v_color; #ifdef SDF out vec4 v_outlineColor; out float v_outlineWidth; #endif const float UPPER_BOUND = 32768.0; const float SHIFT_LEFT16 = 65536.0; const float SHIFT_LEFT12 = 4096.0; const float SHIFT_LEFT8 = 256.0; const float SHIFT_LEFT7 = 128.0; const float SHIFT_LEFT5 = 32.0; const float SHIFT_LEFT3 = 8.0; const float SHIFT_LEFT2 = 4.0; const float SHIFT_LEFT1 = 2.0; const float SHIFT_RIGHT12 = 1.0 / 4096.0; const float SHIFT_RIGHT8 = 1.0 / 256.0; const float SHIFT_RIGHT7 = 1.0 / 128.0; const float SHIFT_RIGHT5 = 1.0 / 32.0; const float SHIFT_RIGHT3 = 1.0 / 8.0; const float SHIFT_RIGHT2 = 1.0 / 4.0; const float SHIFT_RIGHT1 = 1.0 / 2.0; vec4 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) { // Note the halfSize cannot be computed in JavaScript because it is sent via // compressed vertex attributes that coerce it to an integer. vec2 halfSize = imageSize * scale * 0.5; halfSize *= ((direction * 2.0) - 1.0); vec2 originTranslate = origin * abs(halfSize); #if defined(ROTATION) || defined(ALIGNED_AXIS) if (validAlignedAxis || rotation != 0.0) { float angle = rotation; if (validAlignedAxis) { vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0); angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) / (projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y)); } float cosTheta = cos(angle); float sinTheta = sin(angle); rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta); halfSize = rotationMatrix * halfSize; } else { rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0); } #endif mpp = czm_metersPerPixel(positionEC); positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp); positionEC.xy += (translate + pixelOffset) * mpp; return positionEC; } #ifdef VERTEX_DEPTH_CHECK float getGlobeDepth(vec4 positionEC) { vec4 posWC = czm_eyeToWindowCoordinates(positionEC); float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw)); if (globeDepth == 0.0) { return 0.0; // not on the globe } vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth); return eyeCoordinate.z / eyeCoordinate.w; } #endif void main() { // Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition // unpack attributes vec3 positionHigh = positionHighAndScale.xyz; vec3 positionLow = positionLowAndRotation.xyz; float scale = positionHighAndScale.w; #if defined(ROTATION) || defined(ALIGNED_AXIS) float rotation = positionLowAndRotation.w; #else float rotation = 0.0; #endif float compressed = compressedAttribute0.x; vec2 pixelOffset; pixelOffset.x = floor(compressed * SHIFT_RIGHT7); compressed -= pixelOffset.x * SHIFT_LEFT7; pixelOffset.x -= UPPER_BOUND; vec2 origin; origin.x = floor(compressed * SHIFT_RIGHT5); compressed -= origin.x * SHIFT_LEFT5; origin.y = floor(compressed * SHIFT_RIGHT3); compressed -= origin.y * SHIFT_LEFT3; #ifdef FRAGMENT_DEPTH_CHECK vec2 depthOrigin = origin.xy; #endif origin -= vec2(1.0); float show = floor(compressed * SHIFT_RIGHT2); compressed -= show * SHIFT_LEFT2; #ifdef INSTANCED vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w); vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w); vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange; #else vec2 direction; direction.x = floor(compressed * SHIFT_RIGHT1); direction.y = compressed - direction.x * SHIFT_LEFT1; vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w); #endif float temp = compressedAttribute0.y * SHIFT_RIGHT8; pixelOffset.y = -(floor(temp) - UPPER_BOUND); vec2 translate; translate.y = (temp - floor(temp)) * SHIFT_LEFT16; temp = compressedAttribute0.z * SHIFT_RIGHT8; translate.x = floor(temp) - UPPER_BOUND; translate.y += (temp - floor(temp)) * SHIFT_LEFT8; translate.y -= UPPER_BOUND; temp = compressedAttribute1.x * SHIFT_RIGHT8; float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2); vec2 imageSize = vec2(floor(temp), temp2); #ifdef FRAGMENT_DEPTH_CHECK float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2)); float applyTranslate = 0.0; if (labelHorizontalOrigin != 0.0) // is a billboard, so set apply translate to false { applyTranslate = 1.0; labelHorizontalOrigin -= 2.0; depthOrigin.x = labelHorizontalOrigin + 1.0; } depthOrigin = vec2(1.0) - (depthOrigin * 0.5); #endif #ifdef EYE_DISTANCE_TRANSLUCENCY vec4 translucencyByDistance; translucencyByDistance.x = compressedAttribute1.z; translucencyByDistance.z = compressedAttribute1.w; translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0; temp = compressedAttribute1.y * SHIFT_RIGHT8; translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0; #endif #if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK) temp = compressedAttribute3.w; temp = temp * SHIFT_RIGHT12; vec2 dimensions; dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12; dimensions.x = floor(temp); #endif #ifdef ALIGNED_AXIS vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8)); temp = compressedAttribute2.z * SHIFT_RIGHT5; bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0; #else vec3 alignedAxis = vec3(0.0); bool validAlignedAxis = false; #endif vec4 pickColor; vec4 color; temp = compressedAttribute2.y; temp = temp * SHIFT_RIGHT8; pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8; pickColor.r = floor(temp); temp = compressedAttribute2.x; temp = temp * SHIFT_RIGHT8; color.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; color.g = (temp - floor(temp)) * SHIFT_LEFT8; color.r = floor(temp); temp = compressedAttribute2.z * SHIFT_RIGHT8; bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0; temp = floor(temp) * SHIFT_RIGHT8; pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8; pickColor /= 255.0; color.a = floor(temp); color /= 255.0; /////////////////////////////////////////////////////////////////////////// vec4 p = czm_translateRelativeToEye(positionHigh, positionLow); vec4 positionEC = czm_modelViewRelativeToEye * p; #if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK) float eyeDepth = positionEC.z; #endif positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz); positionEC.xyz *= show; /////////////////////////////////////////////////////////////////////////// #if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE) float lengthSq; if (czm_sceneMode == czm_sceneMode2D) { // 2D camera distance is a special case // treat all billboards as flattened to the z=0.0 plane lengthSq = czm_eyeHeight2D.y; } else { lengthSq = dot(positionEC.xyz, positionEC.xyz); } #endif #ifdef EYE_DISTANCE_SCALING float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq); scale *= distanceScale; translate *= distanceScale; // push vertex behind near plane for clipping if (scale == 0.0) { positionEC.xyz = vec3(0.0); } #endif float translucency = 1.0; #ifdef EYE_DISTANCE_TRANSLUCENCY translucency = czm_nearFarScalar(translucencyByDistance, lengthSq); // push vertex behind near plane for clipping if (translucency == 0.0) { positionEC.xyz = vec3(0.0); } #endif #ifdef EYE_DISTANCE_PIXEL_OFFSET float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq); pixelOffset *= pixelOffsetScale; #endif #ifdef DISTANCE_DISPLAY_CONDITION float nearSq = compressedAttribute3.x; float farSq = compressedAttribute3.y; if (lengthSq < nearSq || lengthSq > farSq) { positionEC.xyz = vec3(0.0); } #endif mat2 rotationMatrix; float mpp; #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = compressedAttribute3.z; #endif #ifdef VERTEX_DEPTH_CHECK if (lengthSq < disableDepthTestDistance) { float depthsilon = 10.0; vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy; vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp); float globeDepth1 = getGlobeDepth(pEC1); if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1) { vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp); float globeDepth2 = getGlobeDepth(pEC2); if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2) { vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp); float globeDepth3 = getGlobeDepth(pEC3); if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3) { positionEC.xyz = vec3(0.0); } } } } #endif positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp); gl_Position = czm_projection * positionEC; v_textureCoordinates = textureCoordinates; #ifdef LOG_DEPTH czm_vertexLogDepth(); #endif #ifdef DISABLE_DEPTH_DISTANCE if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) { disableDepthTestDistance = czm_minimumDisableDepthTestDistance; } if (disableDepthTestDistance != 0.0) { // Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w. float zclip = gl_Position.z / gl_Position.w; bool clipped = (zclip < -1.0 || zclip > 1.0); if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance))) { // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH v_depthFromNearPlusOne = 1.0; #endif } } #endif #ifdef FRAGMENT_DEPTH_CHECK if (sizeInMeters) { translate /= mpp; dimensions /= mpp; imageSize /= mpp; } #if defined(ROTATION) || defined(ALIGNED_AXIS) v_rotationMatrix = rotationMatrix; #else v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0); #endif float enableDepthCheck = 0.0; if (lengthSq < disableDepthTestDistance) { enableDepthCheck = 1.0; } float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12)); float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12)); float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12)); float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12)); v_compressed.x = eyeDepth; v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck; v_compressed.z = dw * SHIFT_LEFT12 + dh; v_compressed.w = iw * SHIFT_LEFT12 + ih; v_originTextureCoordinateAndTranslate.xy = depthOrigin; v_originTextureCoordinateAndTranslate.zw = translate; v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate; #endif #ifdef SDF vec4 outlineColor; float outlineWidth; temp = sdf.x; temp = temp * SHIFT_RIGHT8; outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8; outlineColor.r = floor(temp); temp = sdf.y; temp = temp * SHIFT_RIGHT8; float temp3 = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8; outlineColor.a = floor(temp); outlineColor /= 255.0; v_outlineWidth = outlineWidth / 255.0; v_outlineColor = outlineColor; v_outlineColor.a *= translucency; #endif v_pickColor = pickColor; v_color = color; v_color.a *= translucency; } `;function St(e,t){if(e=y(e,y.EMPTY_OBJECT),c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=vt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=vt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");o=vt.clone(o)}if(c(r)){if(r.far<=r.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Pt.clone(r)}this._show=y(e.show,!0),this._position=d.clone(y(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._pixelOffset=H.clone(y(e.pixelOffset,H.ZERO)),this._translate=new H(0,0),this._eyeOffset=d.clone(y(e.eyeOffset,d.ZERO)),this._heightReference=y(e.heightReference,gt.NONE),this._verticalOrigin=y(e.verticalOrigin,si.CENTER),this._horizontalOrigin=y(e.horizontalOrigin,Fs.CENTER),this._scale=y(e.scale,1),this._color=z.clone(y(e.color,z.WHITE)),this._rotation=y(e.rotation,0),this._alignedAxis=d.clone(y(e.alignedAxis,d.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=y(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=y(e.collection,t),this._pickId=void 0,this._pickPrimitive=y(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 s=e.image;let a=e.imageId;c(s)&&(c(a)||(typeof s=="string"?a=s:c(s.src)?a=s.src:a=Wr()),this._imageId=a,this._image=s),c(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),c(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=oe.SCENE3D,this._clusterShow=!0,this._outlineColor=z.clone(y(e.outlineColor,z.BLACK)),this._outlineWidth=y(e.outlineWidth,0),this._updateClamping()}const TF=St.SHOW_INDEX=0,qA=St.POSITION_INDEX=1,G5=St.PIXEL_OFFSET_INDEX=2,nxe=St.EYE_OFFSET_INDEX=3,ixe=St.HORIZONTAL_ORIGIN_INDEX=4,oxe=St.VERTICAL_ORIGIN_INDEX=5,rxe=St.SCALE_INDEX=6,YA=St.IMAGE_INDEX_INDEX=7,AF=St.COLOR_INDEX=8,sxe=St.ROTATION_INDEX=9,axe=St.ALIGNED_AXIS_INDEX=10,cxe=St.SCALE_BY_DISTANCE_INDEX=11,lxe=St.TRANSLUCENCY_BY_DISTANCE_INDEX=12,uxe=St.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,dxe=St.DISTANCE_DISPLAY_CONDITION=14,hxe=St.DISABLE_DEPTH_DISTANCE=15;St.TEXTURE_COORDINATE_BOUNDS=16;const xF=St.SDF_INDEX=17;St.NUMBER_OF_PROPERTIES=18;function mi(e,t){const n=e._billboardCollection;c(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(St.prototype,{show:{get:function(){return this._show},set:function(e){A.typeOf.bool("value",e),this._show!==e&&(this._show=e,mi(this,TF))}},position:{get:function(){return this._position},set:function(e){A.typeOf.object("value",e);const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),this._updateClamping(),mi(this,qA))}},heightReference:{get:function(){return this._heightReference},set:function(e){A.typeOf.number("value",e);const t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),mi(this,qA))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){A.typeOf.object("value",e);const t=this._pixelOffset;H.equals(t,e)||(H.clone(e,t),mi(this,G5))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._scaleByDistance;vt.equals(t,e)||(this._scaleByDistance=vt.clone(e,t),mi(this,cxe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._translucencyByDistance;vt.equals(t,e)||(this._translucencyByDistance=vt.clone(e,t),mi(this,lxe))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;vt.equals(t,e)||(this._pixelOffsetScaleByDistance=vt.clone(e,t),mi(this,uxe))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){A.typeOf.object("value",e);const t=this._eyeOffset;d.equals(t,e)||(d.clone(e,t),mi(this,nxe))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){A.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,mi(this,ixe))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){A.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,mi(this,oxe))}},scale:{get:function(){return this._scale},set:function(e){A.typeOf.number("value",e),this._scale!==e&&(this._scale=e,mi(this,rxe))}},color:{get:function(){return this._color},set:function(e){A.typeOf.object("value",e);const t=this._color;z.equals(t,e)||(z.clone(e,t),mi(this,AF))}},rotation:{get:function(){return this._rotation},set:function(e){A.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,mi(this,sxe))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){A.typeOf.object("value",e);const t=this._alignedAxis;d.equals(t,e)||(d.clone(e,t),mi(this,axe))}},width:{get:function(){return y(this._width,this._imageWidth)},set:function(e){c(e)&&A.typeOf.number("value",e),this._width!==e&&(this._width=e,mi(this,YA))}},height:{get:function(){return y(this._height,this._imageHeight)},set:function(e){c(e)&&A.typeOf.number("value",e),this._height!==e&&(this._height=e,mi(this,YA))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){A.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,mi(this,AF))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!Pt.equals(e,this._distanceDisplayCondition)){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),mi(this,dxe)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(c(e)&&(A.typeOf.number("value",e),e<0))throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,mi(this,hxe))}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,c(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){c(e)?typeof e=="string"?this.setImage(e,e):e instanceof Ae?this.setImage(e.url,e):c(e.src)?this.setImage(e.src,e):this.setImage(Wr(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,mi(this,YA))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition),mi(this,qA)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,mi(this,TF))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),mi(this,xF))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,mi(this,xF))}}});St.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};St.prototype._updateClamping=function(){St._updateClamping(this._billboardCollection,this)};const $A=new he;St._updateClamping=function(e,t){const n=e._scene;if(!c(n)){if(t._heightReference!==gt.NONE)throw new E("Height reference is not supported without a scene.");return}const i=n.globe,o=y(i==null?void 0:i.ellipsoid,ae.WGS84),r=n.frameState.mode,s=r!==t._mode;if(t._mode=r,(t._heightReference===gt.NONE||s)&&c(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===gt.NONE||!c(t._position))return;c(t._removeCallbackFunc)&&t._removeCallbackFunc();const a=o.cartesianToCartographic(t._position);if(!c(a)){t._actualClampedPosition=void 0;return}function l(h){const f=o.cartographicToCartesian(h,t._clampedPosition);zP(t._heightReference)&&(t._mode===oe.SCENE3D?(h.height+=a.height,o.cartographicToCartesian(h,f)):f.x+=a.height),t._clampedPosition=f}t._removeCallbackFunc=n.updateHeight(a,l,t._heightReference),he.clone(a,$A);const u=n.getHeight(a,t._heightReference);c(u)&&($A.height=u),l($A)};St.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let o;const r=this;function s(l){if(r._imageId!==t||r._image!==n||!Re.equals(r._imageSubRegion,i))return;const u=e.textureCoordinates[l];r._imageWidth=e.texture.width*u.width,r._imageHeight=e.texture.height*u.height,r._imageIndex=l,r._ready=!0,r._image=void 0,r._imageIndexPromise=void 0,mi(r,YA);const h=r._billboardCollection._scene;!c(h)||h.frameState.afterRender.push(()=>!0)}if(c(n)&&(o=e.addImage(t,n)),c(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,!c(o))return;const a=e.getImageIndex(t);if(c(a)&&!c(i)){s(a);return}o.then(s).catch(function(l){console.error(`Error loading image for billboard: ${l}`),r._imageIndexPromise=void 0})};St.prototype.setImage=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("image is required.");this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,c(this._billboardCollection._textureAtlas)&&this._loadImage())};St.prototype.setImageSubRegion=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("subRegion is required.");this._imageId===e&&Re.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=Re.clone(t),c(this._billboardCollection._textureAtlas)&&this._loadImage())};St.prototype._setTranslate=function(e){if(!c(e))throw new E("value is required.");const t=this._translate;H.equals(t,e)||(H.clone(e,t),mi(this,G5))};St.prototype._getActualPosition=function(){return c(this._clampedPosition)?this._clampedPosition:this._actualPosition};St.prototype._setActualPosition=function(e){c(this._clampedPosition)||d.clone(e,this._actualPosition),mi(this,qA)};const CF=new te;St._computeActualPosition=function(e,t,n,i){return c(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===oe.SCENE3D?t:(L.multiplyByPoint(i,t,CF),Ao.computeActualWgs84Position(n,CF))};const j5=new d;St._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=L.multiplyByPoint(e,t,j5),a=Ao.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(!!c(a))return H.add(a,i,a),a};const TT=new H(0,0);St.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;if(c(t)||(t=new H),!c(n))throw new E("Billboard must be in a collection. Was it removed?");if(!c(e))throw new E("scene is required.");H.clone(this._pixelOffset,TT),H.add(TT,this._translate,TT);let i=n.modelMatrix,o=this._position;if(c(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==oe.SCENE3D)){const s=e.mapProjection,a=s.ellipsoid,l=s.unproject(o,$A);o=a.cartographicToCartesian(l,j5),i=L.IDENTITY}return St._computeScreenSpacePosition(i,o,this._eyeOffset,TT,e,t)};St.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height;const r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===Fs.RIGHT?s-=i:e.horizontalOrigin===Fs.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===si.BOTTOM||e.verticalOrigin===si.BASELINE?a-=o:e.verticalOrigin===si.CENTER&&(a-=o*.5),c(n)||(n=new Re),n.x=s,n.y=a,n.width=i,n.height=o,n};St.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.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&&Re.equals(this._imageSubRegion,e._imageSubRegion)&&z.equals(this._color,e._color)&&H.equals(this._pixelOffset,e._pixelOffset)&&H.equals(this._translate,e._translate)&&d.equals(this._eyeOffset,e._eyeOffset)&&vt.equals(this._scaleByDistance,e._scaleByDistance)&&vt.equals(this._translucencyByDistance,e._translucencyByDistance)&&vt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Pt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};St.prototype._destroy=function(){c(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),c(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const fxe={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},io=Object.freeze(fxe),pxe={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},Aa=Object.freeze(pxe);function Hu(e,t,n,i,o){this.bottomLeft=y(e,H.ZERO),this.topRight=y(t,H.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}const mxe=new H(16,16);function ou(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.borderWidthInPixels,1),n=y(e.initialSize,mxe);if(!c(e.context))throw new E("context is required.");if(t<0)throw new E("borderWidthInPixels must be greater than or equal to zero.");if(n.x<1||n.y<1)throw new E("initialSize must be greater than zero.");this._context=e.context,this._pixelFormat=y(e.pixelFormat,Ve.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=Wr(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties(ou.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return c(this._texture)||(this._texture=new xt({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}}});function _xe(e,t){const n=e._context,i=e.numberOfImages,o=2,r=e._borderWidthInPixels;if(i>0){const s=e._texture.width,a=e._texture.height,l=o*(s+t.width+r),u=o*(a+t.height+r),h=s/l,f=a/u,_=new Hu(new H(s+r,r),new H(l,a)),g=new Hu(new H,new H(l,a),e._root,_),m=new Hu(new H(r,a+r),new H(l,u)),b=new Hu(new H,new H(l,u),g,m);for(let C=0;Cs){t.childNode1=new Hu(new H(t.bottomLeft.x,t.bottomLeft.y),new H(t.bottomLeft.x+n.width,t.topRight.y));const a=t.bottomLeft.x+n.width+e._borderWidthInPixels;a0)&&(e._shaderDisableDepthDistance=!0,h===Number.POSITIVE_INFINITY&&(h=-1));let _,g;if(c(o._labelDimensions))g=o._labelDimensions.x,_=o._labelDimensions.y;else{let x=0,C=0;const w=o._imageIndex;if(w!==-1){const P=n[w];if(!c(P))throw new E(`Invalid billboard image index: ${w}`);x=P.height,C=P.width}_=Math.round(y(o.height,e._textureAtlas.texture.dimensions.y*x));const v=e._textureAtlas.texture.width;g=Math.round(y(o.width,v*C))}const m=Math.floor(R.clamp(g,0,gS)),b=Math.floor(R.clamp(_,0,gS)),T=m*gS+b;e._instanced?(r=o._index,s(r,a,l,h,T)):(r=o._index*4,s(r+0,a,l,h,T),s(r+1,a,l,h,T),s(r+2,a,l,h,T),s(r+3,a,l,h,T))}function f8(e,t,n,i,o){if(Np(o.heightReference)){const m=e._scene,b=t.context,T=t.globeTranslucencyState.translucent,x=c(m.globe)&&m.globe.depthTestAgainstTerrain;e._shaderClampToGround=b.depthTexture&&!T&&x}let r;const s=i[ni.textureCoordinateBoundsOrLabelTranslate];if(pt.maximumVertexTextureImageUnits>0){let m=0,b=0;c(o._labelTranslate)&&(m=o._labelTranslate.x,b=o._labelTranslate.y),e._instanced?(r=o._index,s(r,m,b,0,0)):(r=o._index*4,s(r+0,m,b,0,0),s(r+1,m,b,0,0),s(r+2,m,b,0,0),s(r+3,m,b,0,0));return}let a=0,l=0,u=0,h=0;const f=o._imageIndex;if(f!==-1){const m=n[f];if(!c(m))throw new E(`Invalid billboard image index: ${f}`);a=m.x,l=m.y,u=m.width,h=m.height}const _=a+u,g=l+h;e._instanced?(r=o._index,s(r,a,l,_,g)):(r=o._index*4,s(r+0,a,l,_,g),s(r+1,a,l,_,g),s(r+2,a,l,_,g),s(r+3,a,l,_,g))}function Mxe(e,t,n,i,o){if(!c(e._batchTable))return;const r=i[ni.a_batchId],s=o._batchIndex;let a;e._instanced?(a=o._index,r(a,s)):(a=o._index*4,r(a+0,s),r(a+1,s),r(a+2,s),r(a+3,s))}function p8(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[ni.sdf],a=o.outlineColor,l=o.outlineWidth,u=z.floatToByte(a.red),h=z.floatToByte(a.green),f=z.floatToByte(a.blue),_=u*s_+h*Jl+f,g=l/Aa.RADIUS,m=z.floatToByte(a.alpha)*s_+z.floatToByte(g)*Jl;e._instanced?(r=o._index,s(r,_,m)):(r=o._index*4,s(r+0,_+o8,m),s(r+1,_+r8,m),s(r+2,_+s8,m),s(r+3,_+a8,m))}function Fxe(e,t,n,i,o){n8(e,t,n,i,o),c8(e,t,n,i,o),l8(e,t,n,i,o),cD(e,t,n,i,o),lD(e,t,n,i,o),u8(e,t,n,i,o),d8(e,t,n,i,o),h8(e,t,n,i,o),f8(e,t,n,i,o),Mxe(e,t,n,i,o),p8(e,t,n,i,o)}function yS(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let l=0;l0){this._vaf=Pxe(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),f=this._vaf.writers;for(let M=0;M0){const M=kxe;M.length=0,(l[My]||l[Axe]||l[Txe])&&M.push(n8),(l[Rg]||l[Y5]||l[yxe]||l[bxe]||l[gxe])&&(M.push(c8),this._instanced&&M.push(lD)),(l[Rg]||l[xxe]||l[K5])&&(M.push(l8),M.push(cD)),(l[Rg]||l[X5])&&M.push(cD),l[$5]&&M.push(lD),l[Q5]&&M.push(u8),l[Z5]&&M.push(d8),(l[J5]||l[Cxe]||l[Rg]||l[My])&&M.push(h8),(l[Rg]||l[My])&&M.push(f8),l[e8]&&M.push(p8);const U=M.length;if(f=this._vaf.writers,a/n>.1){for(let B=0;Bn*1.5&&(s.length=n),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m,b=L.IDENTITY;e.mode===oe.SCENE3D?(b=this.modelMatrix,m=se.clone(this._baseVolumeWC,this._boundingVolume)):m=se.clone(this._baseVolume2D,this._boundingVolume),zxe(this,e,m);const T=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,T){this._blendOption===io.OPAQUE||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:J.LESS},depthMask:!0}):this._rsOpaque=void 0;const M=this._blendOption===io.TRANSLUCENT;this._blendOption===io.TRANSLUCENT||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:M?J.LEQUAL:J.LESS},depthMask:M,blending:Zn.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let x,C,w,v,P;const N=pt.maximumVertexTextureImageUnits>0;if(T||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){x=txe,C=exe,P=[],c(this._batchTable)&&(P.push("VECTOR_TILE"),x=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(x),C=this._batchTable.getFragmentShaderCallback(!1,void 0)(C)),w=new Oe({defines:P,sources:[x]}),this._instanced&&w.defines.push("INSTANCED"),this._shaderRotation&&w.defines.push("ROTATION"),this._shaderAlignedAxis&&w.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&w.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&w.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&w.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&w.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&w.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(N?w.defines.push("VERTEX_DEPTH_CHECK"):w.defines.push("FRAGMENT_DEPTH_CHECK"));const M=1-Aa.CUTOFF;this._sdf&&w.defines.push("SDF");const U=c(this._batchTable)?"VECTOR_TILE":"";this._blendOption===io.OPAQUE_AND_TRANSLUCENT&&(v=new Oe({defines:["OPAQUE",U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._sp=Jt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni}),v=new Oe({defines:["TRANSLUCENT",U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Jt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),this._blendOption===io.OPAQUE&&(v=new Oe({defines:[U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._sp=Jt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),this._blendOption===io.TRANSLUCENT&&(v=new Oe({defines:[U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Jt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),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 k=e.commandList;if(_.render||_.pick){const M=this._colorCommands,U=this._blendOption===io.OPAQUE,B=this._blendOption===io.OPAQUE_AND_TRANSLUCENT,S=this._vaf.va,D=S.length;let p=this._uniforms,I;c(this._batchTable)?(p=this._batchTable.getUniformMapCallback()(p),I=this._batchTable.getPickId()):I="v_pickColor",M.length=D;const O=B?D*2:D;for(let F=0;F0}},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){c(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=y(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,Vxe);i.height=i.height-t+e;const o=n.cartographicToCartesian(i);this._billboard.position=o,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],o],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=z.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&&Um(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}}});yo.defaultColor=z.WHITE;yo.defaultPointOutlineColor=z.BLACK;yo.defaultPointOutlineWidth=0;yo.defaultPointSize=8;function Um(e){const t=e._billboard;if(c(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(c(e._billboardImage))return;const n=y(e._color,yo.defaultColor),i=y(e._pointOutlineColor,yo.defaultPointOutlineColor),o=y(e._pointOutlineWidth,yo.defaultPointOutlineWidth),r=y(e._pointSize,yo.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,l=e._billboardOutlineWidth,u=e._billboardSize;if(z.equals(n,s)&&z.equals(i,a)&&o===l&&r===u)return;e._billboardColor=z.clone(n,e._billboardColor),e._billboardOutlineColor=z.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const h=n.alpha,f=n.toCssColorString(),_=i.toCssColorString(),g=JSON.stringify([f,r,_,o]);t.setImage(g,m8(h,f,_,o,r))}yo.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};yo.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};yo.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};yo.prototype.getPropertyInherited=function(e){return Ir.getPropertyInherited(this._content,this._batchId,e)};yo.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};yo.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};yo.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};yo.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function Hxe(e,t,n,i,o){const r=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),l=document.createElement("canvas"),u=100,h=r.width+u|0,f=3*a,_=f/2;l.width=h,l.height=f;const g=l.getContext("2d");g.font=n,g.fillStyle="white",g.fillRect(0,0,l.width+1,l.height+1),i&&(g.strokeStyle="black",g.lineWidth=e.lineWidth,g.strokeText(t,u/2,_)),o&&(g.fillStyle="black",g.fillText(t,u/2,_));const m=g.getImageData(0,0,h,f).data,b=m.length,T=h*4;let x,C,w,v;for(x=0;x=0;--x)if(m[x]!==255){v=x/T|0;break}let P=-1;for(x=0;x]/,o=[];let r="",s=vo.LTR,a="";const l=e.length;for(let u=0;u";case">":return"<"}}const Jxe="\u05D0-\u05EA",eCe="\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF",IF=new RegExp(`[${Jxe}${eCe}]`);function tCe(e){const t=e.split(` `);let n="";for(let i=0;iu+1?s[u+1].Type===vo.RTL?(l=f+l,a=0):(l=Fg(l,a,h.Word),a+=h.Word.length):l=Fg(l,0,f)):h.Type===vo.RTL?l=Fg(l,a,f):h.Type===vo.LTR?(l+=h.Word,a=l.length):(h.Type===vo.WEAK||h.Type===vo.BRACKETS)&&(u>0&&s[u-1].Type===vo.RTL?s.length>u+1?s[u+1].Type===vo.RTL?l=Fg(l,a,f):(l+=h.Word,a=l.length):l+=h.Word:(l+=h.Word,a=l.length))}n+=l,i=1){var F=p.charCodeAt(I-1),V=O;return 55296<=F&&F<=56319?(F-55296)*1024+(V-56320)+65536:V}return O}function S(p,I,O){var F=[p].concat(I).concat([O]),V=F[F.length-2],G=O,j=F.lastIndexOf(T);if(j>1&&F.slice(1,j).every(function(q){return q==r})&&[r,b,w].indexOf(p)==-1)return N;var W=F.lastIndexOf(s);if(W>0&&F.slice(1,W).every(function(q){return q==s})&&[m,s].indexOf(V)==-1)return F.filter(function(q){return q==s}).length%2==1?k:M;if(V==n&&G==i)return v;if(V==o||V==n||V==i)return G==T&&I.every(function(q){return q==r})?N:P;if(G==o||G==n||G==i)return P;if(V==l&&(G==l||G==u||G==f||G==_))return v;if((V==f||V==u)&&(G==u||G==h))return v;if((V==_||V==h)&&G==h)return v;if(G==r||G==x)return v;if(G==a)return v;if(V==m)return v;var X=F.indexOf(r)!=-1?F.lastIndexOf(r)-1:F.length-2;return[b,w].indexOf(F[X])!=-1&&F.slice(X+1,-1).every(function(q){return q==r})&&G==T||V==x&&[C,w].indexOf(G)!=-1?v:I.indexOf(s)!=-1?N:V==s&&G==s?v:P}this.nextBreak=function(p,I){if(I===void 0&&(I=0),I<0)return 0;if(I>=p.length-1)return p.length;for(var O=D(B(p,I)),F=[],V=I+1;V0;let f=t._backgroundBillboard;const _=e._backgroundBillboardCollection;h?(c(f)||(f=_.add({collection:e,image:y8,imageSubRegion:sCe}),t._backgroundBillboard=f),f.color=t._backgroundColor,f.show=t._show,f.position=t._position,f.eyeOffset=t._eyeOffset,f.pixelOffset=t._pixelOffset,f.horizontalOrigin=Fs.LEFT,f.verticalOrigin=t._verticalOrigin,f.heightReference=t._heightReference,f.scale=t.totalScale,f.pickPrimitive=t,f.id=t._id,f.translucencyByDistance=t._translucencyByDistance,f.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,f.scaleByDistance=t._scaleByDistance,f.distanceDisplayCondition=t._distanceDisplayCondition,f.disableDepthTestDistance=t._disableDepthTestDistance,f.clusterShow=t.clusterShow):c(f)&&(_.remove(f),t._backgroundBillboard=f=void 0);const g=e._glyphTextureCache;for(u=0;u0&&w.height>0){const v=jxe(w,{cutoff:Aa.CUTOFF,radius:Aa.RADIUS}),P=w.getContext("2d"),N=w.width,k=w.height,M=P.getImageData(0,0,N,k);for(let U=0;U0?C=w.pop():(C=e._billboardCollection.add({collection:e}),C._labelDimensions=new H,C._labelTranslate=new H),a.billboard=C),C.show=t._show,C.position=t._position,C.eyeOffset=t._eyeOffset,C.pixelOffset=t._pixelOffset,C.horizontalOrigin=Fs.LEFT,C.verticalOrigin=t._verticalOrigin,C.heightReference=t._heightReference,C.scale=t.totalScale,C.pickPrimitive=t,C.id=t._id,C.image=T,C.translucencyByDistance=t._translucencyByDistance,C.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,C.scaleByDistance=t._scaleByDistance,C.distanceDisplayCondition=t._distanceDisplayCondition,C.disableDepthTestDistance=t._disableDepthTestDistance,C._batchIndex=t._batchIndex,C.outlineColor=t.outlineColor,t.style===dl.FILL_AND_OUTLINE?(C.color=t._fillColor,C.outlineWidth=t.outlineWidth):t.style===dl.FILL?(C.color=t._fillColor,C.outlineWidth=0):t.style===dl.OUTLINE&&(C.color=z.TRANSPARENT,C.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function DF(e,t,n){return t===Fs.CENTER?-e/2:t===Fs.RIGHT?-(e+n.x):n.x}const Mi=new H,hCe=new H;function fCe(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let l=Number.NEGATIVE_INFINITY,u=0,h=1,f;const _=t.length,g=e._backgroundBillboard,m=H.clone(c(g)?e._backgroundPadding:H.ZERO,hCe);for(m.x/=e._relativeSize,m.y/=e._relativeSize,f=0;f<_;++f)n.charAt(f)===` `?(a.push(r),++h,r=0):(i=t[f],o=i.dimensions,u=Math.max(u,o.height-o.descent),l=Math.max(l,o.descent),r+=o.width-o.minx,f<_-1&&(r+=t[f+1].dimensions.minx),s=Math.max(s,r));a.push(r);const b=u+l,T=e.totalScale,x=e._horizontalOrigin,C=e._verticalOrigin;let w=0,v=a[w],P=DF(v,x,m);const N=(c(e._lineHeight)?e._lineHeight:rCe*e._fontSize)/e._relativeSize,k=N*(h-1);let M=s,U=b+k;c(g)&&(M+=m.x*2,U+=m.y*2,g._labelHorizontalOrigin=x),Mi.x=P*T,Mi.y=0;let B=!0,S=0;for(f=0;f<_;++f)if(n.charAt(f)===` `)++w,S+=N,v=a[w],P=DF(v,x,m),Mi.x=P*T,B=!0;else if(i=t[f],o=i.dimensions,C===si.TOP?(Mi.y=o.height-u-m.y,Mi.y+=Aa.PADDING):C===si.CENTER?Mi.y=(k+o.height-u)/2:C===si.BASELINE?(Mi.y=k,Mi.y-=Aa.PADDING):(Mi.y=k+l+m.y,Mi.y-=Aa.PADDING),Mi.y=(Mi.y-o.descent-S)*T,B&&(Mi.x-=Aa.PADDING*T,B=!1),c(i.billboard)&&(i.billboard._setTranslate(Mi),i.billboard._labelDimensions.x=M,i.billboard._labelDimensions.y=U,i.billboard._labelHorizontalOrigin=x),f<_-1){const D=t[f+1];Mi.x+=(o.width-o.minx+D.dimensions.minx)*T}if(c(g)&&n.split(` `).join("").length>0&&(x===Fs.CENTER?P=-s/2-m.x:x===Fs.RIGHT?P=-(s+m.x*2):P=0,Mi.x=P*T,C===si.TOP?Mi.y=b-u-l:C===si.CENTER?Mi.y=(b-u)/2-l:C===si.BASELINE?Mi.y=-m.y-l:Mi.y=0,Mi.y=Mi.y*T,g.width=M,g.height=U,g._setTranslate(Mi),g._labelTranslate=H.clone(Mi,g._labelTranslate)),Np(e.heightReference))for(f=0;f<_;++f){i=t[f];const D=i.billboard;c(D)&&(D._labelTranslate=H.clone(Mi,D._labelTranslate))}}function b8(e,t){const n=t._glyphs;for(let i=0,o=n.length;i0?io.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Ga.prototype.isDestroyed=function(){return!1};Ga.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(),ve(this)};const pCe=`in vec3 position3DHigh; in vec3 position3DLow; in vec3 position2DHigh; in vec3 position2DLow; in vec3 prevPosition3DHigh; in vec3 prevPosition3DLow; in vec3 prevPosition2DHigh; in vec3 prevPosition2DLow; in vec3 nextPosition3DHigh; in vec3 nextPosition3DLow; in vec3 nextPosition2DHigh; in vec3 nextPosition2DLow; in vec4 texCoordExpandAndBatchIndex; out vec2 v_st; out float v_width; out vec4 v_pickColor; out float v_polylineAngle; void main() { float texCoord = texCoordExpandAndBatchIndex.x; float expandDir = texCoordExpandAndBatchIndex.y; bool usePrev = texCoordExpandAndBatchIndex.z < 0.0; float batchTableIndex = texCoordExpandAndBatchIndex.w; vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex); float width = widthAndShow.x + 0.5; float show = widthAndShow.y; if (width < 1.0) { show = 0.0; } vec4 pickColor = batchTable_getPickColor(batchTableIndex); vec4 p, prev, next; if (czm_morphTime == 1.0) { p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz); prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz); next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz); } else if (czm_morphTime == 0.0) { p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy); next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy); } else { p = czm_columbusViewMorph( czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy), czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz), czm_morphTime); prev = czm_columbusViewMorph( czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy), czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz), czm_morphTime); next = czm_columbusViewMorph( czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy), czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz), czm_morphTime); } #ifdef DISTANCE_DISPLAY_CONDITION vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex); vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex); vec3 centerLow = centerLowAndRadius.xyz; float radius = centerLowAndRadius.w; vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex); float lengthSq; if (czm_sceneMode == czm_sceneMode2D) { lengthSq = czm_eyeHeight2D.y; } else { vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz); lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius); } float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; if (lengthSq < nearSq || lengthSq > farSq) { show = 0.0; } #endif float polylineAngle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; v_st.s = texCoord; v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w); v_width = width; v_pickColor = pickColor; v_polylineAngle = polylineAngle; } `,ks={};ks.numberOfPoints=function(e,t,n){const i=d.distance(e,t);return Math.ceil(i/n)};ks.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))))};const mCe=new he;ks.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let o=0;o0){t=y(t,L.IDENTITY);const o=L.inverseTransformation(t,_Ce),r=L.multiplyByPoint(o,d.ZERO,gCe),s=d.normalize(L.multiplyByPointAsVector(o,d.UNIT_Y,PF),PF),a=_t.fromPointNormal(r,s,yCe),l=d.normalize(L.multiplyByPointAsVector(o,d.UNIT_X,OF),OF),u=_t.fromPointNormal(r,l,bCe);let h=1;n.push(d.clone(e[0]));let f=n[0];const _=e.length;for(let g=1;g<_;++g){const m=e[g];if(_t.getPointDistance(u,f)<0||_t.getPointDistance(u,m)<0){const b=Ei.lineSegmentPlane(f,m,a,TCe);if(c(b)){const T=d.multiplyByScalar(s,5e-9,ACe);_t.getPointDistance(a,f)<0&&d.negate(T,T),n.push(d.add(b,T,new d)),i.push(h+1),d.negate(T,T),n.push(d.add(b,T,new d)),h=1}}n.push(d.clone(e[g])),h++,f=m}i.push(h)}return{positions:n,lengths:i}};ks.generateArc=function(e){c(e)||(e={});const t=e.positions;if(!c(t))throw new E("options.positions is required.");const n=t.length,i=y(e.ellipsoid,ae.WGS84);let o=y(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const b=i.scaleToGeodeticSurface(t[0],kO);if(o=r?o[0]:o,o!==0){const T=i.geodeticSurfaceNormal(b,Mh);d.multiplyByScalar(T,o,T),d.add(b,T,b)}return[b.x,b.y,b.z]}let s=e.minDistance;if(!c(s)){const b=y(e.granularity,R.RADIANS_PER_DEGREE);s=R.chordLength(b,i.maximumRadius)}let a=0,l;for(l=0;l2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(d.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;c(t)&&(i=L.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=Io.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(x8),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=se.fromPoints(this._actualPositions),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new se}const A8=$o.POSITION_INDEX=0,SCe=$o.SHOW_INDEX=1,vCe=$o.WIDTH_INDEX=2,ICe=$o.MATERIAL_INDEX=3,By=$o.POSITION_SIZE_INDEX=4,DCe=$o.DISTANCE_DISPLAY_CONDITION=5,x8=$o.NUMBER_OF_PROPERTIES=6;function Bu(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;c(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties($o.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");e!==this._show&&(this._show=e,Bu(this,SCe))}},positions:{get:function(){return this._positions},set:function(e){if(!c(e))throw new E("value is required.");let t=gs(e,d.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(d.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Bu(this,By),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=se.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Bu(this,A8),this.update()}},material:{get:function(){return this._material},set:function(e){if(!c(e))throw new E("material is required.");this._material!==e&&(this._material=e,Bu(this,ICe))}},width:{get:function(){return this._width},set:function(e){if(!c(e))throw new E("value is required.");const t=this._width;e!==t&&(this._width=e,Bu(this,vCe))}},loop:{get:function(){return this._loop},set:function(e){if(!c(e))throw new E("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!d.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(d.clone(t[0]))):t.length>2&&d.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Bu(this,By)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!c(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");Pt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),Bu(this,DCe))}}});$o.prototype.update=function(){let e=L.IDENTITY;c(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[A8]>0||this._propertiesChanged[By]>0;if((!L.equals(e,this._modelMatrix)||i)&&(this._segments=Io.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=se.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=L.clone(e,this._modelMatrix),this._segments.positions.length!==t)Bu(this,By);else{const o=n.length;for(let r=0;r2){if(o[hD]||o[RF]){const m=e.mode===oe.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,b=rn.fromCartesian(m.center,E8),T=te.fromElements(b.low.x,b.low.y,b.low.z,m.radius,w8);this._batchTable.setBatchedAttribute(i._index,2,b.high),this._batchTable.setBatchedAttribute(i._index,3,T)}if(o[RCe]){const m=S8;m.x=0,m.y=Number.MAX_VALUE;const b=i.distanceDisplayCondition;c(b)&&(m.x=b.near,m.y=b.far),this._batchTable.setBatchedAttribute(i._index,4,m)}}i._clean()}}l.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let l=0;l0){const j=U.isTranslucent();a>=s?(S=new Ze({owner:e}),n.push(S)):S=n[a],++a,D=jt(_(U._uniforms),e._uniformMap),S.boundingVolume=se.clone(zg,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=P,S.vertexArray=b.va,S.renderState=j?e._translucentRS:e._opaqueRS,S.pass=j?xe.TRANSLUCENT:xe.OPAQUE,S.debugShowBoundingVolume=h,S.pickId="v_pickColor",S.uniformMap=D,S.count=B,S.offset=v,v+=B,B=0,l=!0,r.push(S)}U=I._material,U.update(o),M=O}const F=I._locatorBuckets,V=F.length;for(let j=0;j0&&(a>=s?(S=new Ze({owner:e}),n.push(S)):S=n[a],++a,D=jt(_(U._uniforms),e._uniformMap),S.boundingVolume=se.clone(zg,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=P,S.vertexArray=b.va,S.renderState=U.isTranslucent()?e._translucentRS:e._opaqueRS,S.pass=U.isTranslucent()?xe.TRANSLUCENT:xe.OPAQUE,S.debugShowBoundingVolume=h,S.pickId="v_pickColor",S.uniformMap=D,S.count=B,S.offset=v,l=!0,r.push(S)),M=void 0}}n.length=a}la.prototype.isDestroyed=function(){return!1};la.prototype.destroy=function(){return v8(this),HO(this),I8(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),ve(this)};function FCe(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[hD]?(i.bufferUsage!==ke.STREAM_DRAW&&(t=!0,i.bufferUsage=ke.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==ke.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=ke.STATIC_DRAW):i.frameCount--),t}const MF=[0,0,0];function FF(e,t,n){e._createVertexArray=!1,HO(e),v8(e),UCe(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let l=0;const u=[[]];let h=0;const f=e._polylineBuckets;let _,g;for(_ in f)f.hasOwnProperty(_)&&(g=f[_],g.updateShader(t,r,s),h+=g.lengthOfPositions);if(h>0){const m=e._mode,b=new Float32Array(6*h*3),T=new Float32Array(h*4);let x,C=0,w=0,v=0;for(_ in f)if(f.hasOwnProperty(_)){g=f[_],g.write(b,T,C,w,v,r,t,n),m===oe.MORPHING&&(c(x)||(x=new Float32Array(6*h*3)),g.writeForMorph(x,C));const D=g.lengthOfPositions;C+=6*D*3,w+=D*4,v+=D*4,l=g.updateIndices(i,a,u,l)}const P=e._positionBufferUsage.bufferUsage,N=ke.STATIC_DRAW;e._positionBuffer=ct.createVertexBuffer({context:t,typedArray:b,usage:P});let k;c(x)&&(k=ct.createVertexBuffer({context:t,typedArray:x,usage:P})),e._texCoordExpandAndBatchIndexBuffer=ct.createVertexBuffer({context:t,typedArray:T,usage:N});const M=3*Float32Array.BYTES_PER_ELEMENT,U=4*Float32Array.BYTES_PER_ELEMENT;let B=0;const S=i.length;for(let D=0;D0){const p=new Uint16Array(o),I=ct.createIndexBuffer({context:t,typedArray:p,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});B+=a[D];const O=6*(D*(M*R.SIXTY_FOUR_KILOBYTES)-B*M),F=M+O,V=M+F,G=M+V,j=M+G,W=M+j,X=D*(U*R.SIXTY_FOUR_KILOBYTES)-B*U,q=[{index:Js.position3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:O,strideInBytes:6*M},{index:Js.position3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:F,strideInBytes:6*M},{index:Js.position2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:O,strideInBytes:6*M},{index:Js.position2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:F,strideInBytes:6*M},{index:Js.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:V,strideInBytes:6*M},{index:Js.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:G,strideInBytes:6*M},{index:Js.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:V,strideInBytes:6*M},{index:Js.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:G,strideInBytes:6*M},{index:Js.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Js.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Js.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Js.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Js.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:Z.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:X}];let ee,Y,ne,Q;m===oe.SCENE3D?(Y=e._positionBuffer,ee="vertexBuffer",ne=MF,Q="value"):m===oe.SCENE2D||m===oe.COLUMBUS_VIEW?(Y=MF,ee="value",ne=e._positionBuffer,Q="vertexBuffer"):(Y=k,ee="vertexBuffer",ne=e._positionBuffer,Q="vertexBuffer"),q[0][ee]=Y,q[1][ee]=Y,q[2][Q]=ne,q[3][Q]=ne,q[4][ee]=Y,q[5][ee]=Y,q[6][Q]=ne,q[7][Q]=ne,q[8][ee]=Y,q[9][ee]=Y,q[10][Q]=ne,q[11][Q]=ne;const le=new Ci({context:t,attributes:q,indexBuffer:I});e._vertexArrays.push({va:le,buckets:u[D]})}}}function BCe(e,t){return t instanceof xt?t.id:t}const AT=[];function zCe(e){const t=Se._uniformList[e.type],n=t.length;AT.length=2*n;let i=0;for(let o=0;o1){a.update();const l=a.material;let u=i[l.type];c(u)||(u=i[l.type]=new bu(l,t,n)),u.addPolyline(a)}}}function kCe(e,t){const n=t.mode;(e._mode!==n||!L.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=L.clone(e.modelMatrix),e._createVertexArray=!0)}function VO(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i=0,o;const r=e._polylines.length;for(let s=0;s0,T=g._index,x=this.getSegments(g,a),C=x.positions,w=x.lengths,v=C.length,P=g.getPickId(s).color;let N=0,k=0,M;for(let V=0;V0||Bo.x>0&&lc.x<0)&&d.clone(Bo,lc),(Bo.x<0&&uc.x>0||Bo.x>0&&uc.x<0)&&d.clone(Bo,uc));const X=j?2:0,q=W?2:4;for(let ee=X;ee2&&(r.setBatchedAttribute(T,2,p),r.setBatchedAttribute(T,3,I),r.setBatchedAttribute(T,4,O))}};const GCe=new d,jCe=new d,WCe=new d,BF=new d;bu.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r0&&(l=a[a.length-1]+1);const u=this.polylines,h=u.length;for(let f=0;f0)g[0]=b;else continue}else g=_._segments.lengths;const m=g.length;if(m>0){let b=0;for(let T=0;TR.SIXTY_FOUR_KILOBYTES&&(_._locatorBuckets.push({locator:r,count:b}),b=0,t.push(4),a=[],e.push(a),l=0,r.count=s,s=0,i=0,r=new TS(0,0,this),n[++o]=[r]),a.push(l,l+2,l+1),a.push(l+1,l+2,l+3),b+=6,s+=6,i+=6,l+=4}_._locatorBuckets.push({locator:r,count:b}),l+4>R.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),l=0,r.count=s,i=0,s=0,r=new TS(0,0,this),n[++o]=[r])}_._clean()}return r.count=s,i};bu.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let o=0;o0){e._boundingVolume2D=se.fromPoints(o,e._boundingVolume2D);const u=e._boundingVolume2D.center;e._boundingVolume2D.center=new d(u.z,u.x,u.y)}return mm.positions=o,mm.lengths=e._segments.lengths,mm};let UF;bu.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*R.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=UF;const l=6*s*3;!c(a)||a.lengthl&&(a=new Float32Array(a.buffer,0,l));const u=this.getSegments(t,i),h=u.positions,f=u.lengths;let _=0,g=0,m=0,b;s=h.length;for(let T=0;T0||Bo.x>0&&lc.x<0)&&d.clone(Bo,lc),(Bo.x<0&&uc.x>0||Bo.x>0&&uc.x<0)&&d.clone(Bo,uc));const v=C?2:0,P=w?2:4;for(let N=v;N{if(e.isDestroyed())return;e._positions=new Float64Array(a.positions);const l=e._billboardCollection,u=e._labelCollection,h=e._polylineCollection;n=e._positions;const f=e._batchIds,_=n.length/3;for(let g=0;g<_;++g){const m=f[g],b=d.unpack(n,g*3,KCe),T=l.add();T.position=b,T._batchIndex=m;const x=u.add();x.text=" ",x.position=b,x._batchIndex=m;const C=h.add();C.positions=[d.clone(b),d.clone(b)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}).catch(a=>{e.isDestroyed()||(e._error=a)})}nf.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a{if(e.isDestroyed())return;e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const m=new Float64Array(g.packedBuffer),b=m[0];aEe(e,m),e._indices=je.getSizeInBytes(b)===2?new Uint16Array(g.indices):new Uint32Array(g.indices),e._indexOffsets=new Uint32Array(g.indexOffsets),e._indexCounts=new Uint32Array(g.indexCounts),e._batchedPositions=new Float32Array(g.positions),e._vertexBatchIds=new Uint16Array(g.batchIds),dEe(e),e._ready=!0}).catch(g=>{e.isDestroyed()||(e._error=g)})}function dEe(e){c(e._primitive)||(e._primitive=new hu({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)}Ad.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Ad.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Ad.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Ad.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};Ad.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=uEe(this)),c(this._error)){const t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};Ad.prototype.isDestroyed=function(){return!1};Ad.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};const hEe=`in vec4 currentPosition; in vec4 previousPosition; in vec4 nextPosition; in vec2 expandAndWidth; in float a_batchId; uniform mat4 u_modifiedModelView; void main() { float expandDir = expandAndWidth.x; float width = abs(expandAndWidth.y) + 0.5; bool usePrev = expandAndWidth.y < 0.0; vec4 p = u_modifiedModelView * currentPosition; vec4 prev = u_modifiedModelView * previousPosition; vec4 next = u_modifiedModelView * nextPosition; float angle; vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; } `;function Pc(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,ae.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=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(Pc.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function fEe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ae.packedLength+d.packedLength,a=new Float64Array(s);let l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ae.pack(o,a,l),l+=ae.packedLength,d.pack(r,a,l),a}const pEe=new Kn("createVectorTilePolylines",5),km={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function mEe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=fEe(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=pEe.scheduleTask(l,a);if(!!c(u))return u.then(function(h){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(h.decodedPositions),e._decodedPositionOffsets=new Uint32Array(h.decodedPositionOffsets)),e._currentPositions=new Float32Array(h.currentPositions),e._previousPositions=new Float32Array(h.previousPositions),e._nextPositions=new Float32Array(h.nextPositions),e._expandAndWidth=new Float32Array(h.expandAndWidth),e._vertexBatchIds=new Uint16Array(h.batchIds);const f=h.indexDatatype;e._indices=f===je.UNSIGNED_SHORT?new Uint16Array(h.indices):new Uint32Array(h.indices),_Ee(e,t),e._ready=!0}).catch(h=>{e.isDestroyed()||(e._error=h)})}function _Ee(e,t){if(!c(e._va)){const n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices;let l=i.byteLength+n.byteLength+o.byteLength;l+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=l;const u=ct.createVertexBuffer({context:t,typedArray:i,usage:ke.STATIC_DRAW}),h=ct.createVertexBuffer({context:t,typedArray:n,usage:ke.STATIC_DRAW}),f=ct.createVertexBuffer({context:t,typedArray:o,usage:ke.STATIC_DRAW}),_=ct.createVertexBuffer({context:t,typedArray:r,usage:ke.STATIC_DRAW}),g=ct.createVertexBuffer({context:t,typedArray:s,usage:ke.STATIC_DRAW}),m=ct.createIndexBuffer({context:t,typedArray:a,usage:ke.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),b=[{index:km.previousPosition,vertexBuffer:u,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.currentPosition,vertexBuffer:h,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.nextPosition,vertexBuffer:f,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.expandAndWidth,vertexBuffer:_,componentDatatype:Z.FLOAT,componentsPerAttribute:2},{index:km.a_batchId,vertexBuffer:g,componentDatatype:Z.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Ci({context:t,attributes:b,indexBuffer:m}),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}}const Vg=new L,kF=new d;function gEe(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return L.clone(n,Vg),L.multiplyByPoint(Vg,e._center,kF),L.setTranslation(Vg,kF,Vg),Vg},u_highlightColor:function(){return e._highlightColor}})}function yEe(e){if(c(e._rs))return;const t={enabled:!0,factor:-5,units:-5};e._rs=Ue.fromCache({blending:Zn.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}const bEe=`uniform vec4 u_highlightColor; void main() { out_FragColor = u_highlightColor; } `;function TEe(e,t){if(c(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(hEe),o=n.getFragmentShaderCallback(!1,void 0,!1)(bEe),r=new Oe({defines:["VECTOR_TILE",Yt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[M0,i]}),s=new Oe({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:km})}function AEe(e,t){if(!c(e._command)){const n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new Ze({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:xe.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}Pc.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!c(n)||!c(i))return;let r,s;const a=n.length;let l=0,u=0;for(r=0;r // vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd); scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd)); vec3 miterPushNormal = czm_normal * normalize(scratchNormal); offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position)); // offset = widthEC offset = offset / dot(miterPushNormal, right); position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0))); gl_Position = czm_depthClamp(czm_projection * position); position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0); vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz; v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz)); v_rightPlaneEC = vec4(right, -dot(right, position.xyz)); position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0); vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz; v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz)); v_halfWidth = endFaceNormalAndHalfWidth.w; } `,vEe=`in vec4 v_startPlaneEC; in vec4 v_endPlaneEC; in vec4 v_rightPlaneEC; in float v_halfWidth; in vec3 v_volumeUpEC; uniform vec4 u_highlightColor; void main() { float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw))); // Discard for sky if (logDepthOrDepth == 0.0) { #ifdef DEBUG_SHOW_VOLUME out_FragColor = vec4(0.0, 0.0, 1.0, 0.5); return; #else // DEBUG_SHOW_VOLUME discard; #endif // DEBUG_SHOW_VOLUME } vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); eyeCoordinate /= eyeCoordinate.w; float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate); // Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC)); // Check distance of the eye coordinate against the right-facing plane float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz); // Check eye coordinate against the mitering planes float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz); float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz); if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) { #ifdef DEBUG_SHOW_VOLUME out_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5); return; #else // DEBUG_SHOW_VOLUME discard; #endif // DEBUG_SHOW_VOLUME } out_FragColor = u_highlightColor; czm_writeDepthClamp(); } `;function xd(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,ae.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 H(Ti._defaultMinTerrainHeight,Ti._defaultMaxTerrainHeight),this._boundingVolume=Ct.fromRectangle(e.rectangle,Ti._defaultMinTerrainHeight,Ti._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=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(xd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function IEe(e,t,n){const i=Ti.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;const a=e._boundingVolume,l=e._rectangle;Ct.fromRectangle(l,o,r,n,a)}function DEe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ae.packedLength+d.packedLength,a=new Float64Array(s);let l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ae.pack(o,a,l),l+=ae.packedLength,d.pack(r,a,l),a}const PEe=new Kn("createVectorTileClampedPolylines"),th={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function OEe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=DEe(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=PEe.scheduleTask(l,a);if(!!c(u))return u.then(function(h){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(h.decodedPositions),e._decodedPositionOffsets=new Uint32Array(h.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(h.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(h.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(h.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(h.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(h.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(h.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(h.vertexBatchIds);const f=h.indexDatatype;e._indices=f===je.UNSIGNED_SHORT?new Uint16Array(h.indices):new Uint32Array(h.indices),LEe(e,t),e._ready=!0}).catch(h=>{e.isDestroyed()||(e._error=h)})}function LEe(e,t){if(!c(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,l=e._vertexBatchIds,u=e._indices;let h=n.byteLength+i.byteLength;h+=o.byteLength+r.byteLength,h+=s.byteLength+a.byteLength,h+=l.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=h;const f=ct.createVertexBuffer({context:t,typedArray:n,usage:ke.STATIC_DRAW}),_=ct.createVertexBuffer({context:t,typedArray:i,usage:ke.STATIC_DRAW}),g=ct.createVertexBuffer({context:t,typedArray:o,usage:ke.STATIC_DRAW}),m=ct.createVertexBuffer({context:t,typedArray:r,usage:ke.STATIC_DRAW}),b=ct.createVertexBuffer({context:t,typedArray:s,usage:ke.STATIC_DRAW}),T=ct.createVertexBuffer({context:t,typedArray:a,usage:ke.STATIC_DRAW}),x=ct.createVertexBuffer({context:t,typedArray:l,usage:ke.STATIC_DRAW}),C=ct.createIndexBuffer({context:t,typedArray:u,usage:ke.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),w=[{index:th.startEllipsoidNormal,vertexBuffer:f,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:th.endEllipsoidNormal,vertexBuffer:_,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:th.startPositionAndHeight,vertexBuffer:g,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.endPositionAndHeight,vertexBuffer:m,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.startFaceNormalAndVertexCorner,vertexBuffer:b,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.endFaceNormalAndHalfWidth,vertexBuffer:T,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.a_batchId,vertexBuffer:x,componentDatatype:Z.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Ci({context:t,attributes:w,indexBuffer:C}),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}}const Hg=new L,VF=new d;function REe(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return L.clone(n,Hg),L.multiplyByPoint(Hg,e._center,VF),L.setTranslation(Hg,VF,Hg),Hg},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function HF(e){return Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.EQUAL,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})}function NEe(e){c(e._rs)||(e._rs=HF(!1),e._rs3DTiles=HF(!0))}function MEe(e,t){if(c(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(SEe),o=n.getFragmentShaderCallback(!1,void 0,!0)(vEe),r=new Oe({defines:["VECTOR_TILE",Yt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[M0,i]}),s=new Oe({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:th})}function FEe(e,t){let n=e._command;if(!c(e._command)){const o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new Ze({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:xe.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const r=Ze.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}const i=e._classificationType;(i===Ui.TERRAIN||i===Ui.BOTH)&&t.commandList.push(n),(i===Ui.CESIUM_3D_TILE||i===Ui.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}xd.prototype.getPositions=function(e){return Pc.getPolylinePositions(this,e)};xd.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o{e.isDestroyed()||(e._error=t)})}xd.prototype.update=function(e){const t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=VEe(this).then(OEe(this,t))),c(this._error)){const i=this._error;throw this._error=void 0,i}return}REe(this,t),MEe(this,t),NEe(this);const n=e.passes;(n.render||n.pick)&&FEe(this,e)};xd.prototype.isDestroyed=function(){return!1};xd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),ve(this)};const xS=32767,HEe=new he,GEe=new d;function jEe(e,t,n,i,o){const r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),l=e.subarray(2*r,3*r);En.zigZagDeltaDecode(s,a,l);const u=new Float64Array(e.length);for(let h=0;h0&&c(e.POLYGON_BATCH_IDS)){const _=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,_,s)}if(a>0&&c(e.POLYLINE_BATCH_IDS)){const _=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,_,a)}if(l>0&&c(e.POINT_BATCH_IDS)){const _=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,_,l)}const u=c(n)||c(i)||c(o),h=s>0&&!c(n)||a>0&&!c(i)||l>0&&!c(o);if(u&&h)throw new Te("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)){let _=0;if(!c(n)&&s>0)for(n=new Uint16Array(s),r=0;r0)for(i=new Uint16Array(a),r=0;r0)for(o=new Uint16Array(l),r=0;r0&&(x=sa(i,n,u),n+=u,h>0&&(C=new Uint8Array(t,n,h),C=new Uint8Array(C),n+=h));const w=y(b.POLYGONS_LENGTH,0),v=y(b.POLYLINES_LENGTH,0),P=y(b.POINTS_LENGTH,0),N=w+v+P,k=new Hn(e,N,x,C,WEe(e));if(e._batchTable=k,N===0)return;const M=new ef(b,T),U=M.getGlobalProperty("REGION");if(!c(U))throw new Te("Feature table global property: REGION must be defined");const B=ce.unpack(U),S=U[4],D=U[5],p=e._tile.computedTransform;let I=M.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(I)?(I=d.unpack(I),L.multiplyByPoint(p,I,I)):(I=ce.center(B),I.height=R.lerp(S,D,.5),I=ae.WGS84.cartographicToCartesian(I));const O=qEe(b,T);if(n+=(4-n%4)%4,w>0){M.featuresLength=w;const F=y(M.getPropertyArray("POLYGON_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_COUNT",Z.UNSIGNED_INT,1));if(!c(F))throw new Te("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const V=y(M.getPropertyArray("POLYGON_INDEX_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_INDEX_COUNT",Z.UNSIGNED_INT,1));if(!c(V))throw new Te("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const G=F.reduce(function(Y,ne){return Y+ne*2},0),j=V.reduce(function(Y,ne){return Y+ne},0),W=new Uint32Array(t,n,j);n+=f;const X=new Uint16Array(t,n,G);n+=_;let q,ee;c(b.POLYGON_MINIMUM_HEIGHTS)&&c(b.POLYGON_MAXIMUM_HEIGHTS)&&(q=M.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",Z.FLOAT,1),ee=M.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",Z.FLOAT,1)),e._polygons=new Ad({positions:X,counts:F,indexCounts:V,indices:W,minimumHeight:S,maximumHeight:D,polygonMinimumHeights:q,polygonMaximumHeights:ee,center:I,rectangle:B,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:k,batchIds:O.polygons,modelMatrix:p})}if(v>0){M.featuresLength=v;const F=y(M.getPropertyArray("POLYLINE_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYLINE_COUNT",Z.UNSIGNED_INT,1));if(!c(F))throw new Te("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let V=M.getPropertyArray("POLYLINE_WIDTHS",Z.UNSIGNED_SHORT,1);if(!c(V)){V=new Uint16Array(v);for(let ee=0;ee0){const F=new Uint16Array(t,n,P*3);n+=m,e._points=new nf({positions:F,batchIds:O.points,minimumHeight:S,maximumHeight:D,rectangle:B,batchTable:k})}}function GO(e){const t=e.featuresLength;if(!c(e._features)&&t>0){const n=new Array(t);c(e._polygons)&&e._polygons.createFeatures(e,n),c(e._polylines)&&e._polylines.createFeatures(e,n),c(e._points)&&e._points.createFeatures(e,n),e._features=n}}Pl.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Pl.prototype.getFeature=function(e){const t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return c(this._features)||GO(this),this._features[e]};Pl.prototype.applyDebugSettings=function(e,t){c(this._polygons)&&this._polygons.applyDebugSettings(e,t),c(this._polylines)&&this._polylines.applyDebugSettings(e,t),c(this._points)&&this._points.applyDebugSettings(e,t)};Pl.prototype.applyStyle=function(e){c(this._features)||GO(this),c(this._polygons)&&this._polygons.applyStyle(e,this._features),c(this._polylines)&&this._polylines.applyStyle(e,this._features),c(this._points)&&this._points.applyStyle(e,this._features)};Pl.prototype.update=function(e,t){let n=!0;c(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons.ready),c(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines.ready),c(this._points)&&(this._points.update(t),n=n&&this._points.ready),c(this._batchTable)&&n&&(c(this._features)||GO(this),this._batchTable.update(e,t),this._ready=!0)};Pl.prototype.pick=function(e,t,n){};Pl.prototype.getPolylinePositions=function(e){const t=this._polylines;if(!!c(t))return t.getPositions(e)};Pl.prototype.isDestroyed=function(){return!1};Pl.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(),ve(this)};function QEe(e,t,n,i,o,r){const s=t.length;let a=0;for(let l=0;l=0?i[r]:void 0}function wd(e){e=y(e,y.EMPTY_OBJECT);const t=e.tile,n=e.class;A.typeOf.object("options.tile",t),A.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(wd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});wd.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};wd.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};wd.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};wd.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};wd.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};wd.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};wd.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};function jO(e,t){const n=To(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!c(n))return;if(!c(e.schema)){jO._oneTimeWarning("findTileMetadata-missing-root-schema","Could not find a metadata schema for tile metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}const i=y(e.schema.classes,y.EMPTY_OBJECT);if(c(n.class)){const o=i[n.class];return new wd({tile:n,class:o})}}jO._oneTimeWarning=$n;function R8(e){const t=new Uint8Array(e);let n=xC(t);if(n==="glTF"&&(n="glb"),na.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=JEe(t);if(c(i.root))return{contentType:na.EXTERNAL_TILESET,jsonPayload:i};if(c(i.asset))return{contentType:na.GLTF,jsonPayload:i};if(c(i.tileAvailability))return{contentType:na.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(c(i.type))return{contentType:na.GEOJSON,jsonPayload:i};if(c(i.voxelTable))return{contentType:na.VOXEL_JSON,jsonPayload:i};throw new Te("Invalid tile content.")}function JEe(e){let t;try{t=sa(e)}catch{throw new Te("Invalid tile content.")}return t}function kc(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;const o=c(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;const r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),this._ready=!1,this._innerContentResources=new Array(r),this._serverKeys=new Array(r);for(let s=0;siwe(e,r,s)),o=await Promise.all(i);return e._contentsCreated=!0,e._contents=o.filter(c),o}async function iwe(e,t,n){if(!!c(t))try{const i=R8(t);if(i.contentType===na.EXTERNAL_TILESET)throw new Te("External tilesets are disallowed inside multiple contents");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===na.GEOMETRY||i.contentType===na.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const l=O8[i.contentType];c(i.binaryPayload)?a=await Promise.resolve(l(o,s,r,i.binaryPayload.buffer,0)):a=await Promise.resolve(l(o,s,r,i.jsonPayload));const u=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){const f=s.implicitSubtree,_=s.implicitCoordinates;a.metadata=f.getContentMetadataView(_,n)}else s.hasImplicitContent||(a.metadata=kC(o,u));const h=L8(o,u);return c(h)&&(a.group=new rO({metadata:h})),a}catch(i){N8(e,n,i)}}function N8(e,t,n){const i=e._tileset,o=e._innerContentResources[t].url,r=c(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0?i.tileFailed.raiseEvent({url:o,message:r}):(console.log(`A content failed to load: ${o}`),console.log(`Error: ${r}`))}kc.prototype.cancelRequests=function(){for(let e=0;ea?g=R.TWO_PI-l+a:g=a-l;const b=Math.ceil(g/t)+1,T=Math.ceil(m/t)+1,x=g/(b-1),C=m/(T-1),w=ce.northwest(e,r),v=ce.center(e,swe);(n!==0||i!==0)&&(v.longitudeR.PI_OVER_TWO||h<-R.PI_OVER_TWO||h>R.PI_OVER_TWO)throw new E("Rotated rectangle is invalid. It crosses over either the north or south pole.");B.granYCos=S.granYCos,B.granYSin=S.granYSin,B.granXCos=S.granXCos,B.granXSin=S.granXSin,U.north=u,U.south=h,U.east=a,U.west=l}if(i!==0){n=n-i;const S=ce.northwest(U,s),D=qF(S,n,x,C,v,b,T);B.stGranYCos=D.granYCos,B.stGranXCos=D.granXCos,B.stGranYSin=D.granYSin,B.stGranXSin=D.granXSin,B.stNwCorner=S,B.stWest=D.west,B.stSouth=D.south}return B};const Ns=WO,awe=new se,cwe=new se,lwe=new d,uwe=new ce;function M8(e,t){const n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap;let a=i,l=2,u=0,h=4;r&&(l-=1,a-=1,u+=1,h-=2),s&&(l-=1,a-=1,u+=1,h-=2),u+=l*o+2*a-h;const f=new Float64Array(u*3);let _=0,g=0,m;const b=lwe;if(r)Ns.computePosition(t,n,!1,g,0,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;else for(m=0;m=0;m--)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;for(m=0,g=i-2;g>0;g--)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;const T=f.length/3*2,x=je.createTypedArray(f.length/3,T);let C=0;for(let v=0;v0){tc.longitude=(t.west+t.east)*.5,tc.latitude=u;const b=n.cartographicToCartesian(tc,gm.origin);d.clone(l,gm.direction);const T=_t.fromPointNormal(e.southwestCornerCartesian,e.westNormal,XF);Ei.rayPlane(gm,T,e.southwestCornerCartesian),h=n.geodeticSurfaceNormal(b,xT)}else h=n.geodeticSurfaceNormalCartographic(ce.southeast(t),xT);const f=d.cross(h,a,$F);d.normalize(f,e.southNormal);const _=t.north;let g;if(_<0){tc.longitude=(t.west+t.east)*.5,tc.latitude=_;const b=n.cartographicToCartesian(tc,gm.origin);d.negate(l,gm.direction);const T=_t.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,XF);Ei.rayPlane(gm,T,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(b,xT)}else g=n.geodeticSurfaceNormalCartographic(ce.northwest(t),xT);const m=d.cross(a,g,$F);d.normalize(m,e.northNormal)}const ywe=new d,bwe=new d,Twe=new d(0,-1,0),Awe=new d(0,0,-1),QF=new d;function xwe(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r=0;if(!ce.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,h=e.northeastCornerCartesian,f=e.westNormal,_=e.southNormal,g=e.eastNormal,m=e.northNormal;t.mode!==oe.SCENE3D&&(u=t.mapProjection.project(ce.southwest(e.rectangle),ywe),u.z=u.y,u.y=u.x,u.x=0,h=t.mapProjection.project(ce.northeast(e.rectangle),bwe),h.z=h.y,h.y=h.x,h.x=0,f=Twe,g=d.UNIT_Y,_=Awe,m=d.UNIT_Z);const b=d.subtract(i,u,QF),T=d.dot(b,f),x=d.dot(b,_),C=d.subtract(i,h,QF),w=d.dot(C,g),v=d.dot(C,m);T>0?r+=T*T:w>0&&(r+=w*w),x>0?r+=x*x:v>0&&(r+=v*v)}let s,a,l;if(t.mode===oe.SCENE3D?(s=o.height,a=e.minimumHeight,l=e.maximumHeight):(s=i.x,a=0,l=0),s>l){const u=s-l;r+=u*u}else if(s0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):_t.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),o=this._edgeNormals[1]);let r,s;for(r=0;r<4;r++)s=2+r,_t.getPointDistance(this._boundingPlanes[s],t)>0&&(n.push(s),i.push(this._planeVertices[s]),o=this._edgeNormals[s]);if(n.length===0)return 0;let a,l;if(n.length===1)return l=this._boundingPlanes[n[0]],a=LS(_t.projectPointOntoPlane(l,t,OS),i[0],l,o),d.distance(a,t);if(n.length===2){if(n[0]===0){const _=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=G8(t,_[0],_[1]),d.distance(a,t)}let h=Number.MAX_VALUE,f;for(r=0;r<2;r++)l=this._boundingPlanes[n[r]],a=LS(_t.projectPointOntoPlane(l,t,OS),i[r],l,this._edgeNormals[n[r]]),f=d.distanceSquared(a,t),f3)return a=LS(_t.projectPointOntoPlane(this._boundingPlanes[1],t,OS),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),d.distance(a,t);const u=n[1]===2&&n[2]===5?0:1;return n[0]===0?d.distance(t,this._vertices[(n[1]-2+u)%4]):d.distance(t,this._vertices[4+(n[1]-2+u)%4])};const Uwe=new d,kwe=new d;function G8(e,t,n){const i=d.subtract(n,t,Uwe),o=d.subtract(e,t,kwe);let r=d.dot(i,o);if(r<=0)return t;const s=d.dot(i,i);return r>=s?n:(r=r/s,new d((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const Vwe=new _t(d.UNIT_X,0);function LS(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let l=0;l0&&(m=!0,f+=u),s1||To(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=c(n.transform)?L.unpack(n.transform):L.clone(L.IDENTITY);const a=c(i)?i.computedTransform:e.modelMatrix,l=L.multiply(a,this.transform,new L),u=c(i)?i._initialTransform:L.IDENTITY;this._initialTransform=L.multiply(u,this.transform,new L),this.computedTransform=l,this.metadata=jO(e,n),this._verticalExaggeration=1,this._verticalExaggerationRelativeHeight=0,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,l),this._boundingVolume2D=void 0;let h;c(s)&&c(s.boundingVolume)&&(h=this.createBoundingVolume(s.boundingVolume,l)),this._contentBoundingVolume=h,this._contentBoundingVolume2D=void 0;let f;c(n.viewerRequestVolume)&&(f=this.createBoundingVolume(n.viewerRequestVolume,l)),this._viewerRequestVolume=f,this.geometricError=n.geometricError,this._geometricError=n.geometricError,c(this._geometricError)||(this._geometricError=c(i)?i._geometricError:e._geometricError,Ai._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let _;c(n.refine)?((n.refine==="replace"||n.refine==="add")&&Ai._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),_=n.refine.toUpperCase()==="REPLACE"?Vr.REPLACE:Vr.ADD):c(i)?_=i.refine:_=Vr.REPLACE,this.refine=_,this.children=[],this.parent=i;let g,m=!1,b,T,x;if(t=Ae.createIfNeeded(t),r)b=bo.UNLOADED,T=t.clone();else if(c(s)){let P=s.uri;c(s.url)&&(Ai._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),P=s.url),P===""?(Ai._deprecationWarning("contentUriEmpty","content.uri property is an empty string, which creates a circular dependency, making this tileset invalid. Omit the content property instead"),g=new Al(e,this),m=!0,b=bo.READY):(b=bo.UNLOADED,T=t.getDerivedResource({url:P}),x=Nn.getServerKey(T.getUrlComponent()))}else g=new Al(e,this),m=!0,b=bo.READY;this._content=g,this._contentResource=T,this._contentState=b,this._expiredContent=void 0,this._serverKey=x,this.hasEmptyContent=m,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.cacheNode=void 0;const C=n.expire;let w,v;c(C)&&(w=C.duration,c(C.date)&&(v=ie.fromIso8601(C.date))),this.expireDuration=w,this.expireDate=v,this.lastStyleTime=0,this._optimChildrenWithinParent=Km.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!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._wasSelectedLastFrame=!1,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._isClippedByPolygon=!1,this._clippingPlanesState=0,this._clippingPolygonsState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=z.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 ie,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Ai._deprecationWarning=Xh;Object.defineProperties(Ai.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return y(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},isVisible:{get:function(){return this._visible&&this._inRequestVolume}},extras:{get:function(){return this._header.extras}},color:{get:function(){return c(this._color)||(this._color=new z),z.clone(this._color)},set:function(e){this._color=z.clone(e,this._color),this._colorDirty=!0}},hasRenderableContent:{get:function(){return!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent}},contentAvailable:{get:function(){return this.contentReady&&this.hasRenderableContent||c(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===bo.READY}},contentUnloaded:{get:function(){return this._contentState===bo.UNLOADED}},hasUnloadedRenderableContent:{get:function(){return this.hasRenderableContent&&this.contentUnloaded}},contentExpired:{get:function(){return this._contentState===bo.EXPIRED}},contentFailed:{get:function(){return this._contentState===bo.FAILED}},commandsLength:{get:function(){return this._commandsLength}}});const jd=new d;function $we(e,t){const{tileset:n,boundingSphere:i}=e,{radius:o,center:r}=i,{camera:s}=t,a=d.multiplyByScalar(s.directionWC,e._centerZDepth,jd),l=d.add(s.positionWC,a,jd),u=d.subtract(l,r,jd);if(d.magnitude(u)>o){const v=d.normalize(u,jd),P=d.multiplyByScalar(v,o,jd),N=d.add(r,P,jd),k=d.subtract(N,s.positionWC,jd),M=d.normalize(k,jd);e._foveatedFactor=1-Math.abs(d.dot(s.directionWC,M))}else e._foveatedFactor=0;const _=e.refine===Vr.REPLACE,g=n.isSkippingLevelOfDetail;if(_&&!g||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&_&&g||n._pass===wr.PRELOAD_FLIGHT||n._pass===wr.PRELOAD)return!1;const m=1-Math.cos(s.frustum.fov*.5),b=n.foveatedConeSize*m;if(e._foveatedFactor<=b)return!1;const T=m-b,x=R.clamp((e._foveatedFactor-b)/T,0,1),C=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.memoryAdjustedScreenSpaceError,x),w=e._screenSpaceError===0&&c(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.memoryAdjustedScreenSpaceError-C<=w}const Y8=new ie;Ai.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,o=y(n,1),r=c(this.parent)?this.parent.geometricError:i._scaledGeometricError,s=t?r:this.geometricError;if(s===0)return 0;const{camera:a,context:l}=e;let u=a.frustum;const h=l.drawingBufferWidth,f=l.drawingBufferHeight*o;let _;if(e.mode===oe.SCENE2D||u instanceof It){const g=u.offCenterFrustum;c(g)&&(u=g);const m=Math.max(u.top-u.bottom,u.right-u.left)/Math.max(h,f);_=s/m}else{const g=Math.max(this._distanceToCamera,R.EPSILON7),m=u.sseDenominator;if(_=s*f/(g*m),i.dynamicScreenSpaceError){const b=i._dynamicScreenSpaceErrorComputedDensity,T=i.dynamicScreenSpaceErrorFactor,x=R.fog(g,b)*T;_-=x}}return _/=e.pixelRatio,_};function Xwe(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;const n=e.memoryAdjustedScreenSpaceError;let i=t._screenSpaceErrorProgressiveResolution>n;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const o=t.parent,r=t._screenSpaceErrorProgressiveResolution<=n,s=c(o)&&o._screenSpaceErrorProgressiveResolution>n;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}function Qwe(e,t){const n=t.parent,o=c(n)&&(!e.isSkippingLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}Ai.prototype.updateVisibility=function(e){const{parent:t,tileset:n}=this;if(this._updatedVisibilityFrame===n._updatedVisibilityFrame)return;const i=c(t)?t.computedTransform:n.modelMatrix,o=c(t)?t._visibilityPlaneMask:_o.MASK_INDETERMINATE;this.updateTransform(i,e),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,o),this._visible=this._visibilityPlaneMask!==_o.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=Qwe(n,this),this._priorityProgressiveResolution=Xwe(n,this),this.priorityDeferred=$we(this,e),this._updatedVisibilityFrame=n._updatedVisibilityFrame};Ai.prototype.updateExpiration=function(){if(c(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=ie.now(Y8);ie.lessThan(this.expireDate,e)&&(this._contentState=bo.EXPIRED,this._expiredContent=this._content)}};function Kwe(e){if(!c(e.expireDuration))return;const t=ie.now(Y8);ie.addSeconds(t,e.expireDuration,t),c(e.expireDate)?ie.lessThan(e.expireDate,t)&&ie.clone(t,e.expireDate):e.expireDate=ie.clone(t)}function Zwe(e){return function(){return e._priority}}Ai.prototype.requestContent=function(){if(!this.hasEmptyContent)return this.hasMultipleContents?Jwe(this):tSe(this)};function Jwe(e){let t=e._content;const n=e._tileset;if(!c(t)){const o=To(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new kc(n,e,e._contentResource.clone(),o),e._content=t}const i=t.requestInnerContents();if(!!c(i))return e._contentState=bo.LOADING,i.then(o=>{if(!e.isDestroyed()&&!!c(o))return e._contentState=bo.PROCESSING,t}).catch(o=>{if(!e.isDestroyed())throw e._contentState=bo.FAILED,o})}async function eSe(e,t,n,i,o){const r=e._contentState;e._contentState=bo.LOADING,++t.statistics.numberOfPendingRequests;let s;try{s=await o}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;if(n.cancelled||n.state===di.CANCELLED){e._contentState=r,++t.statistics.numberOfAttemptedRequests;return}throw e._contentState=bo.FAILED,a}if(e.isDestroyed()){--t.statistics.numberOfPendingRequests;return}if(n.cancelled||n.state===di.CANCELLED){e._contentState=r,--t.statistics.numberOfPendingRequests,++t.statistics.numberOfAttemptedRequests;return}try{const a=await nSe(e,s);return--t.statistics.numberOfPendingRequests,e.isDestroyed()?void 0:(i&&(e.expireDate=void 0),e._content=a,e._contentState=bo.PROCESSING,a)}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;throw e._contentState=bo.FAILED,a}}function tSe(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new iu({throttle:!0,throttleByServer:!0,type:Ip.TILES3D,priorityFunction:Zwe(e),serverKey:e._serverKey});e._request=i,t.request=i;const o=e._tileset,r=t.fetchArrayBuffer();if(!c(r)){++o.statistics.numberOfAttemptedRequests;return}return eSe(e,o,i,n,r)}async function nSe(e,t){const n=R8(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===na.GEOMETRY||n.contentType===na.VECTOR,(n.contentType===na.IMPLICIT_SUBTREE||n.contentType===na.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===na.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=O8[n.contentType];if(e.isDestroyed())return;c(n.binaryPayload)?o=await Promise.resolve(r(i,e,e._contentResource,n.binaryPayload.buffer,0)):o=await Promise.resolve(r(i,e,e._contentResource,n.jsonPayload));const s=e._contentHeader;if(e.hasImplicitContentMetadata){const l=e.implicitSubtree,u=e.implicitCoordinates;o.metadata=l.getContentMetadataView(u,0)}else e.hasImplicitContent||(o.metadata=kC(i,s));const a=L8(i,s);return c(a)&&(o.group=new rO({metadata:a})),o}Ai.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};Ai.prototype.unloadContent=function(){!this.hasRenderableContent||(this._content=this._content&&this._content.destroy(),this._contentState=bo.UNLOADED,this.lastStyleTime=0,this.clippingPlanesDirty=this._clippingPlanesState===0,this._clippingPlanesState=0,this.clippingPolygonsDirty=this._clippingPolygonsState===0,this._clippingPolygonsState=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 $8=new se;function qO(e,t){if(t.mode!==oe.SCENE3D&&!c(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,$8);e._boundingVolume2D=new Sd(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._boundingVolume2D:e._boundingVolume}function iSe(e,t){if(t.mode!==oe.SCENE3D&&!c(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,$8);e._contentBoundingVolume2D=new Sd(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Ai.prototype.visibility=function(e,t){const n=e.cullingVolume,i=qO(this,e),o=this._tileset,r=o.clippingPlanes;if(c(r)&&r.enabled){const a=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=a!==Bt.INSIDE,a===Bt.OUTSIDE)return _o.MASK_OUTSIDE}const s=o.clippingPolygons;if(c(s)&&s.enabled){const a=s.computeIntersectionWithBoundingVolume(i);this._isClippedByPolygon=a!==Bt.OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};Ai.prototype.contentVisibility=function(e){if(!c(this._contentBoundingVolume)||this._visibilityPlaneMask===_o.MASK_INSIDE)return Bt.INSIDE;const t=e.cullingVolume,n=iSe(this,e),i=this._tileset,o=i.clippingPlanes;if(c(o)&&o.enabled){const s=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=s!==Bt.INSIDE,s===Bt.OUTSIDE)return Bt.OUTSIDE}const r=i.clippingPolygons;if(c(r)&&r.enabled){const s=r.computeIntersectionWithBoundingVolume(n);if(this._isClippedByPolygon=s!==Bt.OUTSIDE,s===Bt.INSIDE)return Bt.OUTSIDE}return t.computeVisibility(n)};Ai.prototype.distanceToTile=function(e){return qO(this,e).distanceToCamera(e)};const oSe=new d;Ai.prototype.distanceToTileCenter=function(e){const n=qO(this,e).boundingVolume,i=d.subtract(n.center,e.camera.positionWC,oSe);return d.dot(e.camera.directionWC,i)};Ai.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!c(t)||t.distanceToCamera(e)===0};const X8=new $,Q8=new d,rSe=new $,YO=new d,K8=new ce,Z8=new Ct,mD=new L;function sSe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],YO),o=$.fromArray(e,3,rSe);i=L.multiplyByPoint(t,i,i);const r=L.getMatrix3(t,X8);return o=$.multiply(r,o,o),c(n)?(n.update(i,o),n):new Oc(i,o)}function aSe(e,t,n,i){const o=ce.unpack(e,0,K8),r=e[4],s=e[5],a=Ct.fromRectangle(o,r,s,ae.WGS84,Z8);let l=a.center,u=a.halfAxes;t=L.multiplyTransformation(t,L.inverseTransformation(n,mD),mD),l=L.multiplyByPoint(t,l,l);const h=L.getMatrix3(t,X8);return u=$.multiply(h,u,u),c(i)&&i instanceof Oc?(i.update(l,u),i):new Oc(l,u)}function cSe(e,t,n,i){if(!L.equalsEpsilon(t,n,R.EPSILON8))return aSe(e,t,n,i);const o=ce.unpack(e,0,K8);return c(i)?(i.rectangle=ce.clone(o,i.rectangle),i.minimumHeight=e[4],i.maximumHeight=e[5],i.computeBoundingVolumes(ae.WGS84),i):new ru({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function lSe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],YO),o=e[3];i=L.multiplyByPoint(t,i,i);const r=L.getScale(t,Q8),s=d.maximumComponent(r);return o*=s,c(n)?(n.update(i,o),n):new Sd(i,o)}Ai.prototype.createBoundingVolume=function(e,t,n){const i=this.metadata;let o;if(c(i)&&(o=M4.parseBoundingVolumeSemantic("TILE",i)),c(o)&&(e=o),!c(e))throw new Te("boundingVolume must be defined");if(To(e,"3DTILES_bounding_volume_S2"))return new Q0(e.extensions["3DTILES_bounding_volume_S2"]);const{box:r,region:s,sphere:a}=e;if(c(r)){const l=sSe(r,t,n);return this._verticalExaggeration!==1&&ZF(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l}if(c(s)){const l=cSe(s,t,this._initialTransform,n);return this._verticalExaggeration===1||(l instanceof Oc?ZF(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight):(l.minimumHeight=oa.getHeight(l.minimumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.maximumHeight=oa.getHeight(l.maximumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.computeBoundingVolumes(ae.WGS84))),l}if(c(a)){const l=lSe(a,t,n);if(this._verticalExaggeration!==1){const u=oa.getPosition(l.center,ae.WGS84,this._verticalExaggeration,this._verticalExaggerationRelativeHeight,YO),h=l.radius*this._verticalExaggeration;l.update(u,h)}return l}throw new Te("boundingVolume must contain a sphere, region, or box")};const uSe=d.unpackArray(new Array(8*3).fill(0));function ZF(e,t,n){const i=e.boundingVolume.computeCorners(uSe).map(r=>oa.getPosition(r,ae.WGS84,t,n,r)),o=Ct.fromPoints(i,Z8);e.update(o.center,o.halfAxes)}Ai.prototype.updateTransform=function(e,t){e=y(e,L.IDENTITY);const n=L.multiplyTransformation(e,this.transform,mD),i=!L.equals(n,this.computedTransform),o=c(t)&&(this._verticalExaggeration!==t.verticalExaggeration||this._verticalExaggerationRelativeHeight!==t.verticalExaggerationRelativeHeight);if(!i&&!o)return;i&&L.clone(n,this.computedTransform),o&&(this._verticalExaggeration=t.verticalExaggeration,this._verticalExaggerationRelativeHeight=t.verticalExaggerationRelativeHeight);const r=this._header,s=this._contentHeader;this._boundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._boundingVolume),c(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(s.boundingVolume,this.computedTransform,this._contentBoundingVolume)),c(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(r.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()};Ai.prototype.updateGeometricErrorScale=function(){const e=L.getScale(this.computedTransform,Q8),t=d.maximumComponent(e);if(this.geometricError=this._geometricError*t,!c(this.parent)){const n=this._tileset;n._scaledGeometricError=n._geometricError*t}};function dSe(e,t,n,i){if(!i.isRender)return;const o=c(e._contentHeader)&&c(e._contentHeader.boundingVolume),r=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(r){let l;e._finalResolution?e.hasRenderableContent?l=z.WHITE:l=z.DARKGRAY:l=z.YELLOW,c(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(l)),e._debugBoundingVolume.update(n);const u=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");u.color=$t.toValue(l,u.color)}else!r&&c(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(c(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(z.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&c(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&c(e._viewerRequestVolume)?(c(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(z.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&c(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const s=t.debugColorizeTiles&&!e._debugColorizeTiles||c(t._heatmap.tilePropertyName),a=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):a&&(e._debugColorizeTiles=!1,e.color=z.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),a&&t.makeStyleDirty()}function hSe(e,t,n){const i=e._expiredContent;if(!e.hasMultipleContents&&c(i)){if(!e.contentReady){try{i.update(t,n)}catch{}return}e._expiredContent.destroy(),e._expiredContent=void 0}if(!!c(e.content))try{e.content.update(t,n)}catch(o){throw e._contentState=bo.FAILED,o}}function fSe(e,t){const n=t.clippingPlanes;let i=0;c(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}function pSe(e,t){const n=t.clippingPolygons;let i=0;c(n)&&e._isClippedByPolygon&&n.enabled&&(i=n.clippingPolygonsState),i!==e._clippingPolygonsState&&(e._clippingPolygonsState=i,e.clippingPolygonsDirty=!0)}Ai.prototype.update=function(e,t,n){const{commandList:i}=t,o=i.length;fSe(this,e),pSe(this,e),dSe(this,e,t,n),hSe(this,e,t);const r=i.length;this._commandsLength=r-o;for(let s=o;se.cacheBytes||n);){const s=r.item;r=r.next,this.unloadTile(e,s,t)}};Vp.prototype.trim=function(){this._trimTiles=!0};function VC(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 _D(e,t){let n;return t==="_loadTimestamp"?n=ie.toDate(e).getTime():n=e,n}VC.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=_D(e,n),this._referenceMaximum[n]=_D(t,n)};function ySe(e,t){const n=e.tilePropertyName;if(c(n)){const i=_D(t[n],n);return c(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}const NS=[new z(.1,.1,.1,1),new z(.153,.278,.878,1),new z(.827,.231,.49,1),new z(.827,.188,.22,1),new z(1,.592,.259,1),new z(1,.843,0,1)];VC.prototype.colorize=function(e,t){const n=this.tilePropertyName;if(!c(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=ySe(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const s=r-o+R.EPSILON7,l=R.clamp(i-o,0,s)/s,u=NS.length-1,h=l*u,f=Math.floor(h),_=Math.ceil(h),g=h-f,m=NS[f],b=NS[_],T=z.clone(z.WHITE);T.red=R.lerp(m.red,b.red,g),T.green=R.lerp(m.green,b.green,g),T.blue=R.lerp(m.blue,b.blue,g),e._debugColor=T};VC.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(c(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=c(t)&&c(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};function eu(){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}eu.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};function HC(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,l=t.geometryByteLength,u=t.texturesByteLength,h=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-l:l,e.texturesByteLength+=n?-u:u,e.batchTableByteLength+=n?-h:h):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),c(o)){const f=o.length;for(let _=0;_>1)&858993459,e=(e^e>>2)&252645135,e=(e^e>>4)&16711935,e=(e^e>>8)&65535,e}function FS(e){return e&=153391689,e=(e^e>>2)&51130563,e=(e^e>>4)&50393103,e=(e^e>>8)&4278190335,e=(e^e>>16)&1023,e}J0.encode2D=function(e,t){if(A.typeOf.number("x",e),A.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new E("inputs must be 16-bit unsigned integers");return(t2(e)|t2(t)<<1)>>>0};J0.decode2D=function(e,t){if(A.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new E("input must be a 32-bit unsigned integer");return c(t)||(t=new Array(2)),t[0]=n2(e),t[1]=n2(e>>1),t};J0.encode3D=function(e,t,n){if(A.typeOf.number("x",e),A.typeOf.number("y",t),A.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new E("inputs must be 10-bit unsigned integers");return MS(e)|MS(t)<<1|MS(n)<<2};J0.decode3D=function(e,t){if(A.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new E("input must be a 30-bit unsigned integer");return c(t)||(t=new Array(3)),t[0]=FS(e),t[1]=FS(e>>1),t[2]=FS(e>>2),t};const $x=J0;function xi(e){if(A.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),A.typeOf.number("options.subtreeLevels",e.subtreeLevels),A.typeOf.number("options.level",e.level),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),e.subdivisionScheme===jo.OCTREE&&A.typeOf.number("options.z",e.z),e.level<0)throw new E("level must be non-negative");if(e.x<0)throw new E("x must be non-negative");if(e.y<0)throw new E("y must be non-negative");if(e.subdivisionScheme===jo.OCTREE&&e.z<0)throw new E("z must be non-negative");const t=1<=t)throw new E("x is out of range");if(e.y>=t)throw new E("y is out of range");if(e.subdivisionScheme===jo.OCTREE&&e.z>=t)throw new E("z is out of range");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===jo.OCTREE&&(this.z=e.z)}Object.defineProperties(xi.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===jo.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===jo.OCTREE?$x.encode3D(this.x,this.y,this.z):$x.encode2D(this.x,this.y)}},tileIndex:{get:function(){const e=this.subdivisionScheme===jo.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function $O(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new E("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new E("coordinates must have same subtreeLevels")}xi.prototype.getDescendantCoordinates=function(e){A.typeOf.object("offsetCoordinates",e),$O(this,e);const t=this.level+e.level,n=(this.x<this.level)throw new E("ancestor cannot be above the tileset root");const t=1<>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===jo.OCTREE){const s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};xi.prototype.isEqual=function(e){return A.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===jo.OCTREE?this.z===e.z:!0)};xi.prototype.isImplicitTilesetRoot=function(){return this.level===0};xi.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};xi.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};xi.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===jo.OCTREE&&(e.z=this.z),e};const i2=[0,0,0];xi.fromMortonIndex=function(e,t,n,i){let o;return e===jo.OCTREE?(o=$x.decode3D(i,i2),new xi({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=$x.decode2D(i,i2),new xi({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};xi.fromTileIndex=function(e,t,n){let i,o,r;return e===jo.OCTREE?(i=Math.floor(R.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(R.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),xi.fromMortonIndex(e,t,i,r)};function Po(){}Po.selectTiles=function(e,t){E.throwInstantiationError()};Po.sortChildrenByDistanceToCamera=function(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera};Po.canTraverse=function(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:e._screenSpaceError>e.tileset.memoryAdjustedScreenSpaceError};Po.selectTile=function(e,t){if(e.contentVisibility(t)===Bt.OUTSIDE)return;e._wasSelectedLastFrame=!0;const{content:n,tileset:i}=e;n.featurePropertiesDirty?(n.featurePropertiesDirty=!1,e.lastStyleTime=0,i._selectedTilesToStyle.push(e)):e._selectedFrame0;if((e.hasTilesetContent||e.hasImplicitContent)&&n){const r=e.children[0];nG(r,t),e._visible=r._visible;return}if(CSe(e,t)){e._visible=!1;return}const i=e.refine===Vr.REPLACE,o=e._optimChildrenWithinParent===Km.USE_OPTIMIZATION;if(i&&o&&n&&!ESe(e,t)){++e.tileset._statistics.numberOfTilesCulledWithChildrenUnion,e._visible=!1;return}}function CSe(e,t){const{parent:n,tileset:i}=e;return!c(n)||n.hasTilesetContent||n.hasImplicitContent||n.refine!==Vr.ADD?!1:e.getScreenSpaceError(t,!0)<=i.memoryAdjustedScreenSpaceError}function ESe(e,t){let n=!1;const i=e.children;for(let o=0;o0;){Gg.stackMaximumLength=Math.max(Gg.stackMaximumLength,s.length);const a=s.pop(),l=a.refine===Vr.ADD,u=a.refine===Vr.REPLACE,h=SSe(a);h&&vSe(a,s,t),(l||u&&!h)&&(ISe(e,a),o(a,t),DSe(a,t),a.hasRenderableContent&&!a.contentAvailable&&(n=!1)),r(a,t)}return Gg.stack.trim(Gg.stackMaximumLength),n};function SSe(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:(e.hasEmptyContent,!0)}function vSe(e,t,n){const{children:i}=e;for(let o=0;o0;){zy.stackMaximumLength=Math.max(zy.stackMaximumLength,a.length);const l=a.pop(),u=l.parent,h=!c(u)||u._refines;l._refines=i(l)?PSe(l,a,t)&&h:!1;const f=!l._refines&&h;l.hasRenderableContent?l.refine===Vr.ADD?(BS(l,t),o(l,t)):l.refine===Vr.REPLACE&&(o(l,t),f&&BS(l,t)):(n._emptyTiles.push(l),o(l,t),f&&BS(l,t)),r(l,t),s(l,t)}}function LSe(e,t){const{canTraverse:n,updateTile:i,loadTile:o,touchTile:r}=Po;let s=!0;const a=Uy.stack;for(a.push(e);a.length>0;){Uy.stackMaximumLength=Math.max(Uy.stackMaximumLength,a.length);const l=a.pop(),u=l.children,h=u.length,f=!l.hasRenderableContent&&n(l);if(!f&&!l.contentAvailable&&(s=!1),i(l,t),l.isVisible||(o(l,t),r(l,t)),f)for(let _=0;_0;){Vy.stackMaximumLength=Math.max(Vy.stackMaximumLength,r.length);const a=r.pop().children;for(let l=0;ln._depth+e.skipLevels)}function BSe(e,t,n){const{tileset:i,children:o}=e,{updateTile:r,loadTile:s,touchTile:a}=Po;for(let u=0;ut:e._screenSpaceError>t:!0}function USe(e,t){const{tileset:n}=e,i=n.immediatelyLoadDesiredLevelOfDetail?Number.MAX_VALUE:Math.max(n.baseScreenSpaceError,n.memoryAdjustedScreenSpaceError),{canTraverse:o,loadTile:r,visitTile:s,touchTile:a}=Po,l=ky.stack;for(l.push(e);l.length>0;){ky.stackMaximumLength=Math.max(ky.stackMaximumLength,l.length);const u=l.pop();MSe(u,t);const h=u.parent,f=!c(h)||h._refines;u._refines=o(u)?BSe(u,l,t)&&f:!1;const _=!u._refines&&f;u.hasRenderableContent?u.refine===Vr.ADD?(vT(u,t),r(u,t)):u.refine===Vr.REPLACE&&(zSe(u,i)?(r(u,t),_&&vT(u,t)):_?(vT(u,t),r(u,t)):FSe(n,u)&&r(u,t)):(n._emptyTiles.push(u),r(u,t),_&&vT(u,t)),s(u,t),a(u,t)}}function kSe(e,t){const{selectTile:n,canTraverse:i}=Po,{stack:o,ancestorStack:r}=Gu;let s;for(o.push(e);o.length>0||r.length>0;){if(Gu.stackMaximumLength=Math.max(Gu.stackMaximumLength,o.length),Gu.ancestorStackMaximumLength=Math.max(Gu.ancestorStackMaximumLength,r.length),r.length>0){const u=r.peek();if(u._stackLength===o.length){r.pop(),u!==s&&(u._finalResolution=!1),n(u,t);continue}}const a=o.pop();if(!c(a))continue;const l=i(a);if(a._shouldSelect)if(a.refine===Vr.ADD)n(a,t);else{if(a._selectionDepth=r.length,a._selectionDepth>0&&(a.tileset.hasMixedContent=!0),s=a,!l){n(a,t);continue}r.push(a),a._stackLength=o.length}if(l){const u=a.children;for(let h=0;hTi._defaultMinTerrainHeight&&(s._initialClippingPlanesOriginMatrix=zt.eastNorthUpToFixedFrame(_)),s._clippingPlanesOriginMatrix=L.clone(s._initialClippingPlanesOriginMatrix),s};hi.loadJson=function(e){return Ae.createIfNeeded(e).fetchJson()};hi.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};hi.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!c(i))throw new Te("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new Te("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");c(t.extensionsRequired)&&hi.checkSupportedExtensions(t.extensionsRequired);const o=this._statistics,r=i.tilesetVersion;c(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));const s=o2(this,e,t.root,n);c(n)&&(n.children.push(s),s._depth=n._depth+1);const a=[];for(a.push(s);a.length>0;){const l=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&l.refine===Vr.ADD;const u=l._header.children;if(c(u))for(let h=0;hT.minimumRadius){const w=he.fromCartesian(C,T,HSe);n=d.normalize(a.positionWC,r2),i=a.directionWC,o=a.positionCartographic.height,r=0,s=w.height*2}else{const w=L.multiplyByPoint(b,a.positionWC,WSe);if(n=d.UNIT_Z,i=L.multiplyByPointAsVector(b,a.directionWC,qSe),i=d.normalize(i,i),o=w.z,u instanceof Oc){const v=$.getColumn(x.halfAxes,2,YSe),P=d.magnitude(v);r=C.z-P,s=C.z+P}else if(u instanceof Sd){const v=x.radius;r=C.z-v,s=C.z+v}}}const h=e.dynamicScreenSpaceErrorHeightFalloff,f=r+(s-r)*h,_=s,g=R.clamp((o-f)/(_-f),0,1);let m=1-Math.abs(d.dot(i,n));m=m*(1-g),e._dynamicScreenSpaceErrorComputedDensity=e.dynamicScreenSpaceErrorDensity*m}function XSe(e,t){if(t.hasEmptyContent)return;const{statistics:n}=e,i=t.contentExpired,o=t.requestContent();!c(o)||(o.then(r=>{!c(r)||t.isDestroyed()||e.isDestroyed()||(e._processingQueue.push(t),++n.numberOfTilesProcessing)}).catch(r=>{aG(r,e,t)}),i&&(t.hasTilesetContent||t.hasImplicitContent?lve(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t))}function sG(e,t){return e._priority-t._priority}hi.prototype.postPassesUpdate=function(e){!c(this._root)||(QSe(this,e),dve(this,e),this._cache.unloadTiles(this,lG),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};hi.prototype.prePassesUpdate=function(e){if(!c(this._root))return;ive(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,c(t)&&t.enabled&&t.update(e);const n=this._clippingPolygons;c(n)&&n.enabled&&n.update(e),c(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time)),this._timeSinceLoad=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this.dynamicScreenSpaceError&&$Se(this,e),e.newFrame&&this._cache.reset()};function QSe(e,t){const n=e._requestedTilesInFlight;let i=0;for(let o=0;o=1;if(r._contentState!==bo.LOADING){++i;continue}else if(s){r.cancelRequests(),++i;continue}i>0&&(n[o-i]=r)}n.length-=i}function KSe(e){const t=e._requestedTiles;t.sort(sG);for(let n=0;n0?t.tileFailed.raiseEvent({url:i,message:o}):(console.log(`A 3D tile failed to load: ${i}`),console.log(`Error: ${o}`))}function ZSe(e){const t=e._processingQueue;let n=0;for(let i=0;i0&&(t[i-n]=o)}t.length-=n}const JSe=new he,eve=new he,tve=new d;function nve(e,t,n){if(!e.enableCollision||!e.show)return;const i=e._addHeightCallbacks,o=t.boundingSphere;for(const r of i){if(r.invoked||t._wasSelectedLastFrame)continue;const s=r.ellipsoid,a=he.clone(r.positionCartographic,JSe),l=he.fromCartesian(o.center,s,eve);c(l)&&(a.height=l.height);const u=he.toCartesian(a,s,tve);d.distance(u,o.center)<=o.radius&&n.afterRender.push(()=>{c(r.callback)&&r.callback(a),r.invoked=!1})}}function ive(e,t){ZSe(e);const n=e._processingQueue,{cacheBytes:i,maximumCacheOverflowBytes:o,statistics:r}=e,s=i+o;let a=!1;for(let l=0;ls){a=!0;break}const u=n[l];try{u.process(e,t),u.contentReady&&(--r.numberOfTilesProcessing,e.tileLoad.raiseEvent(u))}catch(h){--r.numberOfTilesProcessing,aG(h,e,u)}}e.totalMemoryUsageInBytes0&&ove(e)}function ove(e){$n("increase-screenSpaceError",`The tiles needed to meet maximumScreenSpaceError would use more memory than allocated for this tileset. The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError). Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`),e._memoryAdjustedScreenSpaceError*=1.02;const t=e._processingQueue;for(let n=0;n0&&(i+=` Points: ${e.content.pointsLength}`,o++),e.content.trianglesLength>0&&(i+=` Triangles: ${e.content.trianglesLength}`,o++),i+=` Features: ${e.content.featuresLength}`,o++),t.debugShowMemoryUsage&&(i+=` Texture Memory: ${s2(e.content.texturesByteLength)}`,i+=` Geometry Memory: ${s2(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=` Urls:`;const s=e.content.innerContentUrls;for(let a=0;a0;e._backfaceCommands.length=0,a&&(c(e._stencilClearCommand)||(e._stencilClearCommand=new bi({stencil:0,pass:xe.CESIUM_3D_TILE,renderState:Ue.fromCache({stencilMask:At.SKIP_LOD_MASK})})),i.push(e._stencilClearCommand));const{statistics:l,tileVisible:u}=e,h=n.isRender,f=i.length;for(let m=0;m=0;--T)i[f+b+T]=i[f+T];for(let T=0;T0&&e._pointCloudEyeDomeLighting.update(t,r,e.pointCloudShading,e.boundingSphere),e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(c(e._tileDebugLabels)||(e._tileDebugLabels=new Ga),ave(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const cG=[];function lve(e,t){const n=t,i=cG;for(i.push(t);i.length>0;){t=i.pop();const o=t.children;for(let r=0;r{t.push(Wt.clone(i))});const n=e.asset.extras;if(c(n)&&c(n.cesium)&&c(n.cesium.credits)){const i=n.cesium.credits;for(let o=0;oi.showOnScreen=i.showOnScreen||e._showCreditsOnScreen),e._credits=t}hi.prototype.getTraversal=function(e){const{pass:t}=e;return t===wr.MOST_DETAILED_PRELOAD||t===wr.MOST_DETAILED_PICK?iG:this.isSkippingLevelOfDetail?rG:oG};hi.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};hi.prototype.updateForPass=function(e,t){A.typeOf.object("frameState",e),A.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===wr.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===wr.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===wr.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;const s=wr.getPassOptions(n),a=s.ignoreCommands,l=y(t.commandList,i),u=l.length;e.commandList=l,e.camera=y(t.camera,o),e.cullingVolume=y(t.cullingVolume,r);const h=this._clippingPolygons;c(h)&&h.enabled&&h.queueCommands(e);const f=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=pve(this,e,f,s)),a&&(l.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};hi.prototype.hasExtension=function(e){return c(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};hi.prototype.isDestroyed=function(){return!1};hi.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),c(this._root)){const e=cG;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const n=t.children;for(let i=0;i{const r=this._addHeightCallbacks,s=r.length;for(let a=0;a{const h=se.distanceSquaredTo(l.contentBoundingVolume.boundingSphere,e.origin),f=se.distanceSquaredTo(u.contentBoundingVolume.boundingSphere,e.origin);return h-f});let a;for(let l=0;l-1;i--)gD(this,e[i],t,n);return ve(this)};Bh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._tilesetHash[e.id];if(!c(n)||n.loadFail)return rt.FAILED;const i=n.tilesetPrimitive;return c(i)?i.show?(se.clone(i.boundingSphere,t),rt.DONE):rt.FAILED:rt.PENDING};Bh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._tilesetHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._tileset)?s.set(r.id,r):(gD(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],gD(this,r,a,l),s.remove(r.id)};function gD(e,t,n,i){const o=n[t.id];c(o)&&(c(o.tilesetPrimitive)&&i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}async function Ave(e,t,n,i){t[n.id]={url:e.url,loadFail:!1};try{const o=await hi.fromUrl(e);if(o.id=n,i.add(o),!c(t[n.id]))return;t[n.id].tilesetPrimitive=o}catch(o){console.error(o),t[n.id].loadFail=!0}}const a2={id:void 0};function eb(e){if(e._firing){e._refire=!0;return}if(e._suspendCount===0){const t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(i.length!==0||t.length!==0||n.length!==0){e._firing=!0;do{e._refire=!1;const o=t.values.slice(0),r=n.values.slice(0),s=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,o,r,s)}while(e._refire);e._firing=!1}}}function As(e){this._owner=e,this._entities=new mt,this._addedEntities=new mt,this._removedEntities=new mt,this._changedEntities=new mt,this._suspendCount=0,this._collectionChanged=new Le,this._id=Wr(),this._show=!0,this._firing=!1,this._refire=!1}As.prototype.suspendEvents=function(){this._suspendCount++};As.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new E("resumeEvents can not be called before suspendEvents.");this._suspendCount--,eb(this)};Object.defineProperties(As.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(!c(e))throw new E("value is required.");if(e===this._show)return;this.suspendEvents();let t;const n=[],i=this._entities.values,o=i.length;for(t=0;t0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};Ji.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};Ji.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};Ji.prototype.contains=function(e){return this.indexOf(e)>=0};const kS=new Ht;Ji.prototype.indexOf=function(e){if(!c(e))throw new E("date is required");const t=this._intervals;kS.start=e,kS.stop=e;let n=Hr(t,kS,XO);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-10&&e.isStartIncluded&&n[i-1].isStartIncluded&&n[i-1].start.equals(e.start)?--i:i0&&(o=ie.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((c(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?(ie.greaterThan(e.stop,n[i-1].stop)?e=new Ht({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new Ht({start:n[i-1].start,stop:n[i-1].stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:n[i-1].isStopIncluded||e.stop.equals(n[i-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(i-1,1),--i):(o=ie.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new Ht({start:e.stop,stop:n[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i-1].isStopIncluded,data:n[i-1].data})),n[i-1]=new Ht({start:n[i-1].start,stop:e.start,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[i-1].data}))));i0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(c(t)?t(n[i].data,e.data):n[i].data===e.data)e=new Ht({start:e.start,stop:ie.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:ie.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new Ht({start:e.stop,stop:n[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i].isStopIncluded,data:n[i].data}),n[i].isEmpty)n.splice(i,1);else break;n.splice(i,0,e),this._changedEvent.raiseEvent(this)};Ji.prototype.removeInterval=function(e){if(!c(e))throw new E("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=Hr(t,e,XO);n<0&&(n=~n);let i=!1;for(n>0&&(ie.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(ie.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 Ht({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 Ht({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n=1e3&&(o+=Math.floor(i/1e3),i=i%1e3),o>=60&&(r+=Math.floor(o/60),o=o%60),r>=60&&(s+=Math.floor(r/60),r=r%60),s>=24&&(a+=Math.floor(s/24),s=s%24),jg[2]=$y(u)?29:28;a>jg[l]||l>=13;)a>jg[l]&&(a-=jg[l],++l),l>=13&&(--l,u+=Math.floor(l/12),l=l%12,++l),jg[2]=$y(u)?29:28;return Jr.millisecond=i,Jr.second=o,Jr.minute=r,Jr.hour=s,Jr.day=a,Jr.month=l,Jr.year=u,ie.fromGregorianDate(Jr,n)}const xve=new ie,Cve=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function dG(e,t){if(!c(e)||e.length===0)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,e[0]==="P"){const n=e.match(Cve);if(!c(n))return!1;if(c(n[1])&&(t.year=Number(n[1].replace(",","."))),c(n[2])&&(t.month=Number(n[2].replace(",","."))),c(n[3])&&(t.day=Number(n[3].replace(",","."))*7),c(n[4])&&(t.day+=Number(n[4].replace(",","."))),c(n[5])&&(t.hour=Number(n[5].replace(",","."))),c(n[6])&&(t.minute=Number(n[6].replace(",","."))),c(n[7])){const i=Number(n[7].replace(",","."));t.second=Math.floor(i),t.millisecond=i%1*1e3}}else e[e.length-1]!=="Z"&&(e+="Z"),ie.toGregorianDate(ie.fromIso8601(e,xve),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const Hy=new L0;Ji.fromIso8601=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601))throw new E("options.iso8601 is required.");const n=e.iso8601.split("/"),i=ie.fromIso8601(n[0]),o=ie.fromIso8601(n[1]),r=[];if(!dG(n[2],Hy))r.push(i,o);else{let s=ie.clone(i);for(r.push(s);ie.compare(s,o)<0;)s=yD(s,Hy),ie.compare(o,s)<=0&&ie.clone(o,s),r.push(s)}return Ji.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ji.fromIso8601DateArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601Dates))throw new E("options.iso8601Dates is required.");return Ji.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return ie.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ji.fromIso8601DurationArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.epoch))throw new E("options.epoch is required.");if(!c(e.iso8601Durations))throw new E("options.iso8601Durations is required.");const n=e.epoch,i=e.iso8601Durations,o=y(e.relativeToPrevious,!1),r=[];let s,a;const l=i.length;for(let u=0;u=0?-a:a}const Bve=new d(-1,0,0);let vf=new L;const zve=new L;let GS=new $;const Uve=$.IDENTITY.clone(),kve=new d,Vve=new te,c2=new d;function ju(e,t,n,i,o,r,s,a){let l=kve,u=Vve;vf=zt.eastNorthUpToFixedFrame(e,o,vf),l=L.multiplyByPointAsVector(vf,Bve,l),l=d.normalize(l,l);const h=Fve(l,t,e,o);GS=$.fromRotationZ(h,GS),c2.z=r,vf=L.multiplyTransformation(vf,L.fromRotationTranslation(GS,c2,zve),vf);const f=Uve;f[0]=s;for(let _=0;_0){const b=u?2:1;for(let T=0;T=0};const jve=new d,Wve=new d;T0.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=Mve(e,r),a=i._granularity,l=i._cornerType,u=o?Gve(t,n):l2(t,n),h=o?l2(t,n):void 0,f=n.height/2,_=n.width/2;let g=e.length,m=[],b=o?[]:void 0,T=Sve,x=vve,C=Ive,w=Dve,v=Pve,P=Ove,N=Lve,k=Rve,M=Nve,U=e[0],B=e[1];w=r.geodeticSurfaceNormal(U,w),T=d.subtract(B,U,T),T=d.normalize(T,T),k=d.cross(w,T,k),k=d.normalize(k,k);let S=s[0],D=s[1];o&&(b=ju(U,k,h,b,r,S+f,1,1)),M=d.clone(U,M),U=B,x=d.negate(T,x);let p,I;for(let V=1;Vye;_--)fe=R.PI_OVER_TWO-_*de,Q[re++]=1-le*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe));for(_=ye;_>0;_--)fe=R.PI_OVER_TWO-de*_,Q[re++]=1-pe*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe));for(_=h-T;_>0;_--)Q[re++]=_*pe,Q[re++]=1;for(_=1;_0;_--)Q[re++]=(_-1)*pe,Q[re++]=1}l.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:Q})}return t.normal&&(l.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.normals})),t.tangent&&(l.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.tangents})),t.bitangent&&(l.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.bitangents})),{attributes:l,indices:G}}function oIe(e,t){if(!t.normal&&!t.tangent&&!t.bitangent&&!t.st)return e;const n=e.position.values;let i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);const r=e.position.values.length/18,s=r*3,a=r*2,l=s*2;let u;if(t.normal||t.bitangent||t.tangent){const h=t.normal?new Float32Array(s*6):void 0,f=t.tangent?new Float32Array(s*6):void 0,_=t.bitangent?new Float32Array(s*6):void 0;let g=_G,m=gG,b=KA,T=ZA,x=iIe,C=yG,w=l;for(u=0;u-t?(o=dIe,o.x=this._cameraPosition.x/(n.radii.x+t),o.y=this._cameraPosition.y/(n.radii.y+t),o.z=this._cameraPosition.z/(n.radii.z+t),i=o.x*o.x+o.y*o.y+o.z*o.z-1):(o=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),KO(e,o,i)};Vc.prototype.computeHorizonCullingPoint=function(e,t,n){return RG(this._ellipsoid,e,t,n)};const OG=ae.clone(ae.UNIT_SPHERE);Vc.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){const o=LG(this._ellipsoid,n,OG);return RG(o,e,t,i)};Vc.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return NG(this._ellipsoid,e,t,n,i,o)};Vc.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){const s=LG(this._ellipsoid,o,OG);return NG(s,e,t,n,i,r)};const hIe=[];Vc.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){A.typeOf.object("rectangle",e);const i=ce.subsample(e,t,0,hIe),o=se.fromPoints(i);if(!(d.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const fIe=new d;function LG(e,t,n){if(c(t)&&t<0&&e.minimumRadius>-t){const i=d.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,fIe);e=ae.fromCartesian3(i,n)}return e}function RG(e,t,n,i){A.typeOf.object("directionToPoint",t),A.defined("positions",n),c(i)||(i=new d);const o=BG(e,t);let r=0;for(let s=0,a=n.length;s0:s>o&&s*s/d.magnitudeSquared(r)>o)}const pIe=new d,mIe=new d;function MG(e,t,n){const i=e.transformPositionToScaledSpace(t,pIe);let o=d.magnitudeSquared(i),r=Math.sqrt(o);const s=d.divideByScalar(i,r,mIe);o=Math.max(1,o),r=Math.max(1,r);const a=d.dot(s,n),l=d.magnitude(d.cross(s,n,s)),u=1/r,h=Math.sqrt(o-1)*u;return 1/(a*u-l*h)}function FG(e,t,n){if(!(t<=0||t===1/0||t!==t))return d.multiplyByScalar(e,t,n)}const YS=new d;function BG(e,t){return d.equals(t,d.ZERO)?t:(e.transformPositionToScaledSpace(t,YS),d.normalize(YS,YS))}function Dn(e,t){if(e=y(e,y.EMPTY_OBJECT),c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=vt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");i=vt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=Pt.clone(o)}this._show=y(e.show,!0),this._position=d.clone(y(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._color=z.clone(y(e.color,z.WHITE)),this._outlineColor=z.clone(y(e.outlineColor,z.TRANSPARENT)),this._outlineWidth=y(e.outlineWidth,0),this._pixelSize=y(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=y(e.disableDepthTestDistance,0),this._id=e.id,this._collection=y(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}const x2=Dn.SHOW_INDEX=0,zG=Dn.POSITION_INDEX=1,_Ie=Dn.COLOR_INDEX=2,gIe=Dn.OUTLINE_COLOR_INDEX=3,yIe=Dn.OUTLINE_WIDTH_INDEX=4,bIe=Dn.PIXEL_SIZE_INDEX=5,TIe=Dn.SCALE_BY_DISTANCE_INDEX=6,AIe=Dn.TRANSLUCENCY_BY_DISTANCE_INDEX=7,xIe=Dn.DISTANCE_DISPLAY_CONDITION_INDEX=8,CIe=Dn.DISABLE_DEPTH_DISTANCE_INDEX=9;Dn.NUMBER_OF_PROPERTIES=10;function oc(e,t){const n=e._pointPrimitiveCollection;c(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(Dn.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");this._show!==e&&(this._show=e,oc(this,x2))}},position:{get:function(){return this._position},set:function(e){if(!c(e))throw new E("value is required.");const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),oc(this,zG))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._scaleByDistance;vt.equals(t,e)||(this._scaleByDistance=vt.clone(e,t),oc(this,TIe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._translucencyByDistance;vt.equals(t,e)||(this._translucencyByDistance=vt.clone(e,t),oc(this,AIe))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!c(e))throw new E("value is required.");this._pixelSize!==e&&(this._pixelSize=e,oc(this,bIe))}},color:{get:function(){return this._color},set:function(e){if(!c(e))throw new E("value is required.");const t=this._color;z.equals(t,e)||(z.clone(e,t),oc(this,_Ie))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),oc(this,gIe))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!c(e))throw new E("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,oc(this,yIe))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");Pt.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),oc(this,xIe))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!c(e)||e<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,oc(this,CIe)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(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,oc(this,x2))}}});Dn.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};Dn.prototype._getActualPosition=function(){return this._actualPosition};Dn.prototype._setActualPosition=function(e){d.clone(e,this._actualPosition),oc(this,zG)};const C2=new te;Dn._computeActualPosition=function(e,t,n){return t.mode===oe.SCENE3D?e:(L.multiplyByPoint(n,e,C2),Ao.computeActualWgs84Position(t,C2))};const E2=new te;Dn._computeScreenSpacePosition=function(e,t,n,i){const o=L.multiplyByVector(e,te.fromElements(t.x,t.y,t.z,1,E2),E2);return Ao.wgs84ToWindowCoordinates(n,o,i)};Dn.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;if(c(t)||(t=new H),!c(n))throw new E("PointPrimitive must be in a collection.");if(!c(e))throw new E("scene is required.");const i=n.modelMatrix,o=Dn._computeScreenSpacePosition(i,this._actualPosition,e,t);if(!!c(o))return o.y=e.canvas.clientHeight-o.y,o};Dn.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,o=i*.5,r=t.x-o,s=t.y-o,a=i,l=i;return c(n)||(n=new Re),n.x=r,n.y=s,n.width=a,n.height=l,n};Dn.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.equals(this._position,e._position)&&z.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&z.equals(this._outlineColor,e._outlineColor)&&vt.equals(this._scaleByDistance,e._scaleByDistance)&&vt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Pt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Dn.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const OT=`in vec4 v_color; in vec4 v_outlineColor; in float v_innerPercent; in float v_pixelDistance; in vec4 v_pickColor; void main() { // The distance in UV space from this fragment to the center of the point, at most 0.5. float distanceToCenter = length(gl_PointCoord - vec2(0.5)); // The max distance stops one pixel shy of the edge to leave space for anti-aliasing. float maxDistance = max(0.0, 0.5 - v_pixelDistance); float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter); float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter); vec4 color = mix(v_outlineColor, v_color, innerAlpha); color.a *= wholeAlpha; // Fully transparent parts of the billboard are not pickable. #if !defined(OPAQUE) && !defined(TRANSLUCENT) if (color.a < 0.005) // matches 0/255 and 1/255 { discard; } #else // The billboard is rendered twice. The opaque pass discards translucent fragments // and the translucent pass discards opaque fragments. #ifdef OPAQUE if (color.a < 0.995) // matches < 254/255 { discard; } #else if (color.a >= 0.995) // matches 254/255 and 255/255 { discard; } #endif #endif out_FragColor = czm_gammaCorrect(color); czm_writeLogDepth(); } `,EIe=`uniform float u_maxTotalPointSize; in vec4 positionHighAndSize; in vec4 positionLowAndOutline; in vec4 compressedAttribute0; // color, outlineColor, pick color in vec4 compressedAttribute1; // show, translucency by distance, some free space in vec4 scaleByDistance; // near, nearScale, far, farScale in vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance out vec4 v_color; out vec4 v_outlineColor; out float v_innerPercent; out float v_pixelDistance; out vec4 v_pickColor; const float SHIFT_LEFT8 = 256.0; const float SHIFT_RIGHT8 = 1.0 / 256.0; void main() { // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition // unpack attributes vec3 positionHigh = positionHighAndSize.xyz; vec3 positionLow = positionLowAndOutline.xyz; float outlineWidthBothSides = 2.0 * positionLowAndOutline.w; float totalSize = positionHighAndSize.w + outlineWidthBothSides; float outlinePercent = outlineWidthBothSides / totalSize; // Scale in response to browser-zoom. totalSize *= czm_pixelRatio; float temp = compressedAttribute1.x * SHIFT_RIGHT8; float show = floor(temp); #ifdef EYE_DISTANCE_TRANSLUCENCY vec4 translucencyByDistance; translucencyByDistance.x = compressedAttribute1.z; translucencyByDistance.z = compressedAttribute1.w; translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0; temp = compressedAttribute1.y * SHIFT_RIGHT8; translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0; #endif /////////////////////////////////////////////////////////////////////////// vec4 color; vec4 outlineColor; vec4 pickColor; // compressedAttribute0.z => pickColor.rgb temp = compressedAttribute0.z * SHIFT_RIGHT8; pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8; pickColor.r = floor(temp); // compressedAttribute0.x => color.rgb temp = compressedAttribute0.x * SHIFT_RIGHT8; color.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; color.g = (temp - floor(temp)) * SHIFT_LEFT8; color.r = floor(temp); // compressedAttribute0.y => outlineColor.rgb temp = compressedAttribute0.y * SHIFT_RIGHT8; outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8; temp = floor(temp) * SHIFT_RIGHT8; outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8; outlineColor.r = floor(temp); // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a temp = compressedAttribute0.w * SHIFT_RIGHT8; pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8; pickColor = pickColor / 255.0; temp = floor(temp) * SHIFT_RIGHT8; outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8; outlineColor /= 255.0; color.a = floor(temp); color /= 255.0; /////////////////////////////////////////////////////////////////////////// vec4 p = czm_translateRelativeToEye(positionHigh, positionLow); vec4 positionEC = czm_modelViewRelativeToEye * p; /////////////////////////////////////////////////////////////////////////// #if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE) float lengthSq; if (czm_sceneMode == czm_sceneMode2D) { // 2D camera distance is a special case // treat all billboards as flattened to the z=0.0 plane lengthSq = czm_eyeHeight2D.y; } else { lengthSq = dot(positionEC.xyz, positionEC.xyz); } #endif #ifdef EYE_DISTANCE_SCALING totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq); #endif if (totalSize > 0.0) { // Add padding for anti-aliasing on both sides. totalSize += 3.0; } // Clamp to max point size. totalSize = min(totalSize, u_maxTotalPointSize); // If size is too small, push vertex behind near plane for clipping. // Note that context.minimumAliasedPointSize "will be at most 1.0". if (totalSize < 1.0) { positionEC.xyz = vec3(0.0); totalSize = 1.0; } float translucency = 1.0; #ifdef EYE_DISTANCE_TRANSLUCENCY translucency = czm_nearFarScalar(translucencyByDistance, lengthSq); // push vertex behind near plane for clipping if (translucency < 0.004) { positionEC.xyz = vec3(0.0); } #endif #ifdef DISTANCE_DISPLAY_CONDITION float nearSq = distanceDisplayConditionAndDisableDepth.x; float farSq = distanceDisplayConditionAndDisableDepth.y; if (lengthSq < nearSq || lengthSq > farSq) { // push vertex behind camera to force it to be clipped positionEC.xyz = vec3(0.0, 0.0, 1.0); } #endif gl_Position = czm_projection * positionEC; czm_vertexLogDepth(); #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) { disableDepthTestDistance = czm_minimumDisableDepthTestDistance; } if (disableDepthTestDistance != 0.0) { // Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w. float zclip = gl_Position.z / gl_Position.w; bool clipped = (zclip < -1.0 || zclip > 1.0); if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance))) { // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH czm_vertexLogDepth(vec4(czm_currentFrustum.x)); #endif } } #endif v_color = color; v_color.a *= translucency * show; v_outlineColor = outlineColor; v_outlineColor.a *= translucency * show; v_innerPercent = 1.0 - outlinePercent; v_pixelDistance = 2.0 / totalSize; gl_PointSize = totalSize * show; gl_Position *= show; v_pickColor = pickColor; } `,wIe=Dn.SHOW_INDEX,bD=Dn.POSITION_INDEX,UG=Dn.COLOR_INDEX,SIe=Dn.OUTLINE_COLOR_INDEX,vIe=Dn.OUTLINE_WIDTH_INDEX,IIe=Dn.PIXEL_SIZE_INDEX,kG=Dn.SCALE_BY_DISTANCE_INDEX,VG=Dn.TRANSLUCENCY_BY_DISTANCE_INDEX,HG=Dn.DISTANCE_DISPLAY_CONDITION_INDEX,DIe=Dn.DISABLE_DEPTH_DISTANCE_INDEX,ZO=Dn.NUMBER_OF_PROPERTIES,cs={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function ja(e){e=y(e,y.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(ZO),this._maxPixelSize=1,this._baseVolume=new se,this._baseVolumeWC=new se,this._baseVolume2D=new se,this._boundingVolume=new se,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(L.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,io.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=oe.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(ja.prototype,{length:{get:function(){return JO(this),this._pointPrimitives.length}}});function GG(e){const t=e.length;for(let n=0;n0&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),r(o,s,a,u)}function OIe(e,t,n,i){jG(e,t,n,i),WG(e,t,n,i),qG(e,t,n,i),YG(e,t,n,i),$G(e,t,n,i)}function XS(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let l=0;l0){this._vaf=PIe(l,n,this._buffersUsage),a=this._vaf.writers;for(let P=0;P0){const P=NIe;P.length=0,(r[bD]||r[vIe]||r[IIe])&&P.push(jG),(r[UG]||r[SIe])&&P.push(WG),(r[wIe]||r[VG])&&P.push(qG),r[kG]&&P.push(YG),(r[HG]||r[DIe])&&P.push($G);const N=P.length;if(a=this._vaf.writers,o/n>.1){for(let k=0;kn*1.5&&(i.length=n),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let f,_=L.IDENTITY;e.mode===oe.SCENE3D?(_=this.modelMatrix,f=se.clone(this._baseVolumeWC,this._boundingVolume)):f=se.clone(this._baseVolume2D,this._boundingVolume),RIe(this,e,f);const g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===io.OPAQUE||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:J.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===io.TRANSLUCENT||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:J.LEQUAL},depthMask:!1,blending:Zn.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let m,b;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(m=new Oe({sources:[EIe]}),this._shaderScaleByDistance&&m.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&m.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&m.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&m.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===io.OPAQUE_AND_TRANSLUCENT&&(b=new Oe({defines:["OPAQUE"],sources:[OT]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs}),b=new Oe({defines:["TRANSLUCENT"],sources:[OT]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._blendOption===io.OPAQUE&&(b=new Oe({sources:[OT]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._blendOption===io.TRANSLUCENT&&(b=new Oe({sources:[OT]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let T,x,C,w;const v=e.commandList;if(u.render||h){const P=this._colorCommands,N=this._blendOption===io.OPAQUE,k=this._blendOption===io.OPAQUE_AND_TRANSLUCENT;T=this._vaf.va,x=T.length,P.length=x;const M=k?x*2:x;for(w=0;w>4;if(o!==QS)throw new Error(`Got v${o} data when expected v${QS}.`);const r=w2[i&15];if(!r)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new e1(a,s,r,t)}constructor(t,n=64,i=Float64Array,o){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=w2.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,Yg,t),this.coords=new this.ArrayType(this.data,Yg+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Yg+s+a+l),this.ids=new this.IndexArrayType(this.data,Yg,t),this.coords=new this.ArrayType(this.data,Yg+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(QS<<4)+r]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=n,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return TD(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:s,nodeSize:a}=this,l=[0,r.length-1,0],u=[];for(;l.length;){const h=l.pop()||0,f=l.pop()||0,_=l.pop()||0;if(f-_<=a){for(let T=_;T<=f;T++){const x=s[2*T],C=s[2*T+1];x>=t&&x<=i&&C>=n&&C<=o&&u.push(r[T])}continue}const g=_+f>>1,m=s[2*g],b=s[2*g+1];m>=t&&m<=i&&b>=n&&b<=o&&u.push(r[g]),(h===0?t<=m:n<=b)&&(l.push(_),l.push(g-1),l.push(1-h)),(h===0?i>=m:o>=b)&&(l.push(g+1),l.push(f),l.push(1-h))}return u}within(t,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:s}=this,a=[0,o.length-1,0],l=[],u=i*i;for(;a.length;){const h=a.pop()||0,f=a.pop()||0,_=a.pop()||0;if(f-_<=s){for(let T=_;T<=f;T++)S2(r[2*T],r[2*T+1],t,n)<=u&&l.push(o[T]);continue}const g=_+f>>1,m=r[2*g],b=r[2*g+1];S2(m,b,t,n)<=u&&l.push(o[g]),(h===0?t-i<=m:n-i<=b)&&(a.push(_),a.push(g-1),a.push(1-h)),(h===0?t+i>=m:n+i>=b)&&(a.push(g+1),a.push(f),a.push(1-h))}return l}}function TD(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;XG(e,t,s,i,o,r),TD(e,t,n,i,s-1,1-r),TD(e,t,n,s+1,o,1-r)}function XG(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const u=o-i+1,h=n-i+1,f=Math.log(u),_=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*_*(u-_)/u)*(h-u/2<0?-1:1),m=Math.max(i,Math.floor(n-h*_/u+g)),b=Math.min(o,Math.floor(n+(u-h)*_/u+g));XG(e,t,n,m,b,r)}const s=t[2*n+r];let a=i,l=o;for($g(e,t,i,n),t[2*o+r]>s&&$g(e,t,i,o);as;)l--}t[2*i+r]===s?$g(e,t,i,l):(l++,$g(e,t,l,o)),l<=n&&(i=l+1),n<=l&&(o=l-1)}}function $g(e,t,n,i){KS(e,n,i),KS(t,2*n,2*i),KS(t,2*n+1,2*i+1)}function KS(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function S2(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function Ol(e){e=y(e,y.EMPTY_OBJECT),this._enabled=y(e.enabled,!1),this._pixelRange=y(e.pixelRange,80),this._minimumClusterSize=y(e.minimumClusterSize,2),this._clusterBillboards=y(e.clusterBillboards,!0),this._clusterLabels=y(e.clusterLabels,!0),this._clusterPoints=y(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 Le,this.show=y(e.show,!0)}function v2(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}const MIe=new Re;function I2(e,t,n,i,o){if(c(e._labelCollection)&&i._clusterLabels?o=Tl.getScreenSpaceBoundingBox(e,t,o):c(e._billboardCollection)&&i._clusterBillboards?o=St.getScreenSpaceBoundingBox(e,t,o):c(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=Dn.getScreenSpaceBoundingBox(e,t,o)),v2(o,n),i._clusterLabels&&!c(e._labelCollection)&&c(e.id)&&QG(i,e.id.id)&&c(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Tl.getScreenSpaceBoundingBox(s,t,MIe);v2(a,n),o=Re.union(o,a,o)}return o}function FIe(e,t){if(e.clusterShow=!0,!c(e._labelCollection)&&c(e.id)&&QG(t,e.id.id)&&c(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function D2(e,t,n,i){const o={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=n,o.billboard.position=o.label.position=o.point.position=e,i._clusterEvent.raiseEvent(n,o)}function QG(e,t){return c(e)&&c(e._collectionIndicesByEntity[t])&&c(e._collectionIndicesByEntity[t].labelIndex)}function ZS(e,t,n,i,o){if(!c(e))return;const r=e.length;for(let s=0;s0){const O=new e1(C.length,64,Uint32Array);for(let F=0;F=h)for(D2(F.position,D,S,e),_.push(F),v=0;v=h){const W=d.multiplyByScalar(j,1/D,j);for(D2(W,D,S,e),_.push({position:W,width:G.width,height:G.height,minimumWidth:N.width,minimumHeight:N.height}),v=0;v0?(a=u.shift(),l=r.get(a)):(l=r.add(),a=r.length-1),s[i]=a;const h=this;return Promise.resolve().then(function(){h._clusterDirty=!0}),l}}function n1(e,t){const n=e._collectionIndicesByEntity[t];!c(n.billboardIndex)&&!c(n.labelIndex)&&!c(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Ol.prototype.getLabel=t1("_labelCollection",Ga,"_unusedLabelIndices","labelIndex");Ol.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._labelCollection)||!c(t)||!c(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,n1(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};Ol.prototype.getBillboard=t1("_billboardCollection",Ts,"_unusedBillboardIndices","billboardIndex");Ol.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._billboardCollection)||!c(t)||!c(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,n1(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};Ol.prototype.getPoint=t1("_pointCollection",ja,"_unusedPointIndices","pointIndex");Ol.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._pointCollection)||!c(t)||!c(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,n1(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function JS(e){if(!c(e))return;const t=e.length;for(let n=0;n0&&this._labelCollection.get(0)._glyphs.length===0&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),c(this._billboardCollection)&&this._billboardCollection.length>0&&!c(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,VIe(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),c(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),c(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),c(this._clusterPointCollection)&&this._clusterPointCollection.update(e),c(this._labelCollection)&&this._labelCollection.update(e),c(this._billboardCollection)&&this._billboardCollection.update(e),c(this._pointCollection)&&this._pointCollection.update(e)};Ol.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(),c(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};function i1(e){this._name=e,this._clock=void 0,this._changed=new Le,this._error=new Le,this._isLoading=!1,this._loading=new Le,this._entityCollection=new As(this),this._entityCluster=new Ol}Object.defineProperties(i1.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){GC.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){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}}});i1.prototype.update=function(e){return!0};const KG={};KG.computePositions=function(e,t,n,i,o){const r=e*.5,s=-r,a=i+i,l=o?2*a:a,u=new Float64Array(l*3);let h,f=0,_=0;const g=o?a*3:0,m=o?(a+i)*3:i*3;for(h=0;h0){const b=Math.min(r,o);u=Math.round(o/b),l+=b}const h=je.createTypedArray(s,l*2);let f=0,_;for(_=0;_0)for(_=0;_=t;i--)e[i]=e[a--]}for(i=0;i=0||c(f)&&ie.compare(h,f)>=0));){for(iv[_++]=h,r=r+1,s=0;s0&&(ov.length=g,O2(n,u,ov),iv.length=_,O2(t,l,iv))}else{for(s=0;so)return;if(this._backwardExtrapolationType===Zm.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const v=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===Zm.NONE||o!==0&&ie.secondsDifference(e,v)>o)return;if(this._forwardExtrapolationType===Zm.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const l=this._xTable,u=this._yTable,h=this._interpolationAlgorithm,f=this._packedInterpolationLength,_=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const v=Math.min(h.getRequiredDataPoints(this._interpolationDegree,_),i);v!==this._numberOfPoints&&(this._numberOfPoints=v,l.length=v,u.length=v*f)}const g=this._numberOfPoints-1;if(g<1)return;let m=0,b=i-1;if(b-m+1>=g+1){let v=a-(g/2|0)-1;vb&&(P=b,v=P-g,v0){n=new Array(t);for(let i=0;i0&&(!c(n)||n.length!==i))throw new E("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)};Lc.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};Lc.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};Lc.prototype.removeSample=function(e){return this._property.removeSample(e)};Lc.prototype.removeSamples=function(e){this._property.removeSamples(e)};Lc.prototype.equals=function(e){return this===e||e instanceof Lc&&K.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};function Uh(e){this._definitionChanged=new Le,this._intervals=new Ji,this._intervals.changedEvent.addEventListener(Uh.prototype._intervalsChanged,this),this._referenceFrame=y(e,Bs.FIXED)}Object.defineProperties(Uh.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}}});Uh.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};Uh.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");const i=this._intervals.findDataForIntervalContainingDate(e);if(c(i))return Kh.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};Uh.prototype.equals=function(e){return this===e||e instanceof Uh&&this._intervals.equals(e._intervals,K.equals)&&this._referenceFrame===e._referenceFrame};Uh.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};function Gs(){this._dataSources=[],this._dataSourceAdded=new Le,this._dataSourceRemoved=new Le,this._dataSourceMoved=new Le}Object.defineProperties(Gs.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}}});Gs.prototype.add=function(e){if(!c(e))throw new E("dataSource is required.");const t=this,n=this._dataSources;return Promise.resolve(e).then(function(i){return n===t._dataSources&&(t._dataSources.push(i),t._dataSourceAdded.raiseEvent(t,i)),i})};Gs.prototype.remove=function(e,t){t=y(t,!1);const n=this._dataSources.indexOf(e);return n!==-1?(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&typeof e.destroy=="function"&&e.destroy(),!0):!1};Gs.prototype.removeAll=function(e){e=y(e,!1);const t=this._dataSources;for(let n=0,i=t.length;nthis._primitives.length)throw new E("index must be less than or equal to the number of primitives.")}const i=e._external=e._external||{},o=i._composites=i._composites||{};return o[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),this._primitiveAdded.raiseEvent(e),e};eo.prototype.remove=function(e){if(this.contains(e)){const t=this._primitives.indexOf(e);if(t!==-1)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),this._primitiveRemoved.raiseEvent(e),!0}return!1};eo.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};eo.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let n=0;n1;--S){if(x=R.PI_OVER_TWO-(S-1)*T,P=Am(-x,r,m,g,l,h,u,f,_,P),N=Am(x+Math.PI,r,m,g,l,h,u,f,_,N),t){for(w[v++]=P.x,w[v++]=P.y,w[v++]=P.z,p=2*(S-1)+2,D=1;D1;--s){for(t[n++]=i++,t[n++]=i,t[n++]=r,o=2*s,a=0;aR.PI&&(f.north=f.north>0?R.PI_OVER_TWO-R.EPSILON7:f.north,f.south=f.south<0?R.EPSILON7-R.PI_OVER_TWO:f.south,f.east=R.PI,f.west=-R.PI),f}function Rc(e){e=y(e,y.EMPTY_OBJECT);const t=e.center,n=y(e.ellipsoid,ae.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=y(e.granularity,R.RADIANS_PER_DEGREE),s=y(e.vertexFormat,Ee.DEFAULT);if(A.defined("options.center",t),A.typeOf.number("options.semiMajorAxis",i),A.typeOf.number("options.semiMinorAxis",o),i0){const m=Math.min(u,l);g=Math.round(l/m);const b=Math.min(g*u,l);for(_=0;_0&&(v=!0,x+=l-1),s0&&h!==b-1&&f!==0&&f!==T-1&&(B[q]=!0),q++;_=0;let ee,Y;for(h=1;h=Fe&&h1||P>1))for(let D=0;D0;h-=u)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);if(p){const Fe=de;for(fe=Fe*3,h=0;h<2;h++)X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,Fe*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1)}else for(h=u-1;h>=0;h--)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);let ye=uPe(X,o,a);o.st&&(ye.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:Y})),n&&(ye.attributes.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:q})),M&&(ye.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:ee}));const Ce=je.createTypedArray(W,V*6);let we,Pe,lt,ft;g=X.length/3;let We=0;for(h=0;h0)for(s=new Array(o),i=0;i0)for(a=new Array(o),i=0;i0)for(s=new Array(o),i=0;i0)for(a=new Array(o),i=0;i{i.raiseEvent(a)}),n[r]=s}this.updaters=n,this.geometryChanged=i,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(Id.prototype._onEntityPropertyChanged,this)}Id.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r0){c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let l;c(this.depthFailAppearanceType)&&(c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),l=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Mt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:l,shadows:this.shadows}),o.add(i),t=!1}else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof kt)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r=0;i--){const o=e[i];if(o.remove(t))return o.updaters.length===0&&(e.splice(i,1),o.destroy()),!0}return!1}mc.prototype.remove=function(e){Y2(this._solidItems,e)||Y2(this._translucentItems,e)};function $2(e,t,n){let i=!1;const o=t.length;for(let r=0;r0)for(r=0;r=0;r--){const s=t[r];if(s.invalidated){t.splice(r,1);const a=s.updaters.values,l=a.length;for(let u=0;u0){c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Go.getValue(e,this.materialProperty,this.material);let a;c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Mt({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:a,shadows:this.shadows}),i.add(n),t=!1}else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof kt)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};_c.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new sr({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r=0;--t){const s=o[t];s.isDirty&&(i=o[t].update(e)&&i,s.isDirty=!1),s.geometry.length===0&&o.splice(t,1)}return i};Tp.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let o=0;o0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Go.getValue(e,this.materialProperty,this.material),n=new sr({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};Z_.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Mt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new tn({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r0)for(f=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n0)for(f=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}}while(f);return h};Ap.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,o=i.length;for(n=0;n-1;a--)l=s[a],u=l.id,h=this._updaterSets.get(u),h.entity===l?h.forEach(function(b){f._removeUpdater(b),f._insertUpdaterIntoBatch(e,b)}):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,h=this._updaterSets.get(u),h.forEach(this._removeUpdater.bind(this)),h.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,h=new Id(l,this._scene),this._updaterSets.set(u,h),h.forEach(function(b){f._insertUpdaterIntoBatch(e,b)}),this._subscriptions.set(u,h.geometryChanged.addEventListener(ca._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let _=!0;const g=this._batches,m=g.length;for(a=0;a-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};const sOe=1,aOe="30px sans-serif",cOe=dl.FILL,lOe=z.WHITE,uOe=z.BLACK,dOe=1,hOe=!1,fOe=new z(.165,.165,.165,.8),pOe=new H(7,5),mOe=H.ZERO,_Oe=d.ZERO,gOe=gt.NONE,yOe=Fs.CENTER,bOe=si.CENTER,TOe=new d,AOe=new z,xOe=new z,COe=new z,EOe=new H,wOe=new d,SOe=new H,vOe=new vt,IOe=new vt,DOe=new vt,POe=new Pt;function K2(e){this.entity=e,this.label=void 0,this.index=void 0}function kh(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(kh.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}kh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i-1;o--)r=t[o],c(r._label)&&c(r._position)&&s.set(r.id,new K2(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._label)&&c(r._position)?s.contains(r.id)||s.set(r.id,new K2(r)):(SD(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],SD(s.get(r.id),r,a),s.remove(r.id)};function SD(e,t,n){c(e)&&(e.label=void 0,n.removeLabel(t))}const OOe=1,LOe=0,ROe=!0,NOe=!0,MOe=Vi.ENABLED,FOe=gt.NONE,BOe=z.RED,zOe=0,UOe=z.WHITE,kOe=RC.HIGHLIGHT,VOe=.5,HOe=new H(1,1),GOe=new L,jOe=new L,Z2=new z,J2=new Array(4),WOe=new d;function Vh(e,t){A.typeOf.object("scene",e),A.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(Vh.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new mt,this._onCollectionChanged(t,t.values,[],[])}async function qOe(e,t,n,i){const o=e._primitives,r=e._modelHash;try{const s=await In.fromGltfAsync({url:n,incrementallyLoadTextures:i,scene:e._scene});if(e.isDestroyed()||!c(r[t.id]))return;s.id=t,o.add(s),r[t.id].modelPrimitive=s,s.errorEvent.addEventListener(a=>{!c(r[t.id])||(console.log(a),a.name!=="TextureError"&&s.incrementallyLoadTextures&&(r[t.id].loadFailed=!0))})}catch(s){if(e.isDestroyed()||!c(r[t.id]))return;console.log(s),r[t.id].loadFailed=!0}}Vh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o-1;i--)vD(this,e[i],t,n);return ve(this)};const GT=new d,YOe=new he;Vh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._modelHash[e.id];if(!c(n)||n.loadFailed)return rt.FAILED;const i=n.modelPrimitive;if(!c(i)||!i.show||!i.ready||!n.modelUpdated)return rt.PENDING;const o=this._scene,r=o.globe,s=y(r==null?void 0:r.ellipsoid,ae.WGS84);if(i.heightReference!==gt.NONE){const l=i.modelMatrix;GT.x=l[12],GT.y=l[13],GT.z=l[14];const u=s.cartesianToCartographic(GT,YOe),h=o.getHeight(u,i.heightReference);return c(h)&&(Np(i.heightReference)?u.height=h:u.height+=h),se.clone(i.boundingSphere,t),t.center=s.cartographicToCartesian(u),rt.DONE}return se.clone(i.boundingSphere,t),rt.DONE};Vh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._modelHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._model)&&c(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._model)&&c(r._position)?($Oe(r,a),s.set(r.id,r)):(vD(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],vD(this,r,a,l),s.remove(r.id)};function vD(e,t,n,i){const o=n[t.id];c(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function $Oe(e,t){const n=t[e.id];c(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function Hh(e){this._definitionChanged=new Le,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(Hh.prototype,{isConstant:{get:function(){return K.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return c(this._value)?this._value.referenceFrame:Bs.FIXED}}});Hh.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};Hh.prototype.setValue=function(e){this._value!==e&&(this._value=e,c(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),c(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};Hh.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");if(!!c(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),c(n)?ae.WGS84.scaleToGeodeticSurface(n,n):void 0};Hh.prototype.equals=function(e){return this===e||e instanceof Hh&&this._value===e._value};Hh.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const XOe=60,QOe=1,c9=new Ht,av=new Ht,cv=new Ht;function eB(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function KOe(e,t,n,i,o,r,s,a,l){let u=a,h;h=e.getValueInReferenceFrame(t,r,l[u]),c(h)&&(l[u++]=h);let f=!c(o)||ie.lessThanOrEquals(o,t)||ie.greaterThanOrEquals(o,n),_=0;const g=i.length;let m=i[_];const b=n;let T=!1,x,C,w;for(;_0&&!T){const v=i[_+1],P=ie.secondsDifference(v,m);T=P>s,T&&(x=Math.ceil(P/s),C=0,w=P/Math.max(x,2),x=Math.max(x-1,1))}if(T&&C0){const g=f.pop();l=this._polylineCollection.get(g),t.index=g}else t.index=this._polylineCollection.length,l=this._polylineCollection.add();l.id=n,t.polyline=l}const h=K.getValueOrDefault(i._resolution,e,XOe);l.show=!0,l.positions=u9(o,r,s,e,this._referenceFrame,h,l.positions.slice()),l.material=Go.getValue(e,i._material,l.material),l.width=K.getValueOrDefault(i._width,e,QOe),l.distanceDisplayCondition=K.getValueOrUndefined(i._distanceDisplayCondition,e,l.distanceDisplayCondition)};ib.prototype.removeObject=function(e){const t=e.polyline;c(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};ib.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),ve(this)};function Gh(e,t){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(Gh.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}Gh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const n=this._items.values;if(n.length===0&&c(this._updaters)&&Object.keys(this._updaters).length>0){for(const i in t)t.hasOwnProperty(i)&&t[i].destroy();this._updaters={}}for(let i=0,o=n.length;i-1;o--)r=t[o],c(r._path)&&c(r._position)&&a.set(r.id,new eB(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._path)&&c(r._position)?a.contains(r.id)||a.set(r.id,new eB(r)):(s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id)));for(o=n.length-1;o>-1;o--)r=n[o],s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};Gh._subSample=u9;const nB=z.WHITE,iB=z.BLACK,oB=0,rB=1,sB=0,aB=new z,n1e=new d,cB=new z,lB=new vt,uB=new vt,dB=new Pt;function hB(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 jh(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(jh.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}jh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i0?(u.scale=1,g=g||x!==r.outlineWidth||C!==r.pixelSize||!z.equals(b,r.color)||!z.equals(T,r.outlineColor)):(u.scale=C/50,C=50,g=g||x!==r.outlineWidth||!z.equals(b,r.color)||!z.equals(T,r.outlineColor)),g){r.color=z.clone(b,r.color),r.outlineColor=z.clone(T,r.outlineColor),r.pixelSize=C,r.outlineWidth=x;const w=b.alpha,v=b.toCssColorString(),P=T.toCssColorString(),N=JSON.stringify([v,C,P,x]);u.setImage(N,m8(w,v,P,x,C))}m&&u._updateClamping()}}return!0};jh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._items.get(e.id);if(!c(n)||!(c(n.pointPrimitive)||c(n.billboard)))return rt.FAILED;if(c(n.pointPrimitive))t.center=d.clone(n.pointPrimitive.position,t.center);else{const i=n.billboard;if(!c(i._clampedPosition))return rt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,rt.DONE};jh.prototype.isDestroyed=function(){return!1};jh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(jh.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t-1;o--)r=t[o],c(r._point)&&c(r._position)&&s.set(r.id,new hB(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._point)&&c(r._position)?s.contains(r.id)||s.set(r.id,new hB(r)):(jy(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],jy(s.get(r.id),r,a),s.remove(r.id)};function jy(e,t,n){if(c(e)){const i=e.pointPrimitive;if(c(i)){e.pointPrimitive=void 0,n.removePoint(t);return}const o=e.billboard;c(o)&&(e.billboard=void 0,n.removeBillboard(t))}}const d9=[];function i1e(e,t,n,i,o){const r=d9;r.length=o;let s;const a=n.red,l=n.green,u=n.blue,h=n.alpha,f=i.red,_=i.green,g=i.blue,m=i.alpha;if(z.equals(n,i)){for(s=0;s0?new Array(o):void 0;for(i=0;i0){let O=0,F=f[0];i=i.filter(function(V,G){let j=!1;return o?j=G===F||G===0&&F===1:j=G+1===F,j?(O++,F=f[O],!1):!0})}let g=_.length;if(g<2||t<=0)return;if(r===cn.GEODESIC||r===cn.RHUMB){let O,F;r===cn.GEODESIC?(O=R.chordLength(s,a.maximumRadius),F=Io.numberOfPoints):(O=s,F=Io.numberOfPointsRhumbLine);const V=Io.extractHeights(_,a);if(c(i)){let G=1;for(l=0;l0)return se.fromPoints(t.positions,e),rt.DONE}return rt.FAILED};ob.prototype.isDestroyed=function(){return!1};ob.prototype.destroy=function(){const t=this._geometryUpdater._scene.id+this._primitives._guid,n=eC[t];c(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete eC[t])),c(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),ve(this)};const h1e=new z,f1e=new Pt,p1e=new Pt;function Fl(e,t,n,i,o){let r;n instanceof kt?r=ds:r=Ur,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new mt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.material=void 0,this.updatersWithAttributes=new mt,this.attributes=new mt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Fl.prototype.onMaterialChanged,this),this.subscriptions=new mt,this.showsUpdated=new mt,this.zIndex=i,this._asynchronous=o}Fl.prototype.onMaterialChanged=function(){this.invalidated=!0};Fl.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof kt&&t instanceof kt?!0:c(t)&&t.equals(n)};Fl.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||!K.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,l){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Fl.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 n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};Fl.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new Sc({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===Ur&&(this.material=Go.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===Ur&&(this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};J_.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l-1;a--)l=s[a],u=l.id,h=this._updaters.get(u),h.entity===l?(yB(this,h),bB(this,e,h)):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,h=this._updaters.get(u),yB(this,h),h.destroy(),this._updaters.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,h=new Ml(l,this._scene),this._updaters.set(u,h),bB(this,e,h),this._subscriptions.set(u,h.geometryChanged.addEventListener(au._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let f=!0;const _=this._batches,g=_.length;for(a=0;a-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};function ua(e){A.typeOf.object("options",e),A.typeOf.object("options.scene",e.scene),A.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),sr.initializeTerrainHeights(),Sc.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new Tu,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=y(e.visualizersCallback,ua.defaultVisualizersCallback);let i=!1;const o=new eo,r=new eo;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,h=n.length;unew o(e,i))]};Object.defineProperties(ua.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}}});ua.prototype.isDestroyed=function(){return!1};ua.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,n=e.length;tA1e*s.maximumRadius?(f=CB,d.normalize(l,f),d.negate(f,f),g=d.clone(d.UNIT_Z,lv),_=d.cross(g,f,jT),d.magnitude(_)>R.EPSILON7&&(d.normalize(f,f),d.normalize(_,_),g=d.cross(f,_,lv),d.normalize(g,g),u=!0)):d.equalsEpsilon(l,C,R.EPSILON7)||(g=CB,d.normalize(N,g),d.normalize(k,k),_=d.cross(g,k,lv),h&&(_=d.multiplyByScalar(_,-1,_)),d.equalsEpsilon(_,d.ZERO,R.EPSILON7)||(f=d.cross(_,g,jT),$.multiplyByVector(P,f,f),$.multiplyByVector(P,_,_),$.multiplyByVector(P,g,g),d.normalize(f,f),d.normalize(_,_),d.normalize(g,g),u=!0))}}c(e.boundingSphere)&&(l=e.boundingSphere.center);let m,b,T;i&&(m=d.clone(t.position,uv),b=d.clone(t.direction,EB),T=d.clone(t.up,wB));const x=T1e;u?(x[0]=f.x,x[1]=f.y,x[2]=f.z,x[3]=0,x[4]=_.x,x[5]=_.y,x[6]=_.z,x[7]=0,x[8]=g.x,x[9]=g.y,x[10]=g.z,x[11]=0,x[12]=l.x,x[13]=l.y,x[14]=l.z,x[15]=0):zt.eastNorthUpToFixedFrame(l,s,x),t._setTransform(x),i&&(d.clone(m,t.position),d.clone(b,t.direction),d.clone(T,t.up),d.cross(b,T,t.right))}if(n){const u=a===oe.SCENE2D||d.equals(e._offset3D,d.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,u)}}function S0(e,t,n){A.defined("entity",e),A.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=y(n,ae.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new d,this._defaultOffset3D=void 0,this._offset3D=new d}Object.defineProperties(S0,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=d.clone(e,new d)}}});S0.defaultOffset3D=new d(-14e3,3500,3500);const WT=new F_,C1e=new d;S0.prototype.update=function(e,t){A.defined("time",e);const n=this.scene,i=this.ellipsoid,o=n.mode;if(o===oe.MORPHING)return;const r=this.entity,s=r.position;if(!c(s))return;const a=r!==this._lastEntity,l=o!==this._mode,u=n.camera;let h=a||l,f=!0;if(a){const _=r.viewFrom,g=c(_);if(!g&&c(t)){WT.pitch=-R.PI_OVER_FOUR,WT.range=0;const m=s.getValue(e,C1e);if(c(m)){const b=2-1/Math.max(1,d.magnitude(m)/i.maximumRadius);WT.pitch*=b}u.viewBoundingSphere(t,WT),this.boundingSphere=t,h=!1,f=!1}else(!g||!c(_.getValue(e,this._offset3D)))&&d.clone(S0._defaultOffset3D,this._offset3D)}else!l&&this._mode!==oe.SCENE2D&&d.clone(u.position,this._offset3D);this._lastEntity=r,this._mode=o,x1e(this,u,h,f,s,e,i)};function Do(e){if(typeof e=="string"){const t=document.getElementById(e);if(t===null)throw new E(`Element with id "${e}" does not exist in the document.`);e=t}return e}var wn=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({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:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-wn.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?wn.Bounce.In(e*2)*.5:wn.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),_y=function(){return performance.now()},E1e=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},e.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},e.prototype.update=function(t,n){t===void 0&&(t=_y()),n===void 0&&(n=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o1?r(e[n],e[n-1],n-i):r(e[o],e[o+1>n?n:o+1],i-o)},Bezier:function(e,t){for(var n=0,i=e.length-1,o=Math.pow,r=Jm.Utils.Bernstein,s=0;s<=i;s++)n+=o(1-t,i-s)*o(t,s)*e[s]*r(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=Jm.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(i=n*(1+t))),r(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],i-o)):t<0?e[0]-(r(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(r(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):r(e[o?o-1:0],e[o],e[n1;i--)n*=i;return e[t]=n,n}}(),CatmullRom:function(e,t,n,i,o){var r=(n-e)*.5,s=(i-t)*.5,a=o*o,l=o*a;return(2*t-2*n+r+s)*l+(-3*t+3*n-2*r-s)*a+r*o+t}}},m9=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),ID=new E1e,w1e=function(){function e(t,n){n===void 0&&(n=ID),this._object=t,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=wn.Linear.None,this._interpolationFunction=Jm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=m9.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=_y()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var r in this._valuesEnd)o[r]=this._valuesEnd[r];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,i,o,r){for(var s in i){var a=t[s],l=Array.isArray(a),u=l?"array":typeof a,h=!l&&Array.isArray(i[s]);if(!(u==="undefined"||u==="function")){if(h){var f=i[s];if(f.length===0)continue;for(var _=[a],g=0,m=f.length;g"u"||r)&&(n[s]=a),l||(n[s]*=1),h?o[s]=i[s].slice().reverse():o[s]=n[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(t){return t===void 0&&(t=_y()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},e.prototype.resume=function(t){return t===void 0&&(t=_y()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;to)return!1;n&&this.start(t,!0)}if(this._goToEnd=!1,ti)return 1;var o=t%n,r=Math.min(o/this._duration,1);return r===0&&t!==0&&t%this._duration===0?1:r},e.prototype._calculateCompletionStatus=function(t,n){return this._duration!==0&&t= PRIMARY_STEPS) { break; } // Calculate sample position along viewpoint ray. vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength); // Calculate height of sample position above ellipsoid. float sampleHeight = length(samplePosition) - atmosphereInnerRadius; // Calculate and accumulate density of particles at the sample position. vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength; opticalDepth += sampleDensity; // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere. czm_ray lightRay = czm_ray(samplePosition, lightDirection); czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius); float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS); float lightPositionLength = 0.0; vec2 lightOpticalDepth = vec2(0.0); // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment. for (int j = 0; j < LIGHT_STEPS_MAX; ++j) { // The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot // loop with non-constant condition, so it has to break early instead if (j >= LIGHT_STEPS) { break; } // Calculate sample position along light ray. vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5); // Calculate height of the light sample position above ellipsoid. float lightHeight = length(lightPosition) - atmosphereInnerRadius; // Calculate density of photons at the light sample position. lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength; // Increment distance on light ray. lightPositionLength += lightStepLength; } // Compute attenuation via the primary ray and the light ray. vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x)))); // Accumulate the scattering. rayleighAccumulation += sampleDensity.x * attenuation; mieAccumulation += sampleDensity.y * attenuation; // Increment distance on primary ray. rayPositionLength += (rayStepLength += rayStepLengthIncrease); } // Compute the scattering amount. rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation; mieColor = u_atmosphereMieCoefficient * mieAccumulation; // Compute the transmittance i.e. how much light is passing through the atmosphere. opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x)))); } vec4 computeAtmosphereColor( vec3 positionWC, vec3 lightDirection, vec3 rayleighColor, vec3 mieColor, float opacity ) { // Setup the primary ray: from the camera position to the vertex position. vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC; vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC); float cosAngle = dot(cameraToPositionWCDirection, lightDirection); float cosAngleSq = cosAngle * cosAngle; float G = u_atmosphereMieAnisotropy; float GSq = G * G; // The Rayleigh phase function. float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq); // The Mie phase function. float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq)); // The final color is generated by combining the effects of the Rayleigh and Mie scattering. vec3 rayleigh = rayleighPhase * rayleighColor; vec3 mie = miePhase * mieColor; vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity; return vec4(color, opacity); } `,v1e=`in vec2 v_textureCoordinates; const float M_PI = 3.141592653589793; float vdcRadicalInverse(int i) { float r; float base = 2.0; float value = 0.0; float invBase = 1.0 / base; float invBi = invBase; for (int x = 0; x < 100; x++) { if (i <= 0) { break; } r = mod(float(i), base); value += r * invBi; invBi *= invBase; i = int(float(i) * invBase); } return value; } vec2 hammersley2D(int i, int N) { return vec2(float(i) / float(N), vdcRadicalInverse(i)); } vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N) { float a = roughness * roughness; float phi = 2.0 * M_PI * xi.x; float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y)); float sinTheta = sqrt(1.0 - cosTheta * cosTheta); vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); vec3 tangentX = normalize(cross(upVector, N)); vec3 tangentY = cross(N, tangentX); return tangentX * H.x + tangentY * H.y + N * H.z; } float G1_Smith(float NdotV, float k) { return NdotV / (NdotV * (1.0 - k) + k); } float G_Smith(float roughness, float NdotV, float NdotL) { float k = roughness * roughness / 2.0; return G1_Smith(NdotV, k) * G1_Smith(NdotL, k); } vec2 integrateBrdf(float roughness, float NdotV) { vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV); float A = 0.0; float B = 0.0; const int NumSamples = 1024; for (int i = 0; i < NumSamples; i++) { vec2 xi = hammersley2D(i, NumSamples); vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0)); vec3 L = 2.0 * dot(V, H) * H - V; float NdotL = clamp(L.z, 0.0, 1.0); float NdotH = clamp(H.z, 0.0, 1.0); float VdotH = clamp(dot(V, H), 0.0, 1.0); if (NdotL > 0.0) { float G = G_Smith(roughness, NdotV, NdotL); float G_Vis = G * VdotH / (NdotH * NdotV); float Fc = pow(1.0 - VdotH, 5.0); A += (1.0 - Fc) * G_Vis; B += Fc * G_Vis; } } return vec2(A, B) / float(NumSamples); } void main() { out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0); } `,I1e=`uniform sampler2D u_opaqueDepthTexture; uniform sampler2D u_translucentDepthTexture; in vec2 v_textureCoordinates; void main() { float opaqueDepth = texture(u_opaqueDepthTexture, v_textureCoordinates).r; float translucentDepth = texture(u_translucentDepthTexture, v_textureCoordinates).r; translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth); out_FragColor = czm_packDepth(translucentDepth); } `,D1e=`/** * Compositing for Weighted Blended Order-Independent Transparency. See: * - http://jcgt.org/published/0002/02/09/ * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html */ uniform sampler2D u_opaque; uniform sampler2D u_accumulation; uniform sampler2D u_revealage; in vec2 v_textureCoordinates; void main() { vec4 opaque = texture(u_opaque, v_textureCoordinates); vec4 accum = texture(u_accumulation, v_textureCoordinates); float r = texture(u_revealage, v_textureCoordinates).r; #ifdef MRT vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a); #else vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r); #endif out_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque; if (opaque != czm_backgroundColor) { out_FragColor.a = 1.0; } } `,P1e=`in vec4 positionEC; void main() { vec3 position; vec3 direction; if (czm_orthographicIn3D == 1.0) { vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw; vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top position = vec3(mix(minPlane, maxPlane, uv), 0.0); direction = vec3(0.0, 0.0, -1.0); } else { position = vec3(0.0); direction = normalize(positionEC.xyz); } czm_ray ray = czm_ray(position, direction); vec3 ellipsoid_center = czm_view[3].xyz; czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii); if (!czm_isEmpty(intersection)) { out_FragColor = vec4(1.0, 1.0, 0.0, 1.0); } else { discard; } czm_writeLogDepth(); } `,O1e=`in vec4 position; out vec4 positionEC; void main() { positionEC = czm_modelView * position; gl_Position = czm_projection * positionEC; czm_vertexLogDepth(); } `,vB=`uniform vec3 u_radii; uniform vec3 u_oneOverEllipsoidRadiiSquared; in vec3 v_positionEC; vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side) { vec3 positionEC = czm_pointAlongRay(ray, intersection); vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz; vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared)); vec3 sphericalNormal = normalize(positionMC / u_radii); vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordinates vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal); vec3 positionToEyeEC = -positionEC; czm_materialInput materialInput; materialInput.s = st.s; materialInput.st = st; materialInput.str = (positionMC + u_radii) / u_radii; materialInput.normalEC = normalEC; materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC); materialInput.positionToEyeEC = positionToEyeEC; czm_material material = czm_getMaterial(materialInput); #ifdef ONLY_SUN_LIGHTING return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC); #else return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC); #endif } void main() { // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii // in the vertex shader. Only when it is larger than some constant, march along the ray. // Otherwise perform one intersection test which will be the common case. // Test if the ray intersects a sphere with the ellipsoid's maximum radius. // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test // may cause false negatives. This will discard fragments before marching the ray forward. float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5; vec3 direction = normalize(v_positionEC); vec3 ellipsoidCenter = czm_modelView[3].xyz; float t1 = -1.0; float t2 = -1.0; float b = -2.0 * dot(direction, ellipsoidCenter); float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius; float discriminant = b * b - 4.0 * c; if (discriminant >= 0.0) { t1 = (-b - sqrt(discriminant)) * 0.5; t2 = (-b + sqrt(discriminant)) * 0.5; } if (t1 < 0.0 && t2 < 0.0) { discard; } float t = min(t1, t2); if (t < 0.0) { t = 0.0; } // March ray forward to intersection with larger sphere and find czm_ray ray = czm_ray(t * direction, direction); vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z); czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii); if (czm_isEmpty(intersection)) { discard; } // If the viewer is outside, compute outsideFaceColor, with normals facing outward. vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0); // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward. vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0); out_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a); out_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a); #if (defined(WRITE_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth))) t = (intersection.start != 0.0) ? intersection.start : intersection.stop; vec3 positionEC = czm_pointAlongRay(ray, t); vec4 positionCC = czm_projection * vec4(positionEC, 1.0); #ifdef LOG_DEPTH czm_writeLogDepth(1.0 + positionCC.w); #else float z = positionCC.z / positionCC.w; float n = czm_depthRange.near; float f = czm_depthRange.far; gl_FragDepth = (z * (f - n) + f + n) * 0.5; #endif #endif } `,IB=`in vec3 position; uniform vec3 u_radii; out vec3 v_positionEC; void main() { // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates. // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry, // but doing it here allows us to change the radii without rewriting the vertex data, and // allows all ellipsoids to reuse the same vertex data. vec4 p = vec4(u_radii * position, 1.0); v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates gl_Position = czm_modelViewProjection * p; // position in clip coordinates // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the // ellipsoid (does not write depth) that was rendered in the farther frustum. // // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates // artifacts since some fragments can be alpha blended twice. This is solved by only rendering // the ellipsoid in the closest frustum to the viewer. gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far); czm_vertexLogDepth(); } `;/** * @license * Copyright (c) 2014-2015, NVIDIA CORPORATION. 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 NVIDIA CORPORATION 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 ``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. */const L1e=`/** * @license * Copyright (c) 2014-2015, NVIDIA CORPORATION. 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 NVIDIA CORPORATION 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 \`\`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. */ // NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples // Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h // Steps used to integrate into Cesium: // * The following defines are set: // #define FXAA_PC 1 // #define FXAA_WEBGL_1 1 // #define FXAA_GREEN_AS_LUMA 1 // #define FXAA_EARLY_EXIT 1 // #define FXAA_GLSL_120 1 // * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed. // * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace // /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/. // * There are no implicit conversions from ivec* to vec* so replace: // #define FxaaInt2 ivec2 // with // #define FxaaInt2 vec2 // * The texture2DLod function is only available in vertex shaders so replace: // #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0) // #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0) // with // #define FxaaTexTop(t, p) texture(t, p) // #define FxaaTexOff(t, p, o, r) texture(t, p + (o * r)) // * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future. // * The following parameters to FxaaPixelShader are unused and can be removed: // fxaaConsolePosPos // fxaaConsoleRcpFrameOpt // fxaaConsoleRcpFrameOpt2 // fxaaConsole360RcpFrameOpt2 // fxaaConsoleEdgeSharpness // fxaaConsoleEdgeThreshold // fxaaConsoleEdgeThresholdMi // fxaaConsole360ConstDir // // Choose the quality preset. // This needs to be compiled into the shader as it effects code. // Best option to include multiple presets is to // in each shader define the preset, then include this file. // // OPTIONS // ----------------------------------------------------------------------- // 10 to 15 - default medium dither (10=fastest, 15=highest quality) // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) // 39 - no dither, very expensive // // NOTES // ----------------------------------------------------------------------- // 12 = slightly faster then FXAA 3.9 and higher edge quality (default) // 13 = about same speed as FXAA 3.9 and better than 12 // 23 = closest to FXAA 3.9 visually and performance wise // _ = the lowest digit is directly related to performance // _ = the highest digit is directly related to style // //#define FXAA_QUALITY_PRESET 12 #if (FXAA_QUALITY_PRESET == 10) #define FXAA_QUALITY_PS 3 #define FXAA_QUALITY_P0 1.5 #define FXAA_QUALITY_P1 3.0 #define FXAA_QUALITY_P2 12.0 #endif #if (FXAA_QUALITY_PRESET == 11) #define FXAA_QUALITY_PS 4 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 3.0 #define FXAA_QUALITY_P3 12.0 #endif #if (FXAA_QUALITY_PRESET == 12) #define FXAA_QUALITY_PS 5 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 4.0 #define FXAA_QUALITY_P4 12.0 #endif #if (FXAA_QUALITY_PRESET == 13) #define FXAA_QUALITY_PS 6 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 4.0 #define FXAA_QUALITY_P5 12.0 #endif #if (FXAA_QUALITY_PRESET == 14) #define FXAA_QUALITY_PS 7 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 4.0 #define FXAA_QUALITY_P6 12.0 #endif #if (FXAA_QUALITY_PRESET == 15) #define FXAA_QUALITY_PS 8 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 4.0 #define FXAA_QUALITY_P7 12.0 #endif #if (FXAA_QUALITY_PRESET == 20) #define FXAA_QUALITY_PS 3 #define FXAA_QUALITY_P0 1.5 #define FXAA_QUALITY_P1 2.0 #define FXAA_QUALITY_P2 8.0 #endif #if (FXAA_QUALITY_PRESET == 21) #define FXAA_QUALITY_PS 4 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 8.0 #endif #if (FXAA_QUALITY_PRESET == 22) #define FXAA_QUALITY_PS 5 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 8.0 #endif #if (FXAA_QUALITY_PRESET == 23) #define FXAA_QUALITY_PS 6 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 8.0 #endif #if (FXAA_QUALITY_PRESET == 24) #define FXAA_QUALITY_PS 7 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 3.0 #define FXAA_QUALITY_P6 8.0 #endif #if (FXAA_QUALITY_PRESET == 25) #define FXAA_QUALITY_PS 8 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 4.0 #define FXAA_QUALITY_P7 8.0 #endif #if (FXAA_QUALITY_PRESET == 26) #define FXAA_QUALITY_PS 9 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 2.0 #define FXAA_QUALITY_P7 4.0 #define FXAA_QUALITY_P8 8.0 #endif #if (FXAA_QUALITY_PRESET == 27) #define FXAA_QUALITY_PS 10 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 2.0 #define FXAA_QUALITY_P7 2.0 #define FXAA_QUALITY_P8 4.0 #define FXAA_QUALITY_P9 8.0 #endif #if (FXAA_QUALITY_PRESET == 28) #define FXAA_QUALITY_PS 11 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 2.0 #define FXAA_QUALITY_P7 2.0 #define FXAA_QUALITY_P8 2.0 #define FXAA_QUALITY_P9 4.0 #define FXAA_QUALITY_P10 8.0 #endif #if (FXAA_QUALITY_PRESET == 29) #define FXAA_QUALITY_PS 12 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.5 #define FXAA_QUALITY_P2 2.0 #define FXAA_QUALITY_P3 2.0 #define FXAA_QUALITY_P4 2.0 #define FXAA_QUALITY_P5 2.0 #define FXAA_QUALITY_P6 2.0 #define FXAA_QUALITY_P7 2.0 #define FXAA_QUALITY_P8 2.0 #define FXAA_QUALITY_P9 2.0 #define FXAA_QUALITY_P10 4.0 #define FXAA_QUALITY_P11 8.0 #endif #if (FXAA_QUALITY_PRESET == 39) #define FXAA_QUALITY_PS 12 #define FXAA_QUALITY_P0 1.0 #define FXAA_QUALITY_P1 1.0 #define FXAA_QUALITY_P2 1.0 #define FXAA_QUALITY_P3 1.0 #define FXAA_QUALITY_P4 1.0 #define FXAA_QUALITY_P5 1.5 #define FXAA_QUALITY_P6 2.0 #define FXAA_QUALITY_P7 2.0 #define FXAA_QUALITY_P8 2.0 #define FXAA_QUALITY_P9 2.0 #define FXAA_QUALITY_P10 4.0 #define FXAA_QUALITY_P11 8.0 #endif #define FxaaBool bool #define FxaaFloat float #define FxaaFloat2 vec2 #define FxaaFloat3 vec3 #define FxaaFloat4 vec4 #define FxaaHalf float #define FxaaHalf2 vec2 #define FxaaHalf3 vec3 #define FxaaHalf4 vec4 #define FxaaInt2 vec2 #define FxaaTex sampler2D #define FxaaSat(x) clamp(x, 0.0, 1.0) #define FxaaTexTop(t, p) texture(t, p) #define FxaaTexOff(t, p, o, r) texture(t, p + (o * r)) FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } FxaaFloat4 FxaaPixelShader( // // Use noperspective interpolation here (turn off perspective interpolation). // {xy} = center of pixel FxaaFloat2 pos, // // Input color texture. // {rgb_} = color in linear or perceptual color space // if (FXAA_GREEN_AS_LUMA == 0) // {___a} = luma in perceptual color space (not linear) FxaaTex tex, // // Only used on FXAA Quality. // This must be from a constant/uniform. // {x_} = 1.0/screenWidthInPixels // {_y} = 1.0/screenHeightInPixels FxaaFloat2 fxaaQualityRcpFrame, // // Only used on FXAA Quality. // This used to be the FXAA_QUALITY_SUBPIX define. // It is here now to allow easier tuning. // Choose the amount of sub-pixel aliasing removal. // This can effect sharpness. // 1.00 - upper limit (softer) // 0.75 - default amount of filtering // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) // 0.25 - almost off // 0.00 - completely off FxaaFloat fxaaQualitySubpix, // // Only used on FXAA Quality. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define. // It is here now to allow easier tuning. // The minimum amount of local contrast required to apply algorithm. // 0.333 - too little (faster) // 0.250 - low quality // 0.166 - default // 0.125 - high quality // 0.063 - overkill (slower) FxaaFloat fxaaQualityEdgeThreshold, // // Only used on FXAA Quality. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define. // It is here now to allow easier tuning. // Trims the algorithm from processing darks. // 0.0833 - upper limit (default, the start of visible unfiltered edges) // 0.0625 - high quality (faster) // 0.0312 - visible limit (slower) // Special notes when using FXAA_GREEN_AS_LUMA, // Likely want to set this to zero. // As colors that are mostly not-green // will appear very dark in the green channel! // Tune by looking at mostly non-green content, // then start at zero and increase until aliasing is a problem. FxaaFloat fxaaQualityEdgeThresholdMin ) { /*--------------------------------------------------------------------------*/ FxaaFloat2 posM; posM.x = pos.x; posM.y = pos.y; FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); #define lumaM rgbyM.y FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy)); FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy)); FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy)); FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy)); /*--------------------------------------------------------------------------*/ FxaaFloat maxSM = max(lumaS, lumaM); FxaaFloat minSM = min(lumaS, lumaM); FxaaFloat maxESM = max(lumaE, maxSM); FxaaFloat minESM = min(lumaE, minSM); FxaaFloat maxWN = max(lumaN, lumaW); FxaaFloat minWN = min(lumaN, lumaW); FxaaFloat rangeMax = max(maxWN, maxESM); FxaaFloat rangeMin = min(minWN, minESM); FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold; FxaaFloat range = rangeMax - rangeMin; FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled); FxaaBool earlyExit = range < rangeMaxClamped; /*--------------------------------------------------------------------------*/ if(earlyExit) return rgbyM; /*--------------------------------------------------------------------------*/ FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy)); FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy)); FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy)); FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); /*--------------------------------------------------------------------------*/ FxaaFloat lumaNS = lumaN + lumaS; FxaaFloat lumaWE = lumaW + lumaE; FxaaFloat subpixRcpRange = 1.0/range; FxaaFloat subpixNSWE = lumaNS + lumaWE; FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS; FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE; /*--------------------------------------------------------------------------*/ FxaaFloat lumaNESE = lumaNE + lumaSE; FxaaFloat lumaNWNE = lumaNW + lumaNE; FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE; FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE; /*--------------------------------------------------------------------------*/ FxaaFloat lumaNWSW = lumaNW + lumaSW; FxaaFloat lumaSWSE = lumaSW + lumaSE; FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2); FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2); FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW; FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE; FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4; FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4; /*--------------------------------------------------------------------------*/ FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE; FxaaFloat lengthSign = fxaaQualityRcpFrame.x; FxaaBool horzSpan = edgeHorz >= edgeVert; FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE; /*--------------------------------------------------------------------------*/ if(!horzSpan) lumaN = lumaW; if(!horzSpan) lumaS = lumaE; if(horzSpan) lengthSign = fxaaQualityRcpFrame.y; FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM; /*--------------------------------------------------------------------------*/ FxaaFloat gradientN = lumaN - lumaM; FxaaFloat gradientS = lumaS - lumaM; FxaaFloat lumaNN = lumaN + lumaM; FxaaFloat lumaSS = lumaS + lumaM; FxaaBool pairN = abs(gradientN) >= abs(gradientS); FxaaFloat gradient = max(abs(gradientN), abs(gradientS)); if(pairN) lengthSign = -lengthSign; FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange); /*--------------------------------------------------------------------------*/ FxaaFloat2 posB; posB.x = posM.x; posB.y = posM.y; FxaaFloat2 offNP; offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; if(!horzSpan) posB.x += lengthSign * 0.5; if( horzSpan) posB.y += lengthSign * 0.5; /*--------------------------------------------------------------------------*/ FxaaFloat2 posN; posN.x = posB.x - offNP.x * FXAA_QUALITY_P0; posN.y = posB.y - offNP.y * FXAA_QUALITY_P0; FxaaFloat2 posP; posP.x = posB.x + offNP.x * FXAA_QUALITY_P0; posP.y = posB.y + offNP.y * FXAA_QUALITY_P0; FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); FxaaFloat subpixE = subpixC * subpixC; FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP)); /*--------------------------------------------------------------------------*/ if(!pairN) lumaNN = lumaSS; FxaaFloat gradientScaled = gradient * 1.0/4.0; FxaaFloat lumaMM = lumaM - lumaNN * 0.5; FxaaFloat subpixF = subpixD * subpixE; FxaaBool lumaMLTZero = lumaMM < 0.0; /*--------------------------------------------------------------------------*/ lumaEndN -= lumaNN * 0.5; lumaEndP -= lumaNN * 0.5; FxaaBool doneN = abs(lumaEndN) >= gradientScaled; FxaaBool doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1; FxaaBool doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1; /*--------------------------------------------------------------------------*/ if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 3) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 4) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 5) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 6) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 7) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 8) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 9) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 10) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 11) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11; /*--------------------------------------------------------------------------*/ #if (FXAA_QUALITY_PS > 12) if(doneNP) { if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; doneN = abs(lumaEndN) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12; doneNP = (!doneN) || (!doneP); if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12; /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } #endif /*--------------------------------------------------------------------------*/ } /*--------------------------------------------------------------------------*/ FxaaFloat dstN = posM.x - posN.x; FxaaFloat dstP = posP.x - posM.x; if(!horzSpan) dstN = posM.y - posN.y; if(!horzSpan) dstP = posP.y - posM.y; /*--------------------------------------------------------------------------*/ FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero; FxaaFloat spanLength = (dstP + dstN); FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero; FxaaFloat spanLengthRcp = 1.0/spanLength; /*--------------------------------------------------------------------------*/ FxaaBool directionN = dstN < dstP; FxaaFloat dst = min(dstN, dstP); FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP; FxaaFloat subpixG = subpixF * subpixF; FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5; FxaaFloat subpixH = subpixG * fxaaQualitySubpix; /*--------------------------------------------------------------------------*/ FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0; FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH); if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign; if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign; return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); } `,R1e=`uniform vec4 u_initialColor; #if TEXTURE_UNITS > 0 uniform sampler2D u_dayTextures[TEXTURE_UNITS]; uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS]; uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS]; #ifdef APPLY_ALPHA uniform float u_dayTextureAlpha[TEXTURE_UNITS]; #endif #ifdef APPLY_DAY_NIGHT_ALPHA uniform float u_dayTextureNightAlpha[TEXTURE_UNITS]; uniform float u_dayTextureDayAlpha[TEXTURE_UNITS]; #endif #ifdef APPLY_SPLIT uniform float u_dayTextureSplit[TEXTURE_UNITS]; #endif #ifdef APPLY_BRIGHTNESS uniform float u_dayTextureBrightness[TEXTURE_UNITS]; #endif #ifdef APPLY_CONTRAST uniform float u_dayTextureContrast[TEXTURE_UNITS]; #endif #ifdef APPLY_HUE uniform float u_dayTextureHue[TEXTURE_UNITS]; #endif #ifdef APPLY_SATURATION uniform float u_dayTextureSaturation[TEXTURE_UNITS]; #endif #ifdef APPLY_GAMMA uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS]; #endif #ifdef APPLY_IMAGERY_CUTOUT uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS]; #endif #ifdef APPLY_COLOR_TO_ALPHA uniform vec4 u_colorsToAlpha[TEXTURE_UNITS]; #endif uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS]; #endif #ifdef SHOW_REFLECTIVE_OCEAN uniform sampler2D u_waterMask; uniform vec4 u_waterMaskTranslationAndScale; uniform float u_zoomedOutOceanSpecularIntensity; #endif #ifdef SHOW_OCEAN_WAVES uniform sampler2D u_oceanNormalMap; #endif #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE) uniform vec2 u_lightingFadeDistance; #endif #ifdef TILE_LIMIT_RECTANGLE uniform vec4 u_cartographicLimitRectangle; #endif #ifdef GROUND_ATMOSPHERE uniform vec2 u_nightFadeDistance; #endif #ifdef ENABLE_CLIPPING_PLANES uniform highp sampler2D u_clippingPlanes; uniform mat4 u_clippingPlanesMatrix; uniform vec4 u_clippingPlanesEdgeStyle; #endif #ifdef ENABLE_CLIPPING_POLYGONS uniform highp sampler2D u_clippingDistance; in vec2 v_clippingPosition; flat in int v_regionIndex; #endif #if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)) uniform float u_minimumBrightness; #endif #ifdef COLOR_CORRECT uniform vec3 u_hsbShift; // Hue, saturation, brightness #endif #ifdef HIGHLIGHT_FILL_TILE uniform vec4 u_fillHighlightColor; #endif #ifdef TRANSLUCENT uniform vec4 u_frontFaceAlphaByDistance; uniform vec4 u_backFaceAlphaByDistance; uniform vec4 u_translucencyRectangle; #endif #ifdef UNDERGROUND_COLOR uniform vec4 u_undergroundColor; uniform vec4 u_undergroundColorAlphaByDistance; #endif #ifdef ENABLE_VERTEX_LIGHTING uniform float u_lambertDiffuseMultiplier; uniform float u_vertexShadowDarkness; #endif in vec3 v_positionMC; in vec3 v_positionEC; in vec3 v_textureCoordinates; in vec3 v_normalMC; in vec3 v_normalEC; #ifdef APPLY_MATERIAL in float v_height; in float v_slope; in float v_aspect; #endif #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) in float v_distance; #endif #if defined(GROUND_ATMOSPHERE) || defined(FOG) in vec3 v_atmosphereRayleighColor; in vec3 v_atmosphereMieColor; in float v_atmosphereOpacity; #endif #if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) float interpolateByDistance(vec4 nearFarScalar, float distance) { float startDistance = nearFarScalar.x; float startValue = nearFarScalar.y; float endDistance = nearFarScalar.z; float endValue = nearFarScalar.w; float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0); return mix(startValue, endValue, t); } #endif #if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL) vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) { return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a); } #endif #ifdef TRANSLUCENT bool inTranslucencyRectangle() { return v_textureCoordinates.x > u_translucencyRectangle.x && v_textureCoordinates.x < u_translucencyRectangle.z && v_textureCoordinates.y > u_translucencyRectangle.y && v_textureCoordinates.y < u_translucencyRectangle.w; } #endif vec4 sampleAndBlend( vec4 previousColor, sampler2D textureToSample, vec2 tileTextureCoordinates, vec4 textureCoordinateRectangle, vec4 textureCoordinateTranslationAndScale, float textureAlpha, float textureNightAlpha, float textureDayAlpha, float textureBrightness, float textureContrast, float textureHue, float textureSaturation, float textureOneOverGamma, float split, vec4 colorToAlpha, float nightBlend) { // This crazy step stuff sets the alpha to 0.0 if this following condition is true: // tileTextureCoordinates.s < textureCoordinateRectangle.s || // tileTextureCoordinates.s > textureCoordinateRectangle.p || // tileTextureCoordinates.t < textureCoordinateRectangle.t || // tileTextureCoordinates.t > textureCoordinateRectangle.q // In other words, the alpha is zero if the fragment is outside the rectangle // covered by this texture. Would an actual 'if' yield better performance? vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend); #endif vec2 translation = textureCoordinateTranslationAndScale.xy; vec2 scale = textureCoordinateTranslationAndScale.zw; vec2 textureCoordinates = tileTextureCoordinates * scale + translation; vec4 value = texture(textureToSample, textureCoordinates); vec3 color = value.rgb; float alpha = value.a; #ifdef APPLY_COLOR_TO_ALPHA vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb); colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b); alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha); #endif #if !defined(APPLY_GAMMA) vec4 tempColor = czm_gammaCorrect(vec4(color, alpha)); color = tempColor.rgb; alpha = tempColor.a; #else color = pow(color, vec3(textureOneOverGamma)); #endif #ifdef APPLY_SPLIT float splitPosition = czm_splitPosition; // Split to the left if (split < 0.0 && gl_FragCoord.x > splitPosition) { alpha = 0.0; } // Split to the right else if (split > 0.0 && gl_FragCoord.x < splitPosition) { alpha = 0.0; } #endif #ifdef APPLY_BRIGHTNESS color = mix(vec3(0.0), color, textureBrightness); #endif #ifdef APPLY_CONTRAST color = mix(vec3(0.5), color, textureContrast); #endif #ifdef APPLY_HUE color = czm_hue(color, textureHue); #endif #ifdef APPLY_SATURATION color = czm_saturation(color, textureSaturation); #endif float sourceAlpha = alpha * textureAlpha; float outAlpha = mix(previousColor.a, 1.0, sourceAlpha); outAlpha += sign(outAlpha) - 1.0; vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha; // When rendering imagery for a tile in multiple passes, // some GPU/WebGL implementation combinations will not blend fragments in // additional passes correctly if their computation includes an unmasked // divide-by-zero operation, // even if it's not in the output or if the output has alpha zero. // // For example, without sanitization for outAlpha, // this renders without artifacts: // if (outAlpha == 0.0) { outColor = vec3(0.0); } // // but using czm_branchFreeTernary will cause portions of the tile that are // alpha-zero in the additional pass to render as black instead of blending // with the previous pass: // outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor); // // So instead, sanitize against divide-by-zero, // store this state on the sign of outAlpha, and correct on return. return vec4(outColor, max(outAlpha, 0.0)); } vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend); vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade); const float fExposure = 2.0; vec3 computeEllipsoidPosition() { float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0); vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0); xy *= czm_viewport.zw * mpp * 0.5; vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x)); czm_ray ray = czm_ray(vec3(0.0), direction); vec3 ellipsoid_center = czm_view[3].xyz; czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii); vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start); return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz; } void main() { #ifdef TILE_LIMIT_RECTANGLE if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x || v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y) { discard; } #endif #ifdef ENABLE_CLIPPING_PLANES float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix); #endif #if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR) vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordinates #endif #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0); #else float nightBlend = 0.0; #endif // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0 // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the // fragments on the edges of tiles even though the vertex shader is outputting // coordinates strictly in the 0-1 range. vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend); #ifdef SHOW_TILE_BOUNDARIES if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) || v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0)) { color = vec4(1.0, 0.0, 0.0, 1.0); } #endif #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE) float cameraDist; if (czm_sceneMode == czm_sceneMode2D) { cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5; } else if (czm_sceneMode == czm_sceneModeColumbusView) { cameraDist = -czm_view[3].z; } else { cameraDist = length(czm_view[3]); } float fadeOutDist = u_lightingFadeDistance.x; float fadeInDist = u_lightingFadeDistance.y; if (czm_sceneMode != czm_sceneMode3D) { vec3 radii = czm_ellipsoidRadii; float maxRadii = max(radii.x, max(radii.y, radii.z)); fadeOutDist -= maxRadii; fadeInDist -= maxRadii; } float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0); #else float fade = 0.0; #endif #ifdef SHOW_REFLECTIVE_OCEAN vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy; vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw; vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation; waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y; float mask = texture(u_waterMask, waterMaskTextureCoordinates).r; if (mask > 0.0) { mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC); vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC); vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx); vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z)); color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade); } #endif #ifdef APPLY_MATERIAL czm_materialInput materialInput; materialInput.st = v_textureCoordinates.st; materialInput.normalEC = normalize(v_normalEC); materialInput.positionToEyeEC = -v_positionEC; materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC)); materialInput.slope = v_slope; materialInput.height = v_height; materialInput.aspect = v_aspect; czm_material material = czm_getMaterial(materialInput); vec4 materialColor = vec4(material.diffuse, material.alpha); color = alphaBlend(materialColor, color); #endif #ifdef ENABLE_VERTEX_LIGHTING float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0); vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a); #elif defined(ENABLE_DAYNIGHT_SHADING) float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0); diffuseIntensity = mix(1.0, diffuseIntensity, fade); vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a); #else vec4 finalColor = color; #endif #ifdef ENABLE_CLIPPING_PLANES vec4 clippingPlanesEdgeColor = vec4(1.0); clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb; float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a; if (clipDistance < clippingPlanesEdgeWidth) { finalColor = clippingPlanesEdgeColor; } #endif #ifdef ENABLE_CLIPPING_POLYGONS vec2 clippingPosition = v_clippingPosition; int regionIndex = v_regionIndex; clipPolygons(u_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex); #endif #ifdef HIGHLIGHT_FILL_TILE finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a); #endif #if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN) vec3 atmosphereLightDirection = czm_sunDirectionWC; #else vec3 atmosphereLightDirection = czm_lightDirectionWC; #endif #if defined(GROUND_ATMOSPHERE) || defined(FOG) if (!czm_backFacing()) { bool dynamicLighting = false; #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING)) dynamicLighting = true; #endif vec3 rayleighColor; vec3 mieColor; float opacity; vec3 positionWC; vec3 lightDirection; // When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader. // Otherwise, the scattering is computed in the vertex shader. #ifdef PER_FRAGMENT_GROUND_ATMOSPHERE positionWC = computeEllipsoidPosition(); lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC)); computeAtmosphereScattering( positionWC, lightDirection, rayleighColor, mieColor, opacity ); #else positionWC = v_positionMC; lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC)); rayleighColor = v_atmosphereRayleighColor; mieColor = v_atmosphereMieColor; opacity = v_atmosphereOpacity; #endif #ifdef COLOR_CORRECT const bool ignoreBlackPixels = true; rayleighColor = czm_applyHSBShift(rayleighColor, u_hsbShift, ignoreBlackPixels); mieColor = czm_applyHSBShift(mieColor, u_hsbShift, ignoreBlackPixels); #endif vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity); // Fog is applied to tiles selected for fog, close to the Earth. #ifdef FOG vec3 fogColor = groundAtmosphereColor.rgb; // If there is lighting, apply that to the fog. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)) float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0); fogColor *= darken; #endif #ifndef HDR fogColor.rgb = czm_acesTonemapping(fogColor.rgb); fogColor.rgb = czm_inverseGamma(fogColor.rgb); #endif const float modifier = 0.15; finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a); #else // Apply ground atmosphere. This happens when the camera is far away from the earth. // The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere. // This value is larger near the "circumference", as it is further away from the camera. We use it to // brighten up that area of the ground atmosphere. const float transmittanceModifier = 0.5; float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0); vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance; #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)) float fadeInDist = u_nightFadeDistance.x; float fadeOutDist = u_nightFadeDistance.y; float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0); float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0); vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken); finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity); #endif #ifndef HDR finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb); #else finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6); #endif finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade); #endif } #endif #ifdef UNDERGROUND_COLOR if (czm_backFacing()) { float distanceFromEllipsoid = max(czm_eyeHeight, 0.0); float distance = max(v_distance - distanceFromEllipsoid, 0.0); float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance); vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount); finalColor = alphaBlend(undergroundColor, finalColor); } #endif #ifdef TRANSLUCENT if (inTranslucencyRectangle()) { vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance; finalColor.a *= interpolateByDistance(alphaByDistance, v_distance); } #endif out_FragColor = finalColor; } #ifdef SHOW_REFLECTIVE_OCEAN float waveFade(float edge0, float edge1, float x) { float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); return pow(1.0 - y, 5.0); } float linearFade(float edge0, float edge1, float x) { return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); } // Based on water rendering by Jonas Wagner: // http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog // low altitude wave settings const float oceanFrequencyLowAltitude = 825000.0; const float oceanAnimationSpeedLowAltitude = 0.004; const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0; const float oceanSpecularIntensity = 0.5; // high altitude wave settings const float oceanFrequencyHighAltitude = 125000.0; const float oceanAnimationSpeedHighAltitude = 0.008; const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0; vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade) { vec3 positionToEyeEC = -positionEyeCoordinates; float positionToEyeECLength = length(positionToEyeEC); // The double normalize below works around a bug in Firefox on Android devices. vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC)); // Fade out the waves as the camera moves far from the surface. float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength); #ifdef SHOW_OCEAN_WAVES // high altitude waves float time = czm_frameNumber * oceanAnimationSpeedHighAltitude; vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0); vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude); // low altitude waves time = czm_frameNumber * oceanAnimationSpeedLowAltitude; noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0); vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude); // blend the 2 wave layers based on distance to surface float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength); float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength); vec3 normalTangentSpace = (highAltitudeFade * normalTangentSpaceHighAltitude) + (lowAltitudeFade * normalTangentSpaceLowAltitude); normalTangentSpace = normalize(normalTangentSpace); // fade out the normal perturbation as we move farther from the water surface normalTangentSpace.xy *= waveIntensity; normalTangentSpace = normalize(normalTangentSpace); #else vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0); #endif vec3 normalEC = enuToEye * normalTangentSpace; const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6); // Use diffuse light to highlight the waves float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue; vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade); #ifdef SHOW_OCEAN_WAVES // Where diffuse light is low or non-existent, use wave highlights based solely on // the wave bumpiness and no particular light direction. float tsPerturbationRatio = normalTangentSpace.z; vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity); #else vec3 nonDiffuseHighlight = vec3(0.0); #endif // Add specular highlights in 3D, and in all modes when zoomed in. float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0); float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue); float specular = specularIntensity * surfaceReflectance; #ifdef HDR specular *= 1.4; float e = 0.2; float d = 3.3; float c = 1.7; vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular)); #else vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular; #endif return vec4(color, imageryColor.a); } #endif // #ifdef SHOW_REFLECTIVE_OCEAN `,N1e=`#ifdef QUANTIZATION_BITS12 in vec4 compressed0; in float compressed1; #else in vec4 position3DAndHeight; in vec4 textureCoordAndEncodedNormals; #endif #ifdef GEODETIC_SURFACE_NORMALS in vec3 geodeticSurfaceNormal; #endif #ifdef EXAGGERATION uniform vec2 u_verticalExaggerationAndRelativeHeight; #endif uniform vec3 u_center3D; uniform mat4 u_modifiedModelView; uniform mat4 u_modifiedModelViewProjection; uniform vec4 u_tileRectangle; // Uniforms for 2D Mercator projection uniform vec2 u_southAndNorthLatitude; uniform vec2 u_southMercatorYAndOneOverHeight; out vec3 v_positionMC; out vec3 v_positionEC; out vec3 v_textureCoordinates; out vec3 v_normalMC; out vec3 v_normalEC; #ifdef APPLY_MATERIAL out float v_slope; out float v_aspect; out float v_height; #endif #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) out float v_distance; #endif #if defined(FOG) || defined(GROUND_ATMOSPHERE) out vec3 v_atmosphereRayleighColor; out vec3 v_atmosphereMieColor; out float v_atmosphereOpacity; #endif #ifdef ENABLE_CLIPPING_POLYGONS uniform highp sampler2D u_clippingExtents; out vec2 v_clippingPosition; flat out int v_regionIndex; #endif // These functions are generated at runtime. vec4 getPosition(vec3 position, float height, vec2 textureCoordinates); float get2DYPositionFraction(vec2 textureCoordinates); vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates) { return u_modifiedModelViewProjection * vec4(position, 1.0); } float get2DMercatorYPositionFraction(vec2 textureCoordinates) { // The width of a tile at level 11, in radians and assuming a single root tile, is // 2.0 * czm_pi / pow(2.0, 11.0) // We want to just linearly interpolate the 2D position from the texture coordinates // when we're at this level or higher. The constant below is the expression // above evaluated and then rounded up at the 4th significant digit. const float maxTileWidth = 0.003068; float positionFraction = textureCoordinates.y; float southLatitude = u_southAndNorthLatitude.x; float northLatitude = u_southAndNorthLatitude.y; if (northLatitude - southLatitude > maxTileWidth) { float southMercatorY = u_southMercatorYAndOneOverHeight.x; float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y; float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y); currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude); positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight); } return positionFraction; } float get2DGeographicYPositionFraction(vec2 textureCoordinates) { return textureCoordinates.y; } vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates) { float yPositionFraction = get2DYPositionFraction(textureCoordinates); vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); return u_modifiedModelViewProjection * rtcPosition2D; } vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates) { return getPositionPlanarEarth(position, 0.0, textureCoordinates); } vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates) { return getPositionPlanarEarth(position, height, textureCoordinates); } vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates) { // We do not do RTC while morphing, so there is potential for jitter. // This is unlikely to be noticeable, though. vec3 position3DWC = position + u_center3D; float yPositionFraction = get2DYPositionFraction(textureCoordinates); vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime); return czm_modelViewProjection * morphPosition; } #ifdef QUANTIZATION_BITS12 uniform vec2 u_minMaxHeight; uniform mat4 u_scaleAndBias; #endif void main() { #ifdef QUANTIZATION_BITS12 vec2 xy = czm_decompressTextureCoordinates(compressed0.x); vec2 zh = czm_decompressTextureCoordinates(compressed0.y); vec3 position = vec3(xy, zh.x); float height = zh.y; vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z); height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x; position = (u_scaleAndBias * vec4(position, 1.0)).xyz; #if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y) || defined(APPLY_MATERIAL) float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x; float encodedNormal = compressed1; #elif defined(INCLUDE_WEB_MERCATOR_Y) float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x; float encodedNormal = 0.0; #elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) float webMercatorT = textureCoordinates.y; float encodedNormal = compressed0.w; #else float webMercatorT = textureCoordinates.y; float encodedNormal = 0.0; #endif #else // A single float per element vec3 position = position3DAndHeight.xyz; float height = position3DAndHeight.w; vec2 textureCoordinates = textureCoordAndEncodedNormals.xy; #if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y) float webMercatorT = textureCoordAndEncodedNormals.z; float encodedNormal = textureCoordAndEncodedNormals.w; #elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL) float webMercatorT = textureCoordinates.y; float encodedNormal = textureCoordAndEncodedNormals.z; #elif defined(INCLUDE_WEB_MERCATOR_Y) float webMercatorT = textureCoordAndEncodedNormals.z; float encodedNormal = 0.0; #else float webMercatorT = textureCoordinates.y; float encodedNormal = 0.0; #endif #endif vec3 position3DWC = position + u_center3D; #ifdef GEODETIC_SURFACE_NORMALS vec3 ellipsoidNormal = geodeticSurfaceNormal; #else vec3 ellipsoidNormal = normalize(position3DWC); #endif #if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS) float exaggeration = u_verticalExaggerationAndRelativeHeight.x; float relativeHeight = u_verticalExaggerationAndRelativeHeight.y; float newHeight = (height - relativeHeight) * exaggeration + relativeHeight; // stop from going through center of earth float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z); newHeight = max(newHeight, -minRadius); vec3 offset = ellipsoidNormal * (newHeight - height); position += offset; position3DWC += offset; height = newHeight; #endif gl_Position = getPosition(position, height, textureCoordinates); v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz; v_positionMC = position3DWC; // position in model coordinates v_textureCoordinates = vec3(textureCoordinates, webMercatorT); #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL) vec3 normalMC = czm_octDecode(encodedNormal); #if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS) vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal; vec3 rejection = normalMC - projection; normalMC = normalize(projection + rejection * exaggeration); #endif v_normalMC = normalMC; v_normalEC = czm_normal3D * v_normalMC; #endif #ifdef ENABLE_CLIPPING_POLYGONS vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC); sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi); vec2 minDistance = vec2(czm_infinity); v_clippingPosition = vec2(czm_infinity); v_regionIndex = -1; for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) { vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex); vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz; vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0)); vec2 distance = abs(rectUv - clamped) * extents.wz; float threshold = 0.01; if (minDistance.x > distance.x || minDistance.y > distance.y) { minDistance = distance; v_clippingPosition = rectUv; if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) { v_regionIndex = regionIndex; } } } #endif #if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE)) bool dynamicLighting = false; #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING)) dynamicLighting = true; #endif #if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN) vec3 atmosphereLightDirection = czm_sunDirectionWC; #else vec3 atmosphereLightDirection = czm_lightDirectionWC; #endif vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC)); computeAtmosphereScattering( position3DWC, lightDirection, v_atmosphereRayleighColor, v_atmosphereMieColor, v_atmosphereOpacity ); #endif #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz); #endif #ifdef APPLY_MATERIAL float northPoleZ = czm_ellipsoidRadii.z; vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ); vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal)); float dotProd = abs(dot(ellipsoidNormal, v_normalMC)); v_slope = acos(dotProd); vec3 normalRejected = ellipsoidNormal * dotProd; vec3 normalProjected = v_normalMC - normalRejected; vec3 aspectVector = normalize(normalProjected); v_aspect = acos(dot(aspectVector, vectorEastMC)); float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal); v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect); v_height = height; #endif } `,DB=`void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) { vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC; vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC); czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection); float atmosphereInnerRadius = length(positionWC); computeScattering( primaryRay, length(cameraToPositionWC), lightDirection, atmosphereInnerRadius, rayleighColor, mieColor, opacity ); } `,M1e=`uniform sampler2D u_texture; in vec2 v_textureCoordinates; void main() { out_FragColor = texture(u_texture, v_textureCoordinates); } `,F1e=`in vec4 position; in float webMercatorT; uniform vec2 u_textureDimensions; out vec2 v_textureCoordinates; void main() { v_textureCoordinates = vec2(position.x, webMercatorT); gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0)); } `,PB=`float interpolateByDistance(vec4 nearFarScalar, float distance) { float startDistance = nearFarScalar.x; float startValue = nearFarScalar.y; float endDistance = nearFarScalar.z; float endValue = nearFarScalar.w; float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0); return mix(startValue, endValue, t); } void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe) { float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z; // Adjustment to the atmosphere radius applied based on the camera height. float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0; float distanceAdjustMax = czm_ellipsoidRadii.x; float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0; float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0); // Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit // for the position on the ellipsoid. float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust; float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust; // Setup the primary ray: from the camera position to the vertex position. vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC; vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC); czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection); underTranslucentGlobe = 0.0; // Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled. #if defined(GLOBE_TRANSLUCENT) // Check for intersection with the inner radius of the atmopshere. czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust); if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) { // Compute position on globe. vec3 direction = normalize(positionWC); czm_ray ellipsoidRay = czm_ray(positionWC, -direction); czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii); vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start); // Control the color using the camera angle. float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth)); // Control the opacity using the distance from Earth. opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth)); vec3 horizonColor = vec3(0.1, 0.2, 0.3); vec3 nearColor = vec3(0.0); rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity); // Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton. underTranslucentGlobe = 1.0; return; } #endif computeScattering( primaryRay, length(cameraToPositionWC), lightDirection, atmosphereInnerRadius, rayleighColor, mieColor, opacity ); // Alter the opacity based on how close the viewer is to the ground. // (0.0 = At edge of atmosphere, 1.0 = On ground) float cameraHeight = czm_eyeHeight + atmosphereInnerRadius; float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS; opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0); // Alter alpha based on time of day (0.0 = night , 1.0 = day) float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0; opacity *= pow(nightAlpha, 0.5); } `,B1e=`in vec3 v_outerPositionWC; uniform vec3 u_hsbShift; #ifndef PER_FRAGMENT_ATMOSPHERE in vec3 v_mieColor; in vec3 v_rayleighColor; in float v_opacity; in float v_translucent; #endif void main (void) { float lightEnum = u_radiiAndDynamicAtmosphereColor.z; vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_outerPositionWC, lightEnum); vec3 mieColor; vec3 rayleighColor; float opacity; float translucent; #ifdef PER_FRAGMENT_ATMOSPHERE computeAtmosphereScattering( v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity, translucent ); #else mieColor = v_mieColor; rayleighColor = v_rayleighColor; opacity = v_opacity; translucent = v_translucent; #endif vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity); #ifndef HDR color.rgb = czm_acesTonemapping(color.rgb); color.rgb = czm_inverseGamma(color.rgb); #endif #ifdef COLOR_CORRECT const bool ignoreBlackPixels = true; color.rgb = czm_applyHSBShift(color.rgb, u_hsbShift, ignoreBlackPixels); #endif // For the parts of the sky atmosphere that are not behind a translucent globe, // we mix in the default opacity so that the sky atmosphere still appears at distance. // This is needed because the opacity in the sky atmosphere is initially adjusted based // on the camera height. if (translucent == 0.0) { color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime); } out_FragColor = color; } `,z1e=`in vec4 position; out vec3 v_outerPositionWC; #ifndef PER_FRAGMENT_ATMOSPHERE out vec3 v_mieColor; out vec3 v_rayleighColor; out float v_opacity; out float v_translucent; #endif void main(void) { vec4 positionWC = czm_model * position; float lightEnum = u_radiiAndDynamicAtmosphereColor.z; vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC.xyz, lightEnum); #ifndef PER_FRAGMENT_ATMOSPHERE computeAtmosphereScattering( positionWC.xyz, lightDirection, v_rayleighColor, v_mieColor, v_opacity, v_translucent ); #endif v_outerPositionWC = positionWC.xyz; gl_Position = czm_modelViewProjection * position; } `,U1e=`uniform samplerCube u_cubeMap; in vec3 v_texCoord; void main() { vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord)); out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime); } `,k1e=`in vec3 position; out vec3 v_texCoord; void main() { vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position)); gl_Position = czm_projection * vec4(p, 1.0); v_texCoord = position.xyz; } `,V1e=`uniform sampler2D u_texture; in vec2 v_textureCoordinates; void main() { vec4 color = texture(u_texture, v_textureCoordinates); out_FragColor = czm_gammaCorrect(color); } `,H1e=`uniform float u_radiusTS; in vec2 v_textureCoordinates; vec2 rotate(vec2 p, vec2 direction) { return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x); } vec4 addBurst(vec2 position, vec2 direction, float lengthScalar) { vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75); float radius = length(rotatedPosition) * lengthScalar; float burst = 1.0 - smoothstep(0.0, 0.55, radius); return vec4(burst); } void main() { float lengthScalar = 2.0 / sqrt(2.0); vec2 position = v_textureCoordinates - vec2(0.5); float radius = length(position) * lengthScalar; float surface = step(radius, u_radiusTS); vec4 color = vec4(vec2(1.0), surface + 0.2, surface); float glow = 1.0 - smoothstep(0.0, 0.55, radius); color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75; vec4 burst = vec4(0.0); // The following loop has been manually unrolled for speed, to // avoid sin() and cos(). // //for (float i = 0.4; i < 3.2; i += 1.047) { // vec2 direction = vec2(sin(i), cos(i)); // burst += 0.4 * addBurst(position, direction, lengthScalar); // // direction = vec2(sin(i - 0.08), cos(i - 0.08)); // burst += 0.3 * addBurst(position, direction, lengthScalar); //} burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar); // angle == 0.4 burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar); // angle == 0.4 + 1.047 burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar); // angle == 0.4 + 1.047 * 2.0 burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar); // angle == 0.4 - 0.08 burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar); // angle == 0.4 + 1.047 - 0.08 burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar); // angle == 0.4 + 1.047 * 2.0 - 0.08 // End of manual loop unrolling. color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15; out_FragColor = clamp(color, vec4(0.0), vec4(1.0)); } `,G1e=`in vec2 direction; uniform float u_size; out vec2 v_textureCoordinates; void main() { vec4 position; if (czm_morphTime == 1.0) { position = vec4(czm_sunPositionWC, 1.0); } else { position = vec4(czm_sunPositionColumbusView.zxy, 1.0); } vec4 positionEC = czm_view * position; vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); vec2 halfSize = vec2(u_size * 0.5); halfSize *= ((direction * 2.0) - 1.0); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0); v_textureCoordinates = direction; } `;function DD(e){let t;const n=e.name,i=e.message;c(n)&&c(i)?t=`${n}: ${i}`:t=e.toString();const o=e.stack;return c(o)&&(t+=` ${o}`),t}const j1e={NONE:0,LERC:1},PD=Object.freeze(j1e),W1e={NONE:0,BITS12:1},Pa=Object.freeze(W1e),Vf=new d,q1e=new d,ac=new H,qT=new L,Y1e=new L,$1e=Math.pow(2,12);function Oo(e,t,n,i,o,r,s,a,l,u){let h=Pa.NONE,f,_;if(c(t)&&c(n)&&c(i)&&c(o)){const g=t.minimum,m=t.maximum,b=d.subtract(m,g,q1e),T=i-n;Math.max(d.maximumComponent(b),T)<$1e-1?h=Pa.BITS12:h=Pa.NONE,f=L.inverseTransformation(o,new L);const C=d.negate(g,Vf);L.multiply(L.fromTranslation(C,qT),f,f);const w=Vf;w.x=1/b.x,w.y=1/b.y,w.z=1/b.z,L.multiply(L.fromScale(w,qT),f,f),_=L.clone(o),L.setTranslation(_,d.ZERO,_),o=L.clone(o,new L);const v=L.fromTranslation(g,qT),P=L.fromScale(b,Y1e),N=L.multiply(v,P,qT);L.multiply(o,N,o),L.multiply(_,N,_)}this.quantization=h,this.minimumHeight=n,this.maximumHeight=i,this.center=d.clone(e),this.toScaledENU=f,this.fromScaledENU=o,this.matrix=_,this.hasVertexNormals=r,this.hasWebMercatorT=y(s,!1),this.hasGeodeticSurfaceNormals=y(a,!1),this.exaggeration=y(l,1),this.exaggerationRelativeHeight=y(u,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}Oo.prototype.encode=function(e,t,n,i,o,r,s,a){const l=i.x,u=i.y;if(this.quantization===Pa.BITS12){n=L.multiplyByPoint(this.toScaledENU,n,Vf),n.x=R.clamp(n.x,0,1),n.y=R.clamp(n.y,0,1),n.z=R.clamp(n.z,0,1);const h=this.maximumHeight-this.minimumHeight,f=R.clamp((o-this.minimumHeight)/h,0,1);H.fromElements(n.x,n.y,ac);const _=En.compressTextureCoordinates(ac);H.fromElements(n.z,f,ac);const g=En.compressTextureCoordinates(ac);H.fromElements(l,u,ac);const m=En.compressTextureCoordinates(ac);if(e[t++]=_,e[t++]=g,e[t++]=m,this.hasWebMercatorT){H.fromElements(s,0,ac);const b=En.compressTextureCoordinates(ac);e[t++]=b}}else d.subtract(n,this.center,Vf),e[t++]=Vf.x,e[t++]=Vf.y,e[t++]=Vf.z,e[t++]=o,e[t++]=l,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=En.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const X1e=new d,_9=new d;Oo.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const r=this.stride;for(let s=0;s0,g=y(e.isGeographic,!0),m=y(e.ellipsoid,ae.WGS84),b=1/m.maximumRadius,T=ce.clone(e.nativeRectangle),x=ce.clone(e.rectangle);let C,w,v,P;c(x)?(C=x.west,w=x.south,v=x.east,P=x.north):g?(C=a(T.west),w=a(T.south),v=a(T.east),P=a(T.north)):(C=T.west*b,w=s-2*o(r(-T.south*b)),v=T.east*b,P=s-2*o(r(-T.north*b)));let N=e.relativeToCenter;const k=c(N);N=k?N:d.ZERO;const M=y(e.includeWebMercatorT,!1),U=y(e.exaggeration,1),B=y(e.exaggerationRelativeHeight,0),D=U!==1,p=y(e.structure,ql.DEFAULT_STRUCTURE),I=y(p.heightScale,ql.DEFAULT_STRUCTURE.heightScale),O=y(p.heightOffset,ql.DEFAULT_STRUCTURE.heightOffset),F=y(p.elementsPerHeight,ql.DEFAULT_STRUCTURE.elementsPerHeight),V=y(p.stride,ql.DEFAULT_STRUCTURE.stride),G=y(p.elementMultiplier,ql.DEFAULT_STRUCTURE.elementMultiplier),j=y(p.isBigEndian,ql.DEFAULT_STRUCTURE.isBigEndian);let W=ce.computeWidth(T),X=ce.computeHeight(T);const q=W/(u-1),ee=X/(h-1);g||(W*=b,X*=b);const Y=m.radiiSquared,ne=Y.x,Q=Y.y,le=Y.z;let pe=65536,re=-65536;const de=zt.eastNorthUpToFixedFrame(N,m),fe=L.inverseTransformation(de,Q1e);let ye,Ce;M&&(ye=vn.geodeticLatitudeToMercatorAngle(w),Ce=1/(vn.geodeticLatitudeToMercatorAngle(P)-ye));const we=K1e;we.x=Number.POSITIVE_INFINITY,we.y=Number.POSITIVE_INFINITY,we.z=Number.POSITIVE_INFINITY;const Pe=Z1e;Pe.x=Number.NEGATIVE_INFINITY,Pe.y=Number.NEGATIVE_INFINITY,Pe.z=Number.NEGATIVE_INFINITY;let lt=Number.POSITIVE_INFINITY;const ft=u*h,We=f>0?u*2+h*2:0,Fe=ft+We,Dt=new Array(Fe),st=new Array(Fe),et=new Array(Fe),hn=M?new Array(Fe):[],ot=D?new Array(Fe):[];let at=0,Xt=h,it=0,fi=u;_&&(--at,++Xt,--it,++fi);const Hi=1e-5;for(let zn=at;zn=h&&(ci=h-1);let Si=T.north-ee*ci;g?Si=a(Si):Si=s-2*o(r(-Si*b));let Ko=(Si-w)/(P-w);Ko=R.clamp(Ko,0,1);const ri=zn===at,fr=zn===Xt-1;f>0&&(ri?Si+=Hi*X:fr&&(Si-=Hi*X));const ha=t(Si),fa=n(Si),So=le*fa;let Ln;M&&(Ln=(vn.geodeticLatitudeToMercatorAngle(Si)-ye)*Ce);for(let Zo=it;Zo=u&&(ho=u-1);const qs=ci*(u*V)+ho*V;let pi;if(F===1)pi=l[qs];else{pi=0;let Mo;if(j)for(Mo=0;Mo=0;--Mo)pi=pi*G+l[qs+Mo]}pi=pi*I+O,re=Math.max(re,pi),pe=Math.min(pe,pi);let ji=T.west+q*ho;g?ji=a(ji):ji=ji*b;let cf=(ji-C)/(v-C);cf=R.clamp(cf,0,1);let vi=ci*u+ho;if(f>0){const Mo=Zo===it,Et=Zo===fi-1,be=ri||fr||Mo||Et;if((ri||fr)&&(Mo||Et))continue;be&&(pi-=f,Mo?(vi=ft+(h-ci-1),ji-=Hi*W):fr?vi=ft+h+(u-ho-1):Et?(vi=ft+h+u+ci,ji+=Hi*W):ri&&(vi=ft+h+u+h+ho))}const pr=ha*t(ji),Rd=ha*n(ji),Lr=ne*pr,Xr=Q*Rd,Jn=1/i(Lr*pr+Xr*Rd+So*fa),qa=Lr*Jn,Ya=Xr*Jn,lf=So*Jn,fo=new d;fo.x=qa+pr*pi,fo.y=Ya+Rd*pi,fo.z=lf+fa*pi,L.multiplyByPoint(fe,fo,dv),d.minimumByComponent(dv,we,we),d.maximumByComponent(dv,Pe,Pe),lt=Math.min(lt,pi),Dt[vi]=fo,et[vi]=new H(cf,Ko),st[vi]=pi,M&&(hn[vi]=Ln),D&&(ot[vi]=m.geodeticSurfaceNormal(fo))}}const Ss=se.fromPoints(Dt);let Qo;c(x)&&(Qo=Ct.fromRectangle(x,pe,re,m));let No;k&&(No=new Vc(m).computeHorizonCullingPointPossiblyUnderEllipsoid(N,Dt,pe));const Gi=new Gr(we,Pe,N),Ni=new Oo(N,Gi,lt,re,de,!1,M,D,U,B),wi=new Float32Array(Fe*Ni.stride);let $r=0;for(let zn=0;zn=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=OB[e];c(n)||(OB[e]=n=[]);let i=n[t];return c(i)||(e*t=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=LB[e];c(n)||(LB[e]=n=[]);let i=n[t];if(!c(i)){const o=so.getRegularGridIndices(e,t),r=y9(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,l=r.eastIndicesNorthToSouth,u=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:l,northIndicesWestToEast:u}}return i};const RB=[];so.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=RB[e];c(n)||(RB[e]=n=[]);let i=n[t];if(!c(i)){const o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,l=o+s,u=r+a,h=y9(e,t),f=h.westIndicesSouthToNorth,_=h.southIndicesEastToWest,g=h.eastIndicesNorthToSouth,m=h.northIndicesWestToEast,b=je.createTypedArray(l,u);b9(e,t,b,0),so.addSkirtIndices(f,_,g,m,o,b,r),i=n[t]={indices:b,westIndicesSouthToNorth:f,southIndicesEastToWest:_,eastIndicesNorthToSouth:g,northIndicesWestToEast:m,indexCountWithoutSkirts:r}}return i};so.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=YT(e,a,r,s),a+=e.length,s=YT(t,a,r,s),a+=t.length,s=YT(n,a,r,s),a+=n.length,YT(i,a,r,s)};function y9(e,t){const n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e);let s;for(s=0;s0?w=so.getRegularGridAndSkirtIndicesAndEdgeIndices(C.gridWidth,C.gridHeight):w=so.getRegularGridIndicesAndEdgeIndices(C.gridWidth,C.gridHeight);const v=C.gridWidth*C.gridHeight;return x._mesh=new YC(f,new Float32Array(C.vertices),w.indices,w.indexCountWithoutSkirts,v,C.minimumHeight,C.maximumHeight,se.clone(C.boundingSphere3D),d.clone(C.occludeePointInScaledSpace),C.numberOfAttributes,Ct.clone(C.orientedBoundingBox),Oo.clone(C.encoding),w.westIndicesSouthToNorth,w.southIndicesEastToWest,w.eastIndicesNorthToSouth,w.northIndicesWestToEast),x._buffer=void 0,x._mesh})};Cl.prototype._createMeshSync=function(e){A.typeOf.object("options.tilingScheme",e.tilingScheme),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),A.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),h=a.cartographicToCartesian(ce.center(u)),f=this._structure,g=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<0?b=so.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):b=so.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const T=m.gridWidth*m.gridHeight;return this._mesh=new YC(h,m.vertices,b.indices,b.indexCountWithoutSkirts,T,m.minimumHeight,m.maximumHeight,m.boundingSphere3D,m.occludeePointInScaledSpace,m.encoding.stride,m.orientedBoundingBox,m.encoding,b.westIndicesSouthToNorth,b.southIndicesEastToWest,b.eastIndicesNorthToSouth,b.northIndicesWestToEast),this._mesh};Cl.prototype.interpolateHeight=function(e,t,n){const i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,l=r.elementMultiplier,u=r.isBigEndian,h=r.heightOffset,f=r.heightScale,_=c(this._mesh),g=this._encoding===PD.LERC;if(!_&&g)return;let b;if(_){const T=this._mesh.vertices,x=this._mesh.encoding;b=A9(T,x,h,f,e,i,o,t,n)}else b=tLe(this._buffer,a,l,s,u,e,i,o,t,n),b=b*f+h;return b};Cl.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");const l=this._mesh;if(!c(l))return;const u=this._width,h=this._height,f=this._structure,_=f.stride,g=new this._bufferType(u*h*_),m=l.vertices,b=l.encoding,T=e.tileXYToRectangle(t,n,i),x=e.tileXYToRectangle(o,r,s),C=f.heightOffset,w=f.heightScale,v=f.elementsPerHeight,P=f.elementMultiplier,N=f.isBigEndian,k=Math.pow(P,v-1);for(let M=0;Mf.highestEncodedHeight?f.highestEncodedHeight:D,nLe(g,v,P,k,_,N,M*u+B,D)}}return Promise.resolve(new Cl({buffer:g,width:u,height:h,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};Cl.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<=s&&(g=s-1,_=s-2);let m=f|0,b=m+1;b>=a&&(b=a-1,m=a-2);const T=h-_,x=f-m;m=a-1-m,b=a-1-b;const C=$T(e,t,n,i,o,m*s+_),w=$T(e,t,n,i,o,m*s+g),v=$T(e,t,n,i,o,b*s+_),P=$T(e,t,n,i,o,b*s+g);return x9(T,x,C,w,v,P)}function A9(e,t,n,i,o,r,s,a,l){const u=(a-o.west)*(r-1)/(o.east-o.west),h=(l-o.south)*(s-1)/(o.north-o.south);let f=u|0,_=f+1;_>=r&&(_=r-1,f=r-2);let g=h|0,m=g+1;m>=s&&(m=s-1,g=s-2);const b=u-f,T=h-g;g=s-1-g,m=s-1-m;const x=(t.decodeHeight(e,g*r+f)-n)/i,C=(t.decodeHeight(e,g*r+_)-n)/i,w=(t.decodeHeight(e,m*r+f)-n)/i,v=(t.decodeHeight(e,m*r+_)-n)/i;return x9(b,T,x,C,w,v)}function x9(e,t,n,i,o,r){return t=0;--a)s=s*n+e[r+a];return s}function nLe(e,t,n,i,o,r,s,a){s*=o;let l;if(r)for(l=0;l0;--l)e[s+l]=a/i|0,a-=e[s+l]*i,i/=n;e[s+l]=a}function _d(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,c(this._tilingScheme)||(this._tilingScheme=new Yr({ellipsoid:y(e.ellipsoid,ae.WGS84)})),this._levelZeroMaximumGeometricError=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Le}Object.defineProperties(_d.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});_d.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new Cl({buffer:new Uint8Array(16*16),width:16,height:16}))};_d.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<0&&(de=N?k.clippingPlanesState:0);let fe=0;c(U)&&U.length>0&&(fe=M?U.clippingPolygonsState:0);let ye=n.surfaceShader;if(c(ye)&&ye.numberOfDayTextures===i&&ye.flags===re&&ye.material===this.material&&ye.clippingShaderState===de&&ye.clippingPolygonShaderState===fe)return ye.shaderProgram;let Ce=this._shadersByTexturesFlags[i];if(c(Ce)||(Ce=this._shadersByTexturesFlags[i]=[]),ye=Ce[re],!c(ye)||ye.material!==this.material||ye.clippingShaderState!==de||ye.clippingPolygonShaderState!==fe){const we=this.baseVertexShaderSource.clone(),Pe=this.baseFragmentShaderSource.clone();de!==0&&Pe.sources.unshift(p1(k,t.context)),fe!==0&&(Pe.sources.unshift(uLe(t.context)),we.sources.unshift(dLe(t.context))),we.defines.push(W),Pe.defines.push(`TEXTURE_UNITS ${i}`,ne,le),o&&Pe.defines.push("APPLY_BRIGHTNESS"),r&&Pe.defines.push("APPLY_CONTRAST"),s&&Pe.defines.push("APPLY_HUE"),a&&Pe.defines.push("APPLY_SATURATION"),l&&Pe.defines.push("APPLY_GAMMA"),u&&Pe.defines.push("APPLY_ALPHA"),h&&Pe.defines.push("APPLY_DAY_NIGHT_ALPHA"),_&&(Pe.defines.push("SHOW_REFLECTIVE_OCEAN"),we.defines.push("SHOW_REFLECTIVE_OCEAN")),g&&Pe.defines.push("SHOW_OCEAN_WAVES"),I&&Pe.defines.push("APPLY_COLOR_TO_ALPHA"),V&&(we.defines.push("UNDERGROUND_COLOR"),Pe.defines.push("UNDERGROUND_COLOR")),G&&(we.defines.push("TRANSLUCENT"),Pe.defines.push("TRANSLUCENT")),m&&(w?(we.defines.push("ENABLE_VERTEX_LIGHTING"),Pe.defines.push("ENABLE_VERTEX_LIGHTING")):(we.defines.push("ENABLE_DAYNIGHT_SHADING"),Pe.defines.push("ENABLE_DAYNIGHT_SHADING"))),b&&(we.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),Pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),T&&(we.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),Pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),x&&(we.defines.push("GROUND_ATMOSPHERE"),Pe.defines.push("GROUND_ATMOSPHERE"),C&&(we.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),Pe.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),we.defines.push("INCLUDE_WEB_MERCATOR_Y"),Pe.defines.push("INCLUDE_WEB_MERCATOR_Y"),P&&(we.defines.push("FOG"),Pe.defines.push("FOG")),f&&Pe.defines.push("APPLY_SPLIT"),N&&Pe.defines.push("ENABLE_CLIPPING_PLANES"),M&&(Pe.defines.push("ENABLE_CLIPPING_POLYGONS"),we.defines.push("ENABLE_CLIPPING_POLYGONS"),U.inverse&&Pe.defines.push("CLIPPING_INVERSE"),Pe.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${U.extentsCount}`),we.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${U.extentsCount}`)),D&&Pe.defines.push("COLOR_CORRECT"),p&&Pe.defines.push("HIGHLIGHT_FILL_TILE"),O&&we.defines.push("GEODETIC_SURFACE_NORMALS"),F&&we.defines.push("EXAGGERATION");let lt=` vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend) { vec4 color = initialColor; `;S&&(lt+=` vec4 cutoutAndColorResult; bool texelUnclipped; `);for(let We=0;We0?n.raiseEvent(l):c(t)&&console.log(`An error occurred in "${t.constructor.name}": ${DD(i)}`),l};Er.reportSuccess=function(e){c(e)&&(e.timesRetried=-1)};const pLe={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},Rn=Object.freeze(pLe),mLe={START:0,LOADING:1,DONE:2,FAILED:3},Mc=Object.freeze(mLe),_Le={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},yi=Object.freeze(_Le);function Yn(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new te(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new d,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=yi.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new se,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(Yn.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let n=!(e===yi.RECEIVING||e===yi.TRANSFORMING);const i=this.imagery;for(let o=0,r=i.length;n&&o=0&&(h=C)}return h!==Number.MAX_VALUE?nn.getPoint(e,h,o):void 0};Yn.prototype.freeResources=function(){c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=yi.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,n=e.length;t=yi.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)DLe(t.context,s);else{const u=s._findAncestorTileWithTerrainData(e);c(u)&&c(u.data.waterMaskTexture)&&(s.waterMaskTexture=u.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,u,s.waterMaskTranslationAndScale))}}function CLe(e,t,n,i,o,r,s){const a=t.parent;if(!a){t.state=Mc.FAILED;return}const l=a.data.terrainData,u=a.x,h=a.y,f=a.level;if(!c(l))return;const _=l.upsample(i.tilingScheme,u,h,f,o,r,s);!c(_)||(e.terrainState=yi.RECEIVING,Promise.resolve(_).then(function(g){!c(g)||(e.terrainData=g,e.terrainState=yi.RECEIVED)}).catch(function(){e.terrainState=yi.FAILED}))}function ELe(e,t,n,i,o){function r(l){if(!c(l)){e.terrainState=yi.UNLOADED,e.request=void 0;return}e.terrainData=l,e.terrainState=yi.RECEIVED,e.request=void 0}function s(l){if(e.request.state===di.CANCELLED){e.terrainData=void 0,e.terrainState=yi.UNLOADED,e.request=void 0;return}e.terrainState=yi.FAILED,e.request=void 0;const u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${l}"`;t._requestError=Er.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){const l=new iu({throttle:!1,throttleByServer:!0,type:Ip.TERRAIN});e.request=l;const u=t.requestTileGeometry(n,i,o,l);c(u)?(e.terrainState=yi.RECEIVING,Promise.resolve(u).then(function(h){r(h)}).catch(function(h){s(h)})):(e.terrainState=yi.UNLOADED,e.request=void 0)}a()}const wLe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function SLe(e,t,n,i,o,r){const s=n.tilingScheme,a=wLe;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.verticalExaggeration,a.exaggerationRelativeHeight=t.verticalExaggerationRelativeHeight,a.throttle=!0;const u=e.terrainData.createMesh(a);!c(u)||(e.terrainState=yi.TRANSFORMING,Promise.resolve(u).then(function(h){e.mesh=h,e.terrainState=yi.TRANSFORMED}).catch(function(){e.terrainState=yi.FAILED}))}Yn._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=ct.createVertexBuffer({context:e,typedArray:n,usage:ke.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{};let s=r[e.id];if(!c(s)||s.isDestroyed()){const a=t.indices;s=ct.createIndexBuffer({context:e,typedArray:a,usage:ke.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new Ci({context:e,attributes:o,indexBuffer:s})};Yn._freeVertexArray=function(e){if(c(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),c(t)&&!t.isDestroyed()&&c(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function vLe(e,t,n,i,o,r,s){e.vertexArray=Yn._createVertexArrayForMesh(t,e.mesh),e.terrainState=yi.READY,e.fill=e.fill&&e.fill.destroy(s)}function ILe(e){let t=e.cache.tile_waterMaskData;if(!c(t)){const n=xt.create({context:e,pixelFormat:Ve.LUMINANCE,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;const i=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function DLe(e,t){const n=t.terrainData.waterMask,i=ILe(e);let o;const r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{const s=Math.sqrt(r);o=xt.create({context:e,pixelFormat:Ve.LUMINANCE,pixelDatatype:Me.UNSIGNED_BYTE,source:{width:s,height:s,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,te.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}Yn.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;c(t)&&(!c(t.data)||!c(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};Yn.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,l=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=l*(o.south-i.south)/s,n.z=a,n.w=l,n};function ws(e){if(e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1),this._projection=new vn(this._ellipsoid),c(e.rectangleSouthwestInMeters)&&c(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new H(-i,-i),this._rectangleNortheastInMeters=new H(i,i)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new ce(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(ws.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});ws.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=o&&(m=o-1);let b=g/u|0;return b>=r&&(b=r-1),c(n)?(n.x=m,n.y=b,n):new H(m,b)};let fv;const E9="AAPK809db8a668914f14bf886dcf16d4dc82Hm5SsO4xOJY2n4-V_ypQyxlGKJRQugNnPIslyTLkk5-HHQl9BRpgdNXaKNGe7oxx",eg={};eg.defaultAccessToken=E9;eg.defaultWorldImageryServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"});eg.defaultWorldHillshadeServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"});eg.defaultWorldOceanServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"});eg.getDefaultTokenCredit=function(e){if(e===E9){if(!c(fv)){const t=' This application is using a default ArcGIS access token. Please assign Cesium.ArcGisMapService.defaultAccessToken with an API key from your ArcGIS Developer account before using the ArcGIS tile services. You can sign up for a free ArcGIS Developer account at https://developers.arcgis.com/.';fv=new Wt(t,!0)}return fv}};const Mu=eg;function _1(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.missingImageUrl))throw new E("options.missingImageUrl is required.");if(!c(e.pixelsToCheck))throw new E("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Ae.createIfNeeded(e.missingImageUrl),n=this;function i(r){c(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=Ax(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0;const l=r.width,u=e.pixelsToCheck;for(let h=0,f=u.length;a&&h0&&(a=!1)}a&&(s=void 0)}n._missingImagePixels=s,n._isReady=!0}function o(){n._missingImagePixels=void 0,n._isReady=!0}t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then(i).catch(o)}_1.prototype.isReady=function(){return this._isReady};_1.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new E("shouldDiscardImage must not be called before the discard policy is ready.");const t=this._pixelsToCheck,n=this._missingImagePixels;if(!c(n)||c(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=Ax(e),o=e.width;for(let r=0,s=t.length;r1&&o==="name"?(t=1,n=i):t>2&&o==="title"?(t=2,n=i):t>3&&/name/i.test(i)?(t=3,n=i):t>4&&/title/i.test(i)&&(t=4,n=i)}c(n)&&(this.name=e[n])};of.prototype.configureDescriptionFromProperties=function(e){function t(n){let i='';for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];c(r)&&(typeof r=="object"?i+=``:i+=``)}return i+="
${o}${t(r)}
${o}${r}
",i}this.description=t(e)};function Bl(){E.throwInstantiationError()}Object.defineProperties(Bl.prototype,{rectangle:{get:E.throwInstantiationError},tileWidth:{get:E.throwInstantiationError},tileHeight:{get:E.throwInstantiationError},maximumLevel:{get:E.throwInstantiationError},minimumLevel:{get:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},tileDiscardPolicy:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError},credit:{get:E.throwInstantiationError},proxy:{get:E.throwInstantiationError},hasAlphaChannel:{get:E.throwInstantiationError}});Bl.prototype.getTileCredits=function(e,t,n){E.throwInstantiationError()};Bl.prototype.requestImage=function(e,t,n,i){E.throwInstantiationError()};Bl.prototype.pickFeatures=function(e,t,n,i,o){E.throwInstantiationError()};const PLe=/\.ktx2$/i;Bl.loadImage=function(e,t){A.defined("url",t);const n=Ae.createIfNeeded(t);return PLe.test(n.url)?Op(n):c(e)&&c(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};const OLe={SATELLITE:1,OCEANS:2,HILLSHADE:3},g_=Object.freeze(OLe);function w9(e){this.useTiles=y(e.usePreCachedTilesIfAvailable,!0);const t=e.ellipsoid;this.tilingScheme=y(e.tilingScheme,new Yr({ellipsoid:t})),this.rectangle=y(e.rectangle,this.tilingScheme.rectangle),this.ellipsoid=t;let n=e.credit;typeof n=="string"&&(n=new Wt(n)),this.credit=n,this.tileCredits=void 0,this.tileDiscardPolicy=e.tileDiscardPolicy,this.tileWidth=y(e.tileWidth,256),this.tileHeight=y(e.tileHeight,256),this.maximumLevel=e.maximumLevel}w9.prototype.build=function(e){e._useTiles=this.useTiles,e._tilingScheme=this.tilingScheme,e._rectangle=this.rectangle,e._credit=this.credit,e._tileCredits=this.tileCredits,e._tileDiscardPolicy=this.tileDiscardPolicy,e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,this.useTiles&&!c(this.tileDiscardPolicy)&&(e._tileDiscardPolicy=new _1({missingImageUrl:S9(e,0,0,this.maximumLevel).url,pixelsToCheck:[new H(0,0),new H(200,20),new H(20,200),new H(80,110),new H(160,130)],disableCheckIfAllPixelsAreTransparent:!0}))};function LLe(e,t){const n=e.tileInfo;if(!c(n))t.useTiles=!1;else{if(t.tileWidth=n.rows,t.tileHeight=n.cols,n.spatialReference.wkid===102100||n.spatialReference.wkid===102113)t.tilingScheme=new ws({ellipsoid:t.ellipsoid});else if(e.tileInfo.spatialReference.wkid===4326)t.tilingScheme=new Yr({ellipsoid:t.ellipsoid});else{const i=`Tile spatial reference WKID ${e.tileInfo.spatialReference.wkid} is not supported.`;throw new Te(i)}if(t.maximumLevel=e.tileInfo.lods.length-1,c(e.fullExtent)){if(c(e.fullExtent.spatialReference)&&c(e.fullExtent.spatialReference.wkid))if(e.fullExtent.spatialReference.wkid===102100||e.fullExtent.spatialReference.wkid===102113){const i=new vn,o=e.fullExtent,r=i.unproject(new d(Math.max(o.xmin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(o.ymin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),s=i.unproject(new d(Math.min(o.xmax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(o.ymax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0));t.rectangle=new ce(r.longitude,r.latitude,s.longitude,s.latitude)}else if(e.fullExtent.spatialReference.wkid===4326)t.rectangle=ce.fromDegrees(e.fullExtent.xmin,e.fullExtent.ymin,e.fullExtent.xmax,e.fullExtent.ymax);else{const i=`fullExtent.spatialReference WKID ${e.fullExtent.spatialReference.wkid} is not supported.`;throw new Te(i)}}else t.rectangle=t.tilingScheme.rectangle;t.useTiles=!0}c(e.copyrightText)&&e.copyrightText.length>0&&(c(t.credit)?t.tileCredits=[new Wt(e.copyrightText)]:t.credit=new Wt(e.copyrightText))}function RLe(e,t){let n=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(n+=`: ${t.message}`),new Te(n)}async function NLe(e,t){const n=e.getDerivedResource({queryParameters:{f:"json"}});try{const i=await n.fetchJson();LLe(i,t)}catch(i){RLe(e,i)}}function Oa(e){e=y(e,y.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._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=y(e.tilingScheme,new Yr({ellipsoid:e.ellipsoid})),this._useTiles=y(e.usePreCachedTilesIfAvailable,!0),this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers,this._credit=e.credit,this._tileCredits=void 0;let t=e.credit;typeof t=="string"&&(t=new Wt(t)),this.enablePickFeatures=y(e.enablePickFeatures,!0),this._errorEvent=new Le}Oa.fromBasemapType=async function(e,t){A.defined("style",e),t=y(t,y.EMPTY_OBJECT);let n,i,o;switch(e){case g_.SATELLITE:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldImageryServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;case g_.OCEANS:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldOceanServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;case g_.HILLSHADE:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldHillshadeServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;default:throw new E(`Unsupported basemap type: ${e}`)}return Oa.fromUrl(i,{...t,token:n,credit:o,usePreCachedTilesIfAvailable:!0})};function S9(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{const s=e._tilingScheme.tileXYToNativeRectangle(t,n,i),l={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof co?(l.bboxSR=4326,l.imageSR=4326):(l.bboxSR=3857,l.imageSR=3857),e.layers&&(l.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:l})}return r}Object.defineProperties(Oa.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}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}});Oa.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT);const n=Ae.createIfNeeded(e);n.appendForwardSlash(),c(t.token)&&n.setQueryParameters({token:t.token});const i=new Oa(t);i._resource=n;const o=new w9(t);return y(t.usePreCachedTilesIfAvailable,!0)&&await NLe(n,o),o.build(i),i};Oa.prototype.getTileCredits=function(e,t,n){return this._tileCredits};Oa.prototype.requestImage=function(e,t,n,i){return Bl.loadImage(this,S9(this,e,t,n,i))};Oa.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures)return;const r=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let s,a,l;if(this._tilingScheme.projection instanceof co)s=R.toDegrees(i),a=R.toDegrees(o),l="4326";else{const _=this._tilingScheme.projection.project(new he(i,o,0));s=_.x,a=_.y,l="3857"}let u="visible";c(this._layers)&&(u+=`:${this._layers}`);const h={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:l,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:h}).fetchJson().then(function(_){const g=[],m=_.results;if(!c(m))return g;for(let b=0;b`),this._tilingScheme=new ws({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._attributionList=void 0,this._errorEvent=new Le}Object.defineProperties(Ho.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}},mapLayer:{get:function(){return this._mapLayer}},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}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return c(this.mapLayer)}}});Ho.fromUrl=async function(e,t){t=y(t,y.EMPTY_OBJECT),A.defined("url",e),A.defined("options.key",t.key);let n=t.tileProtocol;c(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";const i=y(t.mapStyle,v9.AERIAL),o=Ae.createIfNeeded(e);o.appendForwardSlash();const r={incl:"ImageryProviders",key:t.key,uriScheme:n};c(t.mapLayer)&&(r.mapLayer=t.mapLayer),c(t.culture)&&(r.culture=t.culture);const s=o.getDerivedResource({url:`REST/v1/Imagery/Metadata/${i}`,queryParameters:r}),a=new Ho(t);a._resource=o;const l=new I9;return await zLe(s,l),l.build(a),a};const ULe=new ce;Ho.prototype.getTileCredits=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(e,t,n,ULe);return HLe(this._attributionList,n,i)};Ho.prototype.requestImage=function(e,t,n,i){const o=Bl.loadImage(this,kLe(this,e,t,n,i));if(c(o))return o.catch(function(r){return c(r.blob)&&r.blob.size===0?B_.EMPTY_IMAGE:Promise.reject(r)})};Ho.prototype.pickFeatures=function(e,t,n,i,o){};Ho.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){const r=1<=0;--o){const r=1<=f.zoomMin&&t<=f.zoomMax){const _=ce.intersection(n,f.bbox,VLe);c(_)&&(l=!0)}}l&&i.push(s.credit)}return i}Ho._metadataCache={};const D9=/{[^}]+}/g,P9={x:qLe,y:$Le,z:KLe,s:ZLe,reverseX:YLe,reverseY:XLe,reverseZ:QLe,westDegrees:JLe,southDegrees:eRe,eastDegrees:tRe,northDegrees:nRe,westProjected:iRe,southProjected:oRe,eastProjected:rRe,northProjected:sRe,width:aRe,height:cRe},GLe=jt(P9,{i:lRe,j:uRe,reverseI:dRe,reverseJ:hRe,longitudeDegrees:pRe,latitudeDegrees:mRe,longitudeProjected:_Re,latitudeProjected:gRe,format:bRe});function zl(e){e=y(e,y.EMPTY_OBJECT),this._errorEvent=new Le,A.defined("options.url",e.url);const t=Ae.createIfNeeded(e.url),n=Ae.createIfNeeded(e.pickFeaturesUrl);this._resource=t,this._urlSchemeZeroPadding=e.urlSchemeZeroPadding,this._getFeatureInfoFormats=e.getFeatureInfoFormats,this._pickFeaturesResource=n;let i=e.subdomains;Array.isArray(i)?i=i.slice():c(i)&&i.length>0?i=i.split(""):i=["a","b","c"],this._subdomains=i,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._minimumLevel=y(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._tilingScheme=y(e.tilingScheme,new ws({ellipsoid:e.ellipsoid})),this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._rectangle=ce.intersection(this._rectangle,this._tilingScheme.rectangle),this._tileDiscardPolicy=e.tileDiscardPolicy;let o=e.credit;typeof o=="string"&&(o=new Wt(o)),this._credit=o,this._hasAlphaChannel=y(e.hasAlphaChannel,!0);const r=e.customTags,s=jt(P9,r),a=jt(GLe,r);this._tags=s,this._pickFeaturesTags=a,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=y(e.enablePickFeatures,!0)}Object.defineProperties(zl.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}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}});zl.prototype.getTileCredits=function(e,t,n){};zl.prototype.requestImage=function(e,t,n,i){return Bl.loadImage(this,jLe(this,e,t,n,i))};zl.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures||!c(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0;const s=this;function a(u,h){return u.callback(h)}function l(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const u=s._getFeatureInfoFormats[r],h=WLe(s,e,t,n,i,o,u.format);return++r,u.type==="json"?h.fetchJson().then(u.callback).catch(l):u.type==="xml"?h.fetchXML().then(u.callback).catch(l):u.type==="text"||u.type==="html"?h.fetchText().then(u.callback).catch(l):h.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(l)}return l()};let nC=!1;const _a=new ce;let iC=!1;const rb=new ce;function jLe(e,t,n,i,o){nC=!1,iC=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,l={},u=s.match(D9);return c(u)&&u.forEach(function(h){const f=h.substring(1,h.length-1);c(a[f])&&(l[f]=a[f](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:l})}let OD=!1;const z_=new H;let LD=!1;function WLe(e,t,n,i,o,r,s){nC=!1,iC=!1,OD=!1,LD=!1;const a=e._pickFeaturesResource,l=a.getUrlComponent(!0),u=e._pickFeaturesTags,h={},f=l.match(D9);return c(f)&&f.forEach(function(_){const g=_.substring(1,_.length-1);c(u[g])&&(h[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:h})}function tg(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if(typeof i=="string"){const o=i.length;o>1&&(n=n.length>=o?n:new Array(o-n.toString().length+1).join("0")+n)}}return n}function qLe(e,t,n,i){return tg(e,"{x}",t)}function YLe(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return tg(e,"{reverseX}",o)}function $Le(e,t,n,i){return tg(e,"{y}",n)}function XLe(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return tg(e,"{reverseY}",o)}function QLe(e,t,n,i){const o=e.maximumLevel,r=c(o)&&it.rectangle.east&&(e.east=t.rectangle.east),e.southt.rectangle.north&&(e.north=t.rectangle.north),e}function L9(e,t,n){const i=e.positionToTileXY(ce.southwest(t),n),o=e.positionToTileXY(ce.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}ra._metadataSuccess=function(e,t,n,i,o){const r=/tileformat/i,s=/tileset/i,a=/tilesets/i,l=/boundingbox/i;let u,h,f;const _=[],g=e.childNodes[0].childNodes;for(let M=0;M`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new Le}Object.defineProperties(ia.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}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});ia.fromUrl=async function(e,t,n){A.defined("url",e),A.defined("channel",t),n=y(n,{});const i=y(n.path,"/default_map"),o=Ae.createIfNeeded(e).getDerivedResource({url:i[0]==="/"?i.substring(1):i});o.appendForwardSlash();const r=o.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),s=new R9(n);s.channel=t,await xRe(r,s);const a=new ia(n);return s.build(a),a._resource=o,a._url=e,a._path=i,a};ia.prototype.getTileCredits=function(e,t,n){};ia.prototype.requestImage=function(e,t,n,i){const o=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 Bl.loadImage(this,o)};ia.prototype.pickFeatures=function(e,t,n,i,o){};ia._logoUrl=void 0;Object.defineProperties(ia,{logoUrl:{get:function(){return c(ia._logoUrl)||(ia._logoUrl=Zt("Assets/Images/google_earth_credit.png")),ia._logoUrl},set:function(e){A.defined("value",e),ia._logoUrl=e}}});const CRe=/\/$/,N9=new Wt('© Mapbox © OpenStreetMap Improve this map');function ng(e){e=y(e,y.EMPTY_OBJECT);const t=e.mapId;if(!c(t))throw new E("options.mapId is required.");const n=e.accessToken;if(!c(n))throw new E("options.accessToken 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;const i=Ae.createIfNeeded(y(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=y(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();CRe.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;c(e.credit)?(s=e.credit,typeof s=="string"&&(s=new Wt(s))):s=N9,this._resource=i,this._imageryProvider=new zl({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(ng.prototype,{url:{get:function(){return this._imageryProvider.url}},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}}});ng.prototype.getTileCredits=function(e,t,n){};ng.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};ng.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};ng._defaultCredit=N9;function xp(e){e=y(e,y.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=y(e.rectangle,ce.MAX_VALUE),n=new Yr({rectangle:t,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=n,this._image=void 0,this._texture=void 0,this._hasError=!1,this._errorEvent=new Le;let i=e.credit;typeof i=="string"&&(i=new Wt(i)),this._credit=i,A.defined("options.url",e.url);const o=Ae.createIfNeeded(e.url);this._resource=o,A.typeOf.number("options.tileWidth",e.tileWidth),A.typeOf.number("options.tileHeight",e.tileHeight),this._tileWidth=e.tileWidth,this._tileHeight=e.tileHeight}Object.defineProperties(xp.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}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});function ERe(e,t,n,i){let o=`Failed to load image ${e.url}`;c(t)&&c(t.message)&&(o+=`: ${t.message}`);const r=Er.reportError(i,n,c(n)?n._errorEvent:void 0,o,0,0,0,t);if(r.retry)return y1(e,n,r);throw c(n)&&(n._hasError=!0),new Te(o)}async function y1(e,t,n){try{return await Bl.loadImage(null,e)}catch(i){return ERe(e,i,t,n)}}xp.fromUrl=async function(e,t){A.defined("url",e);const n=Ae.createIfNeeded(e),i=await y1(n);t=y(t,y.EMPTY_OBJECT);const o=new xp({...t,url:e,tileWidth:i.width,tileHeight:i.height});return o._image=i,o};xp.prototype.getTileCredits=function(e,t,n){};xp.prototype.requestImage=async function(e,t,n,i){if(!this._hasError&&!c(this._image)){const o=await y1(this._resource,this);return this._image=o,Er.reportSuccess(this._errorEvent),o}return this._image};xp.prototype.pickFeatures=function(e,t,n,i,o){};function pv(e,t,n){if(!c(e))throw new E("type is required.");if(this.type=e,!c(t))if(e==="json")t="application/json";else if(e==="xml")t="text/xml";else if(e==="html")t="text/html";else if(e==="text")t="text/plain";else throw new E('format is required when type is not "json", "xml", "html", or "text".');if(this.format=t,!c(n))if(e==="json")n=wRe;else if(e==="xml")n=DRe;else if(e==="html")n=NB;else if(e==="text")n=NB;else throw new E('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function wRe(e){const t=[],n=e.features;for(let i=0;i0)for(let r=0;r\s*<\/body>/im,FRe=//im,BRe=/([\s\S]*)<\/title>/im;function NB(e){if(MRe.test(e)||FRe.test(e))return;let t;const n=BRe.exec(e);n&&n.length>1&&(t=n[1]);const i=new of;return i.name=t,i.description=e,i.data=e,[i]}function ig(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.clock",e.clock),A.typeOf.object("options.times",e.times),A.typeOf.func("options.requestImageFunction",e.requestImageFunction),A.typeOf.func("options.reloadFunction",e.reloadFunction),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)}Object.defineProperties(ig.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!c(e))throw new E("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!c(e))throw new E("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});ig.prototype.getFromCache=function(e,t,n,i){const o=M9(e,t,n);let r;const s=this._tileCache[this._currentIntervalIndex];if(c(s)&&c(s[o])){const a=s[o];r=a.promise.catch(function(l){throw i.state=a.request.state,l}),delete s[o]}return r};ig.prototype.checkApproachingInterval=function(e,t,n,i){const o=M9(e,t,n),r=this._tilesRequestedForInterval,s=F9(this),a={key:o,priorityFunction:i.priorityFunction};(!c(s)||!B9(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};ig.prototype._clockOnTick=function(e){const t=e.currentTime,i=this._times.indexOf(t),o=this._currentIntervalIndex;if(i!==o){const s=this._tileCache[o];for(const a in s)s.hasOwnProperty(a)&&s[a].request.cancel();delete this._tileCache[o],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,this._reloadFunction();return}const r=F9(this);if(c(r)){const s=this._tilesRequestedForInterval;let a=!0;for(;a&&s.length!==0;){const l=s.pop();a=B9(this,l,r),a||s.push(l)}}};function M9(e,t,n){return`${e}-${t}-${n}`}function zRe(e){const t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function F9(e){const t=e._times;if(!c(t))return;const n=e._clock,i=n.currentTime,o=n.canAnimate&&n.shouldAnimate,r=n.multiplier;if(!o&&r!==0)return;let s,a=t.indexOf(i);if(a<0)return;const l=t.get(a);return r>0?(s=ie.secondsDifference(l.stop,i),++a):(s=ie.secondsDifference(l.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function B9(e,t,n){const i=e._times.indexOf(n.start),o=e._tileCache;let r=o[i];c(r)||(r=o[i]={});const s=t.key;if(c(r[s]))return!0;const a=zRe(s),l=new iu({throttle:!1,throttleByServer:!0,type:Ip.IMAGERY,priorityFunction:t.priorityFunction}),u=e._requestImageFunction(a.x,a.y,a.level,l,n);return c(u)?(r[s]={promise:u,request:l},!0):!1}const URe=[3034,3035,3042,3043,3044],kRe=[4471,4559];function gl(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.url))throw new E("options.url is required.");if(!c(e.layers))throw new E("options.layers is required.");if(c(e.times)&&!c(e.clock))throw new E("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=y(e.getFeatureInfoUrl,e.url);const t=Ae.createIfNeeded(e.url),n=Ae.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(gl.DefaultParameters,!0),n.setQueryParameters(gl.GetFeatureInfoDefaultParameters,!0),c(e.parameters)&&t.setQueryParameters(MB(e.parameters)),c(e.getFeatureInfoParameters)&&n.setQueryParameters(MB(e.getFeatureInfoParameters));const i=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new ig({clock:e.clock,times:e.times,requestImageFunction:function(s,a,l,u,h){return z9(i,s,a,l,u,h)},reloadFunction:function(){c(i._reload)&&i._reload()}}));const o={};if(o.layers=e.layers,o.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",o.width="{width}",o.height="{height}",parseFloat(t.queryParameters.version)>=1.3){o.crs=y(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof vn?"EPSG:3857":"CRS:84");const s=o.crs.split(":");if(s[0]==="EPSG"&&s.length===2){const a=Number(s[1]);(a>=4e3&&a<5e3&&!kRe.includes(a)||URe.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=y(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof vn?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);const r={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(r.i="{i}",r.j="{j}"):(r.x="{i}",r.y="{j}"),n.setQueryParameters(r,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new zl({url:t,pickFeaturesUrl:n,tilingScheme:y(e.tilingScheme,new Yr({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:y(e.getFeatureInfoFormats,gl.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function z9(e,t,n,i,o,r){const s=c(r)?r.data:void 0,a=e._tileProvider;return c(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function VRe(e,t,n,i,o,r,s){const a=c(s)?s.data:void 0,l=e._tileProvider;return c(a)&&l._pickFeaturesResource.setQueryParameters(a),l.pickFeatures(t,n,i,o,r)}Object.defineProperties(gl.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}},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}}});gl.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};gl.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=z9(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};gl.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery,s=c(r)?r.currentInterval:void 0;return VRe(this,e,t,n,i,o,s)};gl.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});gl.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});gl.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new pv("json","application/json")),Object.freeze(new pv("xml","text/xml")),Object.freeze(new pv("text","text/html"))]);function MB(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}const HRe=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function og(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.url))throw new E("options.url is required.");if(!c(e.layer))throw new E("options.layer is required.");if(!c(e.style))throw new E("options.style is required.");if(!c(e.tileMatrixSetID))throw new E("options.tileMatrixSetID is required.");if(c(e.times)&&!c(e.clock))throw new E("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;const t=Ae.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!c(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(HRe),this._useKvp=!0;else{const f={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(f),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=y(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=c(e.tilingScheme)?e.tilingScheme:new ws({ellipsoid:e.ellipsoid}),this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._minimumLevel=y(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const s=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new ig({clock:e.clock,times:e.times,requestImageFunction:function(f,_,g,m,b){return U9(s,f,_,g,m,b)},reloadFunction:function(){c(s._reload)&&s._reload()}}));const a=this._tilingScheme.positionToTileXY(ce.southwest(this._rectangle),this._minimumLevel),l=this._tilingScheme.positionToTileXY(ce.northeast(this._rectangle),this._minimumLevel),u=(Math.abs(l.x-a.x)+1)*(Math.abs(l.y-a.y)+1);if(u>4)throw new E(`The imagery provider's rectangle and minimumLevel indicate that there are ${u} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new Le;const h=e.credit;this._credit=typeof h=="string"?new Wt(h):h,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():c(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function U9(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=c(s)?s[i]:i.toString(),l=e._subdomains,u=e._dimensions,h=c(r)?r.data:void 0;let f,_;if(!e._useKvp)_={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:l[(t+n+i)%l.length]},f=e._resource.getDerivedResource({request:o}),f.setTemplateValues(_),c(u)&&f.setTemplateValues(u),c(h)&&f.setTemplateValues(h);else{let g={};g.tilematrix=a,g.layer=e._layer,g.style=e._style,g.tilerow=n,g.tilecol=t,g.tilematrixset=e._tileMatrixSetID,g.format=e._format,c(u)&&(g=jt(g,u)),c(h)&&(g=jt(g,h)),_={s:l[(t+n+i)%l.length]},f=e._resource.getDerivedResource({queryParameters:g,request:o}),f.setTemplateValues(_)}return Bl.loadImage(e,f)}Object.defineProperties(og.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}},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,c(this._reload)&&this._reload())}}});og.prototype.getTileCredits=function(e,t,n){};og.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=U9(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};og.prototype.pickFeatures=function(e,t,n,i,o){};const GRe={ARCGIS_MAPSERVER:Oa.fromUrl,BING:async(e,t)=>Ho.fromUrl(e,t),GOOGLE_EARTH:async(e,t)=>{const n=t.channel;return delete t.channel,ia.fromUrl(e,n,t)},MAPBOX:(e,t)=>new ng({url:e,...t}),SINGLE_TILE:xp.fromUrl,TMS:ra.fromUrl,URL_TEMPLATE:(e,t)=>new zl({url:e,...t}),WMS:(e,t)=>new gl({url:e,...t}),WMTS:(e,t)=>new og({url:e,...t})};function xa(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=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileCredits=void 0,this._errorEvent=new Le}Object.defineProperties(xa.prototype,{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(){}}});xa.fromAssetId=async function(e,t){A.typeOf.number("assetId",e),t=y(t,y.EMPTY_OBJECT);const n=ar._createEndpointResource(e,t),i=e.toString()+t.accessToken+t.server;let o=xa._endpointCache[i];c(o)||(o=n.fetchJson(),xa._endpointCache[i]=o);const r=await o;if(r.type!=="IMAGERY")throw new Te(`Cesium ion asset ${e} is not an imagery asset.`);let s;const a=r.externalType;if(!c(a))s=await ra.fromUrl(new ar(r,n));else{const u=GRe[a];if(!c(u))throw new Te(`Unrecognized Cesium ion imagery type: ${a}`);const h={...r.options},f=h.url;delete h.url,s=await u(f,h)}const l=new xa;return s.errorEvent.addEventListener(function(u){u.provider=l,l._errorEvent.raiseEvent(u)}),l._tileCredits=ar.getCreditsFromEndpoint(r,n),l._imageryProvider=s,l};xa.prototype.getTileCredits=function(e,t,n){const i=this._imageryProvider.getTileCredits(e,t,n);return c(i)?this._tileCredits.concat(i):this._tileCredits};xa.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};xa.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};xa._endpointCache={};const jRe={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},tx=Object.freeze(jRe);function nx(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.style,tx.AERIAL);return xa.fromAssetId(t)}function Cp(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){const r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=Rn.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!c(o)&&e.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}Cp.createPlaceholder=function(e){const t=new Cp(e,0,0,0);return t.addReference(),t.state=Rn.PLACEHOLDER,t};Cp.prototype.addReference=function(){++this.referenceCount};Cp.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),c(this.parent)&&this.parent.releaseReference(),c(this.image)&&c(this.image.destroy)&&this.image.destroy(),c(this.texture)&&this.texture.destroy(),c(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),ve(this),0):this.referenceCount};Cp.prototype.processStateMachine=function(e,t,n){this.state===Rn.UNLOADED&&!n&&(this.state=Rn.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===Rn.RECEIVED&&(this.state=Rn.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===Rn.READY&&t&&!this.texture;(this.state===Rn.TEXTURE_LOADED||i)&&(this.state=Rn.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};function KC(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}KC.prototype.freeResources=function(){c(this.readyImagery)&&this.readyImagery.releaseReference(),c(this.loadingImagery)&&this.loadingImagery.releaseReference()};KC.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===Rn.READY)return c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r=i.parent,s;for(;c(r)&&(r.state!==Rn.READY||!this.useWebMercatorT&&!c(r.texture));)r.state!==Rn.FAILED&&r.state!==Rn.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,c(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===Rn.FAILED||i.state===Rn.INVALID?c(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};function Qt(e,t){this._imageryProvider=e,this._readyEvent=new Le,this._errorEvent=new Le,t=y(t,y.EMPTY_OBJECT),e=y(e,y.EMPTY_OBJECT),this.alpha=y(t.alpha,y(e._defaultAlpha,1)),this.nightAlpha=y(t.nightAlpha,y(e._defaultNightAlpha,1)),this.dayAlpha=y(t.dayAlpha,y(e._defaultDayAlpha,1)),this.brightness=y(t.brightness,y(e._defaultBrightness,Qt.DEFAULT_BRIGHTNESS)),this.contrast=y(t.contrast,y(e._defaultContrast,Qt.DEFAULT_CONTRAST)),this.hue=y(t.hue,y(e._defaultHue,Qt.DEFAULT_HUE)),this.saturation=y(t.saturation,y(e._defaultSaturation,Qt.DEFAULT_SATURATION)),this.gamma=y(t.gamma,y(e._defaultGamma,Qt.DEFAULT_GAMMA)),this.splitDirection=y(t.splitDirection,Qt.DEFAULT_SPLIT),this.minificationFilter=y(t.minificationFilter,y(e._defaultMinificationFilter,Qt.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=y(t.magnificationFilter,y(e._defaultMagnificationFilter,Qt.DEFAULT_MAGNIFICATION_FILTER)),this.show=y(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=y(t.rectangle,ce.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new KC(Cp.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=y(t.colorToAlphaThreshold,Qt.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(Qt.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},ready:{get:function(){return c(this._imageryProvider)}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},rectangle:{get:function(){return this._rectangle}}});Qt.DEFAULT_BRIGHTNESS=1;Qt.DEFAULT_CONTRAST=1;Qt.DEFAULT_HUE=0;Qt.DEFAULT_SATURATION=1;Qt.DEFAULT_GAMMA=1;Qt.DEFAULT_SPLIT=zp.NONE;Qt.DEFAULT_MINIFICATION_FILTER=en.LINEAR;Qt.DEFAULT_MAGNIFICATION_FILTER=Yo.LINEAR;Qt.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;Qt.fromProviderAsync=function(e,t){A.typeOf.object("imageryProviderPromise",e);const n=new Qt(void 0,t);return XRe(n,Promise.resolve(e)),n};Qt.fromWorldImagery=function(e){return e=y(e,y.EMPTY_OBJECT),Qt.fromProviderAsync(nx({style:e.style}),e)};Qt.prototype.isBaseLayer=function(){return this._isBaseLayer};Qt.prototype.isDestroyed=function(){return!1};Qt.prototype.destroy=function(){return ve(this)};const k9=new ce,FB=new ce,mv=new ce,V9=new ce;Qt.prototype.getImageryRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return ce.intersection(e.rectangle,t)};Qt.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(!c(t)||c(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||c(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;c(n)||(n=i.imagery.length);const o=this._imageryProvider;if(!this.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const r=o.tilingScheme.projection instanceof vn&&e.rectangle.north<vn.MaximumLatitude&&e.rectangle.south>-vn.MaximumLatitude,s=ce.intersection(o.rectangle,this._rectangle,k9);let a=ce.intersection(e.rectangle,s,FB);if(!c(a)){if(!this.isBaseLayer())return!1;const p=s,I=e.rectangle;a=FB,I.south>=p.north?a.north=a.south=p.north:I.north<=p.south?a.north=a.south=p.south:(a.south=Math.max(I.south,p.south),a.north=Math.min(I.north,p.north)),I.west>=p.east?a.west=a.east=p.east:I.east<=p.west?a.west=a.east=p.west:(a.west=Math.max(I.west,p.west),a.east=Math.min(I.east,p.east))}let l=0;a.south>0?l=a.south:a.north<0&&(l=a.north);const h=1*t.getLevelMaximumGeometricError(e.level);let f=YRe(this,h,l);f=Math.max(0,f);const _=o.maximumLevel;if(f>_&&(f=_),c(o.minimumLevel)){const p=o.minimumLevel;f<p&&(f=p)}const g=o.tilingScheme,m=g.positionToTileXY(ce.northwest(a),f),b=g.positionToTileXY(ce.southeast(a),f);let T=e.rectangle.width/512,x=e.rectangle.height/512;const C=g.tileXYToRectangle(m.x,m.y,f);Math.abs(C.south-e.rectangle.north)<x&&m.y<b.y&&++m.y,Math.abs(C.east-e.rectangle.west)<T&&m.x<b.x&&++m.x;const w=g.tileXYToRectangle(b.x,b.y,f);Math.abs(w.north-e.rectangle.south)<x&&b.y>m.y&&--b.y,Math.abs(w.west-e.rectangle.east)<T&&b.x>m.x&&--b.x;const v=ce.clone(e.rectangle,V9);let P=g.tileXYToRectangle(m.x,m.y,f),N=ce.intersection(P,s,mv),k;r?(g.rectangleToNativeRectangle(v,v),g.rectangleToNativeRectangle(P,P),g.rectangleToNativeRectangle(N,N),g.rectangleToNativeRectangle(s,s),k=g.tileXYToNativeRectangle.bind(g),T=v.width/512,x=v.height/512):k=g.tileXYToRectangle.bind(g);let M,U=0,B=1,S;!this.isBaseLayer()&&Math.abs(N.west-v.west)>=T&&(U=Math.min(1,(N.west-v.west)/v.width)),!this.isBaseLayer()&&Math.abs(N.north-v.north)>=x&&(B=Math.max(0,(N.north-v.south)/v.height));const D=B;for(let p=m.x;p<=b.x;p++)if(M=U,P=k(p,m.y,f),N=ce.simpleIntersection(P,s,mv),!!c(N)){U=Math.min(1,(N.east-v.west)/v.width),p===b.x&&(this.isBaseLayer()||Math.abs(N.east-v.east)<T)&&(U=1),B=D;for(let I=m.y;I<=b.y;I++){if(S=B,P=k(p,I,f),N=ce.simpleIntersection(P,s,mv),!c(N))continue;B=Math.max(0,(N.south-v.south)/v.height),I===b.y&&(this.isBaseLayer()||Math.abs(N.south-v.south)<x)&&(B=0);const O=new te(M,B,U,S),F=this.getImageryFromCache(p,I,f);i.imagery.splice(n,0,new KC(F,O,r)),++n}}return!0};Qt.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const l=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=l.rectangleToNativeRectangle(n,k9),i=l.rectangleToNativeRectangle(i,V9)}const o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new te(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)};Qt.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(s){if(!c(s))return o();e.image=s,e.state=Rn.RECEIVED,e.request=void 0,Er.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===di.CANCELLED){e.state=Rn.UNLOADED,e.request=void 0;return}e.state=Rn.FAILED,e.request=void 0;const a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=Er.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){const s=new iu({throttle:!1,throttleByServer:!0,type:Ip.IMAGERY});e.request=s,e.state=Rn.TRANSITIONING;const a=t.requestImage(e.x,e.y,e.level,s);if(!c(a)){e.state=Rn.UNLOADED,e.request=void 0;return}c(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(l){i(l)}).catch(function(l){o(l)})}r()};Qt.prototype._createTextureWebGL=function(e,t){const n=new un({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return c(i.internalFormat)?new xt({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new xt({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?Ve.RGBA:Ve.RGB,sampler:n})};Qt.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(c(n.tileDiscardPolicy)){const r=n.tileDiscardPolicy;if(c(r)){if(!r.isReady()){t.state=Rn.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=Rn.INVALID;return}}}if(this.minificationFilter!==en.NEAREST&&this.minificationFilter!==en.LINEAR)throw new E("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof vn?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=Rn.TEXTURE_LOADED};function BB(e,t,n){return`${e}:${t}:${n}`}Qt.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===en.LINEAR&&i===Yo.LINEAR&&!Ve.isCompressedFormat(t.pixelFormat)&&R.isPowerOfTwo(t.width)&&R.isPowerOfTwo(t.height)){n=en.LINEAR_MIPMAP_LINEAR;const r=pt.maximumTextureFilterAnisotropy,s=Math.min(r,y(this._maximumAnisotropy,r)),a=BB(n,i,s);let l=e.cache.imageryLayerMipmapSamplers;c(l)||(l={},e.cache.imageryLayerMipmapSamplers=l);let u=l[a];c(u)||(u=l[a]=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(v_.NICEST),t.sampler=u}else{const r=BB(n,i,0);let s=e.cache.imageryLayerNonMipmapSamplers;c(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];c(a)||(a=s[r]=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};Qt.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=y(n,!0),n&&!(this._imageryProvider.tilingScheme.projection instanceof co)&&o.width/i.width>1e-5){const s=this;t.addReference();const a=new A_({persists:!0,owner:this,preExecute:function(l){qRe(l,r,i,t.rectangle)},postExecute:function(l){t.texture=l,s._finalizeReprojectTexture(r,l),t.state=Rn.READY,t.releaseReference()},canceled:function(){t.state=Rn.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=Rn.READY};Qt.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};Qt.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){c(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};Qt.prototype.getImageryFromCache=function(e,t,n,i){const o=H9(e,t,n);let r=this._imageryCache[o];return c(r)||(r=new Cp(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};Qt.prototype.removeImageryFromCache=function(e){const t=H9(e.x,e.y,e.level);delete this._imageryCache[t]};function H9(e,t,n){return JSON.stringify([e,t,n])}const QT={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new H,texture:void 0},WRe=Yt.supportsTypedArrays()?new Float32Array(2*64):void 0;function qRe(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!c(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){c(this.framebuffer)&&this.framebuffer.destroy(),c(this.vertexArray)&&this.vertexArray.destroy(),c(this.shaderProgram)&&this.shaderProgram.destroy()}};const T=new Float32Array(2*64*2);let x=0;for(let N=0;N<64;++N){const k=N/63;T[x++]=0,T[x++]=k,T[x++]=1,T[x++]=k}const C={position:0,webMercatorT:1},w=so.getRegularGridIndices(2,64),v=ct.createIndexBuffer({context:t,typedArray:w,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});o.vertexArray=new Ci({context:t,attributes:[{index:C.position,vertexBuffer:ct.createVertexBuffer({context:t,typedArray:T,usage:ke.STATIC_DRAW}),componentsPerAttribute:2},{index:C.webMercatorT,vertexBuffer:ct.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:ke.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:v});const P=new Oe({sources:[F1e]});o.shaderProgram=Jt.fromCache({context:t,vertexShaderSource:P,fragmentShaderSource:M1e,attributeLocations:C}),o.sampler=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;QT.textureDimensions.x=r,QT.textureDimensions.y=s,QT.texture=n;let a=Math.sin(i.south);const l=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const h=1/(.5*Math.log((1+a)/(1-a))-l),f=new xt({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});R.isPowerOfTwo(r)&&R.isPowerOfTwo(s)&&f.generateMipmap(v_.NICEST);const _=i.south,g=i.north,m=WRe;let b=0;for(let T=0;T<64;++T){const x=T/63,C=R.lerp(_,g,x);a=Math.sin(C);const v=(.5*Math.log((1+a)/(1-a))-l)*h;m[b++]=v,m[b++]=v}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(m),e.shaderProgram=o.shaderProgram,e.outputTexture=f,e.uniformMap=QT,e.vertexArray=o.vertexArray}function YRe(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof co?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,h=Math.log(u)/Math.log(2);return Math.round(h)|0}function $Re(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function XRe(e,t){let n;try{if(n=await Promise.resolve(t),e.isDestroyed())return;e._imageryProvider=n,e._readyEvent.raiseEvent(n)}catch(i){$Re(e._errorEvent,i)}}const QRe={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},Ft=QRe,G9={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>=G9.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},Tn=G9;function Gp(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 te}Gp.prototype.update=function(e,t,n){this.changedThisFrame&&(j9(e,t,this.tile,n),this.changedThisFrame=!1)};Gp.prototype.destroy=function(e){this._destroyVertexArray(e),c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};Gp.prototype._destroyVertexArray=function(e){c(this.vertexArray)&&(c(e)?e.push(this.vertexArray):Yn._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const KRe=new yu;Gp.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=KRe;a.clear();for(let u=0;u<t.length;++u){const h=t[u];c(h.data.vertexArray)&&a.enqueue(t[u])}let l=a.dequeue();for(;l!==void 0;){const u=l.findTileToWest(r),h=l.findTileToSouth(r),f=l.findTileToEast(r),_=l.findTileToNorth(r);Fo(e,n,l,u,s,Ft.EAST,!1,a,i),Fo(e,n,l,h,s,Ft.NORTH,!1,a,i),Fo(e,n,l,f,s,Ft.WEST,!1,a,i),Fo(e,n,l,_,s,Ft.SOUTH,!1,a,i);const g=u.findTileToNorth(r),m=u.findTileToSouth(r),b=f.findTileToNorth(r),T=f.findTileToSouth(r);Fo(e,n,l,g,s,Ft.SOUTHEAST,!1,a,i),Fo(e,n,l,b,s,Ft.SOUTHWEST,!1,a,i),Fo(e,n,l,m,s,Ft.NORTHEAST,!1,a,i),Fo(e,n,l,T,s,Ft.NORTHWEST,!1,a,i),l=a.dequeue()}};function Fo(e,t,n,i,o,r,s,a,l){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||Tn.wasKicked(u._lastSelectionResult)||Tn.originalResult(u._lastSelectionResult)===Tn.CULLED);){if(s)return;const h=u.parent;if(r>=Ft.NORTHWEST&&h!==void 0)switch(r){case Ft.NORTHWEST:u=u===h.northwestChild?h:void 0;break;case Ft.NORTHEAST:u=u===h.northeastChild?h:void 0;break;case Ft.SOUTHWEST:u=u===h.southwestChild?h:void 0;break;case Ft.SOUTHEAST:u=u===h.southeastChild?h:void 0;break}else u=h}if(u!==void 0){if(u._lastSelectionResult===Tn.RENDERED){if(c(u.data.vertexArray))return;ZRe(e,t,n,u,r,o,a,l);return}if(Tn.originalResult(i._lastSelectionResult)!==Tn.CULLED)switch(r){case Ft.WEST:Fo(e,t,n,i.northwestChild,o,r,!0,a,l),Fo(e,t,n,i.southwestChild,o,r,!0,a,l);break;case Ft.EAST:Fo(e,t,n,i.southeastChild,o,r,!0,a,l),Fo(e,t,n,i.northeastChild,o,r,!0,a,l);break;case Ft.SOUTH:Fo(e,t,n,i.southwestChild,o,r,!0,a,l),Fo(e,t,n,i.southeastChild,o,r,!0,a,l);break;case Ft.NORTH:Fo(e,t,n,i.northeastChild,o,r,!0,a,l),Fo(e,t,n,i.northwestChild,o,r,!0,a,l);break;case Ft.NORTHWEST:Fo(e,t,n,i.northwestChild,o,r,!0,a,l);break;case Ft.NORTHEAST:Fo(e,t,n,i.northeastChild,o,r,!0,a,l);break;case Ft.SOUTHWEST:Fo(e,t,n,i.southwestChild,o,r,!0,a,l);break;case Ft.SOUTHEAST:Fo(e,t,n,i.southeastChild,o,r,!0,a,l);break;default:throw new E("Invalid edge")}}}function ZRe(e,t,n,i,o,r,s,a){const l=i.data;if(l.fill===void 0)l.fill=new Gp(i);else if(l.fill.visitedFrame===r)return;l.fill.enqueuedFrame!==r&&(l.fill.enqueuedFrame=r,l.fill.changedThisFrame=!1,s.enqueue(i)),JRe(e,t,n,i,o,a)}function JRe(e,t,n,i,o,r){const s=i.data.fill;let a;const l=n.data.fill;c(l)?(l.visitedFrame=t.frameNumber,l.changedThisFrame&&(j9(e,t,n,r),l.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,h;switch(o){case Ft.WEST:u=s.westMeshes,h=s.westTiles;break;case Ft.SOUTH:u=s.southMeshes,h=s.southTiles;break;case Ft.EAST:u=s.eastMeshes,h=s.eastTiles;break;case Ft.NORTH:u=s.northMeshes,h=s.northTiles;break;case Ft.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case Ft.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case Ft.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case Ft.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||u[0]!==a||u.length!==1,u[0]=a,h[0]=n,u.length=1,h.length=1;return}let f,_,g,m;const b=n.rectangle;let T;const x=i.rectangle;switch(o){case Ft.WEST:for(T=(x.north-x.south)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.greaterThan(b.north,m.south,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.greaterThanOrEquals(b.south,m.north,T));++_);break;case Ft.SOUTH:for(T=(x.east-x.west)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.lessThan(b.west,m.east,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.lessThanOrEquals(b.east,m.west,T));++_);break;case Ft.EAST:for(T=(x.north-x.south)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.lessThan(b.south,m.north,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.lessThanOrEquals(b.north,m.south,T));++_);break;case Ft.NORTH:for(T=(x.east-x.west)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.greaterThan(b.east,m.west,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.greaterThanOrEquals(b.west,m.east,T));++_);break}_-f===1?(s.changedThisFrame=s.changedThisFrame||u[f]!==a,u[f]=a,h[f]=n):(s.changedThisFrame=!0,u.splice(f,_-f,a),h.splice(f,_-f,n))}const qf=new he,eNe=new he,b_=new d,T1=new d,ND=new H,MD=new H,ya=new H;function ZC(){this.height=0,this.encodedNormal=new H}function KT(e,t,n,i,o,r,s,a,l){if(c(o))return o;let u;if(c(r)&&c(s))u=(r.height+s.height)*.5;else if(c(r))u=r.height;else if(c(s))u=s.height;else if(c(a))u=a.height;else{const f=e.tile.data.tileBoundingRegion;let _=0,g=0;c(f)&&(_=f.minimumHeight,g=f.maximumHeight),u=(_+g)*.5}return W9(e,t,n,i,u,l),l}const tNe={minimumHeight:0,maximumHeight:0},nNe=new d,zB=new ZC,UB=new ZC,kB=new ZC,VB=new ZC,iNe=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,oNe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function j9(e,t,n,i){Yn.initialize(n,e.terrainProvider,e._imageryLayers);const o=n.data,r=o.fill,s=n.rectangle,a=t.verticalExaggeration,l=t.verticalExaggerationRelativeHeight,u=a!==1,h=n.tilingScheme.ellipsoid;let f=JT(r,h,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,kB),_=JT(r,h,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,zB),g=JT(r,h,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,UB),m=JT(r,h,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,VB);f=KT(r,h,0,1,f,_,m,g,kB),_=KT(r,h,0,0,_,f,g,m,zB),g=KT(r,h,1,1,g,_,m,f,UB),m=KT(r,h,1,1,m,g,f,_,VB);const b=_.height,T=g.height,x=f.height,C=m.height;let w=Math.min(b,T,x,C),v=Math.max(b,T,x,C);const P=(w+v)*.5;let N,k;const M=e.getLevelMaximumGeometricError(n.level),U=h.maximumRadius-M;let B=Math.acos(U/h.maximumRadius)*4;if(B*=1.5,s.width>B&&v-w<=M){const p=new Cl({width:9,height:9,buffer:iNe,structure:{heightOffset:v}}),I=oNe;I.tilingScheme=n.tilingScheme,I.x=n.x,I.y=n.y,I.level=n.level,I.exaggeration=a,I.exaggerationRelativeHeight=l,r.mesh=p._createMeshSync(I)}else{const p=u,I=ce.center(s,eNe);I.height=P;const O=h.cartographicToCartesian(I,nNe),F=new Oo(O,void 0,void 0,void 0,void 0,!0,!0,p,a,l);let V=5,G;for(G=r.westMeshes,N=0,k=G.length;N<k;++N)V+=G[N].eastIndicesNorthToSouth.length;for(G=r.southMeshes,N=0,k=G.length;N<k;++N)V+=G[N].northIndicesWestToEast.length;for(G=r.eastMeshes,N=0,k=G.length;N<k;++N)V+=G[N].westIndicesSouthToNorth.length;for(G=r.northMeshes,N=0,k=G.length;N<k;++N)V+=G[N].southIndicesEastToWest.length;const j=tNe;j.minimumHeight=w,j.maximumHeight=v;const W=F.stride;let X=new Float32Array(V*W),q=0;const ee=q;q=ZT(h,s,F,X,q,0,1,f.height,f.encodedNormal,1,j),q=tA(r,h,F,X,q,r.westTiles,r.westMeshes,Ft.EAST,j);const Y=q;q=ZT(h,s,F,X,q,0,0,_.height,_.encodedNormal,0,j),q=tA(r,h,F,X,q,r.southTiles,r.southMeshes,Ft.NORTH,j);const ne=q;q=ZT(h,s,F,X,q,1,0,g.height,g.encodedNormal,0,j),q=tA(r,h,F,X,q,r.eastTiles,r.eastMeshes,Ft.WEST,j);const Q=q;q=ZT(h,s,F,X,q,1,1,m.height,m.encodedNormal,1,j),q=tA(r,h,F,X,q,r.northTiles,r.northMeshes,Ft.SOUTH,j),w=j.minimumHeight,v=j.maximumHeight;const le=Ct.fromRectangle(s,w,v,n.tilingScheme.ellipsoid),pe=vn.geodeticLatitudeToMercatorAngle(s.south),re=1/(vn.geodeticLatitudeToMercatorAngle(s.north)-pe),de=(vn.geodeticLatitudeToMercatorAngle(I.latitude)-pe)*re,fe=h.geodeticSurfaceNormalCartographic(qf,T1),ye=En.octEncode(fe,ND),Ce=q;F.encode(X,q*W,le.center,H.fromElements(.5,.5,ya),P,ye,de,fe),++q;const we=q,Pe=we<256?1:2,lt=(we-1)*3,ft=lt*Pe,We=(X.length-we*W)*Float32Array.BYTES_PER_ELEMENT;let Fe;if(We>=ft){const at=we*W*Float32Array.BYTES_PER_ELEMENT;Fe=we<256?new Uint8Array(X.buffer,at,lt):new Uint16Array(X.buffer,at,lt)}else Fe=we<256?new Uint8Array(lt):new Uint16Array(lt);X=new Float32Array(X.buffer,0,we*W);let Dt=0;for(N=0;N<we-2;++N)Fe[Dt++]=Ce,Fe[Dt++]=N,Fe[Dt++]=N+1;Fe[Dt++]=Ce,Fe[Dt++]=N,Fe[Dt++]=0;const st=[];for(N=Y;N>=ee;--N)st.push(N);const et=[];for(N=ne;N>=Y;--N)et.push(N);const hn=[];for(N=Q;N>=ne;--N)hn.push(N);const ot=[];for(ot.push(0),N=Ce-1;N>=Q;--N)ot.push(N);r.mesh=new YC(F.center,X,Fe,lt,we,w,v,se.fromOrientedBoundingBox(le),dNe(e,le.center,s,w,v),F.stride,le,F,st,et,hn,ot)}const S=t.context;r._destroyVertexArray(i),r.vertexArray=Yn._createVertexArrayForMesh(S,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const D=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const p=o._findAncestorTileWithTerrainData(n);c(p)&&c(p.data.waterMaskTexture)&&(r.waterMaskTexture=p.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,p,r.waterMaskTranslationAndScale))}c(D)&&(--D.referenceCount,D.referenceCount===0&&D.destroy())}function ZT(e,t,n,i,o,r,s,a,l,u,h){const f=qf;f.longitude=R.lerp(t.west,t.east,r),f.latitude=R.lerp(t.south,t.north,s),f.height=a;const _=e.cartographicToCartesian(f,b_);let g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(_,T1));const m=MD;return m.x=r,m.y=s,n.encode(i,o*n.stride,_,m,a,l,u,g),h.minimumHeight=Math.min(h.minimumHeight,a),h.maximumHeight=Math.max(h.maximumHeight,a),o+1}const rC=new ce;function v0(e,t,n,i){let o=e.rectangle;const r=t.rectangle;t.x===0&&n.x===1&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=ce.clone(e.rectangle,rC),o.west-=R.TWO_PI,o.east-=R.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=ce.clone(e.rectangle,rC),o.west+=R.TWO_PI,o.east+=R.TWO_PI);const s=o.east-o.west,a=(r.west-o.west)/s,l=(r.east-o.west)/s,u=o.north-o.south,h=(r.south-o.south)/u,f=(r.north-o.south)/u;let _=(n.x-a)/(l-a),g=(n.y-h)/(f-h);return Math.abs(_)<Math.EPSILON5?_=0:Math.abs(_-1)<Math.EPSILON5&&(_=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=_,i.y=g,i}const rNe=new H;function FD(e,t,n,i,o){const r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{const a=o.encodedNormal;a.x=0,a.y=0}}const sNe=new H,aNe=new d;function cNe(e,t,n,i,o,r,s,a,l,u){const h=i.encoding,f=i.vertices,_=v0(t,n,h.decodeTextureCoordinates(f,o,ya),ya),g=v0(t,n,h.decodeTextureCoordinates(f,r,MD),MD);let m;l?m=(s-_.x)/(g.x-_.x):m=(a-_.y)/(g.y-_.y);const b=h.decodeHeight(f,o),T=h.decodeHeight(f,r),x=n.rectangle;qf.longitude=R.lerp(x.west,x.east,s),qf.latitude=R.lerp(x.south,x.north,a),u.height=qf.height=R.lerp(b,T,m);let C;if(h.hasVertexNormals){const w=h.getOctEncodedNormal(f,o,rNe),v=h.getOctEncodedNormal(f,r,sNe),P=En.octDecode(w.x,w.y,b_),N=En.octDecode(v.x,v.y,aNe);C=d.lerp(P,N,m,b_),d.normalize(C,C),En.octEncode(C,u.encodedNormal)}else C=e.geodeticSurfaceNormalCartographic(qf,b_),En.octEncode(C,u.encodedNormal)}function W9(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(qf,b_);En.octEncode(s,r.encodedNormal)}function JT(e,t,n,i,o,r,s,a,l,u,h){if(GB(e,t,a,s,!1,n,i,h)||GB(e,t,u,l,!0,n,i,h))return h;let _;if(A1(o,r))return n===0?i===0?_=r.eastIndicesNorthToSouth[0]:_=r.southIndicesEastToWest[0]:i===0?_=r.northIndicesWestToEast[0]:_=r.westIndicesSouthToNorth[0],FD(r,_,n,i,h),h;let g;if(n===0?i===0?g=eA(e.westMeshes,e.westTiles,Ft.EAST,e.southMeshes,e.southTiles,Ft.NORTH):g=eA(e.northMeshes,e.northTiles,Ft.SOUTH,e.westMeshes,e.westTiles,Ft.EAST):i===0?g=eA(e.southMeshes,e.southTiles,Ft.NORTH,e.eastMeshes,e.eastTiles,Ft.WEST):g=eA(e.eastMeshes,e.eastTiles,Ft.WEST,e.northMeshes,e.northTiles,Ft.SOUTH),c(g))return W9(e,t,n,i,g,h),h}function eA(e,t,n,i,o,r,s,a){const l=HB(e,t,!1,n),u=HB(i,o,!0,r);return c(l)&&c(u)?(l+u)*.5:c(l)?l:u}function tA(e,t,n,i,o,r,s,a,l){for(let u=0;u<r.length;++u)o=lNe(e,t,n,i,o,r[u],s[u],a,l);return o}function lNe(e,t,n,i,o,r,s,a,l){let u=r.rectangle;a===Ft.EAST&&e.tile.x===0?(u=ce.clone(r.rectangle,rC),u.west-=R.TWO_PI,u.east-=R.TWO_PI):a===Ft.WEST&&r.x===0&&(u=ce.clone(r.rectangle,rC),u.west+=R.TWO_PI,u.east+=R.TWO_PI);const h=e.tile.rectangle;let f,_;o>0&&(n.decodeTextureCoordinates(i,o-1,ya),f=ya.x,_=ya.y);let g,m;switch(a){case Ft.WEST:g=s.westIndicesSouthToNorth,m=!1;break;case Ft.NORTH:g=s.northIndicesWestToEast,m=!0;break;case Ft.EAST:g=s.eastIndicesNorthToSouth,m=!1;break;case Ft.SOUTH:g=s.southIndicesEastToWest,m=!0;break}const b=r,T=e.tile,x=s.encoding,C=s.vertices,w=n.stride;let v,P;x.hasWebMercatorT&&(v=vn.geodeticLatitudeToMercatorAngle(h.south),P=1/(vn.geodeticLatitudeToMercatorAngle(h.north)-v));for(let N=0;N<g.length;++N){const k=g[N],M=x.decodeTextureCoordinates(C,k,ya);v0(b,T,M,M);const U=M.x,B=M.y,S=m?U:B;if(S<0||S>1||Math.abs(U-f)<R.EPSILON5&&Math.abs(B-_)<R.EPSILON5)continue;const D=Math.abs(U)<R.EPSILON5||Math.abs(U-1)<R.EPSILON5,p=Math.abs(B)<R.EPSILON5||Math.abs(B-1)<R.EPSILON5;if(D&&p)continue;const I=x.decodePosition(C,k,b_),O=x.decodeHeight(C,k);let F;x.hasVertexNormals?F=x.getOctEncodedNormal(C,k,ND):(F=ND,F.x=0,F.y=0);let V=B;if(x.hasWebMercatorT){const j=R.lerp(h.south,h.north,B);V=(vn.geodeticLatitudeToMercatorAngle(j)-v)*P}let G;n.hasGeodeticSurfaceNormals&&(G=t.geodeticSurfaceNormal(I,T1)),n.encode(i,o*w,I,M,O,F,V,G),l.minimumHeight=Math.min(l.minimumHeight,O),l.maximumHeight=Math.max(l.maximumHeight,O),++o}return o}function HB(e,t,n,i,o,r){let s,a,l;n?(s=0,a=e.length,l=1):(s=e.length-1,a=-1,l=-1);for(let u=s;u!==a;u+=l){const h=e[u],f=t[u];if(!A1(f,h))continue;let _;switch(i){case Ft.WEST:_=h.westIndicesSouthToNorth;break;case Ft.SOUTH:_=h.southIndicesEastToWest;break;case Ft.EAST:_=h.eastIndicesNorthToSouth;break;case Ft.NORTH:_=h.northIndicesWestToEast;break}const g=_[n?0:_.length-1];if(c(g))return h.encoding.decodeHeight(h.vertices,g)}}function A1(e,t){return c(t)&&(!c(e.data.fill)||!e.data.fill.changedThisFrame)}function GB(e,t,n,i,o,r,s,a){let l,u,h,f,_;const g=i[o?0:n.length-1],m=n[o?0:n.length-1];if(A1(g,m)&&(r===0?s===0?(l=o?m.northIndicesWestToEast:m.eastIndicesNorthToSouth,u=o,h=o):(l=o?m.eastIndicesNorthToSouth:m.southIndicesEastToWest,u=!o,h=!1):s===0?(l=o?m.westIndicesSouthToNorth:m.northIndicesWestToEast,u=!o,h=!0):(l=o?m.southIndicesEastToWest:m.westIndicesSouthToNorth,u=o,h=!o),l.length>0)){f=o?0:l.length-1,_=l[f],m.encoding.decodeTextureCoordinates(m.vertices,_,ya);const b=v0(g,e.tile,ya,ya);if(b.x===r&&b.y===s)return FD(m,_,r,s,a),!0;if(f=Hr(l,u?r:s,function(T,x){m.encoding.decodeTextureCoordinates(m.vertices,T,ya);const C=v0(g,e.tile,ya,ya);return h?u?C.x-r:C.y-s:u?r-C.x:s-C.y}),f<0){if(f=~f,f>0&&f<l.length)return cNe(t,g,e.tile,m,l[f-1],l[f],r,s,u,a),!0}else return FD(m,l[f],r,s,a),!0}return!1}const uNe=[new d,new d,new d,new d];function dNe(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=uNe;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}function Pi(e){if(!c(e))throw new E("options is required.");if(c(e.terrainProvider))if(c(e.imageryLayers)){if(!c(e.surfaceShaderSet))throw new E("options.surfaceShaderSet is required.")}else throw new E("options.imageryLayers is required.");else throw new E("options.terrainProvider is required.");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=Vi.RECEIVE_ONLY,this.vertexShadowDarkness=.3,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 Le,this._removeLayerAddedListener=this._imageryLayers.layerAdded.addEventListener(Pi.prototype._onLayerAdded,this),this._removeLayerRemovedListener=this._imageryLayers.layerRemoved.addEventListener(Pi.prototype._onLayerRemoved,this),this._removeLayerMovedListener=this._imageryLayers.layerMoved.addEventListener(Pi.prototype._onLayerMoved,this),this._removeLayerShownListener=this._imageryLayers.layerShownOrHidden.addEventListener(Pi.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Le,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 z(0,0,.5,1),this._clippingPlanes=void 0,this._clippingPolygons=void 0,this.cartographicLimitRectangle=ce.clone(ce.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldVerticalExaggeration=void 0,this._oldVerticalExaggerationRelativeHeight=void 0}Object.defineProperties(Pi.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!c(e))throw new E("value is required.");this._baseColor=e,this._firstPassInitialColor=te.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!c(e))throw new E("value is required.");this._quadtree=e}},tilingScheme:{get:function(){if(!!c(this._terrainProvider))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,c(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){Di.setOwner(e,this,"_clippingPolygons")}}});function hNe(e,t){let n=e.loadingImagery;c(n)||(n=e.readyImagery);let i=t.loadingImagery;return c(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}Pi.prototype.update=function(e){this._imageryLayers._update()};function fNe(e,t){const n=t.creditDisplay,i=e._terrainProvider;c(i)&&c(i.credit)&&n.addCreditToNextFrame(i.credit);const o=e._imageryLayers;for(let r=0,s=o.length;r<s;++r){const a=o.get(r);a.ready&&a.show&&c(a.imageryProvider.credit)&&n.addCreditToNextFrame(a.imageryProvider.credit)}}Pi.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(hNe)})),fNe(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)Yn._freeVertexArray(t[i]);t.length=0};Pi.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let o=0,r=t.length;o<r;++o){const s=t[o];c(s)&&(s.length=0)}const n=this._clippingPlanes;c(n)&&n.enabled&&n.update(e);const i=this._clippingPolygons;c(i)&&i.enabled&&(i.update(e),i.queueCommands(e)),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};Pi.prototype.endUpdate=function(e){if(!c(this._renderState)){this._renderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:lp.LESS}}),this._blendRenderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},blending:Zn.ALPHA_BLEND});let s=Je(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=Ue.fromCache(s),s=Je(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=Ue.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&Gp.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,n=e.verticalExaggeration,i=e.verticalExaggerationRelativeHeight,o=this._oldVerticalExaggeration!==n||this._oldVerticalExaggerationRelativeHeight!==i;this._oldVerticalExaggeration=n,this._oldVerticalExaggerationRelativeHeight=i,o&&t.forEachLoadedTile(function(s){s.data.updateExaggeration(s,e,t)});const r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){const l=r[s];if(!!c(l))for(let u=0,h=l.length;u<h;++u){const f=l[u],_=f.data.tileBoundingRegion;BNe(this,f,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,_.minimumHeight)}}};function q9(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)}Pi.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)q9(t[n],e)};Pi.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};Pi.prototype.getLevelMaximumGeometricError=function(e){return c(this._terrainProvider)?this._terrainProvider.getLevelMaximumGeometricError(e):0};Pi.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;c(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===Tn.CULLED_BUT_NEEDED,o=n.terrainState),Yn.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i),n=t.data,i&&o!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==ir.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,Yn.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};const pNe=new se,Y9=new ce,mNe=new ce,_Ne=new he;function ix(e,t){if(t.west<t.east)return t;const n=ce.clone(t,mNe);return ce.center(e,_Ne).longitude>0?n.east=R.PI:n.west=-R.PI,n}function $9(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;if(c(n)&&n.enabled)return!0;const i=e._clippingPolygons;return!!(c(i)&&i.enabled||!ce.equals(e.cartographicLimitRectangle,ce.MAX_VALUE))}Pi.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=$9(this,t);if(t.fog.enabled&&!o&&R.fog(i,t.fog.density)>=1)return ir.NONE;const r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return ir.PARTIAL;const a=t.cullingVolume;let l=s.boundingVolume;c(l)||(l=s.boundingSphere),r.clippedByBoundaries=!1;const u=ix(e.rectangle,this.cartographicLimitRectangle),h=ce.simpleIntersection(u,e.rectangle,Y9);if(!c(h))return ir.NONE;if(ce.equals(h,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==oe.SCENE3D&&(l=pNe,se.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,l),d.fromElements(l.center.z,l.center.x,l.center.y,l.center),t.mode===oe.MORPHING&&c(r.renderedMesh)&&(l=se.union(s.boundingSphere,l,l))),!c(l))return ir.PARTIAL;const f=this._clippingPlanes;if(c(f)&&f.enabled){const T=f.computeIntersectionWithBoundingVolume(l);if(e.isClipped=T!==Bt.INSIDE,T===Bt.OUTSIDE)return ir.NONE}const _=this._clippingPolygons;if(c(_)&&_.enabled){const T=_.computeIntersectionWithBoundingVolume(s);e.isClipped=T!==Bt.OUTSIDE}let g;const m=a.computeVisibility(l);if(m===Bt.OUTSIDE?g=ir.NONE:m===Bt.INTERSECTING?g=ir.PARTIAL:m===Bt.INSIDE&&(g=ir.FULL),g===ir.NONE)return g;const b=t.mode===oe.SCENE3D&&t.camera.frustum instanceof It;if(t.mode===oe.SCENE3D&&!b&&c(n)&&!o){const T=r.occludeePointInScaledSpace;return!c(T)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(T,s.minimumHeight)?g:ir.NONE}return g};Pi.prototype.canRefine=function(e){return c(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};const gNe=[],yNe=[];Pi.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=gNe;i.length=this._imageryLayers.length;let o=!1,r=!1,s;c(n)&&(o=n.terrainState===yi.READY,r=!0,s=n.imagery);let a,l;for(a=0,l=i.length;a<l;++a)i[a]=r;if(c(s))for(a=0,l=s.length;a<l;++a){const f=s[a],_=f.loadingImagery,g=!c(_)||_.state===Rn.FAILED||_.state===Rn.INVALID,m=(f.loadingImagery||f.readyImagery).imageryLayer._layerIndex;i[m]=g&&i[m]}const u=this.quadtree._lastSelectionFrameNumber,h=yNe;for(h.length=0,h.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);h.length>0;){const f=h.pop(),_=f._lastSelectionResultFrame===u?f._lastSelectionResult:Tn.NONE;if(_===Tn.RENDERED){const g=f.data;if(!c(g))continue;if(!o&&f.data.terrainState===yi.READY)return!1;const m=f.data.imagery;for(a=0,l=m.length;a<l;++a){const b=m[a],T=b.loadingImagery,x=!c(T)||T.state===Rn.FAILED||T.state===Rn.INVALID,C=(b.loadingImagery||b.readyImagery).imageryLayer._layerIndex;if(x&&!i[C])return!1}}else _===Tn.REFINED&&h.push(f.southwestChild,f.southeastChild,f.northwestChild,f.northeastChild)}return!0};const bNe=new d;Pi.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(n===void 0)return 0;const i=n.tileBoundingRegion.boundingVolume;if(i===void 0)return 0;const o=t.camera.positionWC,r=t.camera.directionWC,s=d.subtract(i.center,o,bNe),a=d.magnitude(s);return a<R.EPSILON5?0:(d.divideByScalar(s,a,s),(1-d.dot(s,r))*e._distance)};const jB=new L,nA=new L,TNe=new te,ANe=new te,xNe=new te,CNe=new d,WB=new d,ENe=new d,wNe=new d;Pi.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let a=0,l=i.length;a<l;++a){const u=i[a];c(u.readyImagery)&&u.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];c(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);const r=e.data;c(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const s=this._debug;++s.tilesRendered,s.texturesRendered+=n};const SNe=[new d,new d,new d,new d];function qB(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=SNe;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}Pi.prototype.computeDistanceToTile=function(e,t){vNe(e,this,t);const n=e.data;if(n.boundingVolumeSourceTile===void 0)return 9999999999;const o=n.tileBoundingRegion,r=o.minimumHeight,s=o.maximumHeight;if(n.boundingVolumeSourceTile!==e){const l=t.camera.positionCartographic.height,u=Math.abs(l-r),h=Math.abs(l-s);u>h?(o.minimumHeight=r,o.maximumHeight=r):(o.minimumHeight=s,o.maximumHeight=s)}const a=o.distanceToCamera(t);return o.minimumHeight=r,o.maximumHeight=s,a};function vNe(e,t,n){let i=e.data;i===void 0&&(i=e.data=new Yn);const o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new ru({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));const r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight;let l=!1,u=e;const h=i.mesh,f=i.terrainData;if(h!==void 0&&h.minimumHeight!==void 0&&h.maximumHeight!==void 0)r.minimumHeight=h.minimumHeight,r.maximumHeight=h.maximumHeight,l=!0;else if(f!==void 0&&f._minimumHeight!==void 0&&f._maximumHeight!==void 0)r.minimumHeight=f._minimumHeight,r.maximumHeight=f._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let _=e.parent;for(;_!==void 0;){const g=_.data;if(g!==void 0){const m=g.mesh,b=g.terrainData;if(m!==void 0&&m.minimumHeight!==void 0&&m.maximumHeight!==void 0){r.minimumHeight=m.minimumHeight,r.maximumHeight=m.maximumHeight;break}else if(b!==void 0&&b._minimumHeight!==void 0&&b._maximumHeight!==void 0){r.minimumHeight=b._minimumHeight,r.maximumHeight=b._maximumHeight;break}}_=_.parent}u=_}if(u!==void 0){const _=n.verticalExaggeration,g=n.verticalExaggerationRelativeHeight;if(_!==1&&(l=!1,r.minimumHeight=oa.getHeight(r.minimumHeight,_,g),r.maximumHeight=oa.getHeight(r.maximumHeight,_,g)),l)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Ct.clone(h.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=se.clone(h.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=d.clone(h.occludeePointInScaledSpace,i.occludeePointInScaledSpace),c(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=qB(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{const b=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||b)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=qB(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=u,i.boundingVolumeIsFromMesh=l}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}Pi.prototype.isDestroyed=function(){return!1};Pi.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),this._removeLayerAddedListener=this._removeLayerAddedListener&&this._removeLayerAddedListener(),this._removeLayerRemovedListener=this._removeLayerRemovedListener&&this._removeLayerRemovedListener(),this._removeLayerMovedListener=this._removeLayerMovedListener&&this._removeLayerMovedListener(),this._removeLayerShownListener=this._removeLayerShownListener&&this._removeLayerShownListener(),ve(this)};function INe(e,t,n){return function(i){let o,r,s=-1;const a=i.data.imagery,l=a.length;let u;for(u=0;u<l;++u)if(o=a[u],r=y(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=u;break}if(s!==-1){const h=s+e;if(o=a[h],r=c(o)?y(o.readyImagery,o.loadingImagery):void 0,!c(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,h);for(u=s;u<h;++u)a[u].freeResources();a.splice(s,e)}return!0}}Pi.prototype._onLayerAdded=function(e,t){if(!this.isDestroyed()&&e.show){const n=this._terrainProvider,i=this,o=this._imageryLayersUpdatedEvent,r=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(c(s._loadedCallbacks[e._layerIndex]))return;let a;const l=s.data.imagery,u=l.length;let h=-1,f=0;for(a=0;a<u;++a){const g=l[a];if(y(g.readyImagery,g.loadingImagery).imageryLayer===e)h===-1&&(h=a),++f;else if(h!==-1)break}if(h===-1)return;const _=h+f;e._createTileImagerySkeletons(s,n,_)&&(s._loadedCallbacks[e._layerIndex]=INe(f,e,n),s.state=Mc.LOADING)})};if(e.ready){const s=e.imageryProvider;s._reload=r}this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=Mc.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==Tn.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,o.raiseEvent()}};Pi.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(n){const i=n.data.imagery;let o=-1,r=0;for(let s=0,a=i.length;s<a;++s){const l=i[s];let u=l.loadingImagery;if(c(u)||(u=l.readyImagery),u.imageryLayer===e)o===-1&&(o=s),l.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),c(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};Pi.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};Pi.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const DNe=new L,PNe=new L;function YB(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_atmosphereLightIntensity:function(){return this.properties.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return this.properties.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return this.properties.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return this.properties.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return this.properties.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return this.properties.atmosphereMieAnisotropy},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_verticalExaggerationAndRelativeHeight:function(){return this.properties.verticalExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const i=e.context.uniformState.view,o=L.multiplyByPoint(i,this.properties.rtc,WB);return L.setTranslation(i,o,jB),jB},u_modifiedModelViewProjection:function(){const i=e.context.uniformState.view,o=e.context.uniformState.projection,r=L.multiplyByPoint(i,this.properties.rtc,WB);return L.setTranslation(i,r,nA),L.multiply(o,nA,nA),nA},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 i=t._clippingPlanes;return c(i)&&c(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const i=t._clippingPlanes,o=c(i)?L.multiply(e.context.uniformState.view,i.modelMatrix,DNe):L.IDENTITY;return L.inverseTranspose(o,PNe)},u_clippingPlanesEdgeStyle:function(){const i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},u_clippingDistance:function(){const i=t._clippingPolygons.clippingTexture;return c(i)?i:e.context.defaultTexture},u_clippingExtents:function(){const i=t._clippingPolygons.extentsTexture;return c(i)?i:e.context.defaultTexture},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},u_vertexShadowDarkness:function(){return this.properties.vertexShadowDarkness},properties:{initialColor:new te(0,0,.5,1),fillHighlightColor:new z(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new H(65e5,9e6),nightFadeDistance:new H(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new d(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new d(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new d,center3D:void 0,rtc:new d,modifiedModelView:new L,tileRectangle:new te,verticalExaggerationAndRelativeHeight:new H(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new H,southMercatorYAndOneOverHeight:new H,waterMask:void 0,waterMaskTranslationAndScale:new te,minMaxHeight:new H,scaleAndBias:new L,clippingPlanesEdgeColor:z.clone(z.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new te,frontFaceAlphaByDistance:new te,backFaceAlphaByDistance:new te,localizedTranslucencyRectangle:new te,undergroundColor:z.clone(z.TRANSPARENT),undergroundColorAlphaByDistance:new te,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return c(t.materialUniformMap)?jt(n,t.materialUniformMap):n}function ONe(e,t,n){const i=n.data;let o,r;if(c(i.vertexArray)?(o=i.mesh,r=i.vertexArray):c(i.fill)&&c(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!c(o)||!c(r))){if(c(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=LNe(e,r,o),i.wireframeVertexArray.mesh=o}}function LNe(e,t,n){const o={indices:n.indices,primitiveType:ze.TRIANGLES};ti.toWireframe(o);const r=o.indices,s=ct.createIndexBuffer({context:e,typedArray:r,usage:ke.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new Ci({context:e,attributes:t._attributes,indexBuffer:s})}let X9,Q9,ox;(function(){const e=new Gt({geometry:Na.fromDimensions({dimensions:new d(2,2,2)})}),t=new Gt({geometry:new Fh({radius:1})});let n=new L,i,o;function r(s){return new Mt({geometryInstances:s,appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})}X9=function(s,a){return s===i||(ox(),i=s,n=L.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=$t.fromColor(a),o=r(e)),o},Q9=function(s,a){return s===i||(ox(),i=s,n=L.fromTranslation(s.center,n),n=L.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=$t.fromColor(a),o=r(t)),o},ox=function(){c(o)&&(o.destroy(),o=void 0,i=void 0)}})();const RNe=new te(0,0,0,0),NNe={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,enableClippingPolygons:void 0,clippingPolygons:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},MNe=z.TRANSPARENT,FNe=new vt;function BNe(e,t,n){const i=t.data;c(i.vertexArray)||(i.fill===void 0&&(i.fill=new Gp(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(c(r)&&c(r.credits)){const ot=r.credits;for(let at=0,Xt=ot.length;at<Xt;++at)o.addCreditToNextFrame(ot[at])}let s=pt.maximumTextureImageUnits,a=i.waterMaskTexture,l=i.waterMaskTranslationAndScale;!c(a)&&c(i.fill)&&(a=i.fill.waterMaskTexture,l=i.fill.waterMaskTranslationAndScale);const u=n.cameraUnderground,h=n.globeTranslucencyState,f=h.translucent,_=h.frontFaceAlphaByDistance,g=h.backFaceAlphaByDistance,m=h.rectangle,b=y(e.undergroundColor,MNe),T=y(e.undergroundColorAlphaByDistance,FNe),x=$9(e,n)&&n.mode===oe.SCENE3D&&b.alpha>0&&(T.nearValue>0||T.farValue>0),C=e.lambertDiffuseMultiplier,w=e.vertexShadowDarkness,v=e.hasWaterMask&&c(a),P=e.oceanNormalMap,N=v&&c(P),k=e.terrainProvider,M=c(k)&&e.terrainProvider.hasVertexNormals,U=n.fog.enabled&&n.fog.renderable&&!u,B=e.showGroundAtmosphere&&n.mode===oe.SCENE3D,S=Vi.castShadows(e.shadows)&&!f,D=Vi.receiveShadows(e.shadows)&&!f,p=e.hueShift,I=e.saturationShift,O=e.brightnessShift;let F=!(R.equalsEpsilon(p,0,R.EPSILON7)&&R.equalsEpsilon(I,0,R.EPSILON7)&&R.equalsEpsilon(O,0,R.EPSILON7)),V=!1;if(B){const ot=d.magnitude(n.camera.positionWC),at=e.nightFadeOutDistance;V=ot>at}v&&--s,N&&--s,c(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,c(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,c(e.clippingPolygons)&&e.clippingPolygons.enabled&&(--s,--s),s-=h.numberOfTextureUniforms;const G=i.renderedMesh;let j=G.center;const W=G.encoding,X=i.tileBoundingRegion,q=n.verticalExaggeration,ee=n.verticalExaggerationRelativeHeight,Y=q!==1,ne=W.hasGeodeticSurfaceNormals,Q=TNe;let le=0,pe=0,re=0,de=0,fe=!1;if(n.mode!==oe.SCENE3D){const ot=n.mapProjection,at=ot.project(ce.southwest(t.rectangle),ENe),Xt=ot.project(ce.northeast(t.rectangle),wNe);if(Q.x=at.x,Q.y=at.y,Q.z=Xt.x,Q.w=Xt.y,n.mode!==oe.MORPHING&&(j=CNe,j.x=0,j.y=(Q.z+Q.x)*.5,j.z=(Q.w+Q.y)*.5,Q.x-=j.y,Q.y-=j.z,Q.z-=j.y,Q.w-=j.z),n.mode===oe.SCENE2D&&W.quantization===Pa.BITS12){const it=1/(Math.pow(2,12)-1)*.5,fi=(Q.z-Q.x)*it,Hi=(Q.w-Q.y)*it;Q.x-=fi,Q.y-=Hi,Q.z+=fi,Q.w+=Hi}ot instanceof vn&&(le=t.rectangle.south,pe=t.rectangle.north,re=vn.geodeticLatitudeToMercatorAngle(le),de=1/(vn.geodeticLatitudeToMercatorAngle(pe)-re),fe=!0)}const ye=NNe;ye.frameState=n,ye.surfaceTile=i,ye.showReflectiveOcean=v,ye.showOceanWaves=N,ye.enableLighting=e.enableLighting,ye.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,ye.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,ye.showGroundAtmosphere=B,ye.atmosphereLightIntensity=e.atmosphereLightIntensity,ye.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,ye.atmosphereMieCoefficient=e.atmosphereMieCoefficient,ye.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,ye.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,ye.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,ye.perFragmentGroundAtmosphere=V,ye.hasVertexNormals=M,ye.useWebMercatorProjection=fe,ye.clippedByBoundaries=i.clippedByBoundaries,ye.hasGeodeticSurfaceNormals=ne,ye.hasExaggeration=Y;const Ce=i.imagery;let we=0;const Pe=Ce.length,lt=e.showSkirts&&!u&&!f,ft=e.backFaceCulling&&!u&&!f,We=ft?e._renderState:e._disableCullingRenderState,Fe=ft?e._blendRenderState:e._disableCullingBlendRenderState;let Dt=We,st=e._firstPassInitialColor;const et=n.context;if(c(e._debug.boundingSphereTile)||ox(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const ot=e._drawCommands.length;for(let at=0;at<ot;++at)e._uniformMaps[at]=YB(n,e)}do{let ot=0,at,Xt;if(e._drawCommands.length<=e._usedDrawCommands?(at=new Ze,at.owner=t,at.cull=!1,at.boundingVolume=new se,at.orientedBoundingBox=void 0,Xt=YB(n,e),e._drawCommands.push(at),e._uniformMaps.push(Xt)):(at=e._drawCommands[e._usedDrawCommands],Xt=e._uniformMaps[e._usedDrawCommands]),at.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const Lr=X.boundingVolume,Xr=X.boundingSphere;c(Lr)?X9(Lr,z.RED).update(n):c(Xr)&&Q9(Xr,z.RED).update(n)}const it=Xt.properties;te.clone(st,it.initialColor),it.oceanNormalMap=P,it.lightingFadeDistance.x=e.lightingFadeOutDistance,it.lightingFadeDistance.y=e.lightingFadeInDistance,it.nightFadeDistance.x=e.nightFadeOutDistance,it.nightFadeDistance.y=e.nightFadeInDistance,it.atmosphereLightIntensity=e.atmosphereLightIntensity,it.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,it.atmosphereMieCoefficient=e.atmosphereMieCoefficient,it.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,it.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,it.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,it.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const fi=u?g:_,Hi=u?_:g;c(fi)&&(te.fromElements(fi.near,fi.nearValue,fi.far,fi.farValue,it.frontFaceAlphaByDistance),te.fromElements(Hi.near,Hi.nearValue,Hi.far,Hi.farValue,it.backFaceAlphaByDistance)),te.fromElements(T.near,T.nearValue,T.far,T.farValue,it.undergroundColorAlphaByDistance),z.clone(b,it.undergroundColor),it.lambertDiffuseMultiplier=C,it.vertexShadowDarkness=w;const Ss=!c(i.vertexArray)&&c(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Ss&&z.clone(e.fillHighlightColor,it.fillHighlightColor),it.verticalExaggerationAndRelativeHeight.x=q,it.verticalExaggerationAndRelativeHeight.y=ee,it.center3D=G.center,d.clone(j,it.rtc),te.clone(Q,it.tileRectangle),it.southAndNorthLatitude.x=le,it.southAndNorthLatitude.y=pe,it.southMercatorYAndOneOverHeight.x=re,it.southMercatorYAndOneOverHeight.y=de;const Qo=ANe,No=ix(t.rectangle,e.cartographicLimitRectangle),Gi=xNe,Ni=ix(t.rectangle,m);d.fromElements(p,I,O,it.hsbShift);const wi=t.rectangle,$r=1/wi.width,zn=1/wi.height;Qo.x=(No.west-wi.west)*$r,Qo.y=(No.south-wi.south)*zn,Qo.z=(No.east-wi.west)*$r,Qo.w=(No.north-wi.south)*zn,te.clone(Qo,it.localizedCartographicLimitRectangle),Gi.x=(Ni.west-wi.west)*$r,Gi.y=(Ni.south-wi.south)*zn,Gi.z=(Ni.east-wi.west)*$r,Gi.w=(Ni.north-wi.south)*zn,te.clone(Gi,it.localizedTranslucencyRectangle);const ci=U&&R.fog(t._distance,n.fog.density)>R.EPSILON3;F=F&&(ci||B);let Si=!1,Ko=!1,ri=!1,fr=!1,ha=!1,fa=!1,So=!1,Ln=!1,Zo=!1,ho=!1;for(;ot<s&&we<Pe;){const Lr=Ce[we],Xr=Lr.readyImagery;if(++we,!c(Xr)||Xr.imageryLayer.alpha===0)continue;const Jp=Lr.useWebMercatorT?Xr.textureWebMercator:Xr.texture;if(!c(Jp))throw new E("readyImagery is not actually ready!");const Jn=Xr.imageryLayer;c(Lr.textureTranslationAndScale)||(Lr.textureTranslationAndScale=Jn._calculateTextureTranslationAndScale(t,Lr)),it.dayTextures[ot]=Jp,it.dayTextureTranslationAndScale[ot]=Lr.textureTranslationAndScale,it.dayTextureTexCoordsRectangle[ot]=Lr.textureCoordinateRectangle,it.dayTextureUseWebMercatorT[ot]=Lr.useWebMercatorT,it.dayTextureAlpha[ot]=Jn.alpha,fa=fa||it.dayTextureAlpha[ot]!==1,it.dayTextureNightAlpha[ot]=Jn.nightAlpha,So=So||it.dayTextureNightAlpha[ot]!==1,it.dayTextureDayAlpha[ot]=Jn.dayAlpha,So=So||it.dayTextureDayAlpha[ot]!==1,it.dayTextureBrightness[ot]=Jn.brightness,Si=Si||it.dayTextureBrightness[ot]!==Qt.DEFAULT_BRIGHTNESS,it.dayTextureContrast[ot]=Jn.contrast,Ko=Ko||it.dayTextureContrast[ot]!==Qt.DEFAULT_CONTRAST,it.dayTextureHue[ot]=Jn.hue,ri=ri||it.dayTextureHue[ot]!==Qt.DEFAULT_HUE,it.dayTextureSaturation[ot]=Jn.saturation,fr=fr||it.dayTextureSaturation[ot]!==Qt.DEFAULT_SATURATION,it.dayTextureOneOverGamma[ot]=1/Jn.gamma,ha=ha||it.dayTextureOneOverGamma[ot]!==1/Qt.DEFAULT_GAMMA,it.dayTextureSplit[ot]=Jn.splitDirection,Ln=Ln||it.dayTextureSplit[ot]!==0;let qa=it.dayTextureCutoutRectangles[ot];if(c(qa)||(qa=it.dayTextureCutoutRectangles[ot]=new te),te.clone(te.ZERO,qa),c(Jn.cutoutRectangle)){const fo=ix(wi,Jn.cutoutRectangle),Mo=ce.simpleIntersection(fo,wi,Y9);Zo=c(Mo)||Zo,qa.x=(fo.west-wi.west)*$r,qa.y=(fo.south-wi.south)*zn,qa.z=(fo.east-wi.west)*$r,qa.w=(fo.north-wi.south)*zn}let Ya=it.colorsToAlpha[ot];c(Ya)||(Ya=it.colorsToAlpha[ot]=new te);const lf=c(Jn.colorToAlpha)&&Jn.colorToAlphaThreshold>0;if(ho=ho||lf,lf){const fo=Jn.colorToAlpha;Ya.x=fo.red,Ya.y=fo.green,Ya.z=fo.blue,Ya.w=Jn.colorToAlphaThreshold}else Ya.w=-1;if(c(Xr.credits)){const fo=Xr.credits;for(let Mo=0,Et=fo.length;Mo<Et;++Mo)o.addCreditToNextFrame(fo[Mo])}++ot}it.dayTextures.length=ot,it.waterMask=a,te.clone(l,it.waterMaskTranslationAndScale),it.minMaxHeight.x=W.minimumHeight,it.minMaxHeight.y=W.maximumHeight,L.clone(W.matrix,it.scaleAndBias);const qs=e._clippingPlanes,pi=c(qs)&&qs.enabled&&t.isClipped;pi&&(it.clippingPlanesEdgeColor=z.clone(qs.edgeColor,it.clippingPlanesEdgeColor),it.clippingPlanesEdgeWidth=qs.edgeWidth);const ji=e._clippingPolygons,cf=c(ji)&&ji.enabled&&t.isClipped;ye.numberOfDayTextures=ot,ye.applyBrightness=Si,ye.applyContrast=Ko,ye.applyHue=ri,ye.applySaturation=fr,ye.applyGamma=ha,ye.applyAlpha=fa,ye.applyDayNightAlpha=So,ye.applySplit=Ln,ye.enableFog=ci,ye.enableClippingPlanes=pi,ye.clippingPlanes=qs,ye.enableClippingPolygons=cf,ye.clippingPolygons=ji,ye.hasImageryLayerCutout=Zo,ye.colorCorrect=F,ye.highlightFillTile=Ss,ye.colorToAlpha=ho,ye.showUndergroundColor=x,ye.translucent=f;let vi=i.renderedMesh.indices.length;lt||(vi=i.renderedMesh.indexCountWithoutSkirts),at.shaderProgram=e._surfaceShaderSet.getShaderProgram(ye),at.castShadows=S,at.receiveShadows=D,at.renderState=Dt,at.primitiveType=ze.TRIANGLES,at.vertexArray=i.vertexArray||i.fill.vertexArray,at.count=vi,at.uniformMap=Xt,at.pass=xe.GLOBE,e._debug.wireframe&&(ONe(et,e,t),c(i.wireframeVertexArray)&&(at.vertexArray=i.wireframeVertexArray,at.primitiveType=ze.LINES,at.count=vi*2));let pr=at.boundingVolume;const Rd=at.orientedBoundingBox;n.mode!==oe.SCENE3D?(se.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,X.minimumHeight,X.maximumHeight,pr),d.fromElements(pr.center.z,pr.center.x,pr.center.y,pr.center),n.mode===oe.MORPHING&&(pr=se.union(X.boundingSphere,pr,pr))):(at.boundingVolume=se.clone(X.boundingSphere,pr),at.orientedBoundingBox=Ct.clone(X.boundingVolume,Rd)),at.dirty=!0,f&&h.updateDerivedCommands(at,n),q9(at,n),Dt=Fe,st=RNe}while(we<Pe)}function K9(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=ce.clone(ce.MAX_VALUE)}Object.defineProperties(K9.prototype,{enabled:{get:function(){return this._enabled},set:function(e){A.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){A.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),A.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=vt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){A.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),A.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._backFaceAlphaByDistance=vt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){c(e)||(e=ce.clone(ce.MAX_VALUE)),ce.clone(e,this._rectangle)}}});function Xo(){this._layers=[],this.layerAdded=new Le,this.layerRemoved=new Le,this.layerMoved=new Le,this.layerShownOrHidden=new Le}Object.defineProperties(Xo.prototype,{length:{get:function(){return this._layers.length}}});Xo.prototype.add=function(e,t){const n=c(t);if(!c(e))throw new E("layer is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._layers.length)throw new E("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t);const i=e.readyEvent.addEventListener(()=>{this.layerShownOrHidden.raiseEvent(e,e._layerIndex,e.show),i()})};Xo.prototype.addImageryProvider=function(e,t){if(!c(e))throw new E("imageryProvider is required.");const n=new Qt(e);return this.add(n,t),n};Xo.prototype.remove=function(e,t){t=y(t,!0);const n=this._layers.indexOf(e);return n!==-1?(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0):!1};Xo.prototype.removeAll=function(e){e=y(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.layerRemoved.raiseEvent(o,n),e&&o.destroy()}this._layers=[]};Xo.prototype.contains=function(e){return this.indexOf(e)!==-1};Xo.prototype.indexOf=function(e){return this._layers.indexOf(e)};Xo.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._layers[e]};function JC(e,t){if(!c(t))throw new E("layer is required.");const n=e.indexOf(t);if(n===-1)throw new E("layer is not in this collection.");return n}function Z9(e,t,n){const i=e._layers;if(t=R.clamp(t,0,i.length-1),n=R.clamp(n,0,i.length-1),t===n)return;const o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}Xo.prototype.raise=function(e){const t=JC(this._layers,e);Z9(this,t,t+1)};Xo.prototype.lower=function(e){const t=JC(this._layers,e);Z9(this,t,t-1)};Xo.prototype.raiseToTop=function(e){const t=JC(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))};Xo.prototype.lowerToBottom=function(e){const t=JC(this._layers,e);t!==0&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const zNe=new ce;function J9(e,t,n,i){const o=e.globe._surface._tilesToRender;let r;for(let a=0;!c(r)&&a<o.length;++a){const l=o[a];ce.contains(l.rectangle,t)&&(r=l)}if(!c(r))return;const s=r.data.imagery;for(let a=s.length-1;a>=0;--a){const l=s[a],u=l.readyImagery;if(!c(u)||!u.imageryLayer.ready)continue;const h=u.imageryLayer.imageryProvider;if(n&&!c(h.pickFeatures)||!ce.contains(u.rectangle,t))continue;const f=zNe,_=1/1024;f.west=R.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.x-_),f.east=R.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.z+_),f.south=R.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.y-_),f.north=R.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.w+_),ce.contains(f,t)&&i(u)}}Xo.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!c(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];if(J9(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};Xo.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!c(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(J9(t,i,!0,function(s){if(!s.imageryLayer.ready)return;const l=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);c(l)&&(o.push(l),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){const a=[];for(let l=0;l<s.length;++l){const u=s[l],h=r[l];if(c(u)&&u.length>0)for(let f=0;f<u.length;++f){const _=u[f];_.imageryLayer=h,c(_.position)||(_.position=i),a.push(_)}}return a})};Xo.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};Xo.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};Xo.prototype.isDestroyed=function(){return!1};Xo.prototype.destroy=function(){return this.removeAll(!0),ve(this)};Xo.prototype._update=function(){let e=!0;const t=this._layers;let n,i,o,r;for(o=0,r=t.length;o<r;++o)i=t[o],i._layerIndex=o,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(c(i._show)&&(c(n)||(n=[]),n.push(i)),i._show=i.show);if(c(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};function eW(e){this._ellipsoid=new Vc(e.ellipsoid,d.ZERO)}Object.defineProperties(eW.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});function Ms(e){if(!c(e))throw new E("options is required.");if(c(e.x))if(c(e.y)){if(e.x<0||e.y<0)throw new E("options.x and options.y must be greater than or equal to zero.")}else throw new E("options.y is required.");else throw new E("options.x is required.");if(!c(e.level))throw new E("options.level is required and must be greater than or equal to zero.");if(!c(e.tilingScheme))throw new E("options.tilingScheme is required.");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=Tn.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=Mc.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}Ms.createLevelZeroTiles=function(e){if(!c(e))throw new E("tilingScheme is required.");const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let o=0;for(let r=0;r<n;++r)for(let s=0;s<t;++s)i[o++]=new Ms({tilingScheme:e,x:s,y:r,level:0});return i};Ms.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(c(t)&&c(n)){for(i=i.filter(function(a){return n.indexOf(a)===-1}),this._customData=i,s=this._rectangle,o=0;o<t.length;++o)r=t[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=e}else{const a=this._parent;if(c(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;const l=a.customData;for(o=0;o<l.length;++o)r=l[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(Ms.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 c(this._southwestChild)||(this._southwestChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return c(this._southeastChild)||(this._southeastChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return c(this._northwestChild)||(this._northwestChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return c(this._northeastChild)||(this._northeastChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<Mc.DONE}},eligibleForUnloading:{get:function(){let e=!0;return c(this.data)&&(e=this.data.eligibleForUnloading,c(e)||(e=!0)),e}}});Ms.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(o){return o.x===t&&o.y===n})[0]};Ms.prototype.findTileToWest=function(e){const t=this.parent;if(t===void 0)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);if(n!==void 0)return t.southwestChild===this?n.southeastChild:n.northeastChild};Ms.prototype.findTileToEast=function(e){const t=this.parent;if(t===void 0)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);if(n!==void 0)return t.southeastChild===this?n.southwestChild:n.northwestChild};Ms.prototype.findTileToSouth=function(e){const t=this.parent;if(t===void 0)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);if(n!==void 0)return t.southwestChild===this?n.northwestChild:n.northeastChild};Ms.prototype.findTileToNorth=function(e){const t=this.parent;if(t===void 0)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);if(n!==void 0)return t.northwestChild===this?n.southwestChild:n.southeastChild};Ms.prototype.freeResources=function(){this.state=Mc.START,this.renderable=!1,this.upsampledFromParent=!1,c(this.data)&&c(this.data.freeResources)&&this.data.freeResources(),iA(this._southwestChild),this._southwestChild=void 0,iA(this._southeastChild),this._southeastChild=void 0,iA(this._northwestChild),this._northwestChild=void 0,iA(this._northeastChild),this._northeastChild=void 0};function iA(e){c(e)&&e.freeResources()}function eE(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}eE.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};eE.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&c(this._lastBeforeStartOfFrame)&&this.count>e&&c(t);){n=t!==this._lastBeforeStartOfFrame;const i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),tW(this,t)),t=i}};function tW(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}eE.prototype.markTileRendered=function(e){const t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!c(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(c(e.replacementPrevious)||c(e.replacementNext))&&tW(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};function Gc(e){if(!c(e)||!c(e.tileProvider))throw new E("options.tileProvider is required.");if(c(e.tileProvider.quadtree))throw new E("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");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 n=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new eE,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=y(e.maximumScreenSpaceError,2),this.tileCacheSize=y(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new eW({ellipsoid:n}),this._tileLoadProgressEvent=new Le,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(Gc.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});Gc.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function UNe(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,nW(e);const n=e._levelZeroTiles;if(c(n))for(let i=0;i<n.length;++i){const r=n[i].customData,s=r.length;for(let a=0;a<s;++a){const l=r[a];l.level=0,e._addHeightCallbacks.push(l)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}Gc.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;c(t);)t.state!==Mc.START&&e(t),t=t.replacementNext};Gc.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};Gc.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t};return i.removeFunc=function(){const o=n._addHeightCallbacks,r=o.length;for(let s=0;s<r;++s)if(o[s]===i){o.splice(s,1);break}n._removeHeightCallbacks.push(i),i.callback&&(i.callback=void 0)},n._addHeightCallbacks.push(i),i.removeFunc};Gc.prototype.update=function(e){c(this._tileProvider.update)&&this._tileProvider.update(e)};function nW(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}Gc.prototype.beginFrame=function(e){!e.passes.render||(this._tilesInvalidated&&(UNe(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),nW(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};Gc.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),GNe(this,e),JNe(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function kNe(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const o=Le.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push(()=>(o(),!0)),e._lastTileLoadQueueLength=n}const i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce(function(o,r){return Math.max(o,r.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))}Gc.prototype.endFrame=function(e){!e.passes.render||e.mode===oe.MORPHING||(XNe(this,e),ZNe(this,e),kNe(this,e))};Gc.prototype.isDestroyed=function(){return!1};Gc.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};let gy;const $B=new he;function VNe(e,t){let n=ce.center(e.rectangle,$B);const i=n.longitude-gy.longitude,o=n.latitude-gy.latitude;n=ce.center(t.rectangle,$B);const r=n.longitude-gy.longitude,s=n.latitude-gy.latitude;return i*i+o*o-(r*r+s*s)}const HNe=new d;let ey=[];function GNe(e,t){const n=e._debug;if(n.suspendLodUpdate)return;const i=e._tilesToRender;i.length=0;let o;const r=e._tileProvider;if(!c(e._levelZeroTiles)){const b=r.tilingScheme;if(c(b)){const T=r.tilingScheme;e._levelZeroTiles=Ms.createLevelZeroTiles(T);const x=e._levelZeroTiles.length;if(ey.length<x)for(ey=new Array(x),o=0;o<x;++o)ey[o]===void 0&&(ey[o]=new yy)}else return}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s;const a=e._levelZeroTiles,l=a.length>1?e._occluders:void 0;gy=t.camera.positionCartographic,a.sort(VNe);const u=e._addHeightCallbacks,h=e._removeHeightCallbacks,f=t.frameNumber;let _;if(u.length>0||h.length>0){for(o=0,_=a.length;o<_;++o)s=a[o],s._updateCustomData(f,u,h);u.length=0,h.length=0}const g=t.camera;e._cameraPositionCartographic=g.positionCartographic;const m=L.getTranslation(g.transform,HNe);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),o=0,_=a.length;o<_;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?Nr(e,s,r,t,l,!1,ey[o]):(Vu(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=f}function Vu(e,t,n,i){!n.needsLoading||(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function yy(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function iW(){this.southwest=new yy,this.southeast=new yy,this.northwest=new yy,this.northeast=new yy}iW.prototype.combine=function(e){const t=this.southwest,n=this.southeast,i=this.northwest,o=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&o.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||o.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+o.notYetRenderableCount};const BD=new Array(31);for(let e=0;e<BD.length;++e)BD[e]=new iW;function jNe(e,t,n,i,o){const r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);const s=YNe(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,l=n.southeastChild,u=n.northwestChild,h=n.northeastChild,f=e._lastSelectionFrameNumber,_=n._lastSelectionResultFrame===f?n._lastSelectionResult:Tn.NONE,g=e.tileProvider;if(s||i){const m=Tn.originalResult(_)===Tn.RENDERED,b=Tn.originalResult(_)===Tn.CULLED||_===Tn.NONE,T=n.state===Mc.DONE;let x=m||b||T;if(x||c(g.canRenderWithoutLosingDetail)&&(x=g.canRenderWithoutLosingDetail(n)),x){s&&Vu(e,e._tileLoadQueueMedium,n,t),oA(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&Vu(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent&&h.upsampledFromParent){oA(e,n),Vu(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(h),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.REFINED;const b=e._tilesToRender.length,T=e._tileLoadQueueLow.length,x=e._tileLoadQueueMedium.length,C=e._tileLoadQueueHigh.length,w=e._tileToUpdateHeights.length;if(WNe(e,a,l,u,h,t,i,o),b!==e._tilesToRender.length){const v=o.allAreRenderable,P=o.anyWereRenderedLastFrame,N=o.notYetRenderableCount;let k=!1;if(!v&&!P){const M=e._tilesToRender;for(let B=b;B<M.length;++B){let S=M[B];for(;S!==void 0&&S._lastSelectionResult!==Tn.KICKED&&S!==n;)S._lastSelectionResult=Tn.kick(S._lastSelectionResult),S=S.parent}e._tilesToRender.length=b,e._tileToUpdateHeights.length=w,oA(e,n),n._lastSelectionResult=Tn.RENDERED;const U=_===Tn.RENDERED;!U&&N>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=T,e._tileLoadQueueMedium.length=x,e._tileLoadQueueHigh.length=C,Vu(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,k=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=U,U||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!k&&Vu(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,oA(e,n),Vu(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function WNe(e,t,n,i,o,r,s,a){const l=r.camera.positionCartographic,u=e._tileProvider,h=e._occluders,f=BD[t.level],_=f.southwest,g=f.southeast,m=f.northwest,b=f.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(Nr(e,t,u,r,h,s,_),Nr(e,n,u,r,h,s,g),Nr(e,i,u,r,h,s,m),Nr(e,o,u,r,h,s,b)):(Nr(e,i,u,r,h,s,m),Nr(e,t,u,r,h,s,_),Nr(e,o,u,r,h,s,b),Nr(e,n,u,r,h,s,g)):l.latitude<t.rectangle.north?(Nr(e,n,u,r,h,s,g),Nr(e,t,u,r,h,s,_),Nr(e,o,u,r,h,s,b),Nr(e,i,u,r,h,s,m)):(Nr(e,o,u,r,h,s,b),Nr(e,i,u,r,h,s,m),Nr(e,n,u,r,h,s,g),Nr(e,t,u,r,h,s,_)),f.combine(a)}function qNe(e,t){const n=t.rectangle;return c(e._cameraPositionCartographic)&&ce.contains(n,e._cameraPositionCartographic)||c(e._cameraReferenceFrameOriginCartographic)&&ce.contains(n,e._cameraReferenceFrameOriginCartographic)}function Nr(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==ir.NONE)return jNe(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,qNe(e,t)){(!c(t.data)||!c(t.data.vertexArray))&&Vu(e,e._tileLoadQueueMedium,t,i);const a=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===a?t._lastSelectionResult:Tn.NONE;l!==Tn.CULLED_BUT_NEEDED&&l!==Tn.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=Tn.CULLED_BUT_NEEDED}else(e.preloadSiblings||t.level===0)&&Vu(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=Tn.CULLED;t._lastSelectionResultFrame=i.frameNumber}function YNe(e,t,n){if(t.mode===oe.SCENE2D||t.camera.frustum instanceof It||t.camera.frustum instanceof Ki)return $Ne(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator;let a=i*r/(o*s);return t.fog.enabled&&(a-=R.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function $Ne(e,t,n){let o=t.camera.frustum;const r=o.offCenterFrustum;c(r)&&(o=r);const s=t.context,a=s.drawingBufferWidth,l=s.drawingBufferHeight,u=e._tileProvider.getLevelMaximumGeometricError(n.level),h=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(a,l);let f=u/h;return t.fog.enabled&&t.mode!==oe.SCENE2D&&(f-=R.fog(n._distance,t.fog.density)*t.fog.sse),f/=t.pixelRatio,f}function oA(e,t){e._tilesToRender.push(t)}function XNe(e,t){const n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,o=e._tileLoadQueueLow;if(n.length===0&&i.length===0&&o.length===0)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const r=xo()+e._loadQueueTimeSlice,s=e._tileProvider;let a=_v(e,t,s,r,n,!1);a=_v(e,t,s,r,i,a),_v(e,t,s,r,o,a)}function QNe(e,t){return e._loadPriority-t._loadPriority}function _v(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(QNe);for(let s=0,a=o.length;s<a&&(xo()<i||!r);++s){const l=o[s];e._tileReplacementQueue.markTileRendered(l),n.loadTile(t,l),r=!0}return r}const Sm=new nn,gv=new he,Xd=new d,KNe=[];function ZNe(e,t){if(!c(e.tileProvider.tilingScheme))return;const n=KNe;n.length=0;const i=e._tileToUpdateHeights,o=xo(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,l=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid;let h;for(;i.length>0;){const f=i[0];if(!c(f.data)||!c(f.data.mesh)){const b=f._lastSelectionResultFrame===e._lastSelectionFrameNumber?f._lastSelectionResult:Tn.NONE;(b===Tn.RENDERED||b===Tn.CULLED_BUT_NEEDED)&&n.push(f),i.shift(),e._lastTileIndex=0;continue}const _=f.customData,g=_.length;let m=!1;for(h=e._lastTileIndex;h<g;++h){const b=_[h],T=f.data.terrainData,x=c(T)&&T.wasCreatedByUpsampling();if(f.level>b.level&&!x){if(c(b.positionOnEllipsoidSurface)||(b.positionOnEllipsoidSurface=d.fromRadians(b.positionCartographic.longitude,b.positionCartographic.latitude,0,u)),a===oe.SCENE3D){const w=u.geodeticSurfaceNormal(b.positionOnEllipsoidSurface,Sm.direction),v=u.getSurfaceNormalIntersectionWithZAxis(b.positionOnEllipsoidSurface,11500,Sm.origin);if(!c(v)){let P=0;c(f.data.tileBoundingRegion)&&(P=f.data.tileBoundingRegion.minimumHeight);const N=Math.min(P,-11500),k=d.multiplyByScalar(w,Math.abs(N)+1,Xd);d.subtract(b.positionOnEllipsoidSurface,k,Sm.origin)}}else he.clone(b.positionCartographic,gv),gv.height=-11500,l.project(gv,Xd),d.fromElements(Xd.z,Xd.x,Xd.y,Xd),d.clone(Xd,Sm.origin),d.clone(d.UNIT_X,Sm.direction);const C=f.data.pick(Sm,a,l,!1,Xd);c(C)&&(c(b.callback)&&b.callback(C),b.level=f.level)}if(xo()>=s){m=!0;break}}if(m){e._lastTileIndex=h;break}else e._lastTileIndex=0,i.shift()}for(h=0;h<n.length;h++)i.push(n[h])}function JNe(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){const s=i[o];n.showTileThisFrame(s,t)}}function Ul(e){e=y(e,ae.WGS84);const t=new _d({ellipsoid:e}),n=new Xo;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new m1,this._material=void 0,this._surface=new Gc({tileProvider:new Pi({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Le,this._undergroundColor=z.clone(z.BLACK),this._undergroundColorAlphaByDistance=new vt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new K9,zD(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Ae({url:Zt("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.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=Vi.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}Object.defineProperties(Ul.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 c(this._surface)?this._surface._tileLoadQueueHigh.length===0&&this._surface._tileLoadQueueMedium.length===0&&this._surface._tileLoadQueueLow.length===0:!0}},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}},clippingPolygons:{get:function(){return this._surface.tileProvider.clippingPolygons},set:function(e){this._surface.tileProvider.clippingPolygons=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){c(e)||(e=ce.clone(ce.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),c(this._material)&&zD(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,zD(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=z.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=vt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function zD(e){const t=[],n=c(e._material)&&(c(e._material.shaderSource.match(/slope/))||c(e._material.shaderSource.match("normalEC"))),i=[tC,DB];c(e._material)&&(!n||e._terrainProvider.requestVertexNormals)?(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms):e._surface._tileProvider.materialUniformMap=void 0,i.push(R1e),e._surfaceShaderSet.baseVertexShaderSource=new Oe({sources:[tC,DB,N1e],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new Oe({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function eMe(e){return function(t,n){const i=se.distanceSquaredTo(t.pickBoundingSphere,e),o=se.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}const tMe=[],nMe={start:0,stop:0};Ul.prototype.pickWorldCoordinates=function(e,t,n,i){if(!c(e))throw new E("ray is required");if(!c(t))throw new E("scene is required");n=y(n,!0);const o=t.mode,r=t.mapProjection,s=tMe;s.length=0;const a=this._surface._tilesToRender;let l=a.length,u,h;for(h=0;h<l;++h){u=a[h];const _=u.data;if(!c(_))continue;let g=_.pickBoundingSphere;if(o!==oe.SCENE3D)_.pickBoundingSphere=g=se.fromRectangleWithHeights2D(u.rectangle,r,_.tileBoundingRegion.minimumHeight,_.tileBoundingRegion.maximumHeight,g),d.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(c(_.renderedMesh))se.clone(_.tileBoundingRegion.boundingSphere,g);else continue;const m=Ei.raySphere(e,g,nMe);c(m)&&s.push(_)}s.sort(eMe(e.origin));let f;for(l=s.length,h=0;h<l&&(f=s[h].pick(e,t.mode,t.mapProjection,n,i),!c(f));++h);return f};const iMe=new he;Ul.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),c(n)&&t.mode!==oe.SCENE3D){n=d.fromElements(n.y,n.z,n.x,n);const i=t.mapProjection.unproject(n,iMe);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};const oMe=new d,XB=new d,rMe=new he,sMe=new nn;function yv(e,t){return c(e)&&ce.contains(e.rectangle,t)?e:void 0}Ul.prototype.getHeight=function(e){if(!c(e))throw new E("cartographic is required");const t=this._surface._levelZeroTiles;if(!c(t))return;let n,i;const o=t.length;for(i=0;i<o&&(n=t[i],!ce.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;c(n);)n=yv(n._southwestChild,e)||yv(n._southeastChild,e)||yv(n._northwestChild,e)||n._northeastChild,c(n)&&c(n.data)&&c(n.data.renderedMesh)&&(r=n);if(n=r,!c(n)||!c(n.data)||!c(n.data.renderedMesh))return;const s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,l=d.fromRadians(e.longitude,e.latitude,0,a,oMe),u=sMe,h=a.geodeticSurfaceNormal(l,u.direction),f=a.getSurfaceNormalIntersectionWithZAxis(l,11500,u.origin);if(!c(f)){let g;c(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);const m=Math.min(y(g,0),-11500),b=d.multiplyByScalar(h,Math.abs(m)+1,XB);d.subtract(l,b,u.origin)}const _=n.data.pick(u,void 0,s,!1,XB);if(!!c(_))return a.cartesianToCartographic(_,rMe).height};Ul.prototype.update=function(e){!this.show||e.passes.render&&this._surface.update(e)};Ul.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&c(i)&&i.hasWaterMask&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const a=this._oceanNormalMapResource,l=a.url;if(c(l)){const u=this;a.fetchImage().then(function(h){l===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new xt({context:e.context,source:h}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const r=e.passes,s=e.mode;r.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=s===oe.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.atmosphereLightIntensity=this.atmosphereLightIntensity,n.atmosphereRayleighCoefficient=this.atmosphereRayleighCoefficient,n.atmosphereMieCoefficient=this.atmosphereMieCoefficient,n.atmosphereRayleighScaleHeight=this.atmosphereRayleighScaleHeight,n.atmosphereMieScaleHeight=this.atmosphereMieScaleHeight,n.atmosphereMieAnisotropy=this.atmosphereMieAnisotropy,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.vertexShadowDarkness=this.vertexShadowDarkness,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))};Ul.prototype.render=function(e){!this.show||(c(this._material)&&this._material.update(e.context),this._surface.render(e))};Ul.prototype.endFrame=function(e){!this.show||e.passes.render&&this._surface.endFrame(e)};Ul.prototype.isDestroyed=function(){return!1};Ul.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(),ve(this)};function aMe(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}const oW={},cMe=32.184,lMe=2451545,QB=-.0529921,KB=-.1059842,ZB=13.0120009,JB=13.3407154,e3=.9856003,t3=26.4057084,n3=13.064993,i3=.3287146,o3=1.7484877,r3=-.1589763,s3=.0036096,a3=.1643573,c3=12.9590088;let bv=new ie;oW.ComputeMoon=function(e,t){c(e)||(e=ie.now()),bv=ie.addSeconds(e,cMe,bv);const n=ie.totalDays(bv)-lMe,i=n/qn.DAYS_PER_JULIAN_CENTURY,o=(125.045+QB*n)*R.RADIANS_PER_DEGREE,r=(250.089+KB*n)*R.RADIANS_PER_DEGREE,s=(260.008+ZB*n)*R.RADIANS_PER_DEGREE,a=(176.625+JB*n)*R.RADIANS_PER_DEGREE,l=(357.529+e3*n)*R.RADIANS_PER_DEGREE,u=(311.589+t3*n)*R.RADIANS_PER_DEGREE,h=(134.963+n3*n)*R.RADIANS_PER_DEGREE,f=(276.617+i3*n)*R.RADIANS_PER_DEGREE,_=(34.226+o3*n)*R.RADIANS_PER_DEGREE,g=(15.134+r3*n)*R.RADIANS_PER_DEGREE,m=(119.743+s3*n)*R.RADIANS_PER_DEGREE,b=(239.961+a3*n)*R.RADIANS_PER_DEGREE,T=(25.053+c3*n)*R.RADIANS_PER_DEGREE,x=Math.sin(o),C=Math.sin(r),w=Math.sin(s),v=Math.sin(a),P=Math.sin(l),N=Math.sin(u),k=Math.sin(h),M=Math.sin(f),U=Math.sin(_),B=Math.sin(g),S=Math.sin(m),D=Math.sin(b),p=Math.sin(T),I=Math.cos(o),O=Math.cos(r),F=Math.cos(s),V=Math.cos(a),G=Math.cos(l),j=Math.cos(u),W=Math.cos(h),X=Math.cos(f),q=Math.cos(_),ee=Math.cos(g),Y=Math.cos(m),ne=Math.cos(b),Q=Math.cos(T),le=(269.9949+.0031*i-3.8787*x-.1204*C+.07*w-.0172*v+.0072*N-.0052*B+.0043*p)*R.RADIANS_PER_DEGREE,pe=(66.5392+.013*i+1.5419*I+.0239*O-.0278*F+.0068*V-.0029*j+9e-4*W+8e-4*ee-9e-4*Q)*R.RADIANS_PER_DEGREE,re=(38.3213+13.17635815*n-14e-13*n*n+3.561*x+.1208*C-.0642*w+.0158*v+.0252*P-.0066*N-.0047*k-.0046*M+.0028*U+.0052*B+.004*S+.0019*D-.0044*p)*R.RADIANS_PER_DEGREE,de=(13.17635815-14e-13*(2*n)+3.561*I*QB+.1208*O*KB-.0642*F*ZB+.0158*V*JB+.0252*G*e3-.0066*j*t3-.0047*W*n3-.0046*X*i3+.0028*q*o3+.0052*ee*r3+.004*Y*s3+.0019*ne*a3-.0044*Q*c3)/86400*R.RADIANS_PER_DEGREE;return c(t)||(t=new aMe),t.rightAscension=le,t.declination=pe,t.rotation=re,t.rotationRate=de,t};const uMe=oW;function rW(e){(!c(e)||typeof e!="function")&&(e=uMe.ComputeMoon),this._computeFunction=e}const dMe=new d,hMe=new d,fMe=new d;function pMe(e,t,n){const i=dMe;i.x=Math.cos(e+R.PI_OVER_TWO),i.y=Math.sin(e+R.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=fMe;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=d.cross(r,i,hMe);return c(n)||(n=new $),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}const mMe=new $,_Me=new _e;rW.prototype.evaluate=function(e,t){c(e)||(e=ie.now());const n=this._computeFunction(e),i=pMe(n.rightAscension,n.declination,t),o=R.zeroToTwoPi(n.rotation),r=_e.fromAxisAngle(d.UNIT_Z,o,_Me),s=$.fromQuaternion(_e.conjugate(r,r),mMe);return $.multiply(s,i,i)};const UD={position:0};function tE(e){e=y(e,y.EMPTY_OBJECT),this.center=d.clone(y(e.center,d.ZERO)),this._center=new d,this.radii=d.clone(e.radii),this._radii=new d,this._oneOverEllipsoidRadiiSquared=new d,this._boundingSphere=new se,this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=new L,this._computedModelMatrix=new L,this.show=y(e.show,!0),this.material=y(e.material,Se.fromType(Se.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.onlySunLighting=y(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=y(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 Ze({owner:y(e._owner,this)}),this._pickCommand=new Ze({owner:y(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 gMe(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(c(t))return t;const n=rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ee.POSITION_ONLY}));return t=Ci.fromGeometry({context:e,geometry:n,attributeLocations:UD,bufferUsage:ke.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}tE.prototype.update=function(e){if(!this.show||e.mode!==oe.SCENE3D||!c(this.center)||!c(this.radii))return;if(!c(this.material))throw new E("this.material must be defined.");const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!c(this._rs)||i)&&(this._translucent=n,this._rs=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?Zn.ALPHA_BLEND:void 0})),c(this._va)||(this._va=gMe(t));let o=!1;const r=this.radii;if(!d.equals(this._radii,r)){d.clone(r,this._radii);const b=this._oneOverEllipsoidRadiiSquared;b.x=1/(r.x*r.x),b.y=1/(r.y*r.y),b.z=1/(r.z*r.z),o=!0}(!L.equals(this.modelMatrix,this._modelMatrix)||!d.equals(this.center,this._center))&&(L.clone(this.modelMatrix,this._modelMatrix),d.clone(this.center,this._center),L.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(d.clone(d.ZERO,this._boundingSphere.center),this._boundingSphere.radius=d.maximumComponent(r),se.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const s=this._material!==this.material;this._material=this.material,this._material.update(t);const a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const l=e.useLogDepth,u=this._useLogDepth!==l;this._useLogDepth=l;const h=this._colorCommand;let f,_;(s||a||i||u)&&(f=new Oe({sources:[IB]}),_=new Oe({sources:[this.material.shaderSource,vB]}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(f.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:f,fragmentShaderSource:_,attributeLocations:UD}),h.vertexArray=this._va,h.renderState=this._rs,h.shaderProgram=this._sp,h.uniformMap=jt(this._uniforms,this.material._uniforms),h.executeInClosestFrustum=n);const g=e.commandList,m=e.passes;if(m.render&&(h.boundingVolume=this._boundingSphere,h.debugShowBoundingVolume=this.debugShowBoundingVolume,h.modelMatrix=this._computedModelMatrix,h.pass=n?xe.TRANSLUCENT:xe.OPAQUE,g.push(h)),m.pick){const b=this._pickCommand;(!c(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})),(s||a||!c(this._pickSP)||u)&&(f=new Oe({sources:[IB]}),_=new Oe({sources:[this.material.shaderSource,vB],pickColorQualifier:"uniform"}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(f.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH")),this._pickSP=Jt.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:f,fragmentShaderSource:_,attributeLocations:UD}),b.vertexArray=this._va,b.renderState=this._rs,b.shaderProgram=this._pickSP,b.uniformMap=jt(jt(this._uniforms,this._pickUniforms),this.material._uniforms),b.executeInClosestFrustum=n),b.boundingVolume=this._boundingSphere,b.modelMatrix=this._computedModelMatrix,b.pass=n?xe.TRANSLUCENT:xe.OPAQUE,g.push(b)}};tE.prototype.isDestroyed=function(){return!1};tE.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(),ve(this)};function sb(e){e=y(e,y.EMPTY_OBJECT);let t=e.textureUrl;c(t)||(t=Zt("Assets/Textures/moonSmall.jpg")),this.show=y(e.show,!0),this.textureUrl=t,this._ellipsoid=y(e.ellipsoid,ae.MOON),this.onlySunLighting=y(e.onlySunLighting,!0),this._ellipsoidPrimitive=new tE({radii:this.ellipsoid.radii,material:Se.fromType(Se.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new rW}Object.defineProperties(sb.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const rA=new $,yMe=new $,bMe=new d,sA=[];sb.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;c(zt.computeIcrfToFixedMatrix(n,rA))||zt.computeTemeToPseudoFixedMatrix(n,rA);const i=this._axes.evaluate(n,yMe);$.transpose(i,i),$.multiply(rA,i,i);const o=CI.computeMoonPositionInEarthInertialFrame(n,bMe);$.multiplyByVector(rA,o,o),L.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=sA,sA.length=0,t.update(e),e.commandList=r,sA.length===1?sA[0]:void 0};sb.prototype.isDestroyed=function(){return!1};sb.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),ve(this)};const kD=[],VD=[];function TMe(e,t,n,i,o,r){const s=o-i+1,a=r-o,l=kD,u=VD;let h,f;for(h=0;h<s;++h)l[h]=e[i+h];for(f=0;f<a;++f)u[f]=e[o+f+1];h=0,f=0;for(let _=i;_<=r;++_){const g=l[h],m=u[f];h<s&&(f>=a||t(g,m,n)<=0)?(e[_]=g,++h):f<a&&(e[_]=m,++f)}}function HD(e,t,n,i,o){if(i>=o)return;const r=Math.floor((i+o)*.5);HD(e,t,n,i,r),HD(e,t,n,r+1,o),TMe(e,t,n,i,r,o)}function x1(e,t,n){if(!c(e))throw new E("array is required.");if(!c(t))throw new E("comparator is required.");const i=e.length,o=Math.ceil(i*.5);kD.length=o,VD.length=o,HD(e,t,n,0,i-1),kD.length=0,VD.length=0}function ms(e,t){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");this._occluderPosition=d.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 aA=new d;Object.defineProperties(ms.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!c(e))throw new E("cameraPosition is required.");e=d.clone(e,this._cameraPosition);const t=d.subtract(this._occluderPosition,e,aA);let n=d.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=d.multiplyByScalar(t,n,aA);const a=o*o*n;s=d.add(e,d.multiplyByScalar(r,a,aA),aA)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});ms.fromBoundingSphere=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");return c(n)?(d.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new ms(e,t)};const sW=new d;ms.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=d.subtract(e,this._occluderPosition,sW),n=this._occluderRadius;if(n=d.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=d.subtract(e,this._cameraPosition,t),n*n>d.magnitudeSquared(t)}return!1};const AMe=new d;ms.prototype.isBoundingSphereVisible=function(e){const t=d.clone(e.center,AMe),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,sW),o=this._occluderRadius-n;if(o=d.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i),o*o+n*n>d.magnitudeSquared(i)):!1;if(o>0){i=d.subtract(t,this._cameraPosition,i);const r=d.magnitudeSquared(i),s=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+s)*a>r*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+a>r)}return!0}return!1};const xMe=new d;ms.prototype.computeVisibility=function(e){if(!c(e))throw new E("occludeeBS is required.");const t=d.clone(e.center),n=e.radius;if(n>this._occluderRadius)return ir.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,xMe),o=this._occluderRadius-n;const r=d.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i);const s=d.magnitudeSquared(i);return o*o+n*n<s?ir.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?ir.FULL:ir.PARTIAL):(i=d.subtract(t,this._horizonPlanePosition,i),d.dot(i,this._horizonPlaneNormal)>-n?ir.PARTIAL:ir.FULL))}}return ir.NONE};const cA=new d;ms.computeOccludeePoint=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(n))throw new E("positions is required.");if(n.length===0)throw new E("positions must contain at least one element");const i=d.clone(t),o=d.clone(e.center),r=e.radius,s=n.length;if(d.equals(o,t))throw new E("occludeePosition must be different than occluderBoundingSphere.center");const a=d.normalize(d.subtract(i,o,cA),cA),l=-d.dot(a,o),u=ms._anyRotationVector(o,a,l);let h=ms._horizonToPlaneNormalDotProduct(e,a,l,u,n[0]);if(!h)return;let f;for(let g=1;g<s;++g){if(f=ms._horizonToPlaneNormalDotProduct(e,a,l,u,n[g]),!f)return;f<h&&(h=f)}if(h<.0017453283658983088)return;const _=r/h;return d.add(o,d.multiplyByScalar(a,_,cA),cA)};const CMe=[];ms.computeOccludeePointFromRectangle=function(e,t){if(!c(e))throw new E("rectangle is required.");t=y(t,ae.WGS84);const n=ce.subsample(e,t,0,CMe),i=se.fromPoints(n),o=d.ZERO;if(!d.equals(o,i.center))return ms.computeOccludeePoint(new se(o,t.minimumRadius),i.center,n)};const EMe=new d;ms._anyRotationVector=function(e,t,n){const i=d.abs(t,EMe);let o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);const r=new d;let s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=d.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=d.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=d.UNIT_Z);const a=(d.dot(t,i)+n)/-d.dot(t,s);return d.normalize(d.subtract(d.add(i,d.multiplyByScalar(s,a,r),i),e,i),i)};const wMe=new d;ms._rotationVector=function(e,t,n,i,o){let r=d.subtract(i,e,wMe);if(r=d.normalize(r,r),d.dot(t,r)<.9999999847691291){const s=d.cross(t,r,r);if(d.magnitude(s)>R.EPSILON13)return d.normalize(s,new d)}return o};const Tv=new d,SMe=new d,lA=new d,l3=new d;ms._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=d.clone(o,Tv),s=d.clone(e.center,SMe),a=e.radius;let l=d.subtract(s,r,lA);const u=d.magnitudeSquared(l),h=a*a;if(u<h)return!1;const f=u-h,_=Math.sqrt(f),m=1/Math.sqrt(u),T=_*m*_;l=d.normalize(l,l);const x=d.add(r,d.multiplyByScalar(l,T,l3),l3),C=Math.sqrt(f-T*T);let w=this._rotationVector(s,t,n,r,i),v=d.fromElements(w.x*w.x*l.x+(w.x*w.y-w.z)*l.y+(w.x*w.z+w.y)*l.z,(w.x*w.y+w.z)*l.x+w.y*w.y*l.y+(w.y*w.z-w.x)*l.z,(w.x*w.z-w.y)*l.x+(w.y*w.z+w.x)*l.y+w.z*w.z*l.z,Tv);v=d.normalize(v,v);const P=d.multiplyByScalar(v,C,Tv);w=d.normalize(d.subtract(d.add(x,P,lA),s,lA),lA);const N=d.dot(t,w);w=d.normalize(d.subtract(d.subtract(x,P,w),s,w),w);const k=d.dot(t,w);return N<k?N:k};function xs(e){e=y(e,y.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=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new _o,this._perspectiveMatrix=new L,this._infinitePerspective=new L}function GD(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new E("right, left, top, bottom, near, or far parameters are not set.");const t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=L.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=L.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Object.defineProperties(xs.prototype,{projectionMatrix:{get:function(){return GD(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return GD(this),this._infinitePerspective}}});const vMe=new d,IMe=new d,DMe=new d,PMe=new d;xs.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,h=d.cross(t,n,vMe),f=IMe;d.multiplyByScalar(t,l,f),d.add(e,f,f);const _=DMe;d.multiplyByScalar(t,u,_),d.add(e,_,_);const g=PMe;d.multiplyByScalar(h,a,g),d.add(f,g,g),d.subtract(g,e,g),d.normalize(g,g),d.cross(g,n,g),d.normalize(g,g);let m=i[0];return c(m)||(m=i[0]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(h,s,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(n,g,g),d.normalize(g,g),m=i[1],c(m)||(m=i[1]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,r,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(h,g,g),d.normalize(g,g),m=i[2],c(m)||(m=i[2]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,o,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(g,h,g),d.normalize(g,g),m=i[3],c(m)||(m=i[3]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),m=i[4],c(m)||(m=i[4]=new te),m.x=t.x,m.y=t.y,m.z=t.z,m.w=-d.dot(t,f),d.negate(t,g),m=i[5],c(m)||(m=i[5]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,_),this._cullingVolume};xs.prototype.getPixelDimensions=function(e,t,n,i,o){if(GD(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");const r=1/this.near;let s=this.top*r;const a=2*i*n*s/t;s=this.right*r;const l=2*i*n*s/e;return o.x=l,o.y=a,o};xs.prototype.clone=function(e){return c(e)||(e=new xs),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};xs.prototype.equals=function(e){return c(e)&&e instanceof xs&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};xs.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof xs&&R.equalsEpsilon(this.right,e.right,t,n)&&R.equalsEpsilon(this.left,e.left,t,n)&&R.equalsEpsilon(this.top,e.top,t,n)&&R.equalsEpsilon(this.bottom,e.bottom,t,n)&&R.equalsEpsilon(this.near,e.near,t,n)&&R.equalsEpsilon(this.far,e.far,t,n)};function _n(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new xs,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=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this.xOffset=y(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=y(e.yOffset,0),this._yOffset=this.yOffset}_n.packedLength=6;_n.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(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};_n.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new _n),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};function sl(e){if(!c(e.fov)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("fov, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset){if(e.fov<0||e.fov>=Math.PI)throw new E("fov must be in the range [0, PI).");if(e.aspectRatio<0)throw new E("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,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}}Object.defineProperties(_n.prototype,{projectionMatrix:{get:function(){return sl(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return sl(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return sl(this),this._fovy}},sseDenominator:{get:function(){return sl(this),this._sseDenominator}},offCenterFrustum:{get:function(){return sl(this),this._offCenterFrustum}}});_n.prototype.computeCullingVolume=function(e,t,n){return sl(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};_n.prototype.getPixelDimensions=function(e,t,n,i,o){return sl(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};_n.prototype.clone=function(e){return c(e)||(e=new _n),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};_n.prototype.equals=function(e){return!c(e)||!(e instanceof _n)?!1:(sl(this),sl(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};_n.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof _n)?!1:(sl(this),sl(e),R.equalsEpsilon(this.fov,e.fov,t,n)&&R.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const by={NONE:0,SCENE_LIGHT:1,SUNLIGHT:2};by.fromGlobeFlags=function(e){return e.enableLighting&&e.dynamicAtmosphereLighting?e.dynamicAtmosphereLightingFromSun?by.SUNLIGHT:by.SCENE_LIGHT:by.NONE};const aW=Object.freeze(by);function OMe(){this.lightIntensity=10,this.rayleighCoefficient=new d(55e-7,13e-6,284e-7),this.mieCoefficient=new d(21e-6,21e-6,21e-6),this.rayleighScaleHeight=1e4,this.mieScaleHeight=3200,this.mieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.dynamicLighting=aW.NONE}function ab(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(ab.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function LMe(e,t,n){const i=t.createViewportQuadCommand(v1e,{framebuffer:n,renderState:Ue.fromCache({viewport:new Re(0,0,256,256)})});e._drawCommand=i}ab.prototype.update=function(e){if(!c(this._colorTexture)){const t=e.context,n=new xt({context:t,width:256,height:256,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST});this._colorTexture=n;const i=new ur({context:t,colorTextures:[n],destroyAttachments:!1});LMe(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};ab.prototype.isDestroyed=function(){return!1};ab.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),ve(this)};const cW={};function RMe(e,t,n){let i,o,r;if(e instanceof _n){const s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}else if(e instanceof xs)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}const NMe=new d,u3=new d;function lW(e,t,n,i){if(c(i)&&n(.5)>i){const o=n(0),r=n(1),s=n(.5),a=s-o,l=s-r;return function(u){const h=n(u);if(u<=.5){const _=(h-o)/a;return R.lerp(e,-R.PI_OVER_TWO,_)}const f=(h-r)/l;return R.lerp(-R.PI_OVER_TWO,t,1-f)}}return function(o){return R.lerp(e,t,o)}}function C1(e,t,n,i,o){let r=o;const s=Math.max(n,i);if(!c(r)){const a=e.position,l=t,u=e.up,h=e.right,f=e.frustum,_=d.subtract(a,l,NMe),g=d.magnitude(d.multiplyByScalar(u,d.dot(_,u),u3)),m=d.magnitude(d.multiplyByScalar(h,d.dot(_,h),u3));r=Math.min(RMe(f,g,m)*.2,1e9)}if(s<r){const u=-Math.pow((r-n)*1e6,.125),h=Math.pow((r-i)*1e6,1/8);return function(f){const _=f*(h-u)+u;return-Math.pow(_,8)/1e6+r}}return function(a){return R.lerp(n,i,a)}}function I0(e,t){return R.equalsEpsilon(e,R.TWO_PI,R.EPSILON11)&&(e=0),t>e+Math.PI?e+=R.TWO_PI:t<e-Math.PI&&(e-=R.TWO_PI),e}const uW=new d;function MMe(e,t,n,i,o,r,s,a){const l=e.camera,u=d.clone(l.position,uW),h=l.pitch,f=I0(l.heading,i),_=I0(l.roll,r),g=C1(l,n,u.z,n.z,s),m=lW(h,o,g,a);function b(T){const x=T.time/t;l.setView({orientation:{heading:R.lerp(f,i,x),pitch:m(x),roll:R.lerp(_,r,x)}}),H.lerp(u,n,x,l.position),l.position.z=g(x)}return b}function FMe(e,t){e.longitude<t.longitude?e.longitude+=R.TWO_PI:t.longitude+=R.TWO_PI}function BMe(e,t){const n=e.longitude-t.longitude;n<-R.PI?e.longitude+=R.TWO_PI:n>R.PI&&(t.longitude+=R.TWO_PI)}const zMe=new he,UMe=new he;function kMe(e,t,n,i,o,r,s,a,l,u){const h=e.camera,_=e.mapProjection.ellipsoid,g=he.clone(h.positionCartographic,zMe),m=h.pitch,b=I0(h.heading,i),T=I0(h.roll,r),x=_.cartesianToCartographic(n,UMe);g.longitude=R.zeroToTwoPi(g.longitude),x.longitude=R.zeroToTwoPi(x.longitude);let C=!1;if(c(a)){const N=R.zeroToTwoPi(a),k=Math.min(g.longitude,x.longitude),M=Math.max(g.longitude,x.longitude),U=N>=k&&N<=M;if(c(l)){const B=Math.abs(g.longitude-x.longitude),S=R.TWO_PI-B;(U?B:S)<(U?S:B)*l&&!U&&(C=!0)}else U||(C=!0)}C?FMe(g,x):BMe(g,x);const w=C1(h,n,g.height,x.height,s),v=lW(m,o,w,u);function P(){const N=g.longitude,k=x.longitude,M=g.latitude,U=x.latitude;return function(S){const D=S.time/t,p=d.fromRadians(R.lerp(N,k,D),R.lerp(M,U,D),w(D),_);h.setView({destination:p,orientation:{heading:R.lerp(b,i,D),pitch:v(D),roll:R.lerp(T,r,D)}})}}return P()}function VMe(e,t,n,i,o,r,s){const a=e.camera,l=d.clone(a.position,uW),u=I0(a.heading,i),h=a.frustum.right-a.frustum.left,f=C1(a,n,h,n.z,s);function _(g){const m=g.time/t;a.setView({orientation:{heading:R.lerp(u,i,m)}}),H.lerp(l,n,m,a.position);const b=f(m),T=a.frustum,x=T.top/T.right,C=(b-(T.right-T.left))*.5;T.right+=C,T.left-=C,T.top=x*T.right,T.bottom=-T.top}return _}const d3=new he,HMe=new d;function Av(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function h3(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}cW.createTween=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.destination;if(!c(e))throw new E("scene is required.");if(!c(n))throw new E("destination is required.");const i=e.mode;if(i===oe.MORPHING)return Av();const o=y(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,l=t.flyOverLongitude,u=t.flyOverLongitudeWeight,h=t.pitchAdjustHeight;let f=t.easingFunction;o&&i!==oe.SCENE3D&&(s.cartesianToCartographic(n,d3),n=r.project(d3,HMe));const _=e.camera,g=t.endTransform;c(g)&&_._setTransform(g);let m=t.duration;c(m)||(m=Math.ceil(d.distance(_.position,n)/1e6)+2,m=Math.min(m,3));const b=y(t.heading,0),T=y(t.pitch,-R.PI_OVER_TWO),x=y(t.roll,0),C=e.screenSpaceCameraController;C.enableInputs=!1;const w=h3(C,t.complete),v=h3(C,t.cancel),P=_.frustum;let N=e.mode===oe.SCENE2D;if(N=N&&H.equalsEpsilon(_.position,n,R.EPSILON6),N=N&&R.equalsEpsilon(Math.max(P.right-P.left,P.top-P.bottom),n.z,R.EPSILON6),N=N||e.mode!==oe.SCENE2D&&d.equalsEpsilon(n,_.position,R.EPSILON10),N=N&&R.equalsEpsilon(R.negativePiToPi(b),R.negativePiToPi(_.heading),R.EPSILON10)&&R.equalsEpsilon(R.negativePiToPi(T),R.negativePiToPi(_.pitch),R.EPSILON10)&&R.equalsEpsilon(R.negativePiToPi(x),R.negativePiToPi(_.roll),R.EPSILON10),N)return Av(w,v);const k=new Array(4);if(k[oe.SCENE2D]=VMe,k[oe.SCENE3D]=kMe,k[oe.COLUMBUS_VIEW]=MMe,m<=0)return Av(function(){k[i](e,1,n,b,T,x,a,l,u,h)({time:1}),typeof w=="function"&&w()},v);const M=k[i](e,m,n,b,T,x,a,l,u,h);if(!c(f)){const U=_.positionCartographic.height,B=i===oe.SCENE3D?s.cartesianToCartographic(n).height:n.z;U>B&&U>11500?f=ka.CUBIC_OUT:f=ka.QUINTIC_IN_OUT}return{duration:m,easingFunction:f,startObject:{time:0},stopObject:{time:m},update:M,complete:w,cancel:v}};const GMe=cW,jMe={ROTATE:0,INFINITE_SCROLL:1},Wh=Object.freeze(jMe);function Ye(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._transform=L.clone(L.IDENTITY),this._invTransform=L.clone(L.IDENTITY),this._actualTransform=L.clone(L.IDENTITY),this._actualInvTransform=L.clone(L.IDENTITY),this._transformChanged=!1,this.position=new d,this._position=new d,this._positionWC=new d,this._positionCartographic=new he,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new d,this._direction=new d,this._directionWC=new d,this.up=new d,this._up=new d,this._upWC=new d,this.right=new d,this._right=new d,this._rightWC=new d,this.frustum=new _n,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=R.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 Le,this._moveEnd=new Le,this._changed=new Le,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this._changedRoll=void 0,this.percentageChanged=.5,this._viewMatrix=new L,this._invViewMatrix=new L,dW(this),this._mode=oe.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new he(Math.PI,R.PI_OVER_TWO)),this._max2Dfrustum=void 0,CW(this,Ye.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=d.magnitude(this.position);n+=n*Ye.DEFAULT_VIEW_FACTOR,d.normalize(this.position,this.position),d.multiplyByScalar(this.position,n,this.position)}Ye.TRANSFORM_2D=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Ye.TRANSFORM_2D_INVERSE=L.inverseTransformation(Ye.TRANSFORM_2D,new L);Ye.DEFAULT_VIEW_RECTANGLE=ce.fromDegrees(-95,-20,-70,90);Ye.DEFAULT_VIEW_FACTOR=.5;Ye.DEFAULT_OFFSET=new F_(0,-R.PI_OVER_FOUR,0);function dW(e){L.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),L.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),L.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function WMe(e){if(!c(e._oldPositionWC))e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=d.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=d.magnitude(t),e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=xo()):e.timeSinceMoved=Math.max(xo()-e._lastMovedTimestamp,0)/1e3}}Ye.prototype.canPreloadFlight=function(){return c(this._currentFlight)&&this._mode!==oe.SCENE2D};Ye.prototype._updateCameraChanged=function(){const e=this;if(WMe(e),e._changed.numberOfListeners===0)return;const t=e.percentageChanged,n=e.heading;c(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%R.TWO_PI;i=i>R.PI?R.TWO_PI-i:i;const o=i/Math.PI;o>t&&(e._changedHeading=n);const r=e.roll;c(e._changedRoll)||(e._changedRoll=r);let s=Math.abs(e._changedRoll-r)%R.TWO_PI;s=s>R.PI?R.TWO_PI-s:s;const a=s/Math.PI;if(a>t&&(e._changedRoll=r),(a>t||o>t)&&e._changed.raiseEvent(Math.max(a,o)),e._mode===oe.SCENE2D){if(!c(e._changedFrustum)){e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}const _=e.position,g=e._changedPosition,m=e.frustum,b=e._changedFrustum,T=_.x+m.left,x=_.x+m.right,C=g.x+b.left,w=g.x+b.right,v=_.y+m.bottom,P=_.y+m.top,N=g.y+b.bottom,k=g.y+b.top,M=Math.max(T,C),U=Math.min(x,w),B=Math.max(v,N),S=Math.min(P,k);let D;if(M>=U||B>=P)D=1;else{let p=b;T<C&&x>w&&v<N&&P>k&&(p=m),D=1-(U-M)*(S-B)/((p.right-p.left)*(p.top-p.bottom))}D>t&&(e._changed.raiseEvent(D),e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!c(e._changedDirection)){e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection);return}const l=R.acosClamped(d.dot(e.directionWC,e._changedDirection));let u;c(e.frustum.fovy)?u=l/(e.frustum.fovy*.5):u=l;const f=d.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(u>t||f>t)&&(e._changed.raiseEvent(Math.max(u,f)),e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection))};function qMe(e){zt.basisTo2D(e._projection,e._transform,e._actualTransform)}const YMe=new he,$Me=new d,uA=new d,XMe=new te,QMe=new te,KMe=new te,ZMe=new te,JMe=new te;function eFe(e){const t=e._projection,n=t.ellipsoid,i=L.getColumn(e._transform,3,XMe),o=n.cartesianToCartographic(i,YMe),r=t.project(o,$Me),s=QMe;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=te.clone(te.UNIT_X,JMe),l=te.add(L.getColumn(e._transform,0,uA),i,uA);n.cartesianToCartographic(l,o),t.project(o,r);const u=KMe;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,d.subtract(u,s,u),u.x=0;const h=ZMe;if(d.magnitudeSquared(u)>R.EPSILON10)d.cross(a,u,h);else{const f=te.add(L.getColumn(e._transform,1,uA),i,uA);n.cartesianToCartographic(f,o),t.project(o,r),h.x=r.z,h.y=r.x,h.z=r.y,h.w=0,d.subtract(h,s,h),h.x=0,d.magnitudeSquared(h)<R.EPSILON10&&(te.clone(te.UNIT_Y,u),te.clone(te.UNIT_Z,h))}d.cross(h,a,u),d.normalize(u,u),d.cross(a,u,h),d.normalize(h,h),L.setColumn(e._actualTransform,0,u,e._actualTransform),L.setColumn(e._actualTransform,1,h,e._actualTransform),L.setColumn(e._actualTransform,2,a,e._actualTransform),L.setColumn(e._actualTransform,3,s,e._actualTransform)}const xv=new d;function ss(e){const t=e._mode;let n=!1,i=0;t===oe.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position;const r=!d.equals(o,e.position)||n;r&&(o=d.clone(e.position,e._position));let s=e._direction;const a=!d.equals(s,e.direction);a&&(d.normalize(e.direction,e.direction),s=d.clone(e.direction,e._direction));let l=e._up;const u=!d.equals(l,e.up);u&&(d.normalize(e.up,e.up),l=d.clone(e.up,e._up));let h=e._right;const f=!d.equals(h,e.right);f&&(d.normalize(e.right,e.right),h=d.clone(e.right,e._right));const _=e._transformChanged||e._modeChanged;e._transformChanged=!1,_&&(L.inverseTransformation(e._transform,e._invTransform),e._mode===oe.COLUMBUS_VIEW||e._mode===oe.SCENE2D?L.equals(L.IDENTITY,e._transform)?L.clone(Ye.TRANSFORM_2D,e._actualTransform):e._mode===oe.COLUMBUS_VIEW?qMe(e):eFe(e):L.clone(e._transform,e._actualTransform),L.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const g=e._actualTransform;if(r||_)if(e._positionWC=L.multiplyByPoint(g,o,e._positionWC),t===oe.SCENE3D||t===oe.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const m=xv;m.x=e._positionWC.y,m.y=e._positionWC.z,m.z=e._positionWC.x,t===oe.SCENE2D&&(m.z=i),e._projection.unproject(m,e._positionCartographic)}if(a||u||f){const m=d.dot(s,d.cross(l,h,xv));if(Math.abs(1-m)>R.EPSILON2){const b=1/d.magnitudeSquared(l),T=d.dot(l,s)*b,x=d.multiplyByScalar(s,T,xv);l=d.normalize(d.subtract(l,x,e._up),e._up),d.clone(l,e.up),h=d.cross(s,l,e._right),d.clone(h,e.right)}}(a||_)&&(e._directionWC=L.multiplyByPointAsVector(g,s,e._directionWC),d.normalize(e._directionWC,e._directionWC)),(u||_)&&(e._upWC=L.multiplyByPointAsVector(g,l,e._upWC),d.normalize(e._upWC,e._upWC)),(f||_)&&(e._rightWC=L.multiplyByPointAsVector(g,h,e._rightWC),d.normalize(e._rightWC,e._rightWC)),(r||a||u||f||_)&&dW(e)}function hW(e,t){let n;return R.equalsEpsilon(Math.abs(e.z),1,R.EPSILON3)?n=Math.atan2(t.y,t.x)-R.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-R.PI_OVER_TWO,R.TWO_PI-R.zeroToTwoPi(n)}function fW(e){return R.PI_OVER_TWO-R.acosClamped(e.z)}function pW(e,t,n){let i=0;return R.equalsEpsilon(Math.abs(e.z),1,R.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=R.zeroToTwoPi(i+R.TWO_PI)),i}const rx=new L,sx=new L;Object.defineProperties(Ye.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return ss(this),this._invTransform}},viewMatrix:{get:function(){return ss(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return ss(this),this._invViewMatrix}},positionCartographic:{get:function(){return ss(this),this._positionCartographic}},positionWC:{get:function(){return ss(this),this._positionWC}},directionWC:{get:function(){return ss(this),this._directionWC}},upWC:{get:function(){return ss(this),this._upWC}},rightWC:{get:function(){return ss(this),this._rightWC}},heading:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=hW(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=fW(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=pW(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}}});Ye.prototype.update=function(e){if(!c(e))throw new E("mode is required.");if(e===oe.SCENE2D&&!(this.frustum instanceof Ki))throw new E("An OrthographicOffCenterFrustum is required in 2D.");if((e===oe.SCENE3D||e===oe.COLUMBUS_VIEW)&&!(this.frustum instanceof _n)&&!(this.frustum instanceof It))throw new E("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==oe.MORPHING,t=this._mode===oe.SCENE2D),t){const n=this._max2Dfrustum=this.frustum.clone();if(!(n instanceof Ki))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");const i=2,o=n.top/n.right;n.right=this._maxCoord.x*i,n.left=-n.right,n.top=o*n.right,n.bottom=-n.top}this._mode===oe.SCENE2D&&yW(this,this.position)};const tFe=new d,nFe=new d,iFe=new d;Ye.prototype._setTransform=function(e){const t=d.clone(this.positionWC,tFe),n=d.clone(this.upWC,nFe),i=d.clone(this.directionWC,iFe);L.clone(e,this._transform),this._transformChanged=!0,ss(this);const o=this._actualInvTransform;L.multiplyByPoint(o,t,this.position),L.multiplyByPointAsVector(o,i,this.direction),L.multiplyByPointAsVector(o,n,this.up),d.cross(this.direction,this.up,this.right),ss(this)};const oFe=new H,rFe=new nn,sFe=new d,aFe=new d;function mW(e){if(!L.equals(L.IDENTITY,e.transform))return d.magnitude(e.position);const t=e._scene,n=t.globe,i=oFe;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(c(n)){const a=e.getPickRay(i,rFe);o=n.pickWorldCoordinates(a,t,!0,sFe)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,aFe));let s;if(c(o)||c(r)){const a=c(r)?d.distance(r,e.positionWC):Number.POSITIVE_INFINITY,l=c(o)?d.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,l)}else s=Math.max(e.positionCartographic.height,0);return s}Ye.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof It&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=mW(this)))};const sC=new d,E1=new L,cFe=new L,w1=new _e,S1=new $,_W=new he;function lFe(e,t,n){if(isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new E("position has a NaN component");const i=L.clone(e.transform,E1),o=zt.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,cFe);e._setTransform(o),d.clone(d.ZERO,e.position),n.heading=n.heading-R.PI_OVER_TWO;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,0,e.direction),$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function uFe(e,t,n,i){const o=L.clone(e.transform,E1);if(e._setTransform(L.IDENTITY),!d.equals(t,e.positionWC)){if(i){const a=e._projection,l=a.ellipsoid.cartesianToCartographic(t,_W);t=a.project(l,sC)}d.clone(t,e.position)}n.heading=n.heading-R.PI_OVER_TWO;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,0,e.direction),$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function dFe(e,t,n,i){const o=L.clone(e.transform,E1);if(e._setTransform(L.IDENTITY),!d.equals(t,e.positionWC)){if(i){const l=e._projection,u=l.ellipsoid.cartesianToCartographic(t,_W);t=l.project(u,sC)}H.clone(t,e.position);const r=-t.z*.5,s=-r,a=e.frustum;if(s>r){const l=a.top/a.right;a.right=s,a.left=r,a.top=a.right*l,a.bottom=-a.top}}if(e._scene.mapMode2D===Wh.ROTATE){n.heading=n.heading-R.PI_OVER_TWO,n.pitch=-R.PI_OVER_TWO,n.roll=0;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right)}e._setTransform(o)}const hFe=new d,fFe=new d,pFe=new d;function gW(e,t,n,i){const o=d.clone(n.direction,hFe),r=d.clone(n.up,fFe);if(e._scene.mode===oe.SCENE3D){const a=e._projection.ellipsoid,l=zt.eastNorthUpToFixedFrame(t,a,rx),u=L.inverseTransformation(l,sx);L.multiplyByPointAsVector(u,o,o),L.multiplyByPointAsVector(u,r,r)}const s=d.cross(o,r,pFe);return i.heading=hW(o,r),i.pitch=fW(o),i.roll=pW(o,r,s),i}const jD={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},vm=new lr;Ye.prototype.setView=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.orientation,y.EMPTY_OBJECT);const n=this._mode;if(n===oe.MORPHING)return;c(e.endTransform)&&this._setTransform(e.endTransform);let i=y(e.convert,!0),o=y(e.destination,d.clone(this.positionWC,sC));if(c(o)&&c(o.west)){if(o=this.getRectangleCameraCoordinates(o,sC),isNaN(o.x)||isNaN(o.y))throw new E("destination has a NaN component");i=!1}c(t.direction)&&(t=gW(this,o,t,jD.orientation)),vm.heading=y(t.heading,0),vm.pitch=y(t.pitch,-R.PI_OVER_TWO),vm.roll=y(t.roll,0),n===oe.SCENE3D?lFe(this,o,vm):n===oe.SCENE2D?dFe(this,o,vm,i):uFe(this,o,vm,i)};const mFe=new d;Ye.prototype.flyHome=function(e){const t=this._mode;if(t===oe.MORPHING&&this._scene.completeMorph(),t===oe.SCENE2D)this.flyTo({destination:Ye.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:L.IDENTITY});else if(t===oe.SCENE3D){const n=this.getRectangleCameraCoordinates(Ye.DEFAULT_VIEW_RECTANGLE);let i=d.magnitude(n);i+=i*Ye.DEFAULT_VIEW_FACTOR,d.normalize(n,n),d.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:L.IDENTITY})}else if(t===oe.COLUMBUS_VIEW){const n=this._projection.ellipsoid.maximumRadius;let i=new d(0,-1,1);i=d.multiplyByScalar(d.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(d.normalize(i,mFe).z),roll:0},endTransform:L.IDENTITY,convert:!1})}};Ye.prototype.worldToCameraCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new te),ss(this),L.multiplyByVector(this._actualInvTransform,e,t)};Ye.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPoint(this._actualInvTransform,e,t)};Ye.prototype.worldToCameraCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPointAsVector(this._actualInvTransform,e,t)};Ye.prototype.cameraToWorldCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new te),ss(this),L.multiplyByVector(this._actualTransform,e,t)};Ye.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPoint(this._actualTransform,e,t)};Ye.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPointAsVector(this._actualTransform,e,t)};function yW(e,t){const n=e._scene.mapMode2D===Wh.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y;let r,s;n?(s=i,r=-s):(s=t.x-i*2,r=t.x+i*2),t.x>i&&(t.x=s),t.x<-i&&(t.x=r),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}const f3=new d;Ye.prototype.move=function(e,t){if(!c(e))throw new E("direction is required.");const n=this.position;d.multiplyByScalar(e,t,f3),d.add(n,f3,n),this._mode===oe.SCENE2D&&yW(this,n),this._adjustOrthographicFrustum(!0)};Ye.prototype.moveForward=function(e){e=y(e,this.defaultMoveAmount),this._mode===oe.SCENE2D?nE(this,e):this.move(this.direction,e)};Ye.prototype.moveBackward=function(e){e=y(e,this.defaultMoveAmount),this._mode===oe.SCENE2D?nE(this,-e):this.move(this.direction,-e)};Ye.prototype.moveUp=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,e)};Ye.prototype.moveDown=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,-e)};Ye.prototype.moveRight=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,e)};Ye.prototype.moveLeft=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,-e)};Ye.prototype.lookLeft=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.up,-e)};Ye.prototype.lookRight=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.up,e)};Ye.prototype.lookUp=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.right,-e)};Ye.prototype.lookDown=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.right,e)};const _Fe=new _e,gFe=new $;Ye.prototype.look=function(e,t){if(!c(e))throw new E("axis is required.");const n=y(t,this.defaultLookAmount),i=_e.fromAxisAngle(e,-n,_Fe),o=$.fromQuaternion(i,gFe),r=this.direction,s=this.up,a=this.right;$.multiplyByVector(o,r,r),$.multiplyByVector(o,s,s),$.multiplyByVector(o,a,a)};Ye.prototype.twistLeft=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,e)};Ye.prototype.twistRight=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,-e)};const yFe=new _e,bFe=new $;Ye.prototype.rotate=function(e,t){if(!c(e))throw new E("axis is required.");const n=y(t,this.defaultRotateAmount),i=_e.fromAxisAngle(e,-n,yFe),o=$.fromQuaternion(i,bFe);$.multiplyByVector(o,this.position,this.position),$.multiplyByVector(o,this.direction,this.direction),$.multiplyByVector(o,this.up,this.up),d.cross(this.direction,this.up,this.right),d.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};Ye.prototype.rotateDown=function(e){e=y(e,this.defaultRotateAmount),bW(this,e)};Ye.prototype.rotateUp=function(e){e=y(e,this.defaultRotateAmount),bW(this,-e)};const TFe=new d,AFe=new d,xFe=new d,p3=new d;function bW(e,t){const n=e.position;if(c(e.constrainedAxis)&&!d.equalsEpsilon(e.position,d.ZERO,R.EPSILON2)){const i=d.normalize(n,TFe),o=d.equalsEpsilon(i,e.constrainedAxis,R.EPSILON2),r=d.equalsEpsilon(i,d.negate(e.constrainedAxis,p3),R.EPSILON2);if(!o&&!r){const s=d.normalize(e.constrainedAxis,AFe);let a=d.dot(i,s),l=R.acosClamped(a);t>0&&t>l&&(t=l-R.EPSILON4),a=d.dot(i,d.negate(s,p3)),l=R.acosClamped(a),t<0&&-t>l&&(t=-l+R.EPSILON4);const u=d.cross(s,i,xFe);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}Ye.prototype.rotateRight=function(e){e=y(e,this.defaultRotateAmount),TW(this,-e)};Ye.prototype.rotateLeft=function(e){e=y(e,this.defaultRotateAmount),TW(this,e)};function TW(e,t){c(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function nE(e,t){const n=e.frustum;if(!(n instanceof Ki)||!c(n.left)||!c(n.right)||!c(n.bottom)||!c(n.top))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t=t*.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===Wh.ROTATE&&(s*=e.maximumZoomFactor),r>s&&(r=s,o=-s),o<=r&&(o=1,r=-1),i=n.right/n.top,n.top=o,n.bottom=r,n.right=n.top*i,n.left=-n.right}else{let o=n.right-t,r=n.left+t,s=e._maxCoord.x;e._scene.mapMode2D===Wh.ROTATE&&(s*=e.maximumZoomFactor),o>s&&(o=s,r=-s),o<=r&&(o=1,r=-1),i=n.top/n.right,n.right=o,n.left=r,n.top=n.right*i,n.bottom=-n.top}}function AW(e,t){e.move(e.direction,t)}Ye.prototype.zoomIn=function(e){e=y(e,this.defaultZoomAmount),this._mode===oe.SCENE2D?nE(this,e):AW(this,e)};Ye.prototype.zoomOut=function(e){e=y(e,this.defaultZoomAmount),this._mode===oe.SCENE2D?nE(this,-e):AW(this,-e)};Ye.prototype.getMagnitude=function(){if(this._mode===oe.SCENE3D)return d.magnitude(this.position);if(this._mode===oe.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===oe.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};const CFe=new L;Ye.prototype.lookAt=function(e,t){if(!c(e))throw new E("target is required");if(!c(t))throw new E("offset is required");if(this._mode===oe.MORPHING)throw new E("lookAt is not supported while morphing.");const n=zt.eastNorthUpToFixedFrame(e,ae.WGS84,CFe);this.lookAtTransform(n,t)};const EFe=new d,wFe=new _e,SFe=new _e,vFe=new $;function xW(e,t,n){t=R.clamp(t,-R.PI_OVER_TWO,R.PI_OVER_TWO),e=R.zeroToTwoPi(e)-R.PI_OVER_TWO;const i=_e.fromAxisAngle(d.UNIT_Y,-t,wFe),o=_e.fromAxisAngle(d.UNIT_Z,-e,SFe),r=_e.multiply(o,i,o),s=$.fromQuaternion(r,vFe),a=d.clone(d.UNIT_X,EFe);return $.multiplyByVector(s,a,a),d.negate(a,a),d.multiplyByScalar(a,n,a),a}Ye.prototype.lookAtTransform=function(e,t){if(!c(e))throw new E("transform is required");if(this._mode===oe.MORPHING)throw new E("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!c(t))return;let n;if(c(t.heading)?n=xW(t.heading,t.pitch,t.range):n=t,this._mode===oe.SCENE2D){H.clone(H.ZERO,this.position),d.negate(n,this.up),this.up.z=0,d.magnitudeSquared(this.up)<R.EPSILON10&&d.clone(d.UNIT_Y,this.up),d.normalize(this.up,this.up),this._setTransform(L.IDENTITY),d.negate(d.UNIT_Z,this.direction),d.cross(this.direction,this.up,this.right),d.normalize(this.right,this.right);const i=this.frustum,o=i.top/i.right;i.right=d.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}d.clone(n,this.position),d.negate(this.position,this.direction),d.normalize(this.direction,this.direction),d.cross(this.direction,d.UNIT_Z,this.right),d.magnitudeSquared(this.right)<R.EPSILON10&&d.clone(d.UNIT_X,this.right),d.normalize(this.right,this.right),d.cross(this.right,this.direction,this.up),d.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const ty=new he,IFe=new he,DFe=new d,PFe=new d,OFe=new d,LFe=new d,RFe=new d,NFe=new d,MFe=new d,Cv=new d,FFe={direction:new d,right:new d,up:new d};let m3;function es(e,t,n,i){return Math.abs(d.dot(t,n))/i-d.dot(e,n)}function CW(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:FFe,s=t.north,a=t.south;let l=t.east;const u=t.west;u>l&&(l+=R.TWO_PI);const h=(u+l)*.5;let f;if(a<-R.PI_OVER_TWO+R.RADIANS_PER_DEGREE&&s>R.PI_OVER_TWO-R.RADIANS_PER_DEGREE)f=0;else{const U=ty;U.longitude=h,U.latitude=s,U.height=0;const B=IFe;B.longitude=h,B.latitude=a,B.height=0;let S=m3;(!c(S)||S.ellipsoid!==o)&&(m3=S=new Mp(void 0,void 0,o)),S.setEndPoints(U,B),f=S.interpolateUsingFraction(.5,ty).latitude}const _=ty;_.longitude=h,_.latitude=f,_.height=0;const g=o.cartographicToCartesian(_,MFe),m=ty;m.longitude=l,m.latitude=s;const b=o.cartographicToCartesian(m,DFe);m.longitude=u;const T=o.cartographicToCartesian(m,OFe);m.longitude=h;const x=o.cartographicToCartesian(m,RFe);m.latitude=a;const C=o.cartographicToCartesian(m,NFe);m.longitude=l;const w=o.cartographicToCartesian(m,LFe);m.longitude=u;const v=o.cartographicToCartesian(m,PFe);d.subtract(T,g,T),d.subtract(w,g,w),d.subtract(b,g,b),d.subtract(v,g,v),d.subtract(x,g,x),d.subtract(C,g,C);const P=o.geodeticSurfaceNormal(g,r.direction);d.negate(P,P);const N=d.cross(P,d.UNIT_Z,r.right);d.normalize(N,N);const k=d.cross(N,P,r.up);let M;if(e.frustum instanceof It){const U=Math.max(d.distance(b,T),d.distance(w,v)),B=Math.max(d.distance(b,w),d.distance(T,v));let S,D;const p=e.frustum._offCenterFrustum,I=p.right/p.top,O=B*I;U>O?(S=U,D=S/I):(D=B,S=O),M=Math.max(S,D)}else{const U=Math.tan(e.frustum.fovy*.5),B=e.frustum.aspectRatio*U;if(M=Math.max(es(P,k,T,U),es(P,k,w,U),es(P,k,b,U),es(P,k,v,U),es(P,k,x,U),es(P,k,C,U),es(P,N,T,B),es(P,N,w,B),es(P,N,b,B),es(P,N,v,B),es(P,N,x,B),es(P,N,C,B)),a<0&&s>0){const S=ty;S.longitude=u,S.latitude=0,S.height=0;let D=o.cartographicToCartesian(S,Cv);d.subtract(D,g,D),M=Math.max(M,es(P,k,D,U),es(P,N,D,B)),S.longitude=l,D=o.cartographicToCartesian(S,Cv),d.subtract(D,g,D),M=Math.max(M,es(P,k,D,U),es(P,N,D,B))}}return d.add(g,d.multiplyByScalar(P,-M,Cv),n)}const BFe=new he,zFe=new d,UFe=new d;function kFe(e,t,n){const i=e._projection;t.west>t.east&&(t=ce.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=BFe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,zFe);L.multiplyByPoint(o,a,a),L.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const l=i.project(s,UFe);if(L.multiplyByPoint(o,l,l),L.multiplyByPoint(r,l,l),n.x=(a.x-l.x)*.5+l.x,n.y=(a.y-l.y)*.5+l.y,c(e.frustum.fovy)){const u=Math.tan(e.frustum.fovy*.5),h=e.frustum.aspectRatio*u;n.z=Math.max((a.x-l.x)/h,(a.y-l.y)/u)*.5}else{const u=a.x-l.x,h=a.y-l.y;n.z=Math.max(u,h)}return n}const VFe=new he,HFe=new d,GFe=new d;function jFe(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===Wh.INFINITE_SCROLL?o+=R.TWO_PI:(t=ce.MAX_VALUE,o=t.east));let r=VFe;r.longitude=o,r.latitude=t.north;const s=i.project(r,HFe);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,GFe),l=Math.abs(s.x-a.x)*.5;let u=Math.abs(s.y-a.y)*.5,h,f;const _=e.frustum.right/e.frustum.top,g=u*_;return l>g?(h=l,f=h/_):(f=u,h=g),u=Math.max(2*h,2*f),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}Ye.prototype.getRectangleCameraCoordinates=function(e,t){if(!c(e))throw new E("rectangle is required");const n=this._mode;if(c(t)||(t=new d),n===oe.SCENE3D)return CW(this,e,t);if(n===oe.COLUMBUS_VIEW)return kFe(this,e,t);if(n===oe.SCENE2D)return jFe(this,e,t)};const WFe=new nn;function qFe(e,t,n,i){n=y(n,ae.WGS84);const o=e.getPickRay(t,WFe),r=Ei.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return nn.getPoint(o,s,i)}const YFe=new nn;function $Fe(e,t,n,i){let r=e.getPickRay(t,YFe).origin;r=d.fromElements(r.y,r.z,0,r);const s=n.unproject(r);if(!(s.latitude<-R.PI_OVER_TWO||s.latitude>R.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}const XFe=new nn;function QFe(e,t,n,i){const o=e.getPickRay(t,XFe),r=-o.origin.x/o.direction.x;nn.getPoint(o,r,i);const s=n.unproject(new d(i.y,i.z,0));if(!(s.latitude<-R.PI_OVER_TWO||s.latitude>R.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}Ye.prototype.pickEllipsoid=function(e,t,n){if(!c(e))throw new E("windowPosition is required.");const i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(c(n)||(n=new d),t=y(t,ae.WGS84),this._mode===oe.SCENE3D)n=qFe(this,e,t,n);else if(this._mode===oe.SCENE2D)n=$Fe(this,e,this._projection,n);else if(this._mode===oe.COLUMBUS_VIEW)n=QFe(this,e,this._projection,n);else return;return n}};const KFe=new d,ZFe=new d,JFe=new d;function e2e(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=Math.tan(e.frustum.fovy*.5),a=e.frustum.aspectRatio*s,l=e.frustum.near,u=2/o*t.x-1,h=2/r*(r-t.y)-1,f=e.positionWC;d.clone(f,n.origin);const _=d.multiplyByScalar(e.directionWC,l,KFe);d.add(f,_,_);const g=d.multiplyByScalar(e.rightWC,u*l*a,ZFe),m=d.multiplyByScalar(e.upWC,h*l*s,JFe),b=d.add(_,g,n.direction);return d.add(b,m,b),d.subtract(b,f,b),d.normalize(b,b),n}const dA=new d;function t2e(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight;let s=e.frustum;const a=s.offCenterFrustum;c(a)&&(s=a);let l=2/o*t.x-1;l*=(s.right-s.left)*.5;let u=2/r*(r-t.y)-1;u*=(s.top-s.bottom)*.5;const h=n.origin;return d.clone(e.position,h),d.multiplyByScalar(e.right,l,dA),d.add(dA,h,h),d.multiplyByScalar(e.up,u,dA),d.add(dA,h,h),d.clone(e.directionWC,n.direction),(e._mode===oe.COLUMBUS_VIEW||e._mode===oe.SCENE2D)&&d.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}Ye.prototype.getPickRay=function(e,t){if(!c(e))throw new E("windowPosition is required.");c(t)||(t=new nn);const n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;const i=this.frustum;return c(i.aspectRatio)&&c(i.fov)&&c(i.near)?e2e(this,e,t):t2e(this,e,t)};const n2e=new d,i2e=new d;Ye.prototype.distanceToBoundingSphere=function(e){if(!c(e))throw new E("boundingSphere is required.");const t=d.subtract(this.positionWC,e.center,n2e),n=d.multiplyByScalar(this.directionWC,d.dot(t,this.directionWC),i2e);return Math.max(0,d.magnitude(n)-e.radius)};const o2e=new H;Ye.prototype.getPixelSize=function(e,t,n){if(!c(e))throw new E("boundingSphere is required.");if(!c(t))throw new E("drawingBufferWidth is required.");if(!c(n))throw new E("drawingBufferHeight is required.");const i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,o2e);return Math.max(o.x,o.y)};function r2e(e,t,n,i,o,r){const s=d.clone(t);n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z);function a(l){const u=d.lerp(t,s,l.time,new d);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:ka.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}const s2e=new d,_3=new d,a2e=new d,c2e=new d;function l2e(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(d.UNIT_X,s2e),r=-d.dot(o,n)/d.dot(o,i),s=d.add(n,d.multiplyByScalar(i,r,_3),_3);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,a2e);const a=Math.tan(e.frustum.fovy*.5),l=e.frustum.aspectRatio*a,u=d.magnitude(d.subtract(n,s,c2e)),h=l*u,f=a*u,_=e._maxCoord.x,g=e._maxCoord.y,m=Math.max(h-_,_),b=Math.max(f-g,g);if(n.z<-m||n.z>m||n.y<-b||n.y>b){const T=s.y<-m||s.y>m,x=s.z<-b||s.z>b;if(T||x)return r2e(e,n,s,m,b,t)}}Ye.prototype.createCorrectPositionTween=function(e){if(!c(e))throw new E("duration is required.");if(this._mode===oe.COLUMBUS_VIEW)return l2e(this,e)};const u2e=new d,tr={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};Ye.prototype.cancelFlight=function(){c(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};Ye.prototype.completeFlight=function(){if(c(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=tr.destination,e.orientation.heading=tr.heading,e.orientation.pitch=tr.pitch,e.orientation.roll=tr.roll,this.setView(e),c(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};Ye.prototype.flyTo=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.destination;if(!c(t))throw new E("destination is required.");if(this._mode===oe.MORPHING)return;this.cancelFlight();const i=t instanceof ce;i&&(t=this.getRectangleCameraCoordinates(t,u2e));let o=y(e.orientation,y.EMPTY_OBJECT);if(c(o.direction)&&(o=gW(this,t,o,jD.orientation)),c(e.duration)&&e.duration<=0){const h=jD;h.destination=e.destination,h.orientation.heading=o.heading,h.orientation.pitch=o.pitch,h.orientation.roll=o.roll,h.convert=e.convert,h.endTransform=e.endTransform,this.setView(h),typeof e.complete=="function"&&e.complete();return}const r=this;let s;tr.destination=t,tr.heading=o.heading,tr.pitch=o.pitch,tr.roll=o.roll,tr.duration=e.duration,tr.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),c(e.complete)&&e.complete()},tr.cancel=e.cancel,tr.endTransform=e.endTransform,tr.convert=i?!1:e.convert,tr.maximumHeight=e.maximumHeight,tr.pitchAdjustHeight=e.pitchAdjustHeight,tr.flyOverLongitude=e.flyOverLongitude,tr.flyOverLongitudeWeight=e.flyOverLongitudeWeight,tr.easingFunction=e.easingFunction;const a=this._scene,l=GMe.createTween(a,tr);if(l.duration===0){typeof l.complete=="function"&&l.complete();return}s=a.tweens.add(l),this._currentFlight=s;let u=this._scene.preloadFlightCamera;this._mode!==oe.SCENE2D&&(c(u)||(u=Ye.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function d2e(e,t){const n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function h2e(e,t){let n=e.frustum;const i=n.offCenterFrustum;c(i)&&(n=i);let o,r;const s=n.right/n.top,a=t*s;return t>a?(o=t,r=o/s):(r=t,o=a),Math.max(o,r)*1.5}const f2e=100;function EW(e,t,n){n=F_.clone(c(n)?n:Ye.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!c(r)||r===0){const s=t.radius;s===0?n.range=f2e:e.frustum instanceof It||e._mode===oe.SCENE2D?n.range=h2e(e,s):n.range=d2e(e,s),n.range=R.clamp(n.range,i,o)}return n}Ye.prototype.viewBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");if(this._mode===oe.MORPHING)throw new E("viewBoundingSphere is not supported while morphing.");t=EW(this,e,t),this.lookAt(e.center,t)};const p2e=new L,m2e=new d,_2e=new d,g2e=new d,y2e=new d,b2e=new te,T2e=new _e,A2e=new $;Ye.prototype.flyToBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");t=y(t,y.EMPTY_OBJECT);const n=this._mode===oe.SCENE2D||this._mode===oe.COLUMBUS_VIEW;this._setTransform(L.IDENTITY);const i=EW(this,e,t.offset);let o;n?o=d.multiplyByScalar(d.UNIT_Z,i.range,m2e):o=xW(i.heading,i.pitch,i.range);const r=zt.eastNorthUpToFixedFrame(e.center,ae.WGS84,p2e);L.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=d.subtract(e.center,o,_2e),d.normalize(s,s),a=L.multiplyByPointAsVector(r,d.UNIT_Z,g2e),1-Math.abs(d.dot(s,a))<R.EPSILON6){const u=_e.fromAxisAngle(s,i.heading,T2e),h=$.fromQuaternion(u,A2e);d.fromCartesian4(L.getColumn(r,1,b2e),a),$.multiplyByVector(h,a,a)}const l=d.cross(s,a,y2e);d.cross(l,s,a),d.normalize(a,a)}this.flyTo({destination:o,orientation:{direction:s,up:a},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 g3=new d,y3=new d,Ev=new d,b3=new d,ny=[new d,new d,new d,new d];function x2e(e,t){const n=t.radii,i=e.positionWC,o=d.multiplyComponents(t.oneOverRadii,i,g3),r=d.magnitude(o),s=d.normalize(o,y3);let a,l;d.equalsEpsilon(s,d.UNIT_Z,R.EPSILON10)?(a=new d(0,1,0),l=new d(0,0,1)):(a=d.normalize(d.cross(d.UNIT_Z,s,Ev),Ev),l=d.normalize(d.cross(s,a,b3),b3));const u=Math.sqrt(d.magnitudeSquared(o)-1),h=d.multiplyByScalar(s,1/r,g3),f=u/r,_=d.multiplyByScalar(a,f,y3),g=d.multiplyByScalar(l,f,Ev),m=d.add(h,g,ny[0]);d.subtract(m,_,m),d.multiplyComponents(n,m,m);const b=d.subtract(h,g,ny[1]);d.subtract(b,_,b),d.multiplyComponents(n,b,b);const T=d.subtract(h,g,ny[2]);d.add(T,_,T),d.multiplyComponents(n,T,T);const x=d.add(h,g,ny[3]);return d.add(x,_,x),d.multiplyComponents(n,x,x),ny}const wv=new H,C2e=new d,fh=[new he,new he,new he,new he];function hA(e,t,n,i,o,r){wv.x=e,wv.y=t;const s=i.pickEllipsoid(wv,o,C2e);return c(s)?(fh[n]=o.cartesianToCartographic(s,fh[n]),1):(fh[n]=o.cartesianToCartographic(r[n],fh[n]),0)}Ye.prototype.computeViewRectangle=function(e,t){e=y(e,ae.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new se(d.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Bt.OUTSIDE)return;const r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight;let l=0;const u=x2e(this,e);if(l+=hA(0,0,0,this,e,u),l+=hA(0,a,1,this,e,u),l+=hA(s,a,2,this,e,u),l+=hA(s,0,3,this,e,u),l<2)return ce.MAX_VALUE;t=ce.fromCartographicArray(fh,t);let h=0,f=fh[3].longitude;for(let _=0;_<4;++_){const g=fh[_].longitude,m=Math.abs(g-f);m>R.PI?h+=R.TWO_PI-m:h+=m,f=g}return R.equalsEpsilon(Math.abs(h),R.TWO_PI,R.EPSILON9)&&(t.west=-R.PI,t.east=R.PI,fh[0].latitude>=0?t.north=R.PI_OVER_TWO:t.south=-R.PI_OVER_TWO),t};Ye.prototype.switchToPerspectiveFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof _n)return;const e=this._scene;this.frustum=new _n,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=R.toRadians(60)};Ye.prototype.switchToOrthographicFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof It)return;const e=mW(this),t=this._scene;this.frustum=new It,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};Ye.clone=function(e,t){return c(t)||(t=new Ye(e._scene)),d.clone(e.position,t.position),d.clone(e.direction,t.direction),d.clone(e.up,t.up),d.clone(e.right,t.right),L.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};function jp(e){A.typeOf.object("options",e),A.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}const T3=576,E2e=100,iy="#ffffff",Sv="#48b";function wW(e,t){this.credit=e,this.count=y(t,1)}function w2e(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(Wt.equals(o,t))return!0}return!1}function S2e(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;Wt.equals(n,t)||(c(t)&&e._cesiumCreditContainer.removeChild(t.element),c(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const SW="cesium-credit-delimiter";function A3(e){const t=document.createElement("span");return t.textContent=e,t.className=SW,t}function x3(e,t){if(c(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function C3(e,t,n,i){const o=e.childNodes;let r=-1;t.sort(function(s,a){return a.count-s.count});for(let s=0;s<t.length;++s){const a=t[s].credit;if(c(a)){if(r=s,c(n)&&(r*=2,s>0)){const u=r-1;if(o.length<=u)e.appendChild(A3(n));else{const h=o[u];h.className!==SW&&e.replaceChild(A3(n),h)}}const l=a.element;if(o.length<=r)e.appendChild(x3(l,i));else{const u=o[r];u._creditId!==a._id&&e.replaceChild(x3(l,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function v2e(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<T3?(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((i-t.clientHeight)*.5)}px`),e._lastViewportWidth=n),n>=T3&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function ts(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` } `,n}function I2e(e){let t="";t+=ts(".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)"}),t+=ts(".cesium-credit-lightbox",{"background-color":"#303336",color:iy,position:"relative","min-height":`${E2e}px`,margin:"auto"}),t+=ts(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:iy}),t+=ts(".cesium-credit-lightbox > ul > li a:hover",{color:Sv}),t+=ts(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),t+=ts(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),t+=ts(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),t+=ts(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:iy}),t+=ts(".cesium-credit-lightbox-close:hover",{color:Sv}),t+=ts(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),t+=ts(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),t+=ts(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),t+=ts(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:iy}),t+=ts(".cesium-credit-expand-link:hover",{color:Sv}),t+=ts(".cesium-credit-text",{color:iy}),t+=ts(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});function n(r){if(r.shadowRoot)return r.shadowRoot;if(r.getRootNode){const s=r.getRootNode();if(s instanceof ShadowRoot)return s}}const i=y(n(e),document.head),o=document.createElement("style");o.innerHTML=t,i.appendChild(o)}function ki(e,t,n){A.defined("container",e);const i=this;n=y(n,document.body);const o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);const r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(m){r.contains(m.target)||i.hideLightbox()}o.addEventListener("click",s,!1);const a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);const l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="×",l.className="cesium-credit-lightbox-close",r.appendChild(l);const u=document.createElement("ul");r.appendChild(u);const h=document.createElement("div");h.className="cesium-credit-logoContainer",h.style.display="inline",e.appendChild(h);const f=document.createElement("div");f.className="cesium-credit-textContainer",f.style.display="inline",e.appendChild(f);const _=document.createElement("a");_.className="cesium-credit-expand-link",_.onclick=this.showLightbox.bind(this),_.textContent="Data attribution",e.appendChild(_),I2e(e);const g=Wt.clone(ki.cesiumCredit);this._delimiter=y(t," \u2022 "),this._screenContainer=f,this._cesiumCreditContainer=h,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=_,this._expanded=!1,this._staticCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new mt,lightboxCredits:new mt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function vW(e,t,n,i){i=y(i,1);let o=t.get(n.id);if(c(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{const r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new wW(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}ki.prototype.addCreditToNextFrame=function(e){if(A.defined("credit",e),e.isIon()){c(this._defaultCredit)||(this._defaultCredit=Wt.clone(IW())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,vW(this,t,e)};ki.prototype.addStaticCredit=function(e){A.defined("credit",e);const t=this._staticCredits;w2e(t,e)||t.push(e)};ki.prototype.removeStaticCredit=function(e){A.defined("credit",e);const t=this._staticCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};ki.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};ki.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};ki.prototype.update=function(){this._expanded&&v2e(this)};ki.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits,n=e.lightboxCredits;t.removeAll(),n.removeAll();const i=this._staticCredits;for(let o=0;o<i.length;++o){const r=i[o],s=r.showOnScreen?t:n;r.isIon()&&Wt.equals(ki.cesiumCredit,this._cesiumCredit)||vW(this,s,r,Number.MAX_VALUE)}Wt.equals(ki.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Wt.clone(ki.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};ki.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;C3(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",C3(this._creditList,t,void 0,"li"),S2e(this)};ki.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),ve(this)};ki.prototype.isDestroyed=function(){return!1};ki._cesiumCredit=void 0;ki._cesiumCreditInitialized=!1;let fA;function IW(){if(!c(fA)){let e=Zt("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new Ec(e).path()),fA=new Wt(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return ki._cesiumCreditInitialized||(ki._cesiumCredit=fA,ki._cesiumCreditInitialized=!0),fA}Object.defineProperties(ki,{cesiumCredit:{get:function(){return IW(),ki._cesiumCredit},set:function(e){ki._cesiumCredit=e,ki._cesiumCreditInitialized=!0}}});ki.CreditDisplayElement=wW;const iE=0,D2e=1;function qh(e){A.typeOf.object("options",e),A.typeOf.object("options.frustum",e.frustum),A.typeOf.object("options.origin",e.origin),A.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=y(e.vertexFormat,Ee.DEFAULT),r=y(e._drawNearPlane,!0);let s,a;t instanceof _n?(s=iE,a=_n.packedLength):t instanceof It&&(s=D2e,a=It.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=_e.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+d.packedLength+_e.packedLength+Ee.packedLength}qh.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t),n=y(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===iE?(_n.pack(o,t,n),n+=_n.packedLength):(It.pack(o,t,n),n+=It.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,_e.pack(e._orientation,t,n),n+=_e.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n]=e._drawNearPlane?1:0,t};const P2e=new _n,O2e=new It,L2e=new _e,R2e=new d,N2e=new Ee;qh.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++];let o;i===iE?(o=_n.unpack(e,t,P2e),t+=_n.packedLength):(o=It.unpack(e,t,O2e),t+=It.packedLength);const r=d.unpack(e,t,R2e);t+=d.packedLength;const s=_e.unpack(e,t,L2e);t+=_e.packedLength;const a=Ee.unpack(e,t,N2e);t+=Ee.packedLength;const l=e[t]===1;if(!c(n))return new qh({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:l});const u=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(u),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=_e.clone(s,n._orientation),n._vertexFormat=Ee.clone(a,n._vertexFormat),n._drawNearPlane=l,n};function Im(e,t,n,i,o,r,s,a){const l=e/3*2;for(let u=0;u<4;++u)c(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),c(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),c(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[l]=0,o[l+1]=0,o[l+2]=1,o[l+3]=0,o[l+4]=1,o[l+5]=1,o[l+6]=0,o[l+7]=1}const M2e=new $,F2e=new L,vv=new L,DW=new d,PW=new d,OW=new d,B2e=new d,z2e=new d,U2e=new d,Qd=new Array(3),cb=new Array(4);cb[0]=new te(-1,-1,1,1);cb[1]=new te(1,-1,1,1);cb[2]=new te(1,1,1,1);cb[3]=new te(-1,1,1,1);const LW=new Array(4);for(let e=0;e<4;++e)LW[e]=new te;qh._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const l=$.fromQuaternion(t,M2e);let u=y(r,DW),h=y(s,PW),f=y(a,OW);u=$.getColumn(l,0,u),h=$.getColumn(l,1,h),f=$.getColumn(l,2,f),d.normalize(u,u),d.normalize(h,h),d.normalize(f,f),d.negate(u,u);const _=L.computeView(e,f,h,u,F2e);let g,m;const b=i.projectionMatrix;if(n===iE){const T=L.multiply(b,_,vv);m=L.inverse(T,vv)}else g=L.inverseTransformation(_,vv);c(m)?(Qd[0]=i.near,Qd[1]=i.far):(Qd[0]=0,Qd[1]=i.near,Qd[2]=i.far);for(let T=0;T<2;++T)for(let x=0;x<4;++x){let C=te.clone(cb[x],LW[x]);if(c(m)){C=L.multiplyByVector(m,C,C);const w=1/C.w;d.multiplyByScalar(C,w,C),d.subtract(C,e,C),d.normalize(C,C);const v=d.dot(f,C);d.multiplyByScalar(C,Qd[T]/v,C),d.add(C,e,C)}else{const w=i.offCenterFrustum;c(w)&&(i=w);const v=Qd[T],P=Qd[T+1];C.x=(C.x*(i.right-i.left)+i.left+i.right)*.5,C.y=(C.y*(i.top-i.bottom)+i.bottom+i.top)*.5,C.z=(C.z*(v-P)-v-P)*.5,C.w=1,L.multiplyByVector(g,C,C)}o[12*T+x*3]=C.x,o[12*T+x*3+1]=C.y,o[12*T+x*3+2]=C.z}};qh.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5;let l=new Float64Array(3*4*6);qh._computeNearFarPlanes(i,o,t,n,l);let u=3*4*2;l[u]=l[3*4],l[u+1]=l[3*4+1],l[u+2]=l[3*4+2],l[u+3]=l[0],l[u+4]=l[1],l[u+5]=l[2],l[u+6]=l[3*3],l[u+7]=l[3*3+1],l[u+8]=l[3*3+2],l[u+9]=l[3*7],l[u+10]=l[3*7+1],l[u+11]=l[3*7+2],u+=3*4,l[u]=l[3*5],l[u+1]=l[3*5+1],l[u+2]=l[3*5+2],l[u+3]=l[3],l[u+4]=l[3+1],l[u+5]=l[3+2],l[u+6]=l[0],l[u+7]=l[1],l[u+8]=l[2],l[u+9]=l[3*4],l[u+10]=l[3*4+1],l[u+11]=l[3*4+2],u+=3*4,l[u]=l[3],l[u+1]=l[3+1],l[u+2]=l[3+2],l[u+3]=l[3*5],l[u+4]=l[3*5+1],l[u+5]=l[3*5+2],l[u+6]=l[3*6],l[u+7]=l[3*6+1],l[u+8]=l[3*6+2],l[u+9]=l[3*2],l[u+10]=l[3*2+1],l[u+11]=l[3*2+2],u+=3*4,l[u]=l[3*2],l[u+1]=l[3*2+1],l[u+2]=l[3*2+2],l[u+3]=l[3*6],l[u+4]=l[3*6+1],l[u+5]=l[3*6+2],l[u+6]=l[3*7],l[u+7]=l[3*7+1],l[u+8]=l[3*7+2],l[u+9]=l[3*3],l[u+10]=l[3*3+1],l[u+11]=l[3*3+2],r||(l=l.subarray(3*4));const h=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:l})});if(c(s.normal)||c(s.tangent)||c(s.bitangent)||c(s.st)){const _=c(s.normal)?new Float32Array(12*a):void 0,g=c(s.tangent)?new Float32Array(3*4*a):void 0,m=c(s.bitangent)?new Float32Array(3*4*a):void 0,b=c(s.st)?new Float32Array(2*4*a):void 0,T=DW,x=PW,C=OW,w=d.negate(T,B2e),v=d.negate(x,z2e),P=d.negate(C,U2e);u=0,r&&(Im(u,_,g,m,b,P,T,x),u+=3*4),Im(u,_,g,m,b,C,w,x),u+=3*4,Im(u,_,g,m,b,w,P,x),u+=3*4,Im(u,_,g,m,b,v,P,w),u+=3*4,Im(u,_,g,m,b,T,C,x),u+=3*4,Im(u,_,g,m,b,x,C,w),c(_)&&(h.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:_})),c(g)&&(h.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g})),c(m)&&(h.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m})),c(b)&&(h.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:b}))}const f=new Uint16Array(6*a);for(let _=0;_<a;++_){const g=_*6,m=_*4;f[g]=m,f[g+1]=m+1,f[g+2]=m+2,f[g+3]=m,f[g+4]=m+2,f[g+5]=m+3}return new Tt({attributes:h,indices:f,primitiveType:ze.TRIANGLES,boundingSphere:se.fromVertices(l)})};const v1=0,k2e=1;function D0(e){A.typeOf.object("options",e),A.typeOf.object("options.frustum",e.frustum),A.typeOf.object("options.origin",e.origin),A.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=y(e._drawNearPlane,!0);let r,s;t instanceof _n?(r=v1,s=_n.packedLength):t instanceof It&&(r=k2e,s=It.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=_e.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+d.packedLength+_e.packedLength}D0.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t),n=y(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===v1?(_n.pack(o,t,n),n+=_n.packedLength):(It.pack(o,t,n),n+=It.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,_e.pack(e._orientation,t,n),n+=_e.packedLength,t[n]=e._drawNearPlane?1:0,t};const V2e=new _n,H2e=new It,G2e=new _e,j2e=new d;D0.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++];let o;i===v1?(o=_n.unpack(e,t,V2e),t+=_n.packedLength):(o=It.unpack(e,t,H2e),t+=It.packedLength);const r=d.unpack(e,t,j2e);t+=d.packedLength;const s=_e.unpack(e,t,G2e);t+=_e.packedLength;const a=e[t]===1;if(!c(n))return new D0({frustum:o,origin:r,orientation:s,_drawNearPlane:a});const l=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(l),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=_e.clone(s,n._orientation),n._drawNearPlane=a,n};D0.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(3*4*2);qh._computeNearFarPlanes(i,o,t,n,s);const a=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s})});let l,u;const h=r?2:1,f=new Uint16Array(8*(h+1));let _=r?0:1;for(;_<2;++_)l=r?_*8:0,u=_*4,f[l]=u,f[l+1]=u+1,f[l+2]=u+1,f[l+3]=u+2,f[l+4]=u+2,f[l+5]=u+3,f[l+6]=u+3,f[l+7]=u;for(_=0;_<2;++_)l=(h+_)*8,u=_*4,f[l]=u,f[l+1]=u+4,f[l+2]=u+1,f[l+3]=u+5,f[l+4]=u+2,f[l+5]=u+6,f[l+6]=u+3,f[l+7]=u+7;return new Tt({attributes:a,indices:f,primitiveType:ze.LINES,boundingSphere:se.fromVertices(s)})};function ph(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.camera))throw new E("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=y(e.color,z.CYAN),this._updateOnChange=y(e.updateOnChange,!0),this.show=y(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}const W2e=new d,q2e=new $,Y2e=new _e,$2e=new _n,X2e=new xs,Q2e=new It,K2e=new Ki,Z2e=new z,J2e=[1,1e5];ph.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(t.length===0){const r=this._camera,s=r.frustum;let a;s instanceof _n?a=$2e:s instanceof xs?a=X2e:s instanceof It?a=Q2e:a=K2e,a=s.clone(a);let l,u=this._frustumSplits;!c(u)||u.length<=1?(u=J2e,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,l=1):l=u.length-1;const h=r.positionWC,f=r.directionWC,_=r.upWC;let g=r.rightWC;g=d.negate(g,W2e);const m=q2e;$.setColumn(m,0,g,m),$.setColumn(m,1,_,m),$.setColumn(m,2,f,m);const b=_e.fromRotationMatrix(m,Y2e);for(t.length=n.length=l,i=0;i<l;++i)a.near=u[i],a.far=u[i+1],t[i]=new Mt({geometryInstances:new Gt({geometry:new qh({origin:h,orientation:b,frustum:a,_drawNearPlane:i===0}),attributes:{color:$t.fromColor(z.fromAlpha(this._color,.1,Z2e))},id:this.id,pickPrimitive:this}),appearance:new tn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Mt({geometryInstances:new Gt({geometry:new D0({origin:h,orientation:b,frustum:a,_drawNearPlane:i===0}),attributes:{color:$t.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};ph.prototype.isDestroyed=function(){return!1};ph.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 ve(this)};function lb(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=y(e,0)}const oy=Yt.supportsTypedArrays()?new Float32Array(12):[],E3=new d,w3=new d,Iv=new d,S3=new d,pA=new d;function eBe(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof It)o=d.ZERO,r=i.rightWC,s=i.upWC;else{const f=i.positionWC,_=d.multiplyComponents(e.oneOverRadii,f,E3),g=d.normalize(_,w3),m=d.normalize(d.cross(d.UNIT_Z,_,Iv),Iv),b=d.normalize(d.cross(g,m,S3),S3),T=d.magnitude(_),x=Math.sqrt(T*T-1);o=d.multiplyByScalar(g,1/T,E3);const C=x/T;r=d.multiplyByScalar(m,C,w3),s=d.multiplyByScalar(b,C,Iv)}const a=d.add(o,s,pA);d.subtract(a,r,a),d.multiplyComponents(n,a,a),d.pack(a,oy,0);const l=d.subtract(o,s,pA);d.subtract(l,r,l),d.multiplyComponents(n,l,l),d.pack(l,oy,3);const u=d.add(o,s,pA);d.add(u,r,u),d.multiplyComponents(n,u,u),d.pack(u,oy,6);const h=d.subtract(o,s,pA);return d.add(h,r,h),d.multiplyComponents(n,h,h),d.pack(h,oy,9),oy}lb.prototype.update=function(e){if(this._mode=e.mode,e.mode!==oe.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid.radii,i=new ae(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(c(this._command)||(this._rs=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new Ze({renderState:this._rs,boundingVolume:new se(d.ZERO,i.maximumRadius),pass:xe.OPAQUE,owner:this})),!c(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const s=new Oe({sources:[O1e]}),a=new Oe({sources:[P1e]});o&&(a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=eBe(i,e);if(c(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const s=new Tt({attributes:{position:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:ze.TRIANGLES});this._va=Ci.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:ke.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};lb.prototype.execute=function(e,t){this._mode===oe.SCENE3D&&this._command.execute(e,t)};lb.prototype.isDestroyed=function(){return!1};lb.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};function sd(){}const tBe=/\bgl_FragDepth\b/,nBe=/\bdiscard\b/;function iBe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!c(n)){const i=t._attributeLocations;let o=t.fragmentShaderSource,r,s=!1;const a=o.sources;let l=a.length;for(r=0;r<l;++r)if(tBe.test(a[r])||nBe.test(a[r])){s=!0;break}let u=!1;const h=o.defines;for(l=h.length,r=0;r<l;++r)if(h[r]==="LOG_DEPTH"){u=!0;break}let f;!s&&!u?(f=`void main() { out_FragColor = vec4(1.0); } `,o=new Oe({sources:[f]})):!s&&u&&(f=`void main() { out_FragColor = vec4(1.0); czm_writeLogDepth(); } `,o=new Oe({defines:["LOG_DEPTH"],sources:[f]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function oBe(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!c(i)){const o=Ue.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=Ue.fromCache(o),n[t.id]=i}return i}sd.createDepthOnlyDerivedCommand=function(e,t,n,i){c(i)||(i={});let o,r;return c(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=Ze.shallowClone(t,i.depthOnlyCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=iBe(n,t.shaderProgram),i.depthOnlyCommand.renderState=oBe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};const rBe=/\s+czm_writeLogDepth\(/,sBe=/\s+czm_vertexLogDepth\(/;function aBe(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!c(i)){const o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=c(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a,l,u=!1,h=r.sources,f=h.length;for(a=0;a<f;++a)if(sBe.test(h[a])){u=!0;break}if(!u){for(a=0;a<f;++a)h[a]=Oe.replaceMain(h[a],"czm_log_depth_main");l=` void main() { czm_log_depth_main(); czm_vertexLogDepth(); } `,h.push(l)}for(h=s.sources,f=h.length,u=!1,a=0;a<f;++a)rBe.test(h[a])&&(u=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(u=!0);let _="";if(!u){for(a=0;a<f;a++)h[a]=Oe.replaceMain(h[a],"czm_log_depth_main");_+=` void main() { czm_log_depth_main(); czm_writeLogDepth(); } `}h.push(_),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}sd.createLogDepthCommand=function(e,t,n){c(n)||(n={});let i;return c(n.command)&&(i=n.command.shaderProgram),n.command=Ze.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=aBe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function cBe(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!c(i)){const o=t._attributeLocations;let r=t.fragmentShaderSource;const s=r.sources,a=s.length,u=s.some(_=>_.includes("out_FragData"))?"out_FragData_0":"out_FragColor",h=`void main () { czm_non_pick_main(); if (${u}.a == 0.0) { discard; } ${u} = ${n}; } `,f=new Array(a+1);for(let _=0;_<a;++_)f[_]=Oe.replaceMain(s[_],"czm_non_pick_main");f[a]=h,r=new Oe({sources:f,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function lBe(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!c(i)){const o=Ue.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=Ue.fromCache(o),n[t.id]=i}return i}sd.createPickDerivedCommand=function(e,t,n,i){c(i)||(i={});let o,r;return c(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=Ze.shallowClone(t,i.pickCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=cBe(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=lBe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function uBe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!c(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=c(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}sd.createHdrCommand=function(e,t,n){c(n)||(n={});let i;return c(n.command)&&(i=n.command.shaderProgram),n.command=Ze.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=uBe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function oE(e){if(!c(e))throw new E("scene is required.");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(i){const o=i.alpha;if(!c(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=R.toRadians(o),t._beta=R.toRadians(i.beta),t._gamma=R.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}const dBe=new _e,v3=new _e,hBe=new $;function fBe(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=_e.fromAxisAngle(o,n,v3),l=_e.fromAxisAngle(r,i,dBe),u=_e.multiply(l,a,l),h=_e.fromAxisAngle(s,t,v3);_e.multiply(h,u,u);const f=$.fromQuaternion(u,hBe);$.multiplyByVector(f,r,r),$.multiplyByVector(f,s,s),$.multiplyByVector(f,o,o)}oE.prototype.update=function(){if(!c(this._alpha))return;c(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;fBe(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};oE.prototype.isDestroyed=function(){return!1};oE.prototype.destroy=function(){return this._removeListener(),ve(this)};function RW(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}const ax=[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],nu=[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<nu.length;++e)nu[e]*=1e6;const NW=nu[1],WD=nu[nu.length-1];for(let e=0;e<nu.length;++e)nu[e]=(nu[e]-WD)/(NW-WD);let _r=0;function pBe(e){const t=ax,n=t.length;if(e<t[0])return _r=0,_r;if(e>t[n-1])return _r=n-2,_r;if(e>=t[_r]){if(_r+1<n&&e<t[_r+1])return _r;if(_r+2<n&&e<t[_r+2])return++_r,_r}else if(_r-1>=0&&e>=t[_r-1])return--_r,_r;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return _r=i,_r}const mBe=new d;RW.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const n=e.camera,i=n.positionCartographic;if(!c(i)||i.height>8e5||e.mode!==oe.SCENE3D){e.fog.enabled=!1,e.fog.density=0;return}const o=i.height,r=pBe(o),s=R.clamp((o-ax[r])/(ax[r+1]-ax[r]),0,1);let a=R.lerp(nu[r],nu[r+1],s);const l=this.density*1e6,u=l/NW*WD;a=a*(l-u)*1e-6;const h=d.normalize(n.positionWC,mBe),f=Math.abs(d.dot(n.directionWC,h));a*=1-f,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};function _Be(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=oe.SCENE3D,this.morphTime=oe.getMorphTime(oe.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,pickVoxel:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,renderable:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.atmosphere=void 0,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=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}const br={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},Yf=br.DERIVED_COMMANDS_MAXIMUM_LENGTH,MW=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function Wp(){this._frontFaceAlphaByDistance=new vt(0,1,0,1),this._backFaceAlphaByDistance=new vt(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=ce.clone(ce.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(Yf),this._derivedBlendCommandTypes=new Array(Yf),this._derivedPickCommandTypes=new Array(Yf),this._derivedCommandTypesToUpdate=new Array(Yf),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(Wp.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}}});Wp.prototype.update=function(e){const t=e.globe;if(!c(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=I3(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=I3(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=D3(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=D3(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=TBe(this,e,t),this._sunVisibleThroughGlobe=gBe(this,e),this._environmentVisible=yBe(this,e),this._useDepthPlane=bBe(this,e),this._numberOfTextureUniforms=ABe(this),this._rectangle=ce.clone(t.translucency.rectangle,this._rectangle),xBe(this,e)};function I3(e,t,n,i){return e?c(n)?(vt.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 D3(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function gBe(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function yBe(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function bBe(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function TBe(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==oe.SCENE2D&&t.context.depthTexture}function ABe(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function xBe(e,t){e._derivedCommandsLength=Dv(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=Dv(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=Dv(e,t,!1,!0,e._derivedPickCommandTypes);let n,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 o=0;for(n=0;n<Yf;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;const r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!c(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=BBe())}function Dv(e,t,n,i,o){let r=0;const s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;const l=t.cameraUnderground,u=e._requiresManualDepthTest,h=i?br.PICK_FRONT_FACE:u?br.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:br.TRANSLUCENT_FRONT_FACE,f=i?br.PICK_BACK_FACE:u?br.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:br.TRANSLUCENT_BACK_FACE;return t.mode===oe.SCENE2D?(o[r++]=br.DEPTH_ONLY_FRONT_FACE,o[r++]=h,r):(a?(n||(o[r++]=br.DEPTH_ONLY_FRONT_AND_BACK_FACE),l?(o[r++]=h,o[r++]=f):(o[r++]=f,o[r++]=h)):l?(n||(o[r++]=br.DEPTH_ONLY_BACK_FACE),o[r++]=br.OPAQUE_FRONT_FACE,o[r++]=f):(n||(o[r++]=br.DEPTH_ONLY_FRONT_FACE),o[r++]=br.OPAQUE_BACK_FACE,o[r++]=h),r)}function hc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function P3(e,t){return e.indexOf(t)>-1}function CBe(e,t){hc(e.defines,"TRANSLUCENT"),hc(t.defines,"TRANSLUCENT")}function EBe(e,t){hc(e.defines,"GROUND_ATMOSPHERE"),hc(t.defines,"GROUND_ATMOSPHERE"),hc(e.defines,"FOG"),hc(t.defines,"FOG"),hc(e.defines,"TRANSLUCENT"),hc(t.defines,"TRANSLUCENT")}function Pv(e,t){if(P3(t.defines,"TILE_LIMIT_RECTANGLE")||P3(t.defines,"ENABLE_CLIPPING_PLANES"))return;const n=`void main() { out_FragColor = vec4(1.0); } `;t.sources=[n]}function I1(e,t){const n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=Oe.replaceMain(n[r],"czm_globe_translucency_main");const o=` uniform sampler2D u_classificationTexture; void main() { vec2 st = gl_FragCoord.xy / czm_viewport.zw; #ifdef MANUAL_DEPTH_TEST float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st)); if (logDepthOrDepth != 0.0) { vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); float depthEC = eyeCoordinate.z / eyeCoordinate.w; if (v_positionEC.z < depthEC) { discard; } } #endif czm_globe_translucency_main(); vec4 classificationColor = texture(u_classificationTexture, st); if (classificationColor.a > 0.0) { // Reverse premultiplication process to get the correct composited result of the classification primitives classificationColor.rgb /= classificationColor.a; } out_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + out_FragColor * (1.0 - classificationColor.a); } `;n.push(o)}function FW(e,t){I1(e,t),hc(e.defines,"GROUND_ATMOSPHERE"),hc(t.defines,"GROUND_ATMOSPHERE"),hc(e.defines,"FOG"),hc(t.defines,"FOG")}function wBe(e,t){I1(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function SBe(e,t){FW(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function O3(e,t){const n=`uniform sampler2D u_classificationTexture; void main() { vec2 st = gl_FragCoord.xy / czm_viewport.zw; vec4 pickColor = texture(u_classificationTexture, st); if (pickColor == vec4(0.0)) { discard; } out_FragColor = pickColor; } `;t.sources=[n]}function vBe(e,t,n,i,o,r){if(!c(o))return t;if(!i&&c(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!c(s)){const a=t._attributeLocations,l=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();l.defines=c(l.defines)?l.defines.slice(0):[],u.defines=c(u.defines)?u.defines.slice(0):[],o(l,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:a})}return s}function IBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0}function DBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0}function PBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function OBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function LBe(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function L3(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=Zn.ALPHA_BLEND}function R3(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=Zn.ALPHA_BLEND}function RBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function NBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function MBe(e,t,n,i,o){if(!c(i))return e;if(!n&&c(t))return t;let r=o[e.id];if(!c(r)){const s=Ue.getState(e);i(s),r=Ue.fromCache(s),o[e.id]=r}return r}function Dm(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function FBe(e,t,n,i,o){return c(o)?!i&&c(n)?n:jt(t,o(e),!1):t}function Kc(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function BBe(){return[new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:CBe,getRenderStateFunction:IBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:EBe,getRenderStateFunction:DBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:PBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:OBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:LBe,getUniformMapFunction:void 0}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:I1,getRenderStateFunction:L3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:FW,getRenderStateFunction:R3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:wBe,getRenderStateFunction:L3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:SBe,getRenderStateFunction:R3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:O3,getRenderStateFunction:RBe,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:O3,getRenderStateFunction:NBe,getUniformMapFunction:Dm})]}const N3=new Array(Yf),M3=new Array(Yf);Wp.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)M3[o]=this._derivedCommandPacks[n[o]],N3[o]=MW[n[o]];zBe(this,e,i,n,N3,M3,t)}};function zBe(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency;const l=e._derivedCommandsDirty;if(t.dirty||!c(a)||l){t.dirty=!1,c(a)||(a={},t.derivedCommands.globeTranslucency=a);const u=s.frameNumber,h=y(a.uniformMapDirtyFrame,0),f=y(a.shaderProgramDirtyFrame,0),_=y(a.renderStateDirtyFrame,0),g=a.uniformMap!==t.uniformMap,m=a.shaderProgramId!==t.shaderProgram.id,b=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=u),m&&(a.shaderProgramDirtyFrame=u),b&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let T=0;T<n;++T){const x=r[T],C=i[T],w=o[T];let v=a[w],P,N,k;c(v)?(P=v.uniformMap,N=v.shaderProgram,k=v.renderState):(P=void 0,N=void 0,k=void 0),v=Ze.shallowClone(t,v),a[w]=v;const M=y(v.derivedCommands.uniformMapDirtyFrame,0),U=y(v.derivedCommands.shaderProgramDirtyFrame,0),B=y(v.derivedCommands.renderStateDirtyFrame,0),S=g||M<h,D=m||U<f,p=b||B<_;S&&(v.derivedCommands.uniformMapDirtyFrame=u),D&&(v.derivedCommands.shaderProgramDirtyFrame=u),p&&(v.derivedCommands.renderStateDirtyFrame=u),v.derivedCommands.type=C,v.pass=x.pass,v.pickOnly=x.pickOnly,v.uniformMap=FBe(e,t.uniformMap,P,S,x.getUniformMapFunction),v.shaderProgram=vBe(s.context,t.shaderProgram,N,D,x.getShaderProgramFunction,w),v.renderState=MBe(t.renderState,k,p,x.getRenderStateFunction,x.renderStateCache)}}}Wp.prototype.pushDerivedCommands=function(e,t,n){const i=n.passes.pick||n.passes.pickVoxel;if(i&&t)return;let o=this._derivedCommandTypes,r=this._derivedCommandsLength;if(i?(o=this._derivedPickCommandTypes,r=this._derivedPickCommandsLength):t&&(o=this._derivedBlendCommandTypes,r=this._derivedBlendCommandsLength),r===0){n.commandList.push(e);return}const s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){const l=MW[o[a]];n.commandList.push(s[l])}};function BW(e,t,n,i,o,r,s){for(let a=0;a<t;++a){const l=e[a],u=l.derivedCommands.type;(!c(s)||s.indexOf(u)>-1)&&n(l,i,o,r)}}function F3(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}const UBe=[br.OPAQUE_FRONT_FACE,br.OPAQUE_BACK_FACE],kBe=[br.DEPTH_ONLY_FRONT_FACE,br.DEPTH_ONLY_BACK_FACE,br.DEPTH_ONLY_FRONT_AND_BACK_FACE];Wp.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[xe.GLOBE],a=e.indices[xe.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),BW(s,a,t,i,r,o,UBe))};Wp.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[xe.GLOBE],a=e.indices[xe.GLOBE],l=e.commands[xe.TERRAIN_CLASSIFICATION],u=e.indices[xe.TERRAIN_CLASSIFICATION];if(a===0||u===0)return;const h=this._frontFaceTranslucent,f=this._backFaceTranslucent;if((!h||!f)&&F3(l,u,t,i,r,o),!h&&!f)return;this._globeTranslucencyFramebuffer=n;const _=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,BW(s,a,t,i,r,o,kBe),r.depthTexture){const m=n.packDepth(r,o);r.uniformState.globeDepthTexture=m}F3(l,u,t,i,r,o),r.uniformState.globeDepthTexture=_,o.framebuffer=g};const Ep=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; void main() { out_FragColor = texture(colorTexture, v_textureCoordinates); } `;function kl(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new on({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new on({depthStencil:!0,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 bi({color:new z(0,0,0,0),owner:this}),this._clearCommand=new bi({color:new z(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(kl.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});kl.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const VBe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:0,mask:At.CLASSIFICATION_MASK},blending:Zn.ALPHA_BLEND},HBe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:0,mask:At.CLASSIFICATION_MASK},blending:Zn.ALPHA_BLEND},GBe={depthMask:!0,depthTest:{enabled:!0},stencilTest:At.setCesium3DTileBit(),stencilMask:At.CESIUM_3D_TILE_MASK,blending:Zn.ALPHA_BLEND},jBe=`uniform sampler2D colorTexture; uniform sampler2D depthTexture; uniform sampler2D classifiedTexture; in vec2 v_textureCoordinates; void main() { vec4 color = texture(colorTexture, v_textureCoordinates); if (color.a == 0.0) { discard; } bool isClassified = all(equal(texture(classifiedTexture, v_textureCoordinates), vec4(0.0))); #ifdef UNCLASSIFIED vec4 highlightColor = czm_invertClassificationColor; if (isClassified) { discard; } #else vec4 highlightColor = vec4(1.0); if (!isClassified) { discard; } #endif out_FragColor = color * highlightColor; gl_FragDepth = texture(depthTexture, v_textureCoordinates).r; } `,WBe=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; void main() { vec4 color = texture(colorTexture, v_textureCoordinates); if (color.a == 0.0) { discard; } #ifdef UNCLASSIFIED out_FragColor = color * czm_invertClassificationColor; #else out_FragColor = color; #endif } `;kl.prototype.update=function(e,t,n){const i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,l=!c(i)||i.width!==s||i.height!==a;if((l||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._previousFramebuffer)||(this._depthStencilTexture=new xt({context:e,width:s,height:a,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new cl({context:e,width:s,height:a,format:qu.DEPTH24_STENCIL8,numSamples:t})))),!c(this._fbo.framebuffer)||l||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,h;c(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),h=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,h=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),c(h)&&this._fbo.setDepthStencilRenderbuffer(h),this._fbo.update(e,s,a,t),c(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(c(this._rsUnclassified)||(this._rsUnclassified=Ue.fromCache(VBe),this._rsClassified=Ue.fromCache(HBe),this._rsDefault=Ue.fromCache(GBe)),!c(this._unclassifiedCommand)||o||r){c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const u=c(this._previousFramebuffer)?WBe:jBe,h=new Oe({defines:["UNCLASSIFIED"],sources:[u]}),f=new Oe({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(h,{renderState:c(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(f,{renderState:c(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),c(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),c(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(Ep,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};kl.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};kl.prototype.clear=function(e,t){c(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};kl.prototype.executeClassified=function(e,t){if(!c(this._previousFramebuffer)){const n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)};kl.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};kl.prototype.isDestroyed=function(){return!1};kl.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),ve(this)};function cx(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(cx.prototype,{total:{get:function(){return this._total}}});function Sh(e){if(c(e)&&e.length!==nl.NUMBER_OF_JOB_TYPES)throw new E("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");const t=new Array(nl.NUMBER_OF_JOB_TYPES);t[nl.TEXTURE]=new cx(c(e)?e[nl.TEXTURE]:10),t[nl.PROGRAM]=new cx(c(e)?e[nl.PROGRAM]:10),t[nl.BUFFER]=new cx(c(e)?e[nl.BUFFER]:30);const n=t.length;let i,o=0;for(i=0;i<n;++i)o+=t[i].total;const r=new Array(n);for(i=0;i<n;++i)r[i]=!1;this._totalBudget=o,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=r}Sh.getTimestamp=xo;Object.defineProperties(Sh.prototype,{totalBudget:{get:function(){return this._totalBudget}}});Sh.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};Sh.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const i=e[n];i.starvedLastFrame=i.starvedThisFrame,i.starvedThisFrame=!1,i.usedThisFrame=0,i.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0};Sh.prototype.execute=function(e,t){const n=this._budgets,i=n[t],o=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&o)return i.starvedThisFrame=!0,!1;let r;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){const l=n.length;let u;for(u=0;u<l&&(r=n[u],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++u);if(u===l&&o)return!1;o&&(i.starvedThisFrame=!0)}const s=Sh.getTimestamp();e.execute();const a=Sh.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};function rE(e){e=y(e,y.EMPTY_OBJECT);const t=Do(e.container);if(!c(t))throw new E("container is required");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 o=document.createElement("div");o.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),o.appendChild(this._msText),n.appendChild(o),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=xo(),this._lastMsSampleTime=xo(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}Object.defineProperties(rE.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});rE.prototype.update=function(e){const t=xo(),n=y(e,!0);this._fpsFrameCount++;const i=t-this._lastFpsSampleTime;if(i>1e3){let r="N/A";n&&(r=this._fpsFrameCount*1e3/i|0),this._fpsText.nodeValue=`${r} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const o=t-this._lastMsSampleTime;if(o>200){let r="N/A";n&&(r=(o/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${r} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}};rE.prototype.destroy=function(){return ve(this)};function qp(){this._framebuffer=new on,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(qp.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function qBe(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function YBe(e,t,n){if(!c(e._copyDepthCommand)){const i=`uniform highp sampler2D u_texture; in vec2 v_textureCoordinates; void main() { out_FragColor = czm_packDepth(texture(u_texture, v_textureCoordinates).r); } `;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:Ue.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}qp.prototype.update=function(e,t){qBe(this,e,t),YBe(this,e,t)};const $Be=new te,XBe=new te(1,1/255,1/65025,1/16581375);qp.prototype.getDepth=function(e,t,n){if(!c(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=te.unpack(i,0,$Be);return te.divideByScalar(o,255,o),te.dot(o,XBe)};qp.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};qp.prototype.isDestroyed=function(){return!1};qp.prototype.destroy=function(){return this._framebuffer.destroy(),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=c(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),ve(this)};function QBe(e,t){this.near=y(e,0),this.far=y(t,0);const n=xe.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}const qD=`uniform highp sampler2D u_depthTexture; in vec2 v_textureCoordinates; void main() { out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r); } `;function Cu(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new on,this._tempCopyDepthFramebuffer=new on,this._updateDepthFramebuffer=new on({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 Re,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}Object.defineProperties(Cu.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}});function KBe(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function zW(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Re.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Re.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Re.clone(o.viewport,e._scissorRectangle),s=!0),(!c(e._rs)||!Re.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Zn.ALPHA_BLEND}),e._rsUpdate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})),c(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,c(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,c(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,c(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,c(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new bi({color:new z(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}Cu.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,l=o?e.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,l),this._copyDepthFramebuffer.update(e,s,a),zW(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};Cu.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};Cu.prototype.executeCopyDepth=function(e,t){c(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};Cu.prototype.executeUpdateDepth=function(e,t,n,i){const o=c(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(c(this._updateDepthCommand)){if(!c(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const r=this._copyDepthFramebuffer.getColorTexture().width,s=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,r,s);const a=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(a,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,r,s),zW(this,e,r,s,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}return}c(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)};Cu.prototype.executeCopyColor=function(e,t){c(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};Cu.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;c(i)&&(z.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};Cu.prototype.isDestroyed=function(){return!1};Cu.prototype.destroy=function(){return KBe(this),c(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),c(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),c(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),ve(this)};function Yp(){this._framebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new on,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new Re,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(Yp.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()}}});function ZBe(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function JBe(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function e3e(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Re.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Re.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Re.clone(o.viewport,e._scissorRectangle),s=!0),(!c(e._renderState)||!Re.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),c(e._clearCommand)||(e._clearCommand=new bi({color:new z(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}Yp.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;JBe(this,n,o,r,e),e3e(this,n,o,r,i),this._useHdr=e};Yp.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};Yp.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};Yp.prototype.isDestroyed=function(){return!1};Yp.prototype.destroy=function(){return ZBe(this),ve(this)};function Pd(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;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 on({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new on({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new on({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new on({createColorAttachments:!1}),this._opaqueClearCommand=new bi({color:new z(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new bi({color:new z(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new bi({color:new z(0,0,0,0),owner:this}),this._alphaClearCommand=new bi({color:new z(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 Re,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function UW(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function YD(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function kW(e){UW(e),YD(e)}function t3e(e,t,n,i){UW(e),e._accumulationTexture=new xt({context:t,width:n,height:i,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function n3e(e,t){YD(e);const n=J.FRAMEBUFFER_COMPLETE;let i=!0;const{width:o,height:r}=e._accumulationTexture;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),(e._translucentFBO.status!==n||e._adjustTranslucentFBO.status!==n)&&(YD(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);const s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,l=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!l||!u)&&(kW(e),e._translucentMultipassSupport=!1,i=!1)}return i}Pd.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();const{width:r,height:s}=this._opaqueTexture,a=this._accumulationTexture,l=!c(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((l||u)&&(this._numSamples=o,t3e(this,e,r,s)),(!c(this._translucentFBO.framebuffer)||l||u)&&!n3e(this,e))return;this._useHDR=i;const h=this;let f,_;c(this._compositeCommand)||(f=new Oe({sources:[D1e]}),this._translucentMRTSupport&&f.defines.push("MRT"),_={u_opaque:function(){return h._opaqueTexture},u_accumulation:function(){return h._accumulationTexture},u_revealage:function(){return h._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this})),c(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(f=new Oe({defines:["MRT"],sources:[SB]}),_={u_bgColor:function(){return h._translucentMRTClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this})):this._translucentMultipassSupport&&(f=new Oe({sources:[SB]}),_={u_bgColor:function(){return h._translucentMultipassClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this}),_={u_bgColor:function(){return h._alphaClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this}))),this._viewport.width=r,this._viewport.height=s;const g=!Re.equals(this._viewport,t.viewport);let m=g!==this._useScissorTest;this._useScissorTest=g,Re.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Re.clone(t.viewport,this._scissorRectangle),m=!0),(!c(this._rs)||!Re.equals(this._viewport,this._rs.viewport)||m)&&(this._rs=Ue.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),c(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const i3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ONE,functionDestinationRgb:Yi.ONE,functionSourceAlpha:Yi.ZERO,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA},o3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ONE,functionDestinationRgb:Yi.ONE,functionSourceAlpha:Yi.ONE,functionDestinationAlpha:Yi.ONE},r3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ZERO,functionDestinationRgb:Yi.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:Yi.ZERO,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA};function D1(e,t,n,i){let o=n[i.id];if(!c(o)){const r=Ue.getState(i);r.depthMask=!1,r.blending=t,o=Ue.fromCache(r),n[i.id]=o}return o}function s3e(e,t,n){return D1(t,i3e,e._translucentRenderStateCache,n)}function a3e(e,t,n){return D1(t,o3e,e._translucentRenderStateCache,n)}function c3e(e,t,n){return D1(t,r3e,e._alphaRenderStateCache,n)}const l3e=` vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a; float ai = czm_out_FragColor.a; float wzi = czm_alphaWeight(ai); out_FragData_0 = vec4(Ci * wzi, ai); out_FragData_1 = vec4(ai * wzi); `,u3e=` vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a; float ai = czm_out_FragColor.a; float wzi = czm_alphaWeight(ai); out_FragColor = vec4(Ci, ai) * wzi; `,d3e=` float ai = czm_out_FragColor.a; out_FragColor = vec4(ai); `;function P1(e,t,n,i){const{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(c(r))return r;const s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map(function(h){return Oe.replaceMain(h,"czm_translucent_main").replace(/out_FragColor/g,"czm_out_FragColor").replace(/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,"").replace(/\bdiscard\b/g,"czm_discard = true").replace(/czm_phong/g,"czm_translucentPhong")}),a.sources.splice(0,0,`vec4 czm_out_FragColor; bool czm_discard = false; `);const l=[...i.matchAll(/out_FragData_(\d+)/g)];let u="";for(let h=0;h<l.length;h++){const f=l[h];u=`layout (location = ${f[1]}) out vec4 ${f[0]}; ${u}`}return a.sources.push(u),a.sources.push(`void main() { czm_translucent_main(); if (czm_discard) { discard; } ${i}} `),o.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:s})}function h3e(e,t){return P1(e,t,"translucentMRT",l3e)}function f3e(e,t){return P1(e,t,"translucentMultipass",u3e)}function p3e(e,t){return P1(e,t,"alphaMultipass",d3e)}Pd.prototype.createDerivedCommands=function(e,t,n){if(c(n)||(n={}),this._translucentMRTSupport){let a,l;return c(n.translucentCommand)&&(a=n.translucentCommand.shaderProgram,l=n.translucentCommand.renderState),n.translucentCommand=Ze.shallowClone(e,n.translucentCommand),!c(a)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=h3e(t,e.shaderProgram),n.translucentCommand.renderState=s3e(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=a,n.translucentCommand.renderState=l),n}let i,o,r,s;return c(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=Ze.shallowClone(e,n.translucentCommand),n.alphaCommand=Ze.shallowClone(e,n.alphaCommand),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=f3e(t,e.shaderProgram),n.translucentCommand.renderState=a3e(this,t,e.renderState),n.alphaCommand.shaderProgram=p3e(t,e.shaderProgram),n.alphaCommand.renderState=c3e(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o,n.alphaCommand.shaderProgram=r,n.alphaCommand.renderState=s),n};function m3e(e,t,n,i,o,r){let s,a,l;const{context:u,frameState:h}=t,{useLogDepth:f,shadowState:_}=h,g=t._hdr,m=i.framebuffer,b=_.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(u,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(u,i);const T=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,l=0;l<o.length;++l)s=o[l],s=f?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,T);for(c(r)&&(s=r.unclassifiedCommand,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,T)),i.framebuffer=e._alphaFBO.framebuffer,l=0;l<o.length;++l)s=o[l],s=f?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,T);c(r)&&(s=r.unclassifiedCommand,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,T)),i.framebuffer=m}function _3e(e,t,n,i,o,r){const{context:s,frameState:a}=t,{useLogDepth:l,shadowState:u}=a,h=t._hdr,f=i.framebuffer,_=u.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const g=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let m,b;for(let T=0;T<o.length;++T)m=o[T],m=l?m.derivedCommands.logDepth.command:m,m=h?m.derivedCommands.hdr.command:m,b=_&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(b,t,s,i,g);c(r)&&(m=r.unclassifiedCommand,b=_&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(b,t,s,i,g)),i.framebuffer=f}Pd.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){_3e(this,e,t,n,i,o);return}m3e(this,e,t,n,i,o)};Pd.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};Pd.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,z.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};Pd.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};Pd.prototype.isDestroyed=function(){return!1};Pd.prototype.destroy=function(){return kW(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),ve(this)};function ub(){this._framebuffer=new on({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(ub.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function g3e(e){e._framebuffer.destroy()}function y3e(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new Lp(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Re},o.viewport=new Re,e._passState=o}ub.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&y3e(this,e);const r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s};ub.prototype.isDestroyed=function(){return!1};ub.prototype.destroy=function(){return g3e(this),ve(this)};function rg(e){const t=new Lp(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Re},t.viewport=new Re,this._context=e,this._fb=new on({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}rg.prototype.begin=function(e,t){const n=this._context,{width:i,height:o}=t;return Re.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};const ry=new z;rg.prototype.end=function(e){const t=y(e.width,1),n=y(e.height,1),i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(t*.5),l=Math.floor(n*.5);let u=0,h=0,f=0,_=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-l<=h&&h<=l){const m=4*((l-h)*t+u+a);ry.red=z.byteToFloat(o[m]),ry.green=z.byteToFloat(o[m+1]),ry.blue=z.byteToFloat(o[m+2]),ry.alpha=z.byteToFloat(o[m+3]);const b=i.getObjectByPickColor(ry);if(c(b))return b}if(u===h||u<0&&-u===h||u>0&&u===1-h){const m=f;f=-_,_=m}u+=f,h+=_}};rg.prototype.readVoxelInfo=function(e){const t=y(e.width,1),n=y(e.height,1),o=this._context.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.floor(t*.5),a=4*(Math.floor(n*.5)*t+r);return o.slice(a,a+4)};rg.prototype.isDestroyed=function(){return!1};rg.prototype.destroy=function(){return this._fb.destroy(),ve(this)};function Eu(){this._numSamples=1,this._colorFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new z(0,0,0,0),this._clearCommand=new bi({color:new z(0,0,0,0),depth:1,owner:this})}function b3e(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(Eu.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});Eu.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};Eu.prototype.clear=function(e,t,n){z.clone(n,this._clearCommand.color),z.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};Eu.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};Eu.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};Eu.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};Eu.prototype.isDestroyed=function(){return!1};Eu.prototype.destroy=function(){return b3e(this),ve(this)};function bc(){}bc.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};bc.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const r=Oe.findPositionVarying(e),s=c(r);if(t&&!s){const a=o.length;for(let u=0;u<a;++u)o[u]=Oe.replaceMain(o[u],"czm_shadow_cast_main");const l=`out vec3 v_positionEC; void main() { czm_shadow_cast_main(); v_positionEC = (czm_inverseProjection * gl_Position).xyz; }`;o.push(l)}return new Oe({defines:i,sources:o})};bc.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=Oe.findPositionVarying(e);const a=c(s);a||(s="v_positionEC");const l=r.length;for(let h=0;h<l;++h)r[h]=Oe.replaceMain(r[h],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`in vec3 v_positionEC; `),u+=`uniform vec4 shadowMap_lightPositionEC; `),i?u+=`void main() { `:u+=`void main() { czm_shadow_cast_main(); if (out_FragColor.a == 0.0) { discard; } `,t?u+=` float distance = length(${s}); if (distance >= shadowMap_lightPositionEC.w) { discard; } distance /= shadowMap_lightPositionEC.w; // radius out_FragColor = czm_packDepth(distance); `:n?u+=` out_FragColor = vec4(1.0); `:u+=` out_FragColor = czm_packDepth(gl_FragCoord.z); `,u+=`} `,r.push(u),new Oe({defines:o,sources:r})};bc.getShadowReceiveShaderKeyword=function(e,t,n,i){const o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,l=e._numberOfCascades>1,u=e.debugCascadeColors,h=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${l}${u}${h}${t}${n}${i}`};bc.createShadowReceiveVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new Oe({defines:i,sources:o})};bc.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=Oe.findNormalVarying(e),s=!i&&c(r)||i&&o,a=Oe.findPositionVarying(e),l=c(a),u=t._usesDepthTexture,h=t._polygonOffsetSupported,f=t._isPointLight,_=t._isSpotLight,g=t._numberOfCascades>1,m=t.debugCascadeColors,b=t.softShadows,T=f?t._pointBias:i?t._terrainBias:t._primitiveBias,x=e.defines.slice(0),C=e.sources.slice(0),w=C.length;for(let N=0;N<w;++N)C[N]=Oe.replaceMain(C[N],"czm_shadow_receive_main");f?x.push("USE_CUBE_MAP_SHADOW"):u&&x.push("USE_SHADOW_DEPTH_TEXTURE"),b&&!f&&x.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?x.push("ENABLE_VERTEX_LIGHTING"):x.push("ENABLE_DAYNIGHT_SHADING")),n&&T.normalShading&&s&&(x.push("USE_NORMAL_SHADING"),T.normalShadingSmooth>0&&x.push("USE_NORMAL_SHADING_SMOOTH"));let v="";f?v+=`uniform samplerCube shadowMap_textureCube; `:v+=`uniform sampler2D shadowMap_texture; `;let P;return l?P=` return vec4(${a}, 1.0); `:P=`#ifndef LOG_DEPTH return czm_windowToEyeCoordinates(gl_FragCoord); #else return vec4(v_logPositionEC, 1.0); #endif `,v+=`uniform mat4 shadowMap_matrix; uniform vec3 shadowMap_lightDirectionEC; uniform vec4 shadowMap_lightPositionEC; uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; #ifdef LOG_DEPTH in vec3 v_logPositionEC; #endif vec4 getPositionEC() { ${P}} vec3 getNormalEC() { ${s?` return normalize(${r}); `:` return vec3(1.0); `}} void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) { ${T.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; float normalOffsetScale = 1.0 - nDotL; vec3 offset = normalOffset * normalOffsetScale * normalEC; positionEC.xyz += offset; `:""}} `,v+=`void main() { czm_shadow_receive_main(); vec4 positionEC = getPositionEC(); vec3 normalEC = getNormalEC(); float depth = -positionEC.z; `,v+=` czm_shadowParameters shadowParameters; shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; `,i?v+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0); `:h||(v+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); `),f?v+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; float distance = length(directionEC); directionEC = normalize(directionEC); float radius = shadowMap_lightPositionEC.w; // Stop early if the fragment is beyond the point light radius if (distance > radius) { return; } vec3 directionWC = czm_inverseViewRotation * directionEC; shadowParameters.depth = distance / radius; shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); shadowParameters.texCoords = directionWC; float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); `:_?v+=` vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); applyNormalOffset(positionEC, normalEC, nDotL); vec4 shadowPosition = shadowMap_matrix * positionEC; // Spot light uses a perspective projection, so perform the perspective divide shadowPosition /= shadowPosition.w; // Stop early if the fragment is not in the shadow bounds if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) { return; } shadowParameters.texCoords = shadowPosition.xy; shadowParameters.depth = shadowPosition.z; shadowParameters.nDotL = nDotL; float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); `:g?v+=` float maxDepth = shadowMap_cascadeSplits[1].w; // Stop early if the eye depth exceeds the last cascade if (depth > maxDepth) { return; } // Get the cascade based on the eye-space depth vec4 weights = czm_cascadeWeights(depth); // Apply normal offset float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); applyNormalOffset(positionEC, normalEC, nDotL); // Transform position into the cascade vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; // Get visibility shadowParameters.texCoords = shadowPosition.xy; shadowParameters.depth = shadowPosition.z; shadowParameters.nDotL = nDotL; float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); // Fade out shadows that are far away float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); visibility = mix(visibility, 1.0, fade); ${m?` // Draw cascade colors for debugging out_FragColor *= czm_cascadeColor(weights); `:""}`:v+=` float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); applyNormalOffset(positionEC, normalEC, nDotL); vec4 shadowPosition = shadowMap_matrix * positionEC; // Stop early if the fragment is not in the shadow bounds if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) { return; } shadowParameters.texCoords = shadowPosition.xy; shadowParameters.depth = shadowPosition.z; shadowParameters.nDotL = nDotL; float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); `,v+=` out_FragColor.rgb *= visibility; } `,C.push(v),new Oe({defines:x,sources:C})};function Wa(e){e=y(e,y.EMPTY_OBJECT);const t=e.context;if(!c(t))throw new E("context is required.");if(!c(e.lightCamera))throw new E("lightCamera is required.");if(c(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new E("Only one or four cascades are supported.");this._enabled=y(e.enabled,!0),this._softShadows=y(e.softShadows,!1),this._normalOffset=y(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=y(e.fromLightSource,!0),this.darkness=y(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=y(e.fadingEnabled,!0),this.maximumDistance=y(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Yt.isInternetExplorer()||Yt.isEdge()||(Yt.isChrome()||Yt.isFirefox())&&Yt.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,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 L,this._shadowMapTexture=void 0,this._lightDirectionEC=new d,this._lightPositionEC=new te,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new sE,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new se,this._isPointLight=y(e.isPointLight,!1),this._pointLightRadius=y(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:y(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?y(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new H,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new Ki:c(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new te,new te],this._cascadeMatrices=[new L,new L,new L,new L],this._cascadeDistances=new te;let i;this._isPointLight?i=6:this._cascadesEnabled?i=this._numberOfCascades:i=1,this._passes=new Array(i);for(let o=0;o<i;++o)this._passes[o]=new T3e(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,O1(this),this._clearCommand=new bi({depth:1,color:new z}),this._clearPassState=new Lp(t),this._size=y(e.size,2048),this.size=this._size}Wa.MAXIMUM_DISTANCE=2e4;function T3e(e){this.camera=new sE,this.passState=new Lp(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function Ov(e,t){return Ue.fromCache({cull:{enabled:!0,face:Qi.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 O1(e){const t=!e._usesDepthTexture;e._primitiveRenderState=Ov(t,e._primitiveBias),e._terrainRenderState=Ov(t,e._terrainBias),e._pointRenderState=Ov(t,e._pointBias)}Wa.prototype.debugCreateRenderStates=function(){O1(this)};Object.defineProperties(Wa.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){S3e(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}}});function L1(e){const t=e._passes.length;for(let n=0;n<t;++n){const i=e._passes[n],o=i.framebuffer;c(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function A3e(e,t){const n=new cl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:qu.DEPTH_COMPONENT16}),i=new xt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST}),o=new ur({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){const a=e._passes[s];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function x3e(e,t){const n=new xt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST}),i=new ur({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){const s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function C3e(e,t){const n=new cl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:qu.DEPTH_COMPONENT16}),i=new Sl({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const s=new ur({context:t,depthRenderbuffer:n,colorTextures:[o[r]],destroyAttachments:!1}),a=e._passes[r];a.framebuffer=s,a.passState.framebuffer=s}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function VW(e,t){e._isPointLight?C3e(e,t):e._usesDepthTexture?x3e(e,t):A3e(e,t)}function E3e(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==J.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,O1(e),L1(e),VW(e,t))}function w3e(e,t){(!c(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(L1(e),VW(e,t),E3e(e,t),HW(e,t))}function HW(e,t,n){n=y(n,0),(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function S3e(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=pt.maximumCubeMapSize>=t?t:pt.maximumCubeMapSize,o.x=t,o.y=t;const r=new Re(0,0,t,t);n[0].passState.viewport=r,n[1].passState.viewport=r,n[2].passState.viewport=r,n[3].passState.viewport=r,n[4].passState.viewport=r,n[5].passState.viewport=r}else i===1?(t=pt.maximumTextureSize>=t?t:pt.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Re(0,0,t,t)):i===4&&(t=pt.maximumTextureSize>=t*2?t:pt.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new Re(0,0,t,t),n[1].passState.viewport=new Re(t,0,t,t),n[2].passState.viewport=new Re(0,t,t,t),n[3].passState.viewport=new Re(t,t,t,t));e._clearPassState.viewport=new Re(0,0,o.x,o.y);for(let r=0;r<i;++r){const s=n[r],a=s.passState.viewport,l=a.x/o.x,u=a.y/o.y,h=a.width/o.x,f=a.height/o.y;s.textureOffsets=new L(h,0,0,l,0,f,0,u,0,0,1,0,0,0,0,1)}}const v3e=new Re;function I3e(e,t){let n;e._isPointLight?n=`uniform samplerCube shadowMap_textureCube; in vec2 v_textureCoordinates; void main() { vec2 uv = v_textureCoordinates; vec3 dir; if (uv.y < 0.5) { if (uv.x < 0.333) { dir.x = -1.0; dir.y = uv.x * 6.0 - 1.0; dir.z = uv.y * 4.0 - 1.0; } else if (uv.x < 0.666) { dir.y = -1.0; dir.x = uv.x * 6.0 - 3.0; dir.z = uv.y * 4.0 - 1.0; } else { dir.z = -1.0; dir.x = uv.x * 6.0 - 5.0; dir.y = uv.y * 4.0 - 1.0; } } else { if (uv.x < 0.333) { dir.x = 1.0; dir.y = uv.x * 6.0 - 1.0; dir.z = uv.y * 4.0 - 3.0; } else if (uv.x < 0.666) { dir.y = 1.0; dir.x = uv.x * 6.0 - 3.0; dir.z = uv.y * 4.0 - 3.0; } else { dir.z = 1.0; dir.x = uv.x * 6.0 - 5.0; dir.y = uv.y * 4.0 - 3.0; } } float shadow = czm_unpackDepth(czm_textureCube(shadowMap_textureCube, dir)); out_FragColor = vec4(vec3(shadow), 1.0); } `:n=`uniform sampler2D shadowMap_texture; in vec2 v_textureCoordinates; void main() { ${e._usesDepthTexture?` float shadow = texture(shadowMap_texture, v_textureCoordinates).r; `:` float shadow = czm_unpackDepth(texture(shadowMap_texture, v_textureCoordinates)); `} out_FragColor = vec4(vec3(shadow), 1.0); } `;const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=xe.OVERLAY,i}function D3e(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=v3e;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;c(a)||(a=I3e(e,n),e._debugShadowViewCommand=a),(!c(a.renderState)||!Re.equals(a.renderState.viewport,s))&&(a.renderState=Ue.fromCache({viewport:Re.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const wu=new Array(8);wu[0]=new te(-1,-1,-1,1);wu[1]=new te(1,-1,-1,1);wu[2]=new te(1,1,-1,1);wu[3]=new te(-1,1,-1,1);wu[4]=new te(-1,-1,1,1);wu[5]=new te(1,-1,1,1);wu[6]=new te(1,1,1,1);wu[7]=new te(-1,1,1,1);const mh=new L,R1=new Array(8);for(let e=0;e<8;++e)R1[e]=new te;function P3e(e,t){const n=new Gt({geometry:new Na({minimum:new d(-.5,-.5,-.5),maximum:new d(.5,.5,.5)}),attributes:{color:$t.fromColor(t)}}),i=new Gt({geometry:new Fh({radius:.5}),attributes:{color:$t.fromColor(t)}});return new Mt({geometryInstances:[n,i],appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const O3e=[z.RED,z.GREEN,z.BLUE,z.MAGENTA],L3e=new d;function R3e(e,t){D3e(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 ph({camera:e._sceneCamera,color:z.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new ph({camera:e._shadowMapCamera,color:z.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 ph({camera:e._passes[i].camera,color:O3e[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!c(e._debugLightFrustum)||e._needsUpdate){const i=e._shadowMapCamera.positionWC,o=_e.IDENTITY,r=e._pointLightRadius*2,s=d.fromElements(r,r,r,L3e),a=L.fromTranslationQuaternionRotationScale(i,o,s,mh);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=P3e(a,z.YELLOW)}e._debugLightFrustum.update(t)}else(!c(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new ph({camera:e._shadowMapCamera,color:z.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function sE(){this.viewMatrix=new L,this.inverseViewMatrix=new L,this.frustum=void 0,this.positionCartographic=new he,this.positionWC=new d,this.directionWC=d.clone(d.UNIT_Z),this.upWC=d.clone(d.UNIT_Y),this.rightWC=d.clone(d.UNIT_X),this.viewProjectionMatrix=new L}sE.prototype.clone=function(e){L.clone(e.viewMatrix,this.viewMatrix),L.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),he.clone(e.positionCartographic,this.positionCartographic),d.clone(e.positionWC,this.positionWC),d.clone(e.directionWC,this.directionWC),d.clone(e.upWC,this.upWC),d.clone(e.rightWC,this.rightWC)};const N3e=new L(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);sE.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return L.multiply(t,e,this.viewProjectionMatrix),L.multiply(N3e,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const M3e=new Array(5),F3e=new _n,B3e=new Array(4),GW=new d,jW=new d;function z3e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades;let a;const l=r-o,u=r/o;let h=.9,f=!1;t.shadowState.closestObjectSize<200&&(f=!0,h=.9);const _=B3e,g=M3e;for(g[0]=o,g[s]=r,a=0;a<s;++a){const B=(a+1)/s,S=o*Math.pow(u,B),D=o+l*B,p=R.lerp(D,S,h);g[a+1]=p,_[a]=p-g[a]}if(f){for(a=0;a<s;++a)_[a]=Math.min(_[a],e._maximumCascadeDistances[a]);let B=g[0];for(a=0;a<s-1;++a)B+=_[a],g[a+1]=B}te.unpack(g,0,e._cascadeSplits[0]),te.unpack(g,1,e._cascadeSplits[1]),te.unpack(_,0,e._cascadeDistances);const m=n.frustum,b=m.left,T=m.right,x=m.bottom,C=m.top,w=m.near,v=m.far,P=n.positionWC,N=n.directionWC,k=n.upWC,M=i.frustum.clone(F3e),U=n.getViewProjection();for(a=0;a<s;++a){M.near=g[a],M.far=g[a+1];const B=L.multiply(M.projectionMatrix,i.viewMatrix,mh),S=L.inverse(B,mh),D=L.multiply(U,S,mh),p=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,GW),I=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,jW);for(let j=0;j<8;++j){const W=te.clone(wu[j],R1[j]);L.multiplyByVector(D,W,W),d.divideByScalar(W,W.w,W),d.minimumByComponent(W,p,p),d.maximumByComponent(W,I,I)}p.x=Math.max(p.x,0),p.y=Math.max(p.y,0),p.z=0,I.x=Math.min(I.x,1),I.y=Math.min(I.y,1),I.z=Math.min(I.z,1);const O=e._passes[a],F=O.camera;F.clone(n);const V=F.frustum;V.left=b+p.x*(T-b),V.right=b+I.x*(T-b),V.bottom=x+p.y*(C-x),V.top=x+I.y*(C-x),V.near=w+p.z*(v-w),V.far=w+I.z*(v-w),O.cullingVolume=F.frustum.computeCullingVolume(P,N,k);const G=e._cascadeMatrices[a];L.multiply(F.getViewProjection(),i.inverseViewMatrix,G),L.multiply(O.textureOffsets,G,G)}}const U3e=new L,k3e=new d,V3e=new d,B3=new d;function H3e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=L.multiply(i.frustum.projectionMatrix,i.viewMatrix,mh),r=L.inverse(o,mh),s=n.directionWC;let a=i.directionWC;d.equalsEpsilon(s,a,R.EPSILON10)&&(a=i.upWC);const l=d.cross(s,a,k3e);a=d.cross(l,s,V3e),d.normalize(a,a),d.normalize(l,l);const u=d.fromElements(0,0,0,B3);let h=L.computeView(u,s,a,l,U3e);const f=L.multiply(h,r,mh),_=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,GW),g=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,jW);for(let v=0;v<8;++v){const P=te.clone(wu[v],R1[v]);L.multiplyByVector(f,P,P),d.divideByScalar(P,P.w,P),d.minimumByComponent(P,_,_),d.maximumByComponent(P,g,g)}g.z+=1e3,_.z-=10;const m=B3;m.x=-(.5*(_.x+g.x)),m.y=-(.5*(_.y+g.y)),m.z=-g.z;const b=L.fromTranslation(m,mh);h=L.multiply(b,h,h);const T=.5*(g.x-_.x),x=.5*(g.y-_.y),C=g.z-_.z,w=n.frustum;w.left=-T,w.right=T,w.bottom=-x,w.top=x,w.near=.01,w.far=C,L.clone(h,n.viewMatrix),L.inverse(h,n.inverseViewMatrix),L.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),d.clone(s,n.directionWC),d.clone(a,n.upWC),d.clone(l,n.rightWC)}const G3e=[new d(-1,0,0),new d(0,-1,0),new d(0,0,-1),new d(1,0,0),new d(0,1,0),new d(0,0,1)],j3e=[new d(0,-1,0),new d(0,0,-1),new d(0,-1,0),new d(0,-1,0),new d(0,0,1),new d(0,-1,0)],W3e=[new d(0,0,1),new d(1,0,0),new d(-1,0,0),new d(0,0,-1),new d(1,0,0),new d(1,0,0)];function q3e(e,t){const n=new _n;n.fov=R.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=G3e[i],o.upWC=j3e[i],o.rightWC=W3e[i],L.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),L.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}const Y3e=new d,$3e=new d,WW=new se,z3=WW.center;function X3e(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=WW;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,Y3e),s=d.negate(i.directionWC,$3e),a=d.dot(r,s);if(e.fadingEnabled){const l=R.clamp(a/.1,0,1);e._darkness=R.lerp(1,e.darkness,l)}else e._darkness=e.darkness;if(a<0){e._outOfView=!0,e._needsUpdate=!1;return}e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)o.center=i.positionWC,o.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(o)===Bt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere);else{const r=i.frustum.far/2,s=d.add(i.positionWC,d.multiplyByScalar(i.directionWC,r,z3),z3);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===Bt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere)}}function Q3e(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?d.clone(i.directionWC,r.directionWC):e._isPointLight?d.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;L.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),d.normalize(s,s),d.negate(s,s),L.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,l;e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),l=Math.min(t.shadowState.farPlane,e.maximumDistance),l=Math.max(l,a+1)):(a=n.frustum.near,l=e.maximumDistance),e._sceneCamera=Ye.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=l,e._distance=l-a,X3e(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}Wa.prototype.update=function(e){if(Q3e(this,e),this._needsUpdate)if(w3e(this,e.context),this._isPointLight&&q3e(this,e),this._cascadesEnabled&&(H3e(this,e),this._numberOfCascades>1&&z3e(this,e)),this._isPointLight)this._shadowMapCullingVolume=_o.fromBoundingSphere(this._boundingSphere);else{const t=this._shadowMapCamera,n=t.positionWC,i=t.directionWC,o=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(n,i,o),this._passes.length===1&&this._passes[0].camera.clone(t)}if(this._passes.length===1){const t=this._sceneCamera.inverseViewMatrix;L.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&R3e(this,e)};Wa.prototype.updatePass=function(e,t){HW(this,e,t)};const K3e=new H;function qW(e,t,n){const i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias,o={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 r=K3e;return r.x=1/e._textureSize.x,r.y=1/e._textureSize.y,te.fromElements(r.x,r.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return te.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new te,combinedUniforms2:new te};return jt(t,o,!1)}function Z3e(e,t,n,i,o,r){let s,a,l;if(c(r)&&(s=r.shaderProgram,a=r.renderState,l=r.uniformMap),r=Ze.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!c(s)||o!==n.shaderProgram.id||t){const u=n.shaderProgram,h=n.pass===xe.GLOBE,f=n.pass!==xe.TRANSLUCENT,_=e._isPointLight,g=e._usesDepthTexture,m=bc.getShadowCastShaderKeyword(_,h,g,f);if(s=i.shaderCache.getDerivedShaderProgram(u,m),!c(s)){const T=u.vertexShaderSource,x=u.fragmentShaderSource,C=bc.createShadowCastVertexShader(T,_,h),w=bc.createShadowCastFragmentShader(x,_,g,f);s=i.shaderCache.createDerivedShaderProgram(u,m,{vertexShaderSource:C,fragmentShaderSource:w,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,_?a=e._pointRenderState:h&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=Je(a,!1),a.cull=Je(a.cull,!1),a.cull.enabled=!1,a=Ue.fromCache(a)),l=qW(e,n.uniformMap,h)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=l,r}Wa.createReceiveDerivedCommand=function(e,t,n,i,o){c(o)||(o={});const r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,l=s.fragmentShaderSource,u=t.pass===xe.GLOBE;let h=!1;if(u&&(h=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let f,_;c(o.receiveCommand)&&(f=o.receiveCommand.shaderProgram,_=o.receiveCommand.uniformMap),o.receiveCommand=Ze.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;const g=o.receiveShaderCastShadows!==t.castShadows,m=o.receiveShaderProgramId!==t.shaderProgram.id;if(!c(f)||m||n||g){const b=bc.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,h);if(f=i.shaderCache.getDerivedShaderProgram(s,b),!c(f)){const T=bc.createShadowReceiveVertexShader(a,u,h),x=bc.createShadowReceiveFragmentShader(l,e[0],t.castShadows,u,h);f=i.shaderCache.createDerivedShaderProgram(s,b,{vertexShaderSource:T,fragmentShaderSource:x,attributeLocations:s._attributeLocations})}_=qW(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=f,o.receiveCommand.uniformMap=_,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};Wa.createCastDerivedCommand=function(e,t,n,i,o){if(c(o)||(o={}),t.castShadows){let r=o.castCommands;c(r)||(r=o.castCommands=[]);const s=o.castShaderProgramId,a=e.length;r.length=a;for(let l=0;l<a;++l)r[l]=Z3e(e[l],n,t,i,s,r[l]);o.castShaderProgramId=t.shaderProgram.id}return o};Wa.prototype.isDestroyed=function(){return!1};Wa.prototype.destroy=function(){L1(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 ve(this)};const Lv=`uniform sampler2D colorTexture; #ifdef DEBUG_SHOW_DEPTH uniform sampler2D u_packedTranslucentDepth; #endif in vec2 v_textureCoordinates; void main() { #ifdef DEBUG_SHOW_DEPTH if (v_textureCoordinates.x < 0.5) { out_FragColor.rgb = vec3(czm_unpackDepth(texture(u_packedTranslucentDepth, v_textureCoordinates))); out_FragColor.a = 1.0; } #else vec4 color = texture(colorTexture, v_textureCoordinates); #ifdef PICK if (color == vec4(0.0)) { discard; } #else // Reverse premultiplication process to get the correct composited result of the classification primitives color.rgb /= color.a; #endif out_FragColor = color; #endif } `;function rf(e){this._drawClassificationFBO=new on({createDepthAttachments:!1}),this._accumulationFBO=new on({createDepthAttachments:!1}),this._packFBO=new on,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 bi({color:new z(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new bi({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new Re,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}Object.defineProperties(rf.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function YW(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function $W(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function J3e(e,t,n,i){YW(e),e._translucentDepthStencilTexture=new xt({context:t,width:n,height:i,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST})}function eze(e,t,n,i){$W(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 tze(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;const o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(J3e(e,t,o,r),eze(e,t,o,r));let s,a;if(c(e._packDepthCommand)||(s=new Oe({sources:[I1e]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!c(e._compositeCommand)){s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const h=e._compositeCommand,f=h.shaderProgram,_=t.shaderCache.createDerivedShaderProgram(f,"pick",{vertexShaderSource:f.vertexShaderSource,fragmentShaderSource:new Oe({sources:s.sources,defines:["PICK"]}),attributeLocations:f._attributeLocations}),g=Ze.shallowClone(h);g.shaderProgram=_,h.derivedCommands.pick=g}c(e._copyCommand)||(s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),c(e._accumulateCommand)||(s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;const l=!Re.equals(e._viewport,n.viewport);let u=l!==e._useScissorTest;e._useScissorTest=l,Re.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Re.clone(n.viewport,e._scissorRectangle),u=!0),(!c(e._rsDepth)||!Re.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!c(e._rsAccumulate)||!Re.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,reference:At.CESIUM_3D_TILE_MASK}})),c(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!c(e._rsComp)||!Re.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Zn.ALPHA_BLEND})),c(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}rf.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const l=e.frameState.useLogDepth,u=e.context,h=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=l?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(!!this._hasTranslucentDepth){for(tze(this,u,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(u,n),a=0;a<r;++a){if(s=i[a],s=l?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;const f=s.derivedCommands.depth.depthOnlyCommand;t(f,e,u,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(u,n)),n.framebuffer=h}};rf.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const o=e.context,r=o.uniformState,s=n.framebuffer;this._frustumsDrawn===2&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(o,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const l=i.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[xe.CESIUM_3D_TILE_CLASSIFICATION];for(let h=0;h<u;++h)t(l[h],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};rf.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;this._frustumsDrawn===1?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture(),(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),nze(this,e,t)};function nze(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}rf.prototype.isSupported=function(){return this._supported};rf.prototype.isDestroyed=function(){return!1};rf.prototype.destroy=function(){return YW(this),$W(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),ve(this)};function ize(){this.command=void 0,this.near=void 0,this.far=void 0}function db(e,t,n){const i=e.context;let o;i.depthTexture&&(o=new Cu);let r;e._useOIT&&i.depthTexture&&(r=new Pd(i));const s=new Lp(i);s.viewport=Re.clone(n),this.camera=t,this._cameraClone=Ye.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new rg(i),this.pickDepthFramebuffer=new ub,this.sceneFramebuffer=new Eu,this.globeDepth=o,this.globeTranslucencyFramebuffer=new Yp,this.oit=r,this.translucentTileClassification=new rf(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}const U3=new d,k3=new d;function oze(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)),o=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),o)}function rze(e,t,n){const i=1/Math.max(1,oze(e.position,t.position));return d.multiplyByScalar(e.position,i,U3),d.multiplyByScalar(t.position,i,k3),d.equalsEpsilon(U3,k3,n)&&d.equalsEpsilon(e.direction,t.direction,n)&&d.equalsEpsilon(e.up,t.up,n)&&d.equalsEpsilon(e.right,t.right,n)&&L.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}db.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return rze(t,n,R.EPSILON15)?(this._cameraStartFired&&xo()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=xo(),Ye.clone(t,n),!0)};function sze(e,t,n,i){const o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===oe.SCENE2D,l=t.nearToFarDistance2D;i*=1+R.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let u;a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),u=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):u=Math.ceil(Math.log(i/n)/Math.log(s));const h=e.frustumCommandsList;h.length=u;for(let f=0;f<u;++f){let _,g;a?(_=Math.min(i-l,n+f*l),g=Math.min(i,_+l)):(_=Math.max(n,Math.pow(s,f)*n),g=Math.min(i,s*_));let m=h[f];c(m)?(m.near=_,m.far=g):m=h[f]=new QBe(_,g)}}function aze(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){const l=r[a],u=l.near,h=l.far;if(i>h)continue;if(o<u)break;const f=n.pass,_=l.indices[f]++;if(l.commands[f][_]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const a=e.debugFrustumStatistics.commandsInFrustums;a[n.debugOverlappingFrustums]=c(a[n.debugOverlappingFrustums])?a[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}const V3=new _o,cze=new Yu;db.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,n=t.camera,i=n.directionWC,o=n.positionWC,r=e._computeCommandList,s=e._overlayCommandList,a=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const l=this.frustumCommandsList,u=l.length,h=xe.NUMBER_OF_PASSES;for(let D=0;D<u;++D)for(let p=0;p<h;++p)l[D].indices[p]=0;r.length=0,s.length=0;const f=this._commandExtents,_=f.length;let g=0,m=+Number.MAX_VALUE,b=-Number.MAX_VALUE;const T=t.shadowState.shadowsEnabled;let x=+Number.MAX_VALUE,C=-Number.MAX_VALUE,w=Number.MAX_VALUE;const v=t.mode===oe.SCENE3D?t.occluder:void 0;let P=t.cullingVolume;const N=V3.planes;for(let D=0;D<5;++D)N[D]=P.planes[D];P=V3;const k=a.length;for(let D=0;D<k;++D){const p=a[D],I=p.pass;if(I===xe.COMPUTE)r.push(p);else if(I===xe.OVERLAY)s.push(p);else{let O,F;const V=p.boundingVolume;if(c(V)){if(!e.isVisible(p,P,v))continue;const j=V.computePlaneDistances(o,i,cze);if(O=j.start,F=j.stop,m=Math.min(m,O),b=Math.max(b,F),T&&p.receiveShadows&&O<Wa.MAXIMUM_DISTANCE&&!(I===xe.GLOBE&&O<-100&&F>100)){const W=F-O;I!==xe.GLOBE&&O<100&&(w=Math.min(w,W)),x=Math.min(x,O),C=Math.max(C,F)}}else p instanceof bi?(O=n.frustum.near,F=n.frustum.far):(O=n.frustum.near,F=n.frustum.far,m=Math.min(m,O),b=Math.max(b,F));let G=f[g];c(G)||(G=f[g]=new ize),G.command=p,G.near=O,G.far=F,g++}}T&&(x=Math.min(Math.max(x,n.frustum.near),n.frustum.far),C=Math.max(Math.min(C,n.frustum.far),x)),T&&(t.shadowState.nearPlane=x,t.shadowState.farPlane=C,t.shadowState.closestObjectSize=w),sze(this,e,m,b);let M,U;for(M=0;M<g;M++)U=f[M],aze(this,e,U.command,U.near,U.far);if(g<_)for(M=g;M<_&&(U=f[M],!!c(U.command));M++)U.command=void 0;const B=l.length,S=t.frustumSplits;S.length=B+1;for(let D=0;D<B;++D)S[D]=l[D].near,D===B-1&&(S[D+1]=l[D].far)};db.prototype.destroy=function(){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();let e;const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const XW=.1,lze=new jp({pass:wr.MOST_DETAILED_PRELOAD}),uze=new jp({pass:wr.MOST_DETAILED_PICK}),aE=new jp({pass:wr.PICK});function Or(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new Re(0,0,1,1),n=new Ye(e);n.frustum=new It({width:XW,aspectRatio:1,near:.1}),this._pickOffscreenView=new db(e,n,t)}Or.prototype.update=function(){this._pickPositionCacheDirty=!0};Or.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return c(i)||(i=new qp,n[t]=i),i};const dze=new Ki,hze=new d,mA=new d,fze=new H,pze=new L;function mze(e,t,n,i,o){const r=e.camera;let s=r.frustum;const a=s.offCenterFrustum;c(a)&&(s=a);let l=2*(t.x-o.x)/o.width-1;l*=(s.right-s.left)*.5;let u=2*(o.height-t.y-o.y)/o.height-1;u*=(s.top-s.bottom)*.5;const h=L.clone(r.transform,pze);r._setTransform(L.IDENTITY);const f=d.clone(r.position,hze);d.multiplyByScalar(r.right,l,mA),d.add(mA,f,f),d.multiplyByScalar(r.up,u,mA),d.add(mA,f,f),r._setTransform(h),e.mode===oe.SCENE2D&&d.fromElements(f.z,f.x,f.y,f);const _=s.getPixelDimensions(o.width,o.height,1,1,fze),g=dze;return g.right=_.x*.5,g.left=-g.right,g.top=_.y*.5,g.bottom=-g.top,g.near=s.near,g.far=s.far,g.computeCullingVolume(f,r.directionWC,r.upWC)}const _ze=new xs,gze=new H;function yze(e,t,n,i,o){const r=e.camera,s=r.frustum,a=s.near,l=Math.tan(s.fovy*.5),u=s.aspectRatio*l,h=2*(t.x-o.x)/o.width-1,f=2*(o.height-t.y-o.y)/o.height-1,_=h*a*u,g=f*a*l,m=s.getPixelDimensions(o.width,o.height,1,1,gze),b=m.x*n*.5,T=m.y*i*.5,x=_ze;return x.top=g+T,x.bottom=g-T,x.right=_+b,x.left=_-b,x.near=a,x.far=s.far,x.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function N1(e,t,n,i,o){const r=e.camera.frustum;return r instanceof It||r instanceof Ki?mze(e,t,n,i,o):yze(e,t,n,i,o)}let al=3,$u=3,ls=new Re(0,0,al,$u);const M1=new H,cE=new z(0,0,0,0);Or.prototype.pick=function(e,t,n,i){A.defined("windowPosition",t),al=y(n,3),$u=y(i,al);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Re.clone(a,u.viewport);const h=Ao.transformWindowToDrawingBuffer(e,t,M1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=N1(e,h,al,$u,a),r.invertClassification=!1,r.passes.pick=!0,r.tilesetPassState=aE,o.uniformState.update(r),e.updateEnvironment(),ls.x=h.x-(al-1)*.5,ls.y=e.drawingBufferHeight-h.y-($u-1)*.5,ls.width=al,ls.height=$u,u=l.begin(ls,a),e.updateAndExecuteCommands(u,cE),e.resolveFramebuffers(u);const f=l.end(ls);return o.endFrame(),f};Or.prototype.pickVoxelCoordinate=function(e,t,n,i){A.defined("windowPosition",t),al=y(n,3),$u=y(i,al);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Re.clone(a,u.viewport);const h=Ao.transformWindowToDrawingBuffer(e,t,M1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=N1(e,h,al,$u,a),r.invertClassification=!1,r.passes.pickVoxel=!0,r.tilesetPassState=aE,o.uniformState.update(r),e.updateEnvironment(),ls.x=h.x-(al-1)*.5,ls.y=e.drawingBufferHeight-h.y-($u-1)*.5,ls.width=al,ls.height=$u,u=l.begin(ls,a),e.updateAndExecuteCommands(u,cE),e.resolveFramebuffers(u);const f=l.readVoxelInfo(ls);return o.endFrame(),f};function bze(e,t){const{defaultView:n,context:i,frameState:o,environmentState:r}=e,{viewport:s,pickDepthFramebuffer:a}=n;e.view=n,s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;let l=n.passState;l.viewport=Re.clone(s,l.viewport),e.clearPasses(o.passes),o.passes.pick=!0,o.passes.depth=!0,o.cullingVolume=N1(e,t,1,1,s),o.tilesetPassState=aE,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,l=a.update(i,t,s),e.updateAndExecuteCommands(l,cE),e.resolveFramebuffers(l),i.endFrame()}const Tze=new _n,Aze=new xs,xze=new It,Cze=new Ki;Or.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(A.defined("windowPosition",t),!e.context.depthTexture)throw new E("Picking from the depth buffer is not supported. Check pickPositionSupported.");const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return d.clone(this._pickPositionCache[i],n);const{context:o,frameState:r,camera:s,defaultView:a}=e,{uniformState:l}=o;e.view=a;const u=Ao.transformWindowToDrawingBuffer(e,t,M1);e.pickTranslucentDepth?bze(e,u):(e.updateFrameState(),l.update(r),e.updateEnvironment()),u.y=e.drawingBufferHeight-u.y;let h;c(s.frustum.fov)?h=s.frustum.clone(Tze):c(s.frustum.infiniteProjectionMatrix)?h=s.frustum.clone(Aze):c(s.frustum.width)?h=s.frustum.clone(xze):h=s.frustum.clone(Cze);const f=a.frustumCommandsList,_=f.length;for(let g=0;g<_;++g){const b=this.getPickDepth(e,g).getDepth(o,u.x,u.y);if(!!c(b)&&b>0&&b<1){const T=f[g];let x;return e.mode===oe.SCENE2D?(x=s.position.z,s.position.z=x-T.near+1,h.far=Math.max(1,T.far-T.near),h.near=1,l.update(r),l.updateFrustum(h)):(h.near=T.near*(g!==0?e.opaqueFrustumNearOffset:1),h.far=T.far,l.updateFrustum(h)),n=Ao.drawingBufferToWgs84Coordinates(e,u,b,n),e.mode===oe.SCENE2D&&(s.position.z=x,l.update(r)),this._pickPositionCache[i]=d.clone(n),n}}this._pickPositionCache[i]=void 0};const Eze=new he;Or.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),c(n)&&e.mode!==oe.SCENE3D){d.fromElements(n.y,n.z,n.x,n);const i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,Eze);o.cartographicToCartesian(r,n)}return n};function QW(e,t){let n,i;const o=[],r=[],s=[],a=[];c(e)||(e=Number.MAX_VALUE);let l=t();for(;c(l);){const u=l.object,h=l.position,f=l.exclude;if(c(h)&&!c(u)){o.push(l);break}if(!c(u)||!c(u.primitive)||!f&&(o.push(l),0>=--e))break;const _=u.primitive;let g=!1;typeof _.getGeometryInstanceAttributes=="function"&&c(u.id)&&(i=_.getGeometryInstanceAttributes(u.id),c(i)&&c(i.show)&&(g=!0,i.show=mn.toValue(!1,i.show),s.push(i))),u instanceof Ir&&(g=!0,u.show=!1,a.push(u)),g||(_.show=!1,r.push(_)),l=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=mn.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}Or.prototype.drillPick=function(e,t,n,i,o){const r=this;return QW(n,function(){const l=r.pick(e,t,i,o);if(c(l))return{object:l,position:void 0,exclude:!1}}).map(function(l){return l.object})};const H3=new d,wze=new d;function Sze(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;const i=this;this.promise=new Promise(o=>{i._completePick=()=>{o()}})}function KW(e,t,n,i){const o=t.direction,r=d.mostOrthogonalAxis(o,H3),s=d.cross(o,r,H3),a=d.cross(o,s,wze);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=y(n,XW),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function vze(e,t,n){const i=t.frameState,{ray:o,width:r,tilesets:s}=n,a=e._pickOffscreenView.camera,l=KW(e,o,r,a),u=lze;u.camera=a,u.cullingVolume=l;let h=!0;const f=s.length;for(let _=0;_<f;++_){const g=s[_];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),h=h&&u.ready)}return h&&n._completePick(),h}Or.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)vze(this,e,t[n])&&t.splice(n--,1)};function ZW(e,t,n){for(let i=0;i<e.length;++i){const o=e.get(i);o.show&&(c(o.isCesium3DTileset)?(!c(t)||t.indexOf(o)===-1)&&n.push(o):o instanceof eo&&ZW(o,t,n))}}function lE(e,t,n,i,o,r){const s=[];if(ZW(t.primitives,i,s),s.length===0)return Promise.resolve(r());const a=new Sze(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function Ize(e,t){return!c(e)||!c(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function Dze(e,t,n,i,o,r,s){const{context:a,frameState:l}=t,u=a.uniformState,h=e._pickOffscreenView;t.view=h,KW(e,n,o,h.camera),ls=Re.clone(h.viewport,ls);const f=h.pickFramebuffer.begin(ls,h.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,s?l.tilesetPassState=uze:l.tilesetPassState=aE,u.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(f,cE),t.resolveFramebuffers(f);let _;const g=h.pickFramebuffer.end(ls);if(t.context.depthTexture){const m=h.frustumCommandsList.length;for(let b=0;b<m;++b){const x=e.getPickDepth(t,b).getDepth(a,0,0);if(!!c(x)&&x>0&&x<1){const C=h.frustumCommandsList[b],w=C.near*(b!==0?t.opaqueFrustumNearOffset:1),v=C.far,P=w+x*(v-w);_=nn.getPoint(n,P);break}}}if(t.view=t.defaultView,a.endFrame(),c(g)||c(_))return{object:g,position:_,exclude:!c(_)&&r||Ize(g,i)}}function JW(e,t,n,i,o,r,s,a){return QW(i,function(){return Dze(e,t,n,o,r,s,a)})}function sg(e,t,n,i,o,r,s){const a=JW(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function e6(e,t,n,i,o,r,s,a){return JW(e,t,n,i,o,r,s,a)}function uE(e,t){return new Promise((n,i)=>{t.then(function(o){const r=e.postRender.addEventListener(function(){r(),n(o)});e.requestRender()}).catch(function(o){i(o)})})}Or.prototype.pickFromRay=function(e,t,n,i){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return sg(this,e,t,n,i,!1,!1)};Or.prototype.drillPickFromRay=function(e,t,n,i,o){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return e6(this,e,t,n,i,o,!1,!1)};Or.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");const o=this;return t=nn.clone(t),n=c(n)?n.slice():n,uE(e,lE(o,e,t,n,i,function(){return sg(o,e,t,n,i,!1,!0)}))};Or.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");const r=this;return t=nn.clone(t),i=c(i)?i.slice():i,uE(e,lE(r,e,t,i,o,function(){return e6(r,e,t,n,i,o,!1,!0)}))};const Pze=new d,Oze=new d,Lze=new nn,t6=new he;function F1(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Ti._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,Oze),s=he.toCartesian(t,i,Pze),a=Lze;a.origin=s,a.direction=r;const l=new nn;return nn.getPoint(a,o,l.origin),d.negate(r,l.direction),l}function n6(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=he.fromCartesian(t,i,t6);return F1(e,o)}function i6(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid;return he.fromCartesian(t,i,t6).height}function Rze(e,t,n,i,o){const r=F1(t,n);return lE(e,t,r,i,o,function(){const s=sg(e,t,r,i,o,!0,!0);if(c(s))return i6(t,s.position)})}function Nze(e,t,n,i,o,r){const s=n6(t,n);return lE(e,t,s,i,o,function(){const a=sg(e,t,s,i,o,!0,!0);if(c(a))return d.clone(a.position,r)})}Or.prototype.sampleHeight=function(e,t,n,i){if(A.defined("position",t),e.mode!==oe.SCENE3D)throw new E("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeight requires depth texture support. Check sampleHeightSupported.");const o=F1(e,t),r=sg(this,e,o,n,i,!0,!1);if(c(r))return i6(e,r.position)};Or.prototype.clampToHeight=function(e,t,n,i,o){if(A.defined("cartesian",t),e.mode!==oe.SCENE3D)throw new E("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeight requires depth texture support. Check clampToHeightSupported.");const r=n6(e,t),s=sg(this,e,r,n,i,!0,!1);if(c(s))return d.clone(s.position,o)};Or.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(A.defined("positions",t),e.mode!==oe.SCENE3D)throw new E("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=c(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Rze(this,e,t[s],n,i);return uE(e,Promise.all(r).then(function(s){const a=s.length;for(let l=0;l<a;++l)t[l].height=s[l];return t}))};Or.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(A.defined("cartesians",t),e.mode!==oe.SCENE3D)throw new E("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=c(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Nze(this,e,t[s],n,i,t[s]);return uE(e,Promise.all(r).then(function(s){const a=s.length;for(let l=0;l<a;++l)t[l]=s[l];return t}))};Or.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const Mze=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; #ifdef AUTO_EXPOSURE uniform sampler2D autoExposure; #endif void main() { vec4 fragmentColor = texture(colorTexture, v_textureCoordinates); vec3 color = fragmentColor.rgb; #ifdef AUTO_EXPOSURE color /= texture(autoExposure, vec2(0.5)).r; #endif color = czm_acesTonemapping(color); color = czm_inverseGamma(color); out_FragColor = vec4(color, fragmentColor.a); } `,Fze=`uniform sampler2D randomTexture; uniform sampler2D depthTexture; uniform float intensity; uniform float bias; uniform float lengthCap; uniform float stepSize; uniform float frustumLength; in vec2 v_textureCoordinates; vec4 clipToEye(vec2 uv, float depth) { vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0)); vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0); posEC = posEC / posEC.w; return posEC; } //Reconstruct Normal Without Edge Removation vec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize) { vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU); vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD); vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL); vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR); vec3 up = posInCamera.xyz - posInCameraUp.xyz; vec3 down = posInCameraDown.xyz - posInCamera.xyz; vec3 left = posInCamera.xyz - posInCameraLeft.xyz; vec3 right = posInCameraRight.xyz - posInCamera.xyz; vec3 DX = length(left) < length(right) ? left : right; vec3 DY = length(up) < length(down) ? up : down; return normalize(cross(DY, DX)); } void main(void) { float depth = czm_readDepth(depthTexture, v_textureCoordinates); vec4 posInCamera = clipToEye(v_textureCoordinates, depth); if (posInCamera.z > frustumLength) { out_FragColor = vec4(1.0); return; } vec2 pixelSize = czm_pixelRatio / czm_viewport.zw; float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y)); float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y)); float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0)); float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0)); vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize); float ao = 0.0; vec2 sampleDirection = vec2(1.0, 0.0); float gapAngle = 90.0 * czm_radiansPerDegree; // RandomNoise float randomVal = texture(randomTexture, v_textureCoordinates / pixelSize / 255.0).x; //Loop for each direction for (int i = 0; i < 4; i++) { float newGapAngle = gapAngle * (float(i) + randomVal); float cosVal = cos(newGapAngle); float sinVal = sin(newGapAngle); //Rotate Sampling Direction vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y); float localAO = 0.0; float localStepSize = stepSize; //Loop for each step for (int j = 0; j < 6; j++) { vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize; //Exception Handling if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0) { break; } float stepDepthInfo = czm_readDepth(depthTexture, newCoords); vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo); vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz; float len = length(diffVec); if (len > lengthCap) { break; } float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 ); float weight = len / lengthCap; weight = 1.0 - weight * weight; if (dotVal < bias) { dotVal = 0.0; } localAO = max(localAO, dotVal * weight); localStepSize += stepSize; } ao += localAO; } ao /= 4.0; ao = 1.0 - clamp(ao, 0.0, 1.0); ao = pow(ao, intensity); out_FragColor = vec4(vec3(ao), 1.0); } `,Bze=`uniform sampler2D colorTexture; uniform sampler2D ambientOcclusionTexture; uniform bool ambientOcclusionOnly; in vec2 v_textureCoordinates; void main(void) { vec4 color = texture(colorTexture, v_textureCoordinates); vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates); out_FragColor = ambientOcclusionOnly ? ao : ao * color; } `,zze=`uniform sampler2D colorTexture; uniform float gradations; in vec2 v_textureCoordinates; void main(void) { vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb; #ifdef CZM_SELECTED_FEATURE if (czm_selected()) { out_FragColor = vec4(rgb, 1.0); return; } #endif float luminance = czm_luminance(rgb); float darkness = luminance * gradations; darkness = (darkness - fract(darkness)) / gradations; out_FragColor = vec4(vec3(darkness), 1.0); } `,Uze=`uniform sampler2D colorTexture; uniform sampler2D bloomTexture; uniform bool glowOnly; in vec2 v_textureCoordinates; void main(void) { vec4 color = texture(colorTexture, v_textureCoordinates); #ifdef CZM_SELECTED_FEATURE if (czm_selected()) { out_FragColor = color; return; } #endif vec4 bloom = texture(bloomTexture, v_textureCoordinates); out_FragColor = glowOnly ? bloom : bloom + color; } `,kze=`uniform sampler2D colorTexture; uniform float brightness; in vec2 v_textureCoordinates; void main(void) { vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb; vec3 target = vec3(0.0); out_FragColor = vec4(mix(target, rgb, brightness), 1.0); } `,Vze=`uniform sampler2D colorTexture; uniform float contrast; uniform float brightness; in vec2 v_textureCoordinates; void main(void) { vec3 sceneColor = texture(colorTexture, v_textureCoordinates).xyz; sceneColor = czm_RGBToHSB(sceneColor); sceneColor.z += brightness; sceneColor = czm_HSBToRGB(sceneColor); float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast)); sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5); out_FragColor = vec4(sceneColor, 1.0); } `,Hze=`uniform sampler2D colorTexture; uniform sampler2D blurTexture; uniform sampler2D depthTexture; uniform float focalDistance; in vec2 v_textureCoordinates; vec4 toEye(vec2 uv, float depth) { vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0)); vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0); posInCamera = posInCamera / posInCamera.w; return posInCamera; } float computeDepthBlur(float depth) { float f; if (depth < focalDistance) { f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x); } else { f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance); f = pow(f, 0.1); } f *= f; f = clamp(f, 0.0, 1.0); return pow(f, 0.5); } void main(void) { float depth = czm_readDepth(depthTexture, v_textureCoordinates); vec4 posInCamera = toEye(v_textureCoordinates, depth); float d = computeDepthBlur(-posInCamera.z); out_FragColor = mix(texture(colorTexture, v_textureCoordinates), texture(blurTexture, v_textureCoordinates), d); } `,Gze=`uniform sampler2D depthTexture; in vec2 v_textureCoordinates; void main(void) { float depth = czm_readDepth(depthTexture, v_textureCoordinates); out_FragColor = vec4(vec3(depth), 1.0); } `,jze=`uniform sampler2D depthTexture; uniform float length; uniform vec4 color; in vec2 v_textureCoordinates; void main(void) { float directions[3]; directions[0] = -1.0; directions[1] = 0.0; directions[2] = 1.0; float scalars[3]; scalars[0] = 3.0; scalars[1] = 10.0; scalars[2] = 3.0; float padx = czm_pixelRatio / czm_viewport.z; float pady = czm_pixelRatio / czm_viewport.w; #ifdef CZM_SELECTED_FEATURE bool selected = false; for (int i = 0; i < 3; ++i) { float dir = directions[i]; selected = selected || czm_selected(vec2(-padx, dir * pady)); selected = selected || czm_selected(vec2(padx, dir * pady)); selected = selected || czm_selected(vec2(dir * padx, -pady)); selected = selected || czm_selected(vec2(dir * padx, pady)); if (selected) { break; } } if (!selected) { out_FragColor = vec4(color.rgb, 0.0); return; } #endif float horizEdge = 0.0; float vertEdge = 0.0; for (int i = 0; i < 3; ++i) { float dir = directions[i]; float scale = scalars[i]; horizEdge -= texture(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale; horizEdge += texture(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale; vertEdge -= texture(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale; vertEdge += texture(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale; } float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge); out_FragColor = vec4(color.rgb, len > length ? color.a : 0.0); } `,Wze=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; #ifdef AUTO_EXPOSURE uniform sampler2D autoExposure; #endif // See slides 142 and 143: // http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting void main() { vec4 fragmentColor = texture(colorTexture, v_textureCoordinates); vec3 color = fragmentColor.rgb; #ifdef AUTO_EXPOSURE float exposure = texture(autoExposure, vec2(0.5)).r; color /= exposure; #endif const float A = 0.22; // shoulder strength const float B = 0.30; // linear strength const float C = 0.10; // linear angle const float D = 0.20; // toe strength const float E = 0.01; // toe numerator const float F = 0.30; // toe denominator const float white = 11.2; // linear white point value vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F; float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F; c = czm_inverseGamma(c / w); out_FragColor = vec4(c, fragmentColor.a); } `,qze=`in vec2 v_textureCoordinates; uniform sampler2D colorTexture; const float fxaaQualitySubpix = 0.5; const float fxaaQualityEdgeThreshold = 0.125; const float fxaaQualityEdgeThresholdMin = 0.0833; void main() { vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw; vec4 color = FxaaPixelShader( v_textureCoordinates, colorTexture, fxaaQualityRcpFrame, fxaaQualitySubpix, fxaaQualityEdgeThreshold, fxaaQualityEdgeThresholdMin); float alpha = texture(colorTexture, v_textureCoordinates).a; out_FragColor = vec4(color.rgb, alpha); } `,$D=`#define SAMPLES 8 uniform float delta; uniform float sigma; uniform float direction; // 0.0 for x direction, 1.0 for y direction uniform sampler2D colorTexture; #ifdef USE_STEP_SIZE uniform float stepSize; #else uniform vec2 step; #endif in vec2 v_textureCoordinates; // Incremental Computation of the Gaussian: // https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html void main() { vec2 st = v_textureCoordinates; vec2 dir = vec2(1.0 - direction, direction); #ifdef USE_STEP_SIZE vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw)); #else vec2 step = step; #endif vec3 g; g.x = 1.0 / (sqrt(czm_twoPi) * sigma); g.y = exp((-0.5 * delta * delta) / (sigma * sigma)); g.z = g.y * g.y; vec4 result = texture(colorTexture, st) * g.x; for (int i = 1; i < SAMPLES; ++i) { g.xy *= g.yz; vec2 offset = float(i) * dir * step; result += texture(colorTexture, st - offset) * g.x; result += texture(colorTexture, st + offset) * g.x; } out_FragColor = result; } `,Yze=`uniform sampler2D colorTexture; uniform sampler2D dirtTexture; uniform sampler2D starTexture; uniform vec2 dirtTextureDimensions; uniform float distortion; uniform float ghostDispersal; uniform float haloWidth; uniform float dirtAmount; uniform float earthRadius; uniform float intensity; in vec2 v_textureCoordinates; // whether it is in space or not // 6500000.0 is empirical value #define DISTANCE_TO_SPACE 6500000.0 // return ndc from world coordinate biased earthRadius vec4 getNDCFromWC(vec3 WC, float earthRadius) { vec4 positionEC = czm_view * vec4(WC, 1.0); positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0); vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); } // Check if current pixel is included Earth // if then mask it gradually float isInEarth(vec2 texcoord, vec2 sceneSize) { vec2 NDC = texcoord * 2.0 - 1.0; vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0); vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5); NDC.xy -= earthPosSC.xy; float X = abs(NDC.x) * sceneSize.x; float Y = abs(NDC.y) * sceneSize.y; return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0)); } // For Chromatic effect vec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace) { vec2 sceneSize = czm_viewport.zw; vec3 color; if(isSpace) { color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture(tex, texcoord + direction * distortion.r).r; color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture(tex, texcoord + direction * distortion.g).g; color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture(tex, texcoord + direction * distortion.b).b; } else { color.r = texture(tex, texcoord + direction * distortion.r).r; color.g = texture(tex, texcoord + direction * distortion.g).g; color.b = texture(tex, texcoord + direction * distortion.b).b; } return vec4(clamp(color, 0.0, 1.0), 0.0); } void main(void) { vec4 originalColor = texture(colorTexture, v_textureCoordinates); vec3 rgb = originalColor.rgb; bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE; // Sun position vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0); vec4 sunPositionEC = czm_view * sunPos; vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC); sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0); // If sun is not in the screen space, use original color. if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1))) { // Lens flare is disabled when not in space until #5932 is fixed. // https://github.com/CesiumGS/cesium/issues/5932 out_FragColor = originalColor; return; } vec2 texcoord = vec2(1.0) - v_textureCoordinates; vec2 pixelSize = czm_pixelRatio / czm_viewport.zw; vec2 invPixelSize = 1.0 / pixelSize; vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion); // ghost vector to image centre: vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal; vec3 direction = normalize(vec3(ghostVec, 0.0)); // sample ghosts: vec4 result = vec4(0.0); vec4 ghost = vec4(0.0); for (int i = 0; i < 4; ++i) { vec2 offset = fract(texcoord + ghostVec * float(i)); // Only bright spots from the centre of the source image ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace); } result += ghost; // sample halo vec2 haloVec = normalize(ghostVec) * haloWidth; float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5)); weightForHalo = pow(1.0 - weightForHalo, 5.0); result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5; // dirt on lens vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions; if (dirtTexCoords.x > 1.0) { dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x); } if (dirtTexCoords.y > 1.0) { dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y); } result += dirtAmount * texture(dirtTexture, dirtTexCoords); // Rotating starburst texture's coordinate // dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0)) float camrot = czm_view[0].z + czm_view[1].y; float cosValue = cos(camrot); float sinValue = sin(camrot); mat3 rotation = mat3( cosValue, -sinValue, 0.0, sinValue, cosValue, 0.0, 0.0, 0.0, 1.0 ); vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0); vec3 st2 = vec3((rotation * st1).xy, 1.0); vec3 st3 = st2 * 0.5 + vec3(0.5); vec2 lensStarTexcoord = st3.xy; float weightForLensFlare = length(vec3(sunPos.xy, 0.0)); float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0); if (!isSpace) { result *= oneMinusWeightForLensFlare * intensity * 0.2; } else { result *= oneMinusWeightForLensFlare * intensity; result *= texture(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0; } result += texture(colorTexture, v_textureCoordinates); out_FragColor = result; } `,$ze=`uniform sampler2D colorTexture; uniform vec3 white; in vec2 v_textureCoordinates; #ifdef AUTO_EXPOSURE uniform sampler2D autoExposure; #endif // See equation 4: // http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf void main() { vec4 fragmentColor = texture(colorTexture, v_textureCoordinates); vec3 color = fragmentColor.rgb; #ifdef AUTO_EXPOSURE float exposure = texture(autoExposure, vec2(0.5)).r; color /= exposure; #endif color = (color * (1.0 + color / white)) / (1.0 + color); color = czm_inverseGamma(color); out_FragColor = vec4(color, fragmentColor.a); } `,Xze=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453); } void main(void) { float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1; vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb; vec3 green = vec3(0.0, 1.0, 0.0); out_FragColor = vec4((noiseValue + rgb) * green, 1.0); } `,Qze=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; #ifdef AUTO_EXPOSURE uniform sampler2D autoExposure; #endif // See equation 3: // http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf void main() { vec4 fragmentColor = texture(colorTexture, v_textureCoordinates); vec3 color = fragmentColor.rgb; #ifdef AUTO_EXPOSURE float exposure = texture(autoExposure, vec2(0.5)).r; color /= exposure; #endif color = color / (1.0 + color); color = czm_inverseGamma(color); out_FragColor = vec4(color, fragmentColor.a); } `,Kze=`uniform sampler2D colorTexture; uniform sampler2D silhouetteTexture; in vec2 v_textureCoordinates; void main(void) { vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates); vec4 color = texture(colorTexture, v_textureCoordinates); out_FragColor = mix(color, silhouetteColor, silhouetteColor.a); } `;function $p(){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 on,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new H,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties($p.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(!!c(e))return e[e.length-1].getColorTexture(0)}}});function o6(e){const t=e._framebuffers;if(!c(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function Zze(e,t){o6(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let l=0;l<r;++l)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[l]=new on,s[l].update(t,n,i,1,o);const a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function r6(e){const t=e._commands;if(!c(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function Jze(e,t){let n;if(t===0)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 eUe(e,t){let n=`uniform sampler2D colorTexture; in vec2 v_textureCoordinates; float sampleTexture(vec2 offset) { `;return e===0?n+=` vec4 color = texture(colorTexture, v_textureCoordinates + offset); return czm_luminance(color.rgb); `:n+=` return texture(colorTexture, v_textureCoordinates + offset).r; `,n+=`} `,n+=`uniform vec2 colorTextureDimensions; uniform vec2 minMaxLuminance; uniform sampler2D previousLuminance; void main() { float color = 0.0; float xStep = 1.0 / colorTextureDimensions.x; float yStep = 1.0 / colorTextureDimensions.y; int count = 0; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { vec2 offset; offset.x = -xStep + float(i) * xStep; offset.y = -yStep + float(j) * yStep; if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { continue; } color += sampleTexture(offset); ++count; } } if (count > 0) { color /= float(count); } `,e===t-1&&(n+=` float previous = texture(previousLuminance, vec2(0.5)).r; color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); color = previous + (color - previous) / (60.0 * 1.5); color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); `),n+=` out_FragColor = vec4(color); } `,n}function tUe(e,t){r6(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(eUe(r,i),{framebuffer:n[r].framebuffer,uniformMap:Jze(e,r)});e._commands=o}$p.prototype.clear=function(e){const t=this._framebuffers;if(!c(t))return;let n=this._clearCommand;c(n)||(n=this._clearCommand=new bi({color:new z(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};$p.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,Zze(this,e),tUe(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o};$p.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!c(n))return;const i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};$p.prototype.isDestroyed=function(){return!1};$p.prototype.destroy=function(){return o6(this),r6(this),ve(this)};const nUe={NEAREST:0,LINEAR:1},wp=nUe;function Wn(e){e=y(e,y.EMPTY_OBJECT);const t=e.fragmentShader,n=y(e.textureScale,1),i=y(e.pixelFormat,Ve.RGBA);if(A.typeOf.string("options.fragmentShader",t),A.typeOf.number.greaterThan("options.textureScale",n,0),A.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!Ve.isColorFormat(i))throw new E("options.pixelFormat must be a color format.");this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=y(e.forcePowerOfTwo,!1),this._sampleMode=y(e.sampleMode,wp.NEAREST),this._pixelFormat=i,this._pixelDatatype=y(e.pixelDatatype,Me.UNSIGNED_BYTE),this._clearColor=y(e.clearColor,z.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 o=new Lp;o.scissorTest={enabled:!0,rectangle:c(e.scissorRectangle)?Re.clone(e.scissorRectangle):new Re},this._passState=o,this._ready=!1;let r=e.name;c(r)||(r=Wr()),this._name=r,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(Wn.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(c(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(c(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 iUe=/uniform\s+sampler2D\s+depthTexture/g;Wn.prototype._isSupported=function(e){return!iUe.test(this._fragmentShader)||e.depthTexture};function oUe(e,t,n){const i=t[n];return(typeof i=="string"||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(o){const r=t[n];t[n]=o;const s=e._actualUniforms,a=s[n];c(a)&&a!==r&&a instanceof xt&&!c(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof xt&&e._texturesToRelease.push(r),typeof o=="string"||o instanceof HTMLCanvasElement||o instanceof HTMLImageElement||o instanceof HTMLVideoElement||o instanceof ImageData?e._dirtyUniforms.push(n):s[n]=o}}}function rUe(e,t){return function(){const n=e._actualUniforms[t];return typeof n=="function"?n():n}}function sUe(e,t){return function(){const n=e[t]();if(c(n))return n.dimensions}}function aUe(e){if(c(e._uniformMap))return;const t={},n={},i=e._uniforms,o=e._actualUniforms;for(const r in i)if(i.hasOwnProperty(r)){typeof i[r]!="function"?(t[r]=rUe(e,r),n[r]=oUe(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();(typeof s=="string"||s instanceof xt||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=sUe(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=jt(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 cUe(e,t){if(c(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(c(e._selectedIdTexture)){const o=e._selectedIdTexture.width;n=n.replace(/in\s+vec2\s+v_textureCoordinates;/g,""),n=`#define CZM_SELECTED_FEATURE uniform sampler2D czm_idTexture; uniform sampler2D czm_selectedIdTexture; uniform float czm_selectedIdTextureStep; in vec2 v_textureCoordinates; bool czm_selected(vec2 offset) { bool selected = false; vec4 id = texture(czm_idTexture, v_textureCoordinates + offset); for (int i = 0; i < ${o}; ++i) { vec4 selectedId = texture(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5)); if (all(equal(id, selectedId))) { return true; } } return false; } bool czm_selected() { return czm_selected(vec2(0.0)); } ${n}`}const i=new Oe({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function lUe(e){const t=e._sampleMode;let n,i;t===wp.LINEAR?(n=en.LINEAR,i=Yo.LINEAR):(n=en.NEAREST,i=Yo.NEAREST);const o=e._sampler;(!c(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function uUe(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function dUe(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function hUe(e,t){let n,i,o;const r=e._texturesToRelease;let s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;const a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){const f=a[n];o=f.name;const _=f.source;e._actualUniforms[o]=new xt({context:t,source:_})}a.length=0;const l=e._dirtyUniforms;if(l.length===0&&!c(e._texturePromise)){e._ready=!0;return}if(l.length===0||c(e._texturePromise))return;s=l.length;const u=e._uniforms,h=[];for(n=0;n<s;++n){o=l[n];const f=u[o],_=e._textureCache.getStageByName(f);if(c(_))e._actualUniforms[o]=dUe(e,f);else if(typeof f=="string"){const g=new Ae({url:f});h.push(g.fetchImage().then(uUe(e,o)))}else e._texturesToCreate.push({name:o,source:f})}l.length=0,h.length>0?(e._ready=!1,e._texturePromise=Promise.all(h).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function s6(e){c(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(!c(t))return;const n=e._uniforms,i=e._actualUniforms;for(const o in i)i.hasOwnProperty(o)&&i[o]instanceof xt&&(c(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function fUe(e){let t=c(e._selected)?e._selected.length:0;const n=c(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function pUe(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!c(n))return;let i,o,r=0;const s=n.length;for(i=0;i<s;++i)o=n[i],c(o.pickIds)?r+=o.pickIds.length:c(o.pickId)&&++r;if(s===0||r===0){const h=new Uint8Array(4);h[0]=255,h[1]=255,h[2]=255,h[3]=255,e._selectedIdTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:h,width:1,height:1},sampler:un.NEAREST});return}let a,l=0;const u=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],c(o.pickIds)){const h=o.pickIds,f=h.length;for(let _=0;_<f;++_)a=h[_].color,u[l]=z.floatToByte(a.red),u[l+1]=z.floatToByte(a.green),u[l+2]=z.floatToByte(a.blue),u[l+3]=z.floatToByte(a.alpha),l+=4}else c(o.pickId)&&(a=o.pickId.color,u[l]=z.floatToByte(a.red),u[l+1]=z.floatToByte(a.green),u[l+2]=z.floatToByte(a.blue),u[l+3]=z.floatToByte(a.alpha),l+=4);e._selectedIdTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:un.NEAREST})}Wn.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&s6(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=fUe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0,pUe(this,e),aUe(this),hUe(this,e),cUe(this,e),lUe(this),this._selectedDirty=!1,!this._ready))return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!c(n))return;const i=n.getColorTexture(0);let o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!c(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=Ue.fromCache({viewport:new Re(0,0,i.width,i.height)}))),this._command.renderState=o};Wn.prototype.execute=function(e,t,n,i){if(!c(this._command)||!c(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,un.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;c(o)&&(o.context=e),this._command.execute(e,o)};Wn.prototype.isDestroyed=function(){return!1};Wn.prototype.destroy=function(){return s6(this),ve(this)};function Cs(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.stages",e.stages),A.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=y(e.inputPreviousStageTexture,!0);let t=e.name;c(t)||(t=Wr()),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}Object.defineProperties(Cs.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}}});Cs.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};Cs.prototype.get=function(e){return A.typeOf.number.greaterThanOrEquals("index",e,0),A.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function mUe(e){let t=c(e._selected)?e._selected.length:0;const n=c(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}Cs.prototype.update=function(e,t){this._selectedDirty=mUe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let o=0;o<i;++o){const r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};Cs.prototype.isDestroyed=function(){return!1};Cs.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return ve(this)};const uo={};function dE(e){const o=`#define USE_STEP_SIZE ${$D}`,r=new Wn({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:wp.LINEAR}),s=new Wn({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:wp.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(l){const u=r.uniforms,h=s.uniforms;u.delta=h.delta=l}},sigma:{get:function(){return r.uniforms.sigma},set:function(l){const u=r.uniforms,h=s.uniforms;u.sigma=h.sigma=l}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(l){const u=r.uniforms,h=s.uniforms;u.stepSize=h.stepSize=l}}}),new Cs({name:e,stages:[r,s],uniforms:a})}uo.createBlurStage=function(){return dE("czm_blur")};uo.createDepthOfFieldStage=function(){const e=dE("czm_depth_of_field_blur"),t=new Wn({name:"czm_depth_of_field_composite",fragmentShader:Hze,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(i){t.uniforms.focalDistance=i}},delta:{get:function(){return e.uniforms.delta},set:function(i){e.uniforms.delta=i}},sigma:{get:function(){return e.uniforms.sigma},set:function(i){e.uniforms.sigma=i}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(i){e.uniforms.stepSize=i}}}),new Cs({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};uo.isDepthOfFieldSupported=function(e){return e.context.depthTexture};uo.createEdgeDetectionStage=function(){const e=Wr();return new Wn({name:`czm_edge_detection_${e}`,fragmentShader:jze,uniforms:{length:.25,color:z.clone(z.BLACK)}})};uo.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function _Ue(e){if(!c(e))return uo.createEdgeDetectionStage();const t=new Cs({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a}; `,o+=` vec4 edge${a} = texture(edgeTexture${a}, v_textureCoordinates); if (edge${a}.a > 0.0) { color = edge${a}; break; } `,n[`edgeTexture${a}`]=e[a].name;const r=`${i}in vec2 v_textureCoordinates; void main() { vec4 color = vec4(0.0); for (int i = 0; i < ${e.length}; i++) { ${o} } out_FragColor = color; } `,s=new Wn({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new Cs({name:"czm_edge_detection_composite",stages:[t,s]})}uo.createSilhouetteStage=function(e){const t=_Ue(e),n=new Wn({name:"czm_silhouette_color_edges",fragmentShader:Kze,uniforms:{silhouetteTexture:t.name}});return new Cs({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};uo.isSilhouetteSupported=function(e){return e.context.depthTexture};uo.createBloomStage=function(){const e=new Wn({name:"czm_bloom_contrast_bias",fragmentShader:Vze,uniforms:{contrast:128,brightness:-.3}}),t=dE("czm_bloom_blur"),n=new Cs({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new Wn({name:"czm_bloom_generate_composite",fragmentShader:Uze,uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(r){i.uniforms.glowOnly=r}},contrast:{get:function(){return e.uniforms.contrast},set:function(r){e.uniforms.contrast=r}},brightness:{get:function(){return e.uniforms.brightness},set:function(r){e.uniforms.brightness=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}}}),new Cs({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};uo.createAmbientOcclusionStage=function(){const e=new Wn({name:"czm_ambient_occlusion_generate",fragmentShader:Fze,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=dE("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new Cs({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new Wn({name:"czm_ambient_occlusion_composite",fragmentShader:Bze,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(r){e.uniforms.intensity=r}},bias:{get:function(){return e.uniforms.bias},set:function(r){e.uniforms.bias=r}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(r){e.uniforms.lengthCap=r}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(r){e.uniforms.stepSize=r}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(r){e.uniforms.frustumLength=r}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(r){e.uniforms.randomTexture=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(r){i.uniforms.ambientOcclusionOnly=r}}}),new Cs({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};uo.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const gUe=`#define FXAA_QUALITY_PRESET 39 ${L1e} ${qze}`;uo.createFXAAStage=function(){return new Wn({name:"czm_FXAA",fragmentShader:gUe,sampleMode:wp.LINEAR})};uo.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE `:"";return t+=Mze,new Wn({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE `:"";return t+=Wze,new Wn({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE `:"";return t+=Qze,new Wn({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE `:"";return t+=$ze,new Wn({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:z.WHITE,autoExposure:void 0}})};uo.createAutoExposureStage=function(){return new $p};uo.createBlackAndWhiteStage=function(){return new Wn({name:"czm_black_and_white",fragmentShader:zze,uniforms:{gradations:5}})};uo.createBrightnessStage=function(){return new Wn({name:"czm_brightness",fragmentShader:kze,uniforms:{brightness:.5}})};uo.createNightVisionStage=function(){return new Wn({name:"czm_night_vision",fragmentShader:Xze})};uo.createDepthViewStage=function(){return new Wn({name:"czm_depth_view",fragmentShader:Gze})};uo.createLensFlareStage=function(){return new Wn({name:"czm_lens_flare",fragmentShader:Yze,uniforms:{dirtTexture:Zt("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:Zt("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:ae.WGS84.maximumRadius}})};const _h=uo;function Su(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function Wy(e){for(;c(e.length);)e=e.get(e.length-1);return e.name}function XD(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;const r=n[i.name]={};if(c(o)){const a=e.getStageByName(o);r[Wy(a)]=!0}const s=i.uniforms;if(c(s)){const a=Object.getOwnPropertyNames(s),l=a.length;for(let u=0;u<l;++u){const h=s[a[u]];if(typeof h=="string"){const f=e.getStageByName(h);c(f)&&(r[Wy(f)]=!0)}}}return i.name}function Ty(e,t,n,i,o){if(c(i.enabled)&&!i.enabled||c(i._isSupported)&&!i._isSupported(t))return o;const r=o,s=!c(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let a=o;const l=i.length;for(let f=0;f<l;++f){const _=i.get(f);c(_.length)?a=Ty(e,t,n,_,o):a=XD(e,t,n,_,o),s&&(o=a)}let u,h;if(s)for(u=1;u<l;++u)h=Wy(i.get(u)),c(n[h])||(n[h]={}),n[h][r]=!0;else for(u=1;u<l;++u){h=Wy(i.get(u));const f=n[h];for(let _=0;_<u;++_)f[Wy(i.get(_))]=!0}return a}function yUe(e,t){const n={};if(c(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=Ty(e,t,n,i,void 0);a=Ty(e,t,n,o,a),a=XD(e,t,n,r,a),a=Ty(e,t,n,e,a),XD(e,t,n,s,a)}else Ty(e,t,n,e,void 0);return n}function bUe(e,t,n){const o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,l=o._pixelDatatype,u=o._clearColor;let h,f;const _=e._framebuffers,g=_.length;for(h=0;h<g;++h){if(f=_[h],r!==f.textureScale||s!==f.forcePowerOfTwo||a!==f.pixelFormat||l!==f.pixelDatatype||!z.equals(u,f.clearColor))continue;const m=f.stages,b=m.length;let T=!1;for(let x=0;x<b;++x)if(n[m[x]]){T=!0;break}if(!T)break}return c(f)&&h<g?(f.stages.push(t),f):(f={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:l,clearColor:u,stages:[t],buffer:new on({pixelFormat:a,pixelDatatype:l}),clear:void 0},_.push(f),f)}function TUe(e,t){const n=yUe(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=bUe(e,i,n[i]))}function QD(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function AUe(e,t){const n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){const a=o[s],l=a.textureScale;let u=Math.ceil(n*l),h=Math.ceil(i*l),f=Math.min(u,h);a.forcePowerOfTwo&&(R.isPowerOfTwo(f)||(f=R.nextPowerOfTwo(f)),u=f,h=f),a.buffer.update(t,u,h),a.clear=new bi({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}Su.prototype.updateDependencies=function(){this._updateDependencies=!0};Su.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=c(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=c(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=c(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=c(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!c(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(QD(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&TUe(this,e);const l=e.drawingBufferWidth,u=e.drawingBufferHeight,h=this._width!==l||this._height!==u;!n&&!h||(this._width=l,this._height=u,this._updateDependencies=!1,QD(this),AUe(this,e))};Su.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};Su.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};Su.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};Su.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(!!c(t))return t.buffer.framebuffer};Su.prototype.isDestroyed=function(){return!1};Su.prototype.destroy=function(){return QD(this),ve(this)};const Ay={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Ay.REINHARD||e===Ay.MODIFIED_REINHARD||e===Ay.FILMIC||e===Ay.ACES}},xy=Object.freeze(Ay),B1=[];function js(){const e=_h.createFXAAStage(),t=_h.createAmbientOcclusionStage(),n=_h.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=_h.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=xy.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new Su(this),r={},s=B1;for(s.push(e,t,n,i);s.length>0;){const l=s.pop();r[l.name]=l,l._textureCache=o;const u=l.length;if(c(u))for(let h=0;h<u;++h)s.push(l.get(h))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const a=this;t.uniforms.randomTexture=function(){return a._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=r,this._textureCache=o}Object.defineProperties(js.prototype,{ready:{get:function(){let e=!1;const t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){const l=t[a];e=e||l.ready&&l.enabled}const i=this._fxaa,o=this._ao,r=this._bloom,s=this._tonemapping;return e=e||i.ready&&i.enabled,e=e||o.ready&&o.enabled,e=e||r.ready&&r.enabled,e=e||s.ready&&s.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return z1(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,n=t.length;for(let s=n-1;s>=0;--s){const a=t[s];if(c(a)&&a.ready&&a.enabled)return this.getOutputTexture(a.name)}const i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const o=this._bloom;if(o.enabled&&o.ready)return this.getOutputTexture(o.name);const r=this._ao;if(r.enabled&&r.ready)return this.getOutputTexture(r.name)}},hasSelected:{get:function(){const e=this._stages.slice();for(;e.length>0;){const t=e.pop();if(!c(t))continue;if(c(t.selected))return!0;const n=t.length;if(c(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;if(!xy.validate(e))throw new E("tonemapper was set to an invalid value.");c(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case xy.REINHARD:n=_h.createReinhardTonemappingStage(t);break;case xy.MODIFIED_REINHARD:n=_h.createModifiedReinhardTonemappingStage(t);break;case xy.FILMIC:n=_h.createFilmicTonemappingStage(t);break;default:n=_h.createAcesTonemappingStage(t);break}if(t){const i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}this._tonemapper=e,this._tonemapping=n,c(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}});function z1(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._stages=t}js.prototype.add=function(e){A.typeOf.object("stage",e);const t=this._stageNames,n=B1;for(n.push(e);n.length>0;){const o=n.pop();if(c(t[o.name]))throw new E(`${o.name} has already been added to the collection or does not have a unique name.`);t[o.name]=o,o._textureCache=this._textureCache;const r=o.length;if(c(r))for(let s=0;s<r;++s)n.push(o.get(s))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e};js.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=B1;for(n.push(e);n.length>0;){const i=n.pop();delete t[i.name];const o=i.length;if(c(o))for(let r=0;r<o;++r)n.push(i.get(r))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0};js.prototype.contains=function(e){return c(e)&&c(e._index)&&e._textureCache===this._textureCache};js.prototype.get=function(e){z1(this);const t=this._stages,n=t.length;return A.typeOf.number.greaterThanOrEquals("stages length",n,0),A.typeOf.number.greaterThanOrEquals("index",e,0),A.typeOf.number.lessThan("index",e,n),t[e]};js.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};js.prototype.getStageByName=function(e){return this._stageNames[e]};js.prototype.update=function(e,t,n){z1(this);const i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const r=this._stages;let s=o.length=r.length,a,l,u=0;for(a=0;a<s;++a)l=r[a],l.ready&&l.enabled&&l._isSupported(e)&&(o[u++]=l);o.length=u;let h=u!==i.length;if(!h){for(a=0;a<u;++a)if(o[a]!==i[a]){h=!0;break}}const f=this._ao,_=this._bloom,g=this._autoExposure,m=this._tonemapping,b=this._fxaa;m.enabled=n;const T=f.enabled&&f._isSupported(e),x=_.enabled&&_._isSupported(e),C=m.enabled&&m._isSupported(e),w=b.enabled&&b._isSupported(e);if((h||this._textureCacheDirty||T!==this._aoEnabled||x!==this._bloomEnabled||C!==this._tonemappingEnabled||w!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=T,this._bloomEnabled=x,this._tonemappingEnabled=C,this._fxaaEnabled=w,this._textureCacheDirty=!1),c(this._randomTexture)&&!T&&(this._randomTexture.destroy(),this._randomTexture=void 0),!c(this._randomTexture)&&T){s=256*256*3;const v=new Uint8Array(s);for(a=0;a<s;a+=3)v[a]=Math.floor(Math.random()*255);this._randomTexture=new xt({context:e,pixelFormat:Ve.RGB,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:v,width:256,height:256},sampler:new un({wrapS:Fn.REPEAT,wrapT:Fn.REPEAT,minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})})}for(this._textureCache.update(e),b.update(e,t),f.update(e,t),_.update(e,t),m.update(e,t),this._autoExposureEnabled&&g.update(e,t),s=r.length,a=0;a<s;++a)r[a].update(e,t);for(u=0,a=0;a<s;++a)l=r[a],l.ready&&l.enabled&&l._isSupported(e)&&u++;h=u!==o.length,h&&this.update(e,t,n)};js.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function Hf(e){for(;c(e.length);)e=e.get(e.length-1);return e.outputTexture}js.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(!!c(t))return Hf(t)};function Yl(e,t,n,i,o){if(c(e.execute)){e.execute(t,n,i,o);return}const r=e.length;let s;if(e.inputPreviousStageTexture)for(Yl(e.get(0),t,n,i,o),s=1;s<r;++s)Yl(e.get(s),t,Hf(e.get(s-1)),i,o);else for(s=0;s<r;++s)Yl(e.get(s),t,n,i,o)}js.prototype.execute=function(e,t,n,i){const o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,l=this._bloom,u=this._autoExposure,h=this._tonemapping,f=a.enabled&&a._isSupported(e),_=l.enabled&&l._isSupported(e),g=this._autoExposureEnabled,m=h.enabled&&h._isSupported(e),b=s.enabled&&s._isSupported(e);if(!b&&!f&&!_&&!m&&r===0)return;let T=t;f&&a.ready&&(Yl(a,e,T,n,i),T=Hf(a)),_&&l.ready&&(Yl(l,e,T,n,i),T=Hf(l)),g&&u.ready&&Yl(u,e,T,n,i),m&&h.ready&&(Yl(h,e,T,n,i),T=Hf(h));let x=T;if(r>0){Yl(o[0],e,T,n,i);for(let C=1;C<r;++C)Yl(o[C],e,Hf(o[C-1]),n,i);x=Hf(o[r-1])}b&&s.ready&&Yl(s,e,x,n,i)};js.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};js.prototype.isDestroyed=function(){return!1};js.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(),ve(this)};const xUe={SHIFT:0,CTRL:1,ALT:2},Tc=Object.freeze(xUe),CUe={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},pn=Object.freeze(CUe);function sf(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function U1(e,t){let n=e;return c(t)&&(n+=`+${t}`),n}function Xp(e){if(e.shiftKey)return Tc.SHIFT;if(e.ctrlKey)return Tc.CTRL;if(e.altKey)return Tc.ALT}const Vo={LEFT:0,MIDDLE:1,RIGHT:2};function pa(e,t,n,i){function o(r){i(e,r)}Yt.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function EUe(e){const t=e._element,n=c(t.disableRootEvents)?t:document;Yt.supportsPointerEvents()?(pa(e,"pointerdown",t,PUe),pa(e,"pointerup",t,Z3),pa(e,"pointermove",t,OUe),pa(e,"pointercancel",t,Z3)):(pa(e,"mousedown",t,a6),pa(e,"mouseup",n,c6),pa(e,"mousemove",n,l6),pa(e,"touchstart",t,IUe),pa(e,"touchend",n,Y3),pa(e,"touchmove",n,DUe),pa(e,"touchcancel",n,Y3)),pa(e,"dblclick",t,SUe);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",pa(e,i,t,vUe)}function wUe(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}const G3={position:new H};function k1(e){e._lastSeenTouchEvent=xo()}function V1(e){return xo()-e._lastSeenTouchEvent>da.mouseEmulationIgnoreMilliseconds}function KD(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function a6(e,t){if(!V1(e))return;const n=t.button;e._buttonDown[n]=!0;let i;if(n===Vo.LEFT)i=pn.LEFT_DOWN;else if(n===Vo.MIDDLE)i=pn.MIDDLE_DOWN;else if(n===Vo.RIGHT)i=pn.RIGHT_DOWN;else return;const o=sf(e,t,e._primaryPosition);H.clone(o,e._primaryStartPosition),H.clone(o,e._primaryPreviousPosition);const r=Xp(t),s=e.getInputAction(i,r);c(s)&&(H.clone(o,G3.position),s(G3),t.preventDefault())}const j3={position:new H},W3={position:new H};function Rv(e,t,n,i){const o=Xp(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(c(r)||c(s)){const a=sf(e,i,e._primaryPosition);if(c(r)&&(H.clone(a,j3.position),r(j3)),c(s)){const l=e._primaryStartPosition;KD(l,a,e._clickPixelTolerance)&&(H.clone(a,W3.position),s(W3))}}}function c6(e,t){if(!V1(e))return;const n=t.button;n!==Vo.LEFT&&n!==Vo.MIDDLE&&n!==Vo.RIGHT||(e._buttonDown[Vo.LEFT]&&(Rv(e,pn.LEFT_UP,pn.LEFT_CLICK,t),e._buttonDown[Vo.LEFT]=!1),e._buttonDown[Vo.MIDDLE]&&(Rv(e,pn.MIDDLE_UP,pn.MIDDLE_CLICK,t),e._buttonDown[Vo.MIDDLE]=!1),e._buttonDown[Vo.RIGHT]&&(Rv(e,pn.RIGHT_UP,pn.RIGHT_CLICK,t),e._buttonDown[Vo.RIGHT]=!1))}const Nv={startPosition:new H,endPosition:new H};function l6(e,t){if(!V1(e))return;const n=Xp(t),i=sf(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(pn.MOUSE_MOVE,n);c(r)&&(H.clone(o,Nv.startPosition),H.clone(i,Nv.endPosition),r(Nv)),H.clone(i,o),(e._buttonDown[Vo.LEFT]||e._buttonDown[Vo.MIDDLE]||e._buttonDown[Vo.RIGHT])&&t.preventDefault()}const q3={position:new H};function SUe(e,t){const n=t.button;let i;if(n===Vo.LEFT)i=pn.LEFT_DOUBLE_CLICK;else return;const o=Xp(t),r=e.getInputAction(i,o);c(r)&&(sf(e,t,q3.position),r(q3))}function vUe(e,t){let n;if(c(t.deltaY)){const r=t.deltaMode;r===t.DOM_DELTA_PIXEL?n=-t.deltaY:r===t.DOM_DELTA_LINE?n=-t.deltaY*40:n=-t.deltaY*120}else t.detail>0?n=t.detail*-120:n=t.wheelDelta;if(!c(n))return;const i=Xp(t),o=e.getInputAction(pn.WHEEL,i);c(o)&&(o(n),t.preventDefault())}function IUe(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,sf(e,r,new H));hE(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.set(s,H.clone(a.get(s)))}function Y3(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);hE(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.remove(s)}const $3={position:new H},Mv={position1:new H,position2:new H},X3={position:new H},Q3={position:new H},K3={position:new H};function hE(e,t){const n=Xp(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(o!==1&&e._buttonDown[Vo.LEFT]){if(e._buttonDown[Vo.LEFT]=!1,c(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(pn.LEFT_UP,n),c(r)&&(H.clone(e._primaryPosition,X3.position),r(X3)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(pn.LEFT_CLICK,n),c(s))){const l=e._primaryStartPosition,u=e._previousPositions.values[0];KD(l,u,e._clickPixelTolerance)&&(H.clone(e._primaryPosition,Q3.position),s(Q3))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(pn.PINCH_END,n),c(r)&&r()),o===1&&!a){const l=i.values[0];H.clone(l,e._primaryPosition),H.clone(l,e._primaryStartPosition),H.clone(l,e._primaryPreviousPosition),e._buttonDown[Vo.LEFT]=!0,r=e.getInputAction(pn.LEFT_DOWN,n),c(r)&&(H.clone(l,$3.position),r($3)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(pn.RIGHT_CLICK,n),c(s))){const u=e._primaryStartPosition,h=e._previousPositions.values[0];KD(u,h,e._holdPixelTolerance)&&(H.clone(e._primaryPosition,K3.position),s(K3))}},da.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(pn.PINCH_START,n),c(r)&&(H.clone(i.values[0],Mv.position1),H.clone(i.values[1],Mv.position2),r(Mv),t.preventDefault()))}function DUe(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;const u=a.get(s);c(u)&&sf(e,r,u)}u6(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,H.clone(a.get(s),l.get(s))}const Fv={startPosition:new H,endPosition:new H},sy={distance:{startPosition:new H,endPosition:new H},angleAndHeight:{startPosition:new H,endPosition:new H}};function u6(e,t){const n=Xp(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(r===1&&e._buttonDown[Vo.LEFT]){const a=i.values[0];H.clone(a,e._primaryPosition);const l=e._primaryPreviousPosition;s=e.getInputAction(pn.MOUSE_MOVE,n),c(s)&&(H.clone(l,Fv.startPosition),H.clone(a,Fv.endPosition),s(Fv)),H.clone(a,l),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(pn.PINCH_MOVE,n),c(s))){const a=i.values[0],l=i.values[1],u=o.values[0],h=o.values[1],f=l.x-a.x,_=l.y-a.y,g=Math.sqrt(f*f+_*_)*.25,m=h.x-u.x,b=h.y-u.y,T=Math.sqrt(m*m+b*b)*.25,x=(l.y+a.y)*.125,C=(h.y+u.y)*.125,w=Math.atan2(_,f),v=Math.atan2(b,m);H.fromElements(0,T,sy.distance.startPosition),H.fromElements(0,g,sy.distance.endPosition),H.fromElements(v,C,sy.angleAndHeight.startPosition),H.fromElements(w,x,sy.angleAndHeight.endPosition),s(sy)}}function PUe(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.set(i,sf(e,t,new H)),hE(e,t),e._previousPositions.set(i,H.clone(n.get(i)))}else a6(e,t)}function Z3(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.remove(i),hE(e,t),e._previousPositions.remove(i)}else c6(e,t)}function OUe(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId,o=n.get(i);if(!c(o))return;sf(e,t,o),u6(e,t);const r=e._previousPositions;H.clone(n.get(i),r.get(i))}else l6(e,t)}function da(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-da.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new H,this._primaryPosition=new H,this._primaryPreviousPosition=new H,this._positions=new mt,this._previousPositions=new mt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=y(e,document),EUe(this)}da.prototype.setInputAction=function(e,t,n){if(!c(e))throw new E("action is required.");if(!c(t))throw new E("type is required.");const i=U1(t,n);this._inputEvents[i]=e};da.prototype.getInputAction=function(e,t){if(!c(e))throw new E("type is required.");const n=U1(e,t);return this._inputEvents[n]};da.prototype.removeInputAction=function(e,t){if(!c(e))throw new E("type is required.");const n=U1(e,t);delete this._inputEvents[n]};da.prototype.isDestroyed=function(){return!1};da.prototype.destroy=function(){return wUe(this),ve(this)};da.mouseEmulationIgnoreMilliseconds=800;da.touchHoldDelayMilliseconds=1500;function Qp(e){A.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}Qp.prototype.completeMorph=function(){c(this._completeMorph)&&this._completeMorph()};Qp.prototype.morphTo2D=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof It,!(this._previousMode===oe.SCENE2D||this._previousMode===oe.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE2D,!0),n._mode=oe.MORPHING,n.camera._setTransform(L.IDENTITY),this._previousMode===oe.COLUMBUS_VIEW?uke(this,e):gke(this,e,t),e===0&&c(this._completeMorph)&&this._completeMorph())};const LUe=new d,RUe=new d,NUe=new d,MUe=new d,FUe=new d,BUe=new d,zUe=new d,UUe=new he,kUe=new L,VUe=new _n,HUe=new It,GUe={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};Qp.prototype.morphToColumbusView=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===oe.COLUMBUS_VIEW||this._previousMode===oe.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,oe.COLUMBUS_VIEW,!0),n.camera._setTransform(L.IDENTITY);let i=LUe;const o=RUe,r=NUe;if(e>0)i.x=0,i.y=-1,i.z=1,i=d.multiplyByScalar(d.normalize(i,i),5*t.maximumRadius,i),d.negate(d.normalize(i,o),o),d.cross(d.UNIT_X,o,r);else{const u=n.camera;if(this._previousMode===oe.SCENE2D)d.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,d.negate(d.UNIT_Z,o),d.clone(d.UNIT_Y,r);else{d.clone(u.positionWC,i),d.clone(u.directionWC,o),d.clone(u.upWC,r);const h=t.scaleToGeodeticSurface(i,zUe),f=zt.eastNorthUpToFixedFrame(h,t,kUe);L.inverseTransformation(f,f),n.mapProjection.project(t.cartesianToCartographic(i,UUe),i),L.multiplyByPointAsVector(f,o,o),L.multiplyByPointAsVector(f,r,r)}}let s;this._morphToOrthographic?(s=HUe,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=VUe,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=R.toRadians(60));const a=GUe;a.position=i,a.direction=o,a.up=r,a.frustum=s;const l=bke(a);hb(this,l),this._previousMode===oe.SCENE2D?yke(this,e,a,l):(a.position2D=L.multiplyByPoint(Ye.TRANSFORM_2D,i,MUe),a.direction2D=L.multiplyByPointAsVector(Ye.TRANSFORM_2D,o,FUe),a.up2D=L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r,BUe),n._mode=oe.MORPHING,T6(this,e,a,l)),e===0&&c(this._completeMorph)&&this._completeMorph()};const H1={position:new d,direction:new d,up:new d,frustum:void 0},d6=new _n;Qp.prototype.morphTo3D=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===oe.SCENE3D||this._previousMode===oe.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE3D,!0),n._mode=oe.MORPHING,n.camera._setTransform(L.IDENTITY),this._previousMode===oe.SCENE2D)eke(this,e,t);else{let i;e>0?(i=H1,d.fromDegrees(0,0,5*t.maximumRadius,t,i.position),d.negate(i.position,i.direction),d.normalize(i.direction,i.direction),d.clone(d.UNIT_Z,i.up)):i=h6(this,t);let o;const r=n.camera;r.frustum instanceof It?o=r.frustum.clone():(o=d6,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=R.toRadians(60)),i.frustum=o;const s=x6(i);hb(this,s),ZD(this,e,i,s)}e===0&&c(this._completeMorph)&&this._completeMorph()}};Qp.prototype.isDestroyed=function(){return!1};Qp.prototype.destroy=function(){return fE(this),ve(this)};function hb(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new da(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,pn.LEFT_DOWN),e._morphHandler.setInputAction(n,pn.MIDDLE_DOWN),e._morphHandler.setInputAction(n,pn.RIGHT_DOWN),e._morphHandler.setInputAction(n,pn.WHEEL)}}function fE(e){const t=e._currentTweens;for(let n=0;n<t.length;++n)t[n].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}const jUe=new he,WUe=new d,qUe=new L;function h6(e,t){const n=e._scene,i=n.camera,o=H1,r=o.position,s=o.direction,a=o.up,l=n.mapProjection.unproject(i.position,jUe);t.cartographicToCartesian(l,r);const u=t.scaleToGeodeticSurface(r,WUe),h=zt.eastNorthUpToFixedFrame(u,t,qUe);return L.multiplyByPointAsVector(h,i.direction,s),L.multiplyByPointAsVector(h,i.up,a),o}const YUe=new d,$Ue=new d,XUe=new d,QUe=new d,KUe=new d,ZUe=new d;function ZD(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(r.position,YUe),a=d.clone(r.direction,$Ue),l=d.clone(r.up,XUe),u=L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,n.position,QUe),h=L.multiplyByPointAsVector(Ye.TRANSFORM_2D_INVERSE,n.direction,KUe),f=L.multiplyByPointAsVector(Ye.TRANSFORM_2D_INVERSE,n.up,ZUe);function _(m){Ac(s,u,m.time,r.position),Ac(a,h,m.time,r.direction),Ac(l,f,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const g=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){A6(e,o,0,1,t,i)}});e._currentTweens.push(g)}const JUe=new It,f6=new d,p6=new d,m6=new d,G1=new d,_6=new d,g6=new d;function eke(e,t,n){t/=3;const i=e._scene,o=i.camera;let r;t>0?(r=H1,d.fromDegrees(0,0,5*n.maximumRadius,n,r.position),d.negate(r.position,r.direction),d.normalize(r.direction,r.direction),d.clone(d.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=h6(e,n));let s;e._morphToOrthographic?(s=JUe,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=d6,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=R.toRadians(60)),r.frustum=s;const a=x6(r);hb(e,a);let l;e._morphToOrthographic?l=function(){ZD(e,t,r,a)}:l=function(){b6(e,t,r,function(){ZD(e,t,r,a)})},t>0?(i._mode=oe.SCENE2D,o.flyTo({duration:t,destination:d.fromDegrees(0,0,5*n.maximumRadius,n,G1),complete:function(){i._mode=oe.MORPHING,l()}})):l()}function Ac(e,t,n,i){return d.lerp(e,t,n,i)}function y6(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof It)return;const a=s.frustum.fov,l=R.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(l*.5)+1e7;function h(_){s.frustum.fov=R.lerp(a,l,_.time);const g=u/Math.tan(s.frustum.fov*.5);i(s,g)}const f=r.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:h,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(f)}const tke=new d,nke=new d,ike=new d,Bv=new d,oke=new d,rke=new d,ske=new Ki,ake=new nn,cke=new d,lke={position:void 0,direction:void 0,up:void 0,frustum:void 0};function uke(e,t){t*=.5;const n=e._scene,i=n.camera,o=d.clone(i.position,tke),r=d.clone(i.direction,nke),s=d.clone(i.up,ike),a=d.negate(d.UNIT_Z,oke),l=d.clone(d.UNIT_Y,rke),u=Bv;if(t>0)d.clone(d.ZERO,Bv),u.z=5*n.mapProjection.ellipsoid.maximumRadius;else{d.clone(o,Bv);const T=ake;L.multiplyByPoint(Ye.TRANSFORM_2D,o,T.origin),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r,T.direction);const x=n.globe;if(c(x)){const C=x.pickWorldCoordinates(T,n,!0,cke);c(C)&&(L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,C,u),u.z+=d.distance(o,u))}}const h=ske;h.right=u.z*.5,h.left=-h.right,h.top=h.right*(n.drawingBufferHeight/n.drawingBufferWidth),h.bottom=-h.top;const f=lke;f.position=u,f.direction=a,f.up=l,f.frustum=h;const _=C6(f);hb(e,_);function g(T){Ac(o,u,T.time,i.position),Ac(r,a,T.time,i.direction),Ac(s,l,T.time,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function m(T,x){T.position.z=x}const b=n.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){y6(e,t,f,m,_)}});e._currentTweens.push(b)}const J3=new he,dke={position:new d,direction:new d,up:new d,position2D:new d,direction2D:new d,up2D:new d,frustum:new Ki},hke={position:new d,direction:new d,up:new d,frustum:void 0},fke=new d,pke=new nn,mke=new L,_ke=new d;function gke(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=dke;if(t>0)d.clone(d.ZERO,r.position),r.position.z=5*n.maximumRadius,d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,J3),i.mapProjection.project(J3,r.position),d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);const f=pke;d.clone(r.position2D,f.origin);const _=d.clone(o.directionWC,f.direction),g=n.scaleToGeodeticSurface(o.positionWC,_ke),m=zt.eastNorthUpToFixedFrame(g,n,mke);L.inverseTransformation(m,m),L.multiplyByPointAsVector(m,_,_),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,_,_);const b=i.globe;if(c(b)){const T=b.pickWorldCoordinates(f,i,!0,fke);if(c(T)){const x=d.distance(r.position2D,T);T.x+=x,d.clone(T,r.position2D)}}}function s(f,_){f.position.x=_}L.multiplyByPoint(Ye.TRANSFORM_2D,r.position,r.position2D),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r.direction,r.direction2D),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r.up,r.up2D);const a=r.frustum;a.right=r.position.z*.5,a.left=-a.right,a.top=a.right*(i.drawingBufferHeight/i.drawingBufferWidth),a.bottom=-a.top;const l=hke;L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,r.position2D,l.position),d.clone(r.direction,l.direction),d.clone(r.up,l.up),l.frustum=a;const u=C6(l);hb(e,u);function h(){y6(e,t,r,s,u)}T6(e,t,r,h)}function b6(e,t,n,i){const o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();const a=r.frustum.fov,l=R.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(l*.5)+1e7,r.frustum.fov=l;function h(_){r.frustum.fov=R.lerp(l,a,_.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}const f=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:h,complete:function(){i(e)}});e._currentTweens.push(f)}function yke(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(n.position,G1),a=d.clone(n.direction,_6),l=d.clone(n.up,g6);o._mode=oe.MORPHING;function u(){r.frustum=n.frustum.clone();const h=d.clone(r.position,f6),f=d.clone(r.direction,p6),_=d.clone(r.up,m6);h.z=s.z;function g(b){Ac(h,s,b.time,r.position),Ac(f,a,b.time,r.direction),Ac(_,l,b.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const m=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(m)}e._morphToOrthographic?u():b6(e,0,n,u)}function T6(e,t,n,i){const o=e._scene,r=o.camera,s=d.clone(r.position,f6),a=d.clone(r.direction,p6),l=d.clone(r.up,m6),u=d.clone(n.position2D,G1),h=d.clone(n.direction2D,_6),f=d.clone(n.up2D,g6);function _(m){Ac(s,u,m.time,r.position),Ac(a,h,m.time,r.direction),Ac(l,f,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}const g=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){A6(e,o,1,0,t,i)}});e._currentTweens.push(g)}function A6(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:ka.QUARTIC_OUT};c(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function x6(e){return function(t){const n=t._scene;n._mode=oe.SCENE3D,n.morphTime=oe.getMorphTime(oe.SCENE3D),fE(t);const i=n.camera;(t._previousMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone());const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE3D,r)}}function C6(e){return function(t){const n=t._scene;n._mode=oe.SCENE2D,n.morphTime=oe.getMorphTime(oe.SCENE2D),fE(t);const i=n.camera;d.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone();const o=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE2D,o)}}function bke(e){return function(t){const n=t._scene;n._mode=oe.COLUMBUS_VIEW,n.morphTime=oe.getMorphTime(oe.COLUMBUS_VIEW),fE(t);const i=n.camera;(t._previousModeMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right));const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.COLUMBUS_VIEW,r)}}const Tke={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Gn=Object.freeze(Tke);function _s(e,t){let n=e;return c(t)&&(n+=`+${t}`),n}function Ake(e,t){H.clone(e.distance.startPosition,t.distance.startPosition),H.clone(e.distance.endPosition,t.distance.endPosition),H.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),H.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function ez(e,t,n){const i=_s(Gn.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,l=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new H;let u=e._movement[i];c(u)||(u=e._movement[i]={}),u.distance={startPosition:new H,endPosition:new H},u.angleAndHeight={startPosition:new H,endPosition:new H},u.prevAngle=0,e._eventHandler.setInputAction(function(h){e._buttonsDown++,r[i]=!0,a[i]=new Date,H.lerp(h.position1,h.position2,.5,s[i])},pn.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,l[i]=new Date},pn.PINCH_END,t),e._eventHandler.setInputAction(function(h){if(r[i]){o[i]?(Ake(h,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):(H.clone(h.distance.endPosition,u.distance.endPosition),H.clone(h.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let f=u.angleAndHeight.endPosition.x;const _=u.prevAngle,g=Math.PI*2;for(;f>=_+Math.PI;)f-=g;for(;f<_-Math.PI;)f+=g;u.angleAndHeight.endPosition.x=-f*n.clientWidth/12,u.angleAndHeight.startPosition.x=-_*n.clientWidth/12}},pn.PINCH_MOVE,t)}function tz(e,t){const n=_s(Gn.WHEEL,t),i=e._pressTime,o=e._releaseTime,r=e._update;r[n]=!0;let s=e._movement[n];c(s)||(s=e._movement[n]={});let a=e._lastMovement[n];c(a)||(a=e._lastMovement[n]={startPosition:new H,endPosition:new H,valid:!1}),s.startPosition=new H,H.clone(H.ZERO,s.startPosition),s.endPosition=new H,e._eventHandler.setInputAction(function(l){const u=7.5*R.toRadians(l);i[n]=o[n]=new Date,s.endPosition.x=0,s.endPosition.y=u,H.clone(s.endPosition,a.endPosition),a.valid=!0,r[n]=!1},pn.WHEEL,t)}function Pm(e,t,n){const i=_s(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new H;let l=e._lastMovement[i];c(l)||(l=e._lastMovement[i]={startPosition:new H,endPosition:new H,valid:!1});let u,h;n===Gn.LEFT_DRAG?(u=pn.LEFT_DOWN,h=pn.LEFT_UP):n===Gn.RIGHT_DRAG?(u=pn.RIGHT_DOWN,h=pn.RIGHT_UP):n===Gn.MIDDLE_DRAG&&(u=pn.MIDDLE_DOWN,h=pn.MIDDLE_UP),e._eventHandler.setInputAction(function(f){e._buttonsDown++,l.valid=!1,o[i]=!0,s[i]=new Date,H.clone(f.position,r[i])},u,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date},h,t)}function nz(e,t){H.clone(e.startPosition,t.startPosition),H.clone(e.endPosition,t.endPosition)}function iz(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in Gn)if(Gn.hasOwnProperty(s)){const a=Gn[s];if(c(a)){const l=_s(a,t);n[l]=!0,c(e._lastMovement[l])||(e._lastMovement[l]={startPosition:new H,endPosition:new H,valid:!1}),c(e._movement[l])||(e._movement[l]={startPosition:new H,endPosition:new H})}}e._eventHandler.setInputAction(function(s){for(const a in Gn)if(Gn.hasOwnProperty(a)){const l=Gn[a];if(c(l)){const u=_s(l,t);r[u]&&(n[u]?(nz(i[u],o[u]),o[u].valid=!0,nz(s,i[u]),n[u]=!1):H.clone(s.endPosition,i[u].endPosition))}}H.clone(s.endPosition,e._currentMousePosition)},pn.MOUSE_MOVE,t)}function jc(e){if(!c(e))throw new E("canvas is required.");this._eventHandler=new da(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new H,tz(this,void 0),ez(this,void 0,e),Pm(this,void 0,Gn.LEFT_DRAG),Pm(this,void 0,Gn.RIGHT_DRAG),Pm(this,void 0,Gn.MIDDLE_DRAG),iz(this,void 0);for(const t in Tc)if(Tc.hasOwnProperty(t)){const n=Tc[t];c(n)&&(tz(this,n),ez(this,n,e),Pm(this,n,Gn.LEFT_DRAG),Pm(this,n,Gn.RIGHT_DRAG),Pm(this,n,Gn.MIDDLE_DRAG),iz(this,n))}}Object.defineProperties(jc.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!this._update[_s(Gn.WHEEL)]||!this._update[_s(Gn.WHEEL,Tc.SHIFT)]||!this._update[_s(Gn.WHEEL,Tc.CTRL)]||!this._update[_s(Gn.WHEEL,Tc.ALT)];return this._buttonsDown>0||e}}});jc.prototype.isMoving=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return!this._update[n]};jc.prototype.getMovement=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._movement[n]};jc.prototype.getLastMovement=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t),i=this._lastMovement[n];if(i.valid)return i};jc.prototype.isButtonDown=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._isDown[n]};jc.prototype.getStartMousePosition=function(e,t){if(!c(e))throw new E("type is required.");if(e===Gn.WHEEL)return this._currentMousePosition;const n=_s(e,t);return this._eventStartPosition[n]};jc.prototype.getButtonPressTime=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._pressTime[n]};jc.prototype.getButtonReleaseTime=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._releaseTime[n]};jc.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};jc.prototype.isDestroyed=function(){return!1};jc.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),ve(this)};function aC(e,t,n,i,o,r,s,a,l,u){this._tweens=e,this._tweenjs=t,this._startObject=Je(n),this._stopObject=Je(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=l,this.cancel=u,this.needsStart=!0}Object.defineProperties(aC.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}}});aC.prototype.cancelTween=function(){this._tweens.remove(this)};function Wc(){this._tweens=[]}Object.defineProperties(Wc.prototype,{length:{get:function(){return this._tweens.length}}});Wc.prototype.add=function(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.startObject)||!c(e.stopObject))throw new E("options.startObject and options.stopObject are required.");if(!c(e.duration)||e.duration<0)throw new E("options.duration is required and must be positive.");if(e.duration===0)return c(e.complete)&&e.complete(),new aC(this);const t=e.duration/qn.SECONDS_PER_MILLISECOND,n=y(e.delay,0),i=n/qn.SECONDS_PER_MILLISECOND,o=y(e.easingFunction,ka.LINEAR_NONE),r=e.startObject,s=new w1e(r);s.to(Je(e.stopObject),t),s.delay(i),s.easing(o),c(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(y(e.complete,null)),s.repeat(y(e._repeat,0));const a=new aC(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};Wc.prototype.addProperty=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.object,n=e.property,i=e.startValue,o=e.stopValue;if(!c(t)||!c(e.property))throw new E("options.object and options.property are required.");if(!c(t[n]))throw new E("options.object must have the specified property.");if(!c(i)||!c(o))throw new E("options.startValue and options.stopValue are required.");function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};Wc.prototype.addAlpha=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.material;if(!c(t))throw new E("options.material is required.");const n=[];for(const o in t.uniforms)t.uniforms.hasOwnProperty(o)&&c(t.uniforms[o])&&c(t.uniforms[o].alpha)&&n.push(o);if(n.length===0)throw new E("material has no properties with alpha components.");function i(o){const r=n.length;for(let s=0;s<r;++s)t.uniforms[n[s]].alpha=o.alpha}return this.add({startObject:{alpha:y(e.startValue,0)},stopObject:{alpha:y(e.stopValue,1)},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};Wc.prototype.addOffsetIncrement=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.material;if(!c(t))throw new E("material is required.");if(!c(t.uniforms.offset))throw new E("material.uniforms must have an offset property.");const n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})};Wc.prototype.remove=function(e){if(!c(e))return!1;const t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),c(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};Wc.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),c(n.cancel)&&n.cancel()}e.length=0};Wc.prototype.contains=function(e){return c(e)&&this._tweens.indexOf(e)!==-1};Wc.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._tweens[e]};Wc.prototype.update=function(e){const t=this._tweens;let n=0;for(e=c(e)?e/qn.SECONDS_PER_MILLISECOND:xo();n<t.length;){const i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};function fb(e){if(!c(e))throw new E("scene is required.");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=Gn.LEFT_DRAG,this.zoomEventTypes=[Gn.RIGHT_DRAG,Gn.WHEEL,Gn.PINCH],this.rotateEventTypes=Gn.LEFT_DRAG,this.tiltEventTypes=[Gn.MIDDLE_DRAG,Gn.PINCH,{eventType:Gn.LEFT_DRAG,modifier:Tc.CTRL},{eventType:Gn.RIGHT_DRAG,modifier:Tc.CTRL}],this.lookEventTypes={eventType:Gn.LEFT_DRAG,modifier:Tc.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumPickingTerrainDistanceWithInertia=4e3,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._lastGlobeHeight=0,this._aggregator=new jc(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 Wc,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new H(-1,-1),this._tiltCenter=new d,this._rotateMousePosition=new H(-1,-1),this._rotateStartPosition=new d,this._strafeStartPosition=new d,this._strafeMousePosition=new H,this._strafeEndMousePosition=new H,this._zoomMouseStart=new H(-1,-1),this._zoomWorldPosition=new d,this._useZoomWorldPosition=!1,this._panLastMousePosition=new H,this._panLastWorldPosition=new d,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 he(Math.PI,R.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=1/5e3,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function xke(e,t){if(e<0)return 0;const n=(1-t)*25;return Math.exp(-n*e)}function Cke(e){return H.equalsEpsilon(e.startPosition,e.endPosition,R.EPSILON14)}const Eke=.4;function wke(e,t,n,i,o,r,s){let a=r[s];c(a)||(a=r[s]={startPosition:new H,endPosition:new H,motion:new H,inertiaEnabled:!0});const l=e.getButtonPressTime(t,n),u=e.getButtonReleaseTime(t,n),h=l&&u&&(u.getTime()-l.getTime())/1e3,f=new Date,_=u&&(f.getTime()-u.getTime())/1e3;if(l&&u&&h<Eke){const g=xke(_,i),m=e.getLastMovement(t,n);if(!c(m)||Cke(m)||!a.inertiaEnabled||(a.motion.x=(m.endPosition.x-m.startPosition.x)*.5,a.motion.y=(m.endPosition.y-m.startPosition.y)*.5,a.startPosition=H.clone(m.startPosition,a.startPosition),a.endPosition=H.multiplyByScalar(a.motion,g,a.endPosition),a.endPosition=H.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||H.distance(a.startPosition,a.endPosition)<.5))return;if(!e.isButtonDown(t,n)){const b=e.getStartMousePosition(t,n);o(r,b,a)}}}function Ske(e,t){if(c(t)){let n=e[t];c(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(c(i)){const o=i.length;for(let r=0;r<o;++r)n=e[i[r]],c(n)&&(n.inertiaEnabled=!1)}}}const oz=[];function Ls(e,t,n,i,o,r){if(!c(n))return;const s=e._aggregator;Array.isArray(n)||(oz[0]=n,n=oz);const a=n.length;for(let l=0;l<a;++l){const u=n[l],h=c(u.eventType)?u.eventType:u,f=u.modifier,_=s.isMoving(h,f)&&s.getMovement(h,f),g=s.getStartMousePosition(h,f);e.enableInputs&&t&&(_?(i(e,g,_),Ske(e,r)):o<1&&wke(s,h,f,o,i,e,r))}}const _A=new nn,vke=new d,Ike=new H,Dke=new d,Pke=new H,Oke=new d,Lke=new d,Rke=new d,Nke=new d,E6=new d,Mke=new d,Fke=new d,Bke=new d,zke=new d,Uke=new d,kke=new d,Vke=new d,Hke=new d,Gke=new d,jke=new d,Lf=new d,rz=new d,sz=new d,zv={orientation:new lr};function j1(e,t,n,i,o,r){let s=1;c(r)&&(s=R.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,h=e.maximumZoomDistance,f=o-u;let _=i*f;_=R.clamp(_,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let m=_*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!c(e._globe)){if(m>0&&Math.abs(o-u)<1||m<0&&Math.abs(o-h)<1)return;o-m<u?m=o-u-1:o-m>h&&(m=o-h)}const b=e._scene,T=b.camera,x=b.mode,C=zv.orientation;if(C.heading=T.heading,C.pitch=T.pitch,C.roll=T.roll,T.frustum instanceof It){Math.abs(m)>0&&(T.zoomIn(m),T._adjustOrthographicFrustum(!0));return}const w=y(n.inertiaEnabled,H.equals(t,e._zoomMouseStart));let v=e._zoomingOnVector,P=e._rotatingZoom,N;if(w||(e._zoomMouseStart=H.clone(t,e._zoomMouseStart),c(e._globe)&&x===oe.SCENE2D?(N=T.getPickRay(t,_A).origin,N=d.fromElements(N.y,N.z,N.x)):c(e._globe)&&(N=gd(e,t,vke)),c(N)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=d.clone(N,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,v=e._zoomingOnVector=!1,P=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){T.zoomIn(m);return}let k=x===oe.COLUMBUS_VIEW;if(T.positionCartographic.height<2e6&&(P=!0),!w||P){if(x===oe.SCENE2D){const M=e._zoomWorldPosition,U=T.position;if(!d.equals(M,U)&&T.positionCartographic.height<e._maxCoord.x*2){const B=T.position.x,S=d.subtract(M,U,Dke);d.normalize(S,S);const D=d.distance(M,U)*m/(T.getMagnitude()*.5);T.move(S,D*.5),(T.position.x<0&&B>0||T.position.x>0&&B<0)&&(N=T.getPickRay(t,_A).origin,N=d.fromElements(N.y,N.z,N.x),e._zoomWorldPosition=d.clone(N,e._zoomWorldPosition))}}else if(x===oe.SCENE3D){const M=d.normalize(T.position,E6);if(e._cameraUnderground||e._zoomingUnderground||T.positionCartographic.height<3e3&&Math.abs(d.dot(T.direction,M))<.6)k=!0;else{const U=b.canvas,B=Pke;B.x=U.clientWidth/2,B.y=U.clientHeight/2;const S=gd(e,B,Oke);if(!c(S))k=!0;else if(T.positionCartographic.height<1e6)if(d.dot(T.direction,M)>=-.5)k=!0;else{const D=Fke;d.clone(T.position,D);const p=e._zoomWorldPosition;let I=Mke;if(I=d.normalize(p,I),d.dot(I,M)<0)return;const O=jke,F=Uke;d.clone(T.direction,F),d.add(D,d.multiplyByScalar(F,1e3,Lf),O);const V=kke,G=Vke;d.subtract(p,D,V),d.normalize(V,G);const j=d.dot(M,G);if(j>=0){e._zoomMouseStart.x=-1;return}const W=Math.acos(-j),X=d.magnitude(D),q=d.magnitude(p),ee=X-m,Y=d.magnitude(V),ne=Math.asin(R.clamp(Y/q*Math.sin(W),-1,1)),Q=Math.asin(R.clamp(ee/q*Math.sin(W),-1,1)),le=ne-Q+W,pe=Bke;d.normalize(D,pe);let re=zke;re=d.cross(G,pe,re),re=d.normalize(re,re),d.normalize(d.cross(pe,re,Lf),F),d.multiplyByScalar(d.normalize(O,Lf),d.magnitude(O)-m,O),d.normalize(D,D),d.multiplyByScalar(D,ee,D);const de=Hke;d.multiplyByScalar(d.add(d.multiplyByScalar(pe,Math.cos(le)-1,rz),d.multiplyByScalar(F,Math.sin(le),sz),Lf),ee,de),d.add(D,de,D),d.normalize(O,pe),d.normalize(d.cross(pe,re,Lf),F);const fe=Gke;d.multiplyByScalar(d.add(d.multiplyByScalar(pe,Math.cos(le)-1,rz),d.multiplyByScalar(F,Math.sin(le),sz),Lf),d.magnitude(O),fe),d.add(O,fe,O),d.clone(D,T.position),d.normalize(d.subtract(O,D,Lf),T.direction),d.clone(T.direction,T.direction),d.cross(T.direction,T.up,T.right),d.cross(T.right,T.direction,T.up),T.setView(zv);return}else{const D=d.normalize(S,Lke),p=d.normalize(e._zoomWorldPosition,Rke),I=d.dot(p,D);if(I>0&&I<1){const O=R.acosClamped(I),F=d.cross(p,D,Nke),V=Math.abs(O)>R.toRadians(20)?T.positionCartographic.height*.75:T.positionCartographic.height-m,G=m/V;T.rotate(F,O*G)}}}}e._rotatingZoom=!k}if(!w&&k||v){let M;const U=Ao.wgs84ToWindowCoordinates(b,e._zoomWorldPosition,Ike);x!==oe.COLUMBUS_VIEW&&H.equals(t,e._zoomMouseStart)&&c(U)?M=T.getPickRay(U,_A):M=T.getPickRay(t,_A);const B=M.direction;(x===oe.COLUMBUS_VIEW||x===oe.SCENE2D)&&d.fromElements(B.y,B.z,B.x,B),T.move(B,m),e._zoomingOnVector=!0}else T.zoomIn(m);e._cameraUnderground||T.setView(zv)}const Wke=new nn,qke=new nn,Yke=new d;function $ke(e,t,n){const o=e._scene.camera;let r=o.getPickRay(n.startPosition,Wke).origin,s=o.getPickRay(n.endPosition,qke).origin;r=d.fromElements(r.y,r.z,r.x,r),s=d.fromElements(s.y,s.z,s.x,s);const a=d.subtract(r,s,Yke),l=d.magnitude(a);l>0&&(d.normalize(a,a),o.move(a,l))}function az(e,t,n){c(n.distance)&&(n=n.distance);const o=e._scene.camera;j1(e,t,n,e._zoomFactor,o.getMagnitude())}const Xke=new H,Qke=new H;function cz(e,t,n){if(c(n.angleAndHeight)){Kke(e,t,n.angleAndHeight);return}const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let l=Xke;l.x=2/s*n.startPosition.x-1,l.y=2/a*(a-n.startPosition.y)-1,l=H.normalize(l,l);let u=Qke;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=H.normalize(u,u);let h=R.acosClamped(l.x);l.y<0&&(h=R.TWO_PI-h);let f=R.acosClamped(u.x);u.y<0&&(f=R.TWO_PI-f);const _=f-h;o.twistRight(_)}function Kke(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);const o=e._scene,r=o.camera,s=o.canvas;let a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);const l=i*a*Math.PI*4;r.twistRight(l)}function Zke(e){const t=e._scene.mapMode2D===Wh.ROTATE;L.equals(L.IDENTITY,e._scene.camera.transform)?(Ls(e,e.enableTranslate,e.translateEventTypes,$ke,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,az,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Ls(e,e.enableRotate,e.tiltEventTypes,cz,e.inertiaSpin,"_lastInertiaTiltMovement")):(Ls(e,e.enableZoom,e.zoomEventTypes,az,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Ls(e,e.enableRotate,e.translateEventTypes,cz,e.inertiaSpin,"_lastInertiaSpinMovement"))}const w6=new nn,Jke=new d,eVe=new d;function gd(e,t,n){const i=e._scene,o=e._globe,r=i.camera;let s;if(i.pickPositionSupported&&(s=i.pickPositionWorldCoordinates(t,Jke)),!c(o))return d.clone(s,n);const a=!e._cameraUnderground,l=r.getPickRay(t,w6),u=o.pickWorldCoordinates(l,i,a,eVe),h=c(s)?d.distance(s,r.positionWC):Number.POSITIVE_INFINITY,f=c(u)?d.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return h<f?d.clone(s,n):d.clone(u,n)}const tVe=new he;function cC(e){const t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode;let r=0;if(o===oe.SCENE3D){const l=t.cartesianToCartographic(i.position,tVe);c(l)&&(r=l.height)}else r=i.position.z;const s=y(e._scene.globeHeight,0);return Math.abs(s-r)}const nVe=new d;function S6(e,t){const n=t.origin,i=t.direction,o=cC(e),r=d.normalize(n,nVe);let s=Math.abs(d.dot(r,i));return s=Math.max(s,.5)*2,o*s}function v6(e,t,n,i){let o=d.distance(t.origin,n);const r=cC(e),s=R.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),nn.getPoint(t,o,i)}function I6(e,t,n,i){let o;return c(n)?(o=d.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=cC(e))):o=cC(e),nn.getPoint(t,o,i)}const iVe=new H;function D6(e,t){const n=t.endPosition,i=H.subtract(t.endPosition,t.startPosition,iVe),o=e._strafeEndMousePosition;H.add(o,i,o),t.endPosition=o,W1(e,t,e._strafeStartPosition),t.endPosition=n}const lz=new nn,oVe=new nn,Uv=new d,rVe=new d,sVe=new d,aVe=new d,cVe=new _t(d.UNIT_X,0),lVe=new H,uVe=new H;function dVe(e,t,n){if(d.equals(t,e._translateMousePosition)||(e._looking=!1),d.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){Ra(e,t,n);return}if(e._strafing){D6(e,n);return}const o=e._scene.camera,r=e._cameraUnderground,s=H.clone(n.startPosition,lVe),a=H.clone(n.endPosition,uVe);let l=o.getPickRay(s,lz);const u=d.clone(d.ZERO,aVe),h=d.UNIT_X;let f;if(o.position.z<e._minimumPickingTerrainHeight&&(f=gd(e,s,Uv),c(f)&&(u.x=f.x)),r||u.x>o.position.z&&c(f)){let w=f;r&&(w=I6(e,l,f,Uv)),H.clone(t,e._strafeMousePosition),H.clone(t,e._strafeEndMousePosition),d.clone(w,e._strafeStartPosition),e._strafing=!0,W1(e,n,e._strafeStartPosition);return}const _=_t.fromPointNormal(u,h,cVe);l=o.getPickRay(s,lz);const g=Ei.rayPlane(l,_,Uv),m=o.getPickRay(a,oVe),b=Ei.rayPlane(m,_,rVe);if(!c(g)||!c(b)){e._looking=!0,Ra(e,t,n),H.clone(t,e._translateMousePosition);return}const T=d.subtract(g,b,sVe),x=T.x;T.x=T.y,T.y=T.z,T.z=x;const C=d.magnitude(T);C>R.EPSILON6&&(d.normalize(T,T),o.move(T,C))}const P6=new H,lx=new nn,ux=new d,hVe=new d,O6=new L,fVe=new L,pVe=new d,mVe=new _t(d.UNIT_X,0),kv=new d,JD=new he,L6=new L,_Ve=new _e,gVe=new $,dx=new d;function yVe(e,t,n){if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){Ra(e,t,n);return}const o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,bVe(e,t,n)):TVe(e,t,n)}function bVe(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=P6;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,lx),l=d.UNIT_X,u=a.origin,h=a.direction;let f;const _=d.dot(l,h);if(Math.abs(_)>R.EPSILON6&&(f=-d.dot(l,u)/_),!c(f)||f<=0){e._looking=!0,Ra(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}const g=d.multiplyByScalar(h,f,ux);d.add(u,g,g);const m=i.mapProjection,b=m.ellipsoid;d.fromElements(g.y,g.z,g.x,g);const T=m.unproject(g,JD);b.cartographicToCartesian(T,g);const x=zt.eastNorthUpToFixedFrame(g,b,O6),C=e._globe,w=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const v=L.clone(o.transform,L6);o._setTransform(x),La(e,t,n,d.UNIT_Z),o._setTransform(v),e._globe=C,e._ellipsoid=w;const P=w.maximumRadius;e._rotateFactor=1/P,e._rotateRateRangeAdjustment=P}function TVe(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const l=d.UNIT_X;if(H.equals(t,e._tiltCenterMousePosition))s=d.clone(e._tiltCenter,ux);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=gd(e,t,ux)),!c(s)){a=o.getPickRay(t,lx);const S=a.origin,D=a.direction;let p;const I=d.dot(l,D);if(Math.abs(I)>R.EPSILON6&&(p=-d.dot(l,S)/I),!c(p)||p<=0){e._looking=!0,Ra(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}s=d.multiplyByScalar(D,p,ux),d.add(S,s,s)}r&&(c(a)||(a=o.getPickRay(t,lx)),v6(e,a,s,s)),H.clone(t,e._tiltCenterMousePosition),d.clone(s,e._tiltCenter)}const u=i.canvas,h=P6;h.x=u.clientWidth/2,h.y=e._tiltCenterMousePosition.y,a=o.getPickRay(h,lx);const f=d.clone(d.ZERO,pVe);f.x=s.x;const _=_t.fromPointNormal(f,l,mVe),g=Ei.rayPlane(a,_,hVe),m=o._projection,b=m.ellipsoid;d.fromElements(s.y,s.z,s.x,s);let T=m.unproject(s,JD);b.cartographicToCartesian(T,s);const x=zt.eastNorthUpToFixedFrame(s,b,O6);let C;c(g)?(d.fromElements(g.y,g.z,g.x,g),T=m.unproject(g,JD),b.cartographicToCartesian(T,g),C=zt.eastNorthUpToFixedFrame(g,b,fVe)):C=x;const w=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const N=L.clone(o.transform,L6);o._setTransform(x);const k=d.cross(d.UNIT_Z,d.normalize(o.position,kv),kv),M=d.dot(o.right,k);if(La(e,t,n,P,!1,!0),o._setTransform(C),M<0){const S=n.startPosition.y-n.endPosition.y;(r&&S<0||!r&&S>0)&&(P=void 0);const D=o.constrainedAxis;o.constrainedAxis=void 0,La(e,t,n,P,!0,!1),o.constrainedAxis=D}else La(e,t,n,P,!0,!1);if(c(o.constrainedAxis)){const S=d.cross(o.direction,o.constrainedAxis,dx);d.equalsEpsilon(S,d.ZERO,R.EPSILON6)||(d.dot(S,o.right)<0&&d.negate(S,S),d.cross(S,o.direction,o.up),d.cross(o.direction,o.up,o.right),d.normalize(o.up,o.up),d.normalize(o.right,o.right))}o._setTransform(N),e._globe=w,e._ellipsoid=v;const U=v.maximumRadius;e._rotateFactor=1/U,e._rotateRateRangeAdjustment=U;const B=d.clone(o.positionWC,kv);if(e.enableCollisionDetection&&$1(e,!0),!d.equals(o.positionWC,B)){o._setTransform(C),o.worldToCameraCoordinatesPoint(B,B);const S=d.magnitudeSquared(B);d.magnitudeSquared(o.position)>S&&(d.normalize(o.position,o.position),d.multiplyByScalar(o.position,Math.sqrt(S),o.position));const D=d.angleBetween(B,o.position),p=d.cross(B,o.position,B);d.normalize(p,p);const I=_e.fromAxisAngle(p,D,_Ve),O=$.fromQuaternion(I,gVe);$.multiplyByVector(O,o.direction,o.direction),$.multiplyByVector(O,o.up,o.up),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up),o._setTransform(N)}}const R6=new H,N6=new nn,M6=new d;function AVe(e,t,n){c(n.distance)&&(n=n.distance);const i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground;let a;s?a=t:(a=R6,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const l=o.getPickRay(a,N6),u=l.origin,h=l.direction,f=o.position.z;let _;f<e._minimumPickingTerrainHeight&&(_=gd(e,a,M6));let g;if(c(_)&&(g=d.distance(u,_)),s){const m=S6(e,l);c(g)?g=Math.min(g,m):g=m}if(!c(g)){const m=d.UNIT_X;g=-d.dot(m,u)/d.dot(m,h)}j1(e,t,n,e._zoomFactor,g)}function xVe(e){const n=e._scene.camera;if(!L.equals(L.IDENTITY,n.transform))Ls(e,e.enableRotate,e.rotateEventTypes,La,e.inertiaSpin,"_lastInertiaSpinMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,B6,e.inertiaZoom,"_lastInertiaZoomMovement");else{const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),Ls(e,e.enableTilt,e.tiltEventTypes,yVe,e.inertiaSpin,"_lastInertiaTiltMovement"),Ls(e,e.enableTranslate,e.translateEventTypes,dVe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,AVe,e.inertiaZoom,"_lastInertiaZoomMovement"),Ls(e,e.enableLook,e.lookEventTypes,Ra),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const o=n.createCorrectPositionTween(e.bounceAnimationTime);c(o)&&(e._tween=i.add(o))}i.update()}}const CVe=new nn,EVe=new _t(d.UNIT_X,0),wVe=new d,SVe=new d;function W1(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,CVe);let s=d.clone(o.direction,SVe);i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.z,s.x,s.y,s);const a=_t.fromPointNormal(n,s,EVe),l=Ei.rayPlane(r,a,wVe);!c(l)||(s=d.subtract(n,l,s),i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.y,s.z,s.x,s),d.add(o.position,s,o.position))}const uz=new d,F6=new he,eP=new d,tP=new ae,vVe=new d,IVe=new d,DVe=new d;function PVe(e,t,n){const o=e._scene.camera,r=e._cameraUnderground;let s=e._ellipsoid;if(!L.equals(o.transform,L.IDENTITY)){La(e,t,n);return}let a,l;const u=s.geodeticSurfaceNormal(o.position,vVe);if(H.equals(t,e._rotateMousePosition)){if(e._looking)Ra(e,t,n,u);else if(e._rotating)La(e,t,n);else if(e._strafing)D6(e,n);else{if(d.magnitude(o.position)<d.magnitude(e._rotateStartPosition))return;a=d.magnitude(e._rotateStartPosition),l=eP,l.x=l.y=l.z=a,s=ae.fromCartesian3(l,tP),Hv(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const h=s.cartesianToCartographic(o.positionWC,F6).height,f=e._globe;if(c(f)&&h<e._minimumPickingTerrainHeight){const _=gd(e,n.startPosition,DVe);if(c(_)){let g=!1;const m=o.getPickRay(n.startPosition,w6);if(r)g=!0,I6(e,m,_,_);else{const b=s.geodeticSurfaceNormal(_,IVe);Math.abs(d.dot(m.direction,b))<.05?g=!0:g=d.magnitude(o.position)<d.magnitude(_)}g?(H.clone(t,e._strafeEndMousePosition),d.clone(_,e._strafeStartPosition),e._strafing=!0,W1(e,n,e._strafeStartPosition)):(a=d.magnitude(_),l=eP,l.x=l.y=l.z=a,s=ae.fromCartesian3(l,tP),Hv(e,t,n,s),d.clone(_,e._rotateStartPosition))}else e._looking=!0,Ra(e,t,n,u)}else c(o.pickEllipsoid(n.startPosition,e._ellipsoid,uz))?(Hv(e,t,n,e._ellipsoid),d.clone(uz,e._rotateStartPosition)):h>e._minimumTrackBallHeight?(e._rotating=!0,La(e,t,n)):(e._looking=!0,Ra(e,t,n,u));H.clone(t,e._rotateMousePosition)}function La(e,t,n,i,o,r){o=y(o,!1),r=y(r,!1);const s=e._scene,a=s.camera,l=s.canvas,u=a.constrainedAxis;c(i)&&(a.constrainedAxis=i);const h=d.magnitude(a.position);let f=e._rotateFactor*(h-e._rotateRateRangeAdjustment);f>e._maximumRotateRate&&(f=e._maximumRotateRate),f<e._minimumRotateRate&&(f=e._minimumRotateRate);let _=(n.startPosition.x-n.endPosition.x)/l.clientWidth,g=(n.startPosition.y-n.endPosition.y)/l.clientHeight;_=Math.min(_,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);const m=f*_*Math.PI*2,b=f*g*Math.PI;o||a.rotateRight(m),r||a.rotateUp(b),a.constrainedAxis=u}const Vv=te.clone(te.UNIT_W),dz=te.clone(te.UNIT_W),gA=new d,Om=new d,yA=new d,hz=new d,OVe=new H,LVe=new H,RVe=new H,NVe=new H,MVe=new nn;function Hv(e,t,n,i){const o=e._scene,r=o.camera,s=H.clone(n.startPosition,OVe),a=H.clone(n.endPosition,LVe),l=i.cartesianToCartographic(r.positionWC,F6).height;let u,h;if(!n.inertiaEnabled&&l<e._minimumPickingTerrainHeight&&(u=d.clone(e._panLastWorldPosition,Vv),!c(e._globe)&&!H.equalsEpsilon(s,e._panLastMousePosition)&&(u=gd(e,s,Vv)),!c(e._globe)&&c(u))){const f=d.subtract(u,r.positionWC,Om),_=d.multiplyByScalar(r.directionWC,d.dot(r.directionWC,f),Om),g=d.magnitude(_),m=r.frustum.getPixelDimensions(o.drawingBufferWidth,o.drawingBufferHeight,g,o.pixelRatio,NVe),b=H.subtract(a,s,RVe),T=d.multiplyByScalar(r.rightWC,b.x*m.x,Om),x=d.normalize(r.positionWC,E6),C=r.getPickRay(a,MVe).direction,w=d.subtract(C,d.projectVector(C,r.rightWC,yA),yA),v=d.angleBetween(w,r.directionWC);let P=1;c(r.frustum.fov)&&(P=Math.max(Math.tan(v),.1));let N=Math.abs(d.dot(r.directionWC,x));const k=-b.y*m.y*2/Math.sqrt(P)*(1-N),M=d.multiplyByScalar(C,k,yA);N=Math.abs(d.dot(r.upWC,x));const U=d.multiplyByScalar(r.upWC,-b.y*(1-N)*m.y,hz);h=d.add(u,T,dz),h=d.add(h,M,h),h=d.add(h,U,h),d.clone(h,e._panLastWorldPosition),H.clone(a,e._panLastMousePosition)}if((!c(u)||!c(h))&&(u=r.pickEllipsoid(s,i,Vv),h=r.pickEllipsoid(a,i,dz)),!c(u)||!c(h)){e._rotating=!0,La(e,t,n);return}if(u=r.worldToCameraCoordinates(u,u),h=r.worldToCameraCoordinates(h,h),c(r.constrainedAxis)){const f=r.constrainedAxis,_=d.mostOrthogonalAxis(f,gA);d.cross(_,f,_),d.normalize(_,_);const g=d.cross(f,_,Om),m=d.magnitude(u),b=d.dot(f,u),T=Math.acos(b/m),x=d.multiplyByScalar(f,b,yA);d.subtract(u,x,x),d.normalize(x,x);const C=d.magnitude(h),w=d.dot(f,h),v=Math.acos(w/C),P=d.multiplyByScalar(f,w,hz);d.subtract(h,P,P),d.normalize(P,P);let N=Math.acos(d.dot(x,_));d.dot(x,g)<0&&(N=R.TWO_PI-N);let k=Math.acos(d.dot(P,_));d.dot(P,g)<0&&(k=R.TWO_PI-k);const M=N-k;let U;d.equalsEpsilon(f,r.position,R.EPSILON2)?U=r.right:U=d.cross(f,r.position,gA);const B=d.cross(f,U,gA),S=d.dot(B,d.subtract(u,f,Om)),D=d.dot(B,d.subtract(h,f,Om));let p;S>0&&D>0?p=v-T:S>0&&D<=0?d.dot(r.position,f)>0?p=-T-v:p=T+v:p=T-v,r.rotateRight(M),r.rotateUp(p)}else{d.normalize(u,u),d.normalize(h,h);const f=d.dot(u,h),_=d.cross(u,h,gA);if(f<1&&!d.equalsEpsilon(_,d.ZERO,R.EPSILON14)){const g=Math.acos(f);r.rotate(_,g)}}}const FVe=new d,BVe=new he;let fz=0;function B6(e,t,n){c(n.distance)&&(n=n.distance);const i=n.inertiaEnabled,o=e._ellipsoid,r=e._scene,s=r.camera,a=r.canvas,l=e._cameraUnderground;let u;l?u=t:(u=R6,u.x=a.clientWidth/2,u.y=a.clientHeight/2);const h=s.getPickRay(u,N6);let f;const _=o.cartesianToCartographic(s.position,BVe).height,g=Math.abs(fz)<e.minimumPickingTerrainDistanceWithInertia;(i?g:_<e._minimumPickingTerrainHeight)&&(f=gd(e,u,M6));let b;if(c(f)&&(b=d.distance(h.origin,f),fz=b),l){const x=S6(e,h);c(b)?b=Math.min(b,x):b=x}c(b)||(b=_);const T=d.normalize(s.position,FVe);j1(e,t,n,e._zoomFactor,b,d.dot(T,s.direction))}const z6=new H,hx=new nn,qy=new d,zVe=new d,U6=new L,UVe=new L,k6=new L,kVe=new _e,VVe=new $,q1=new he,Y1=new d;function HVe(e,t,n){const o=e._scene.camera;if(!L.equals(o.transform,L.IDENTITY))return;if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const a=e._ellipsoid.geodeticSurfaceNormal(o.position,Y1);Ra(e,t,n,a);return}const s=e._ellipsoid.cartesianToCartographic(o.position,q1);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,jVe(e,t,n)):WVe(e,t,n)}const GVe=new he;function jVe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,GVe).height;if(a-s-1<R.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const l=o.canvas,u=z6;u.x=l.clientWidth/2,u.y=l.clientHeight/2;const h=r.getPickRay(u,hx);let f;const _=Ei.rayEllipsoid(h,i);if(c(_))f=nn.getPoint(h,_.start,qy);else if(a>e._minimumTrackBallHeight){const C=Ei.grazingAltitudeLocation(h,i);if(!c(C))return;const w=i.cartesianToCartographic(C,q1);w.height=0,f=i.cartographicToCartesian(w,qy)}else{e._looking=!0;const C=e._ellipsoid.geodeticSurfaceNormal(r.position,Y1);Ra(e,t,n,C),H.clone(t,e._tiltCenterMousePosition);return}const g=zt.eastNorthUpToFixedFrame(f,i,U6),m=e._globe,b=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const T=L.clone(r.transform,k6);r._setTransform(g),La(e,t,n,d.UNIT_Z),r._setTransform(T),e._globe=m,e._ellipsoid=b;const x=b.maximumRadius;e._rotateFactor=1/x,e._rotateRateRangeAdjustment=x}function WVe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground;let a,l,u;if(H.equals(t,e._tiltCenterMousePosition))a=d.clone(e._tiltCenter,qy);else{if(a=gd(e,t,qy),!c(a)){if(l=r.getPickRay(t,hx),u=Ei.rayEllipsoid(l,i),!c(u)){if(i.cartesianToCartographic(r.position,q1).height<=e._minimumTrackBallHeight){e._looking=!0;const D=e._ellipsoid.geodeticSurfaceNormal(r.position,Y1);Ra(e,t,n,D),H.clone(t,e._tiltCenterMousePosition)}return}a=nn.getPoint(l,u.start,qy)}s&&(c(l)||(l=r.getPickRay(t,hx)),v6(e,l,a,a)),H.clone(t,e._tiltCenterMousePosition),d.clone(a,e._tiltCenter)}const h=o.canvas,f=z6;f.x=h.clientWidth/2,f.y=e._tiltCenterMousePosition.y,l=r.getPickRay(f,hx);const _=d.magnitude(a),g=d.fromElements(_,_,_,eP),m=ae.fromCartesian3(g,tP);if(u=Ei.rayEllipsoid(l,m),!c(u))return;const b=d.magnitude(l.origin)>_?u.start:u.stop,T=nn.getPoint(l,b,zVe),x=zt.eastNorthUpToFixedFrame(a,i,U6),C=zt.eastNorthUpToFixedFrame(T,m,UVe),w=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const N=L.clone(r.transform,k6);r._setTransform(C);const k=d.cross(T,r.positionWC,dx);if(d.dot(r.rightWC,k)<0){const S=n.startPosition.y-n.endPosition.y;(s&&S<0||!s&&S>0)&&(P=void 0);const D=r.constrainedAxis;r.constrainedAxis=void 0,La(e,t,n,P,!0,!1),r.constrainedAxis=D}else La(e,t,n,P,!0,!1);if(r._setTransform(x),La(e,t,n,P,!1,!0),c(r.constrainedAxis)){const S=d.cross(r.direction,r.constrainedAxis,dx);d.equalsEpsilon(S,d.ZERO,R.EPSILON6)||(d.dot(S,r.right)<0&&d.negate(S,S),d.cross(S,r.direction,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.up,r.up),d.normalize(r.right,r.right))}r._setTransform(N),e._globe=w,e._ellipsoid=v;const U=v.maximumRadius;e._rotateFactor=1/U,e._rotateRateRangeAdjustment=U;const B=d.clone(r.positionWC,dx);if(e.enableCollisionDetection&&$1(e,!0),!d.equals(r.positionWC,B)){r._setTransform(C),r.worldToCameraCoordinatesPoint(B,B);const S=d.magnitudeSquared(B);d.magnitudeSquared(r.position)>S&&(d.normalize(r.position,r.position),d.multiplyByScalar(r.position,Math.sqrt(S),r.position));const D=d.angleBetween(B,r.position),p=d.cross(B,r.position,B);d.normalize(p,p);const I=_e.fromAxisAngle(p,D,kVe),O=$.fromQuaternion(I,VVe);$.multiplyByVector(O,r.direction,r.direction),$.multiplyByVector(O,r.up,r.up),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up),r._setTransform(N)}}const qVe=new H,YVe=new H,pz=new nn,mz=new nn,$Ve=new d,XVe=new d;function Ra(e,t,n,i){const r=e._scene.camera,s=qVe;s.x=n.startPosition.x,s.y=0;const a=YVe;a.x=n.endPosition.x,a.y=0;let l=r.getPickRay(s,pz),u=r.getPickRay(a,mz),h=0,f,_;r.frustum instanceof It?(f=l.origin,_=u.origin,d.add(r.direction,f,f),d.add(r.direction,_,_),d.subtract(f,r.position,f),d.subtract(_,r.position,_),d.normalize(f,f),d.normalize(_,_)):(f=l.direction,_=u.direction);let g=d.dot(f,_);g<1&&(h=Math.acos(g)),h=n.startPosition.x>n.endPosition.x?-h:h;const m=e._horizontalRotationAxis;if(c(i)?r.look(i,-h):c(m)?r.look(m,-h):r.lookLeft(h),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(s,pz),u=r.getPickRay(a,mz),h=0,r.frustum instanceof It?(f=l.origin,_=u.origin,d.add(r.direction,f,f),d.add(r.direction,_,_),d.subtract(f,r.position,f),d.subtract(_,r.position,_),d.normalize(f,f),d.normalize(_,_)):(f=l.direction,_=u.direction),g=d.dot(f,_),g<1&&(h=Math.acos(g)),h=n.startPosition.y>n.endPosition.y?-h:h,i=y(i,m),c(i)){const b=r.direction,T=d.negate(i,$Ve),x=d.equalsEpsilon(b,i,R.EPSILON2),C=d.equalsEpsilon(b,T,R.EPSILON2);if(!x&&!C){g=d.dot(b,i);let w=R.acosClamped(g);h>0&&h>w&&(h=w-R.EPSILON4),g=d.dot(b,T),w=R.acosClamped(g),h<0&&-h>w&&(h=-w+R.EPSILON4);const v=d.cross(i,b,XVe);r.look(v,h)}else(x&&h<0||C&&h>0)&&r.look(r.right,-h)}else r.lookUp(h)}function QVe(e){Ls(e,e.enableRotate,e.rotateEventTypes,PVe,e.inertiaSpin,"_lastInertiaSpinMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,B6,e.inertiaZoom,"_lastInertiaZoomMovement"),Ls(e,e.enableTilt,e.tiltEventTypes,HVe,e.inertiaSpin,"_lastInertiaTiltMovement"),Ls(e,e.enableLook,e.lookEventTypes,Ra)}const KVe=new L,ZVe=new he;function $1(e,t){e._adjustedHeightForTerrain=!0;const n=e._scene,i=n.mode,o=n.globe;if(i===oe.SCENE2D||i===oe.MORPHING)return;const r=n.camera,s=y(o==null?void 0:o.ellipsoid,ae.WGS84),a=n.mapProjection;let l,u;L.equals(r.transform,L.IDENTITY)||(l=L.clone(r.transform,KVe),u=d.magnitude(r.position),r._setTransform(L.IDENTITY));const h=ZVe;i===oe.SCENE3D?s.cartesianToCartographic(r.position,h):a.unproject(r.position,h);let f=!1;if(h.height<e._minimumCollisionTerrainHeight){const _=e._scene.globeHeight;if(c(_)){const g=_+e.minimumZoomDistance,m=_-e._lastGlobeHeight,b=m/e._lastGlobeHeight;h.height<g&&(t||Math.abs(b)<=.1)&&(h.height=g,i===oe.SCENE3D?s.cartographicToCartesian(h,r.position):a.project(h,r.position),f=!0),t||Math.abs(b)<=.1?e._lastGlobeHeight=_:e._lastGlobeHeight+=m*.1}}c(l)&&(r._setTransform(l),f&&(d.normalize(r.position,r.position),d.negate(r.position,r.direction),d.multiplyByScalar(r.position,Math.max(u,e.minimumZoomDistance),r.position),d.normalize(r.direction,r.direction),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up)))}fb.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t===oe.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};const JVe=new d,e4e=new d;fb.prototype.update=function(){const e=this._scene,{camera:t,globe:n,mode:i}=e;L.equals(t.transform,L.IDENTITY)?(this._globe=n,this._ellipsoid=c(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=ae.UNIT_SPHERE);const{verticalExaggeration:o,verticalExaggerationRelativeHeight:r}=e;this._minimumCollisionTerrainHeight=oa.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=oa.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=oa.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&c(this._globe);const s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;const a=d.clone(t.positionWC,JVe),l=d.clone(t.directionWC,e4e);if(i===oe.SCENE2D?Zke(this):i===oe.COLUMBUS_VIEW?(this._horizontalRotationAxis=d.UNIT_Z,xVe(this)):i===oe.SCENE3D&&(this._horizontalRotationAxis=void 0,QVe(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){const u=!d.equals(a,t.positionWC)||!d.equals(l,t.directionWC);$1(this,u)}this._aggregator.reset()};fb.prototype.isDestroyed=function(){return!1};fb.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),ve(this)};const t4e=`uniform sampler2D colorTexture; uniform sampler2D colorTexture2; uniform vec2 center; uniform float radius; in vec2 v_textureCoordinates; void main() { vec4 color0 = texture(colorTexture, v_textureCoordinates); vec4 color1 = texture(colorTexture2, v_textureCoordinates); float x = length(gl_FragCoord.xy - center) / radius; float t = smoothstep(0.5, 0.8, x); out_FragColor = mix(color0 + color1, color1, t); } `,n4e=`uniform sampler2D colorTexture; uniform float avgLuminance; uniform float threshold; uniform float offset; in vec2 v_textureCoordinates; float key(float avg) { float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0)); return max(0.0, guess) + 0.1; } // See section 9. "The bright-pass filter" of Realtime HDR Rendering // http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf void main() { vec4 color = texture(colorTexture, v_textureCoordinates); vec3 xyz = czm_RGBToXYZ(color.rgb); float luminance = xyz.r; float scaledLum = key(avgLuminance) * luminance / avgLuminance; float brightLum = max(scaledLum - threshold, 0.0); float brightness = brightLum / (offset + brightLum); xyz.r = brightness; out_FragColor = vec4(czm_XYZToRGB(xyz), 1.0); } `;function Od(){this._sceneFramebuffer=new Eu;const e=.125,t=new Array(6);t[0]=new Wn({fragmentShader:Ep,textureScale:e,forcePowerOfTwo:!0,sampleMode:wp.LINEAR});const n=t[1]=new Wn({fragmentShader:n4e,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new H,t[2]=new Wn({fragmentShader:$D,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 Wn({fragmentShader:$D,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 Wn({fragmentShader:Ep,sampleMode:wp.LINEAR}),this._uCenter=new H,this._uRadius=void 0,t[5]=new Wn({fragmentShader:t4e,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new Cs({stages:t});const o=new Su(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Od.prototype.get=function(e){return this._stages.get(e)};Od.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const i=this._stages.get(n);if(i.name===e)return i}};const i4e=new te,_z=new H,o4e=new H,gz=new L;function r4e(e,t,n){const i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection;let l=L.computeViewportTransformation(n,0,1,gz);const u=L.multiplyByPoint(r,o,i4e);let h=zt.pointToGLWindowCoordinates(s,l,o,_z);u.x+=R.SOLAR_RADIUS;const f=zt.pointToGLWindowCoordinates(a,l,u,u),_=H.magnitude(H.subtract(f,h,f))*30*2,g=o4e;g.x=_,g.y=_,e._uCenter=H.clone(h,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;const m=t.drawingBufferWidth,b=t.drawingBufferHeight,T=e._stages,x=T.get(0),C=x.outputTexture.width,w=x.outputTexture.height,v=new Re;v.width=C,v.height=w,l=L.computeViewportTransformation(v,0,1,gz),h=zt.pointToGLWindowCoordinates(s,l,o,_z),g.x*=C/m,g.y*=w/b;const P=x.scissorRectangle;P.x=Math.max(h.x-g.x*.5,0),P.y=Math.max(h.y-g.y*.5,0),P.width=Math.min(g.x,m),P.height=Math.min(g.y,b);for(let N=1;N<4;++N)Re.clone(P,T.get(N).scissorRectangle)}Od.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};Od.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),r4e(this,t,n),o};Od.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 o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)};Od.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Od.prototype.isDestroyed=function(){return!1};Od.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),ve(this)};function V6(){this._cachedShowFrustumsShaders={}}function s4e(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function a4e(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(h){h=Oe.replaceMain(h,"czm_Debug_main");const f=/out_FragData_(\d+)/g;let _;for(;(_=f.exec(h))!==null;)r.indexOf(_[1])===-1&&r.push(_[1]);return h});const s=r.length;let a="";a+=`uniform vec3 debugShowCommandsColor; `,a+=`uniform vec3 debugShowFrustumsColor; `,a+=`void main() { czm_Debug_main(); `;let l;if(s>0)for(l=0;l<s;++l)a+=` out_FragData_${r[l]}.rgb *= debugShowCommandsColor; `,a+=` out_FragData_${r[l]}.rgb *= debugShowFrustumsColor; `;else a+=` out_FragColor.rgb *= debugShowCommandsColor; `,a+=` out_FragColor.rgb *= debugShowFrustumsColor; `;a+="}",o.sources.push(a);const u=s4e(i);return Jt.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}const ay=new z;function c4e(e,t){let n;return c(t.uniformMap)?n=t.uniformMap:n={},c(n.debugShowCommandsColor)||c(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(c(t._debugColor)||(t._debugColor=z.fromRandom()),t._debugColor):z.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(ay.red=t.debugOverlappingFrustums&1<<0?1:0,ay.green=t.debugOverlappingFrustums&1<<1?1:0,ay.blue=t.debugOverlappingFrustums&1<<2?1:0,ay.alpha=1,ay):z.WHITE}),n}const l4e=new Ze;V6.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];c(o)||(o=a4e(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=Ze.shallowClone(t,l4e);r.shaderProgram=o,r.uniformMap=c4e(e,t),r.execute(e.context,n)};function Sp(e,t,n){this._primitive=e,this._tileIndex=t,this._sampleIndex=n,this._metadata={},this._orientedBoundingBox=new Ct}Sp.fromKeyframeNode=function(e,t,n,i){A.typeOf.object("primitive",e),A.typeOf.number("tileIndex",t),A.typeOf.number("sampleIndex",n),A.typeOf.object("keyframeNode",i);const o=new Sp(e,t,n),{spatialNode:r,metadata:s}=i;return o._metadata=u4e(e,s,n),o._orientedBoundingBox=h4e(e,r,n,o._orientedBoundingBox),o};function u4e(e,t,n){if(!c(t))return;const{names:i,types:o}=e.provider,r={};for(let s=0;s<i.length;s++){const a=i[s],l=bt.getComponentCount(o[s]),u=t[s].slice(n*l,(n+1)*l);r[a]=u}return r}const yz=new d,d4e=new d;function h4e(e,t,n,i){const o=t.dimensions,r=o.x*o.y,s=Math.floor(n/r),a=n-s*r,l=Math.floor(a/o.x),u=a-l*o.x,h=d.fromElements(u,l,s,yz),f=d.divideComponents(d.subtract(h,e._paddingBefore,yz),e.dimensions,d4e);return e._shape.computeOrientedBoundingBoxForSample(t,e.dimensions,f,i)}Object.defineProperties(Sp.prototype,{metadata:{get:function(){return this._metadata}},primitive:{get:function(){return this._primitive}},sampleIndex:{get:function(){return this._sampleIndex}},tileIndex:{get:function(){return this._tileIndex}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox.clone()}}});Sp.prototype.hasProperty=function(e){return c(this._metadata[e])};Sp.prototype.getNames=function(){return Object.keys(this._metadata)};Sp.prototype.getProperty=function(e){return this._metadata[e]};const f4e=`struct Ray { vec3 pos; vec3 dir; vec3 rawDir; }; #if defined(JITTER) /** * Generate a pseudo-random value for a given 2D screen coordinate. * Similar to https://www.shadertoy.com/view/4djSRW with a modified hashscale. */ float hash(vec2 p) { vec3 p3 = fract(vec3(p.xyx) * 50.0); p3 += dot(p3, p3.yzx + 19.19); return fract((p3.x + p3.y) * p3.z); } #endif float minComponent(in vec3 v) { return min(min(v.x, v.y), v.z); } float maxComponent(in vec3 v) { return max(max(v.x, v.y), v.z); } struct PointJacobianT { vec3 point; mat3 jacobianT; }; `,p4e=`// See Intersection.glsl for the definition of intersectScene // See IntersectionUtils.glsl for the definition of nextIntersection // See convertUvToBox.glsl, convertUvToCylinder.glsl, or convertUvToEllipsoid.glsl // for the definition of convertUvToShapeUvSpace. The appropriate function is // selected based on the VoxelPrimitive shape type, and added to the shader in // Scene/VoxelRenderResources.js. // See Octree.glsl for the definitions of TraversalData, SampleData, // traverseOctreeFromBeginning, and traverseOctreeFromExisting // See Megatexture.glsl for the definition of accumulatePropertiesFromMegatexture #define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops #if defined(PICKING_VOXEL) #define ALPHA_ACCUM_MAX 0.1 #else #define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0 #endif uniform mat3 u_transformDirectionViewToLocal; uniform vec3 u_cameraPositionUv; uniform float u_stepSize; #if defined(PICKING) uniform vec4 u_pickColor; #endif vec3 getSampleSize(in int level) { vec3 sampleCount = exp2(float(level)) * vec3(u_dimensions); vec3 sampleSizeUv = 1.0 / sampleCount; return scaleShapeUvToShapeSpace(sampleSizeUv); } #define MINIMUM_STEP_SCALAR (0.02) #define SHIFT_FRACTION (0.001) /** * Given a coordinate within a tile, and sample spacings along a ray through * the coordinate, find the distance to the points where the ray entered and * exited the voxel cell, along with the surface normals at those points. * The surface normals are returned in shape space coordinates. */ RayShapeIntersection getVoxelIntersection(in vec3 tileUv, in vec3 sampleSizeAlongRay) { vec3 voxelCoord = tileUv * vec3(u_dimensions); vec3 directions = sign(sampleSizeAlongRay); vec3 positiveDirections = max(directions, 0.0); vec3 entryCoord = mix(ceil(voxelCoord), floor(voxelCoord), positiveDirections); vec3 exitCoord = entryCoord + directions; vec3 distanceFromEntry = -abs((entryCoord - voxelCoord) * sampleSizeAlongRay); float lastEntry = maxComponent(distanceFromEntry); bvec3 isLastEntry = equal(distanceFromEntry, vec3(lastEntry)); vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions; vec4 entry = vec4(entryNormal, lastEntry); vec3 distanceToExit = abs((exitCoord - voxelCoord) * sampleSizeAlongRay); float firstExit = minComponent(distanceToExit); bvec3 isFirstExit = equal(distanceToExit, vec3(firstExit)); vec3 exitNormal = vec3(isFirstExit) * directions; vec4 exit = vec4(exitNormal, firstExit); return RayShapeIntersection(entry, exit); } vec4 getStepSize(in SampleData sampleData, in Ray viewRay, in RayShapeIntersection shapeIntersection, in mat3 jacobianT, in float currentT) { // The Jacobian is computed in a space where the shape spans [-1, 1]. // But the ray is marched in a space where the shape fills [0, 1]. // So we need to scale the Jacobian by 2. vec3 gradient = 2.0 * viewRay.rawDir * jacobianT; vec3 sampleSizeAlongRay = getSampleSize(sampleData.tileCoords.w) / gradient; RayShapeIntersection voxelIntersection = getVoxelIntersection(sampleData.tileUv, sampleSizeAlongRay); // Transform normal from shape space to Cartesian space vec3 voxelNormal = normalize(jacobianT * voxelIntersection.entry.xyz); // Compare with the shape intersection, to choose the appropriate normal vec4 voxelEntry = vec4(voxelNormal, currentT + voxelIntersection.entry.w); vec4 entry = intersectionMax(shapeIntersection.entry, voxelEntry); float fixedStep = minComponent(abs(sampleSizeAlongRay)) * u_stepSize; float shift = fixedStep * SHIFT_FRACTION; float dt = voxelIntersection.exit.w + shift; if ((currentT + dt) > shapeIntersection.exit.w) { // Stop at end of shape dt = shapeIntersection.exit.w - currentT + shift; } float stepSize = clamp(dt, fixedStep * MINIMUM_STEP_SCALAR, fixedStep + shift); return vec4(entry.xyz, stepSize); } vec2 packIntToVec2(int value) { float shifted = float(value) / 255.0; float lowBits = fract(shifted); float highBits = floor(shifted) / 255.0; return vec2(highBits, lowBits); } vec2 packFloatToVec2(float value) { float lowBits = fract(value); float highBits = floor(value) / 255.0; return vec2(highBits, lowBits); } int getSampleIndex(in vec3 tileUv) { ivec3 voxelDimensions = u_dimensions; vec3 sampleCoordinate = tileUv * vec3(voxelDimensions); // tileUv = 1.0 is a valid coordinate but sampleIndex = voxelDimensions is not. // (tileUv = 1.0 corresponds to the last sample, at index = voxelDimensions - 1). // Clamp to [0, voxelDimensions - 0.5) to avoid numerical error before flooring vec3 maxCoordinate = vec3(voxelDimensions) - vec3(0.5); sampleCoordinate = clamp(sampleCoordinate, vec3(0.0), maxCoordinate); ivec3 sampleIndex = ivec3(floor(sampleCoordinate)); #if defined(PADDING) voxelDimensions += u_paddingBefore + u_paddingAfter; sampleIndex += u_paddingBefore; #endif // Convert to a 1D index for lookup in a 1D data array return sampleIndex.x + voxelDimensions.x * (sampleIndex.y + voxelDimensions.y * sampleIndex.z); } void main() { vec4 fragCoord = gl_FragCoord; vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw; // [0,1] vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz); vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection); // normalize again just in case vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection); // normalize again just in case vec3 viewPosUv = u_cameraPositionUv; #if defined(SHAPE_ELLIPSOID) // viewDirUv has been scaled to a space where the ellipsoid is a sphere. // Undo this scaling to get the raw direction. vec3 rawDir = viewDirUv * u_ellipsoidRadiiUv; Ray viewRayUv = Ray(viewPosUv, viewDirUv, rawDir); #else Ray viewRayUv = Ray(viewPosUv, viewDirUv, viewDirUv); #endif Intersections ix; RayShapeIntersection shapeIntersection = intersectScene(screenCoord, viewRayUv, ix); // Exit early if the scene was completely missed. if (shapeIntersection.entry.w == NO_HIT) { discard; } float currentT = shapeIntersection.entry.w; float endT = shapeIntersection.exit.w; vec3 positionUv = viewPosUv + currentT * viewDirUv; PointJacobianT pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv); // Traverse the tree from the start position TraversalData traversalData; SampleData sampleDatas[SAMPLE_COUNT]; traverseOctreeFromBeginning(pointJacobian.point, traversalData, sampleDatas); vec4 step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT); #if defined(JITTER) float noise = hash(screenCoord); // [0,1] currentT += noise * step.w; positionUv += noise * step.w * viewDirUv; #endif FragmentInput fragmentInput; #if defined(STATISTICS) setStatistics(fragmentInput.metadata.statistics); #endif vec4 colorAccum = vec4(0.0); for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) { // Read properties from the megatexture based on the traversal state Properties properties = accumulatePropertiesFromMegatexture(sampleDatas); // Prepare the custom shader inputs copyPropertiesToMetadata(properties, fragmentInput.metadata); fragmentInput.voxel.positionUv = positionUv; fragmentInput.voxel.positionShapeUv = pointJacobian.point; fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv; fragmentInput.voxel.viewDirUv = viewDirUv; fragmentInput.voxel.viewDirWorld = viewDirWorld; fragmentInput.voxel.surfaceNormal = step.xyz; fragmentInput.voxel.travelDistance = step.w; fragmentInput.voxel.stepCount = stepCount; fragmentInput.voxel.tileIndex = sampleDatas[0].megatextureIndex; fragmentInput.voxel.sampleIndex = getSampleIndex(sampleDatas[0].tileUv); // Run the custom shader czm_modelMaterial materialOutput; fragmentMain(fragmentInput, materialOutput); // Sanitize the custom shader output vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha); color.rgb = max(color.rgb, vec3(0.0)); color.a = clamp(color.a, 0.0, 1.0); // Pre-multiplied alpha blend colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a); // Stop traversing if the alpha has been fully saturated if (colorAccum.a > ALPHA_ACCUM_MAX) { colorAccum.a = ALPHA_ACCUM_MAX; break; } if (step.w == 0.0) { // Shape is infinitely thin. The ray may have hit the edge of a // foreground voxel. Step ahead slightly to check for more voxels step.w == 0.00001; } // Keep raymarching currentT += step.w; positionUv = viewPosUv + currentT * viewDirUv; // Check if there's more intersections. if (currentT > endT) { #if (INTERSECTION_COUNT == 1) break; #else shapeIntersection = nextIntersection(ix); if (shapeIntersection.entry.w == NO_HIT) { break; } else { // Found another intersection. Resume raymarching there currentT = shapeIntersection.entry.w; endT = shapeIntersection.exit.w; positionUv = viewPosUv + currentT * viewDirUv; } #endif } // Traverse the tree from the current ray position. // This is similar to traverseOctreeFromBeginning but is faster when the ray is in the same tile as the previous step. pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv); traverseOctreeFromExisting(pointJacobian.point, traversalData, sampleDatas); step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT); } // Convert the alpha from [0,ALPHA_ACCUM_MAX] to [0,1] colorAccum.a /= ALPHA_ACCUM_MAX; #if defined(PICKING) // If alpha is 0.0 there is nothing to pick if (colorAccum.a == 0.0) { discard; } out_FragColor = u_pickColor; #elif defined(PICKING_VOXEL) // If alpha is 0.0 there is nothing to pick if (colorAccum.a == 0.0) { discard; } vec2 megatextureId = packIntToVec2(sampleDatas[0].megatextureIndex); vec2 sampleIndex = packIntToVec2(getSampleIndex(sampleDatas[0].tileUv)); out_FragColor = vec4(megatextureId, sampleIndex); #else out_FragColor = colorAccum; #endif } `,m4e=`in vec2 position; uniform vec4 u_ndcSpaceAxisAlignedBoundingBox; void main() { vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy; vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw; vec2 translation = 0.5 * (aabbMax + aabbMin); vec2 scale = 0.5 * (aabbMax - aabbMin); gl_Position = vec4(position * scale + translation, 0.0, 1.0); } `,_4e=`/* Intersection defines #define INTERSECTION_COUNT ### */ #define NO_HIT (-czm_infinity) #define INF_HIT (czm_infinity * 0.5) struct RayShapeIntersection { vec4 entry; vec4 exit; }; vec4 intersectionMin(in vec4 intersect0, in vec4 intersect1) { if (intersect0.w == NO_HIT) { return intersect1; } else if (intersect1.w == NO_HIT) { return intersect0; } return (intersect0.w <= intersect1.w) ? intersect0 : intersect1; } vec4 intersectionMax(in vec4 intersect0, in vec4 intersect1) { return (intersect0.w >= intersect1.w) ? intersect0 : intersect1; } RayShapeIntersection intersectIntersections(in Ray ray, in RayShapeIntersection intersect0, in RayShapeIntersection intersect1) { bool missed = (intersect0.entry.w == NO_HIT) || (intersect1.entry.w == NO_HIT) || (intersect0.exit.w < intersect1.entry.w) || (intersect0.entry.w > intersect1.exit.w); if (missed) { vec4 miss = vec4(normalize(ray.dir), NO_HIT); return RayShapeIntersection(miss, miss); } vec4 entry = intersectionMax(intersect0.entry, intersect1.entry); vec4 exit = intersectionMin(intersect0.exit, intersect1.exit); return RayShapeIntersection(entry, exit); } struct Intersections { // Don't access these member variables directly - call the functions instead. // Store an array of ray-surface intersections. Each intersection is composed of: // .xyz for the surface normal at the intersection point // .w for the T value // The scale of the normal encodes the shape intersection type: // length(intersection.xyz) = 1: positive shape entry // length(intersection.xyz) = 2: positive shape exit // length(intersection.xyz) = 3: negative shape entry // length(intersection.xyz) = 4: negative shape exit // INTERSECTION_COUNT is the number of ray-*shape* (volume) intersections, // so we need twice as many to track ray-*surface* intersections vec4 intersections[INTERSECTION_COUNT * 2]; #if (INTERSECTION_COUNT > 1) // Maintain state for future nextIntersection calls int index; int surroundCount; bool surroundIsPositive; #endif }; RayShapeIntersection getFirstIntersection(in Intersections ix) { return RayShapeIntersection(ix.intersections[0], ix.intersections[1]); } vec4 encodeIntersectionType(vec4 intersection, int index, bool entry) { float scale = float(index > 0) * 2.0 + float(!entry) + 1.0; return vec4(intersection.xyz * scale, intersection.w); } // Use defines instead of real functions because WebGL1 cannot access array with non-constant index. #define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = vec4(0.0, float(!positive) * 2.0 + float(!enter) + 1.0, 0.0, (t)) #define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec4(0.0, float((index) > 0) * 2.0 + 1.0, 0.0, (entryExit).x); (ix).intersections[(index) * 2 + 1] = vec4(0.0, float((index) > 0) * 2.0 + 2.0, 0.0, (entryExit).y) #define setSurfaceIntersection(/*inout Intersections*/ ix, /*int*/ index, /*vec4*/ intersection, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = encodeIntersectionType((intersection), int(!positive), (enter)) #define setShapeIntersection(/*inout Intersections*/ ix, /*int*/ index, /*RayShapeIntersection*/ intersection) (ix).intersections[(index) * 2 + 0] = encodeIntersectionType((intersection).entry, (index), true); (ix).intersections[(index) * 2 + 1] = encodeIntersectionType((intersection).exit, (index), false) #if (INTERSECTION_COUNT > 1) void initializeIntersections(inout Intersections ix) { // Sort the intersections from min T to max T with bubble sort. // Note: If this sorting function changes, some of the intersection test may // need to be updated. Search for "bubble sort" to find those areas. const int sortPasses = INTERSECTION_COUNT * 2 - 1; for (int n = sortPasses; n > 0; --n) { for (int i = 0; i < sortPasses; ++i) { // The loop should be: for (i = 0; i < n; ++i) {...} but WebGL1 cannot // loop with non-constant condition, so it has to break early instead if (i >= n) { break; } vec4 intersect0 = ix.intersections[i + 0]; vec4 intersect1 = ix.intersections[i + 1]; bool inOrder = intersect0.w <= intersect1.w; ix.intersections[i + 0] = inOrder ? intersect0 : intersect1; ix.intersections[i + 1] = inOrder ? intersect1 : intersect0; } } // Prepare initial state for nextIntersection ix.index = 0; ix.surroundCount = 0; ix.surroundIsPositive = false; } #endif #if (INTERSECTION_COUNT > 1) RayShapeIntersection nextIntersection(inout Intersections ix) { vec4 surfaceIntersection = vec4(0.0, 0.0, 0.0, NO_HIT); RayShapeIntersection shapeIntersection = RayShapeIntersection(surfaceIntersection, surfaceIntersection); const int passCount = INTERSECTION_COUNT * 2; if (ix.index == passCount) { return shapeIntersection; } for (int i = 0; i < passCount; ++i) { // The loop should be: for (i = ix.index; i < passCount; ++i) {...} but WebGL1 cannot // loop with non-constant condition, so it has to continue instead. if (i < ix.index) { continue; } ix.index = i + 1; surfaceIntersection = ix.intersections[i]; int intersectionType = int(length(surfaceIntersection.xyz) - 0.5); bool currShapeIsPositive = intersectionType < 2; bool enter = intMod(intersectionType, 2) == 0; ix.surroundCount += enter ? +1 : -1; ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive; // entering positive or exiting negative if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) { shapeIntersection.entry = surfaceIntersection; } // exiting positive or entering negative after being inside positive bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0; bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive; if (exitPositive || enterNegativeFromPositive) { shapeIntersection.exit = surfaceIntersection; // entry and exit have been found, so the loop can stop if (exitPositive) { // After exiting positive shape there is nothing left to intersect, so jump to the end index. ix.index = passCount; } break; } } return shapeIntersection; } #endif // NOTE: initializeIntersections, nextIntersection aren't even declared unless INTERSECTION_COUNT > 1 `,g4e=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections, // setIntersectionPair, INF_HIT, NO_HIT /* intersectDepth defines (set in Scene/VoxelRenderResources.js) #define DEPTH_INTERSECTION_INDEX ### */ uniform mat4 u_transformPositionViewToUv; void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) { float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord)); if (logDepthOrDepth != 0.0) { // Calculate how far the ray must travel before it hits the depth buffer. vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth); eyeCoordinateDepth /= eyeCoordinateDepth.w; vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth); float t = dot(depthPositionUv - ray.pos, ray.dir); setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT)); } else { // There's no depth at this location. setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT)); } } `,y4e=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections, INF_HIT, // NO_HIT, setShapeIntersection /* Clipping plane defines (set in Scene/VoxelRenderResources.js) #define CLIPPING_PLANES_UNION #define CLIPPING_PLANES_COUNT #define CLIPPING_PLANES_INTERSECTION_INDEX */ uniform sampler2D u_clippingPlanesTexture; uniform mat4 u_clippingPlanesMatrix; // Plane is in Hessian Normal Form vec4 intersectPlane(in Ray ray, in vec4 plane) { vec3 n = plane.xyz; // normal float w = plane.w; // -dot(pointOnPlane, normal) float a = dot(ray.pos, n); float b = dot(ray.dir, n); float t = -(w + a) / b; return vec4(n, t); } void intersectClippingPlanes(in Ray ray, inout Intersections ix) { vec4 backSide = vec4(-ray.dir, -INF_HIT); vec4 farSide = vec4(ray.dir, +INF_HIT); RayShapeIntersection clippingVolume; #if (CLIPPING_PLANES_COUNT == 1) // Union and intersection are the same when there's one clipping plane, and the code // is more simplified. vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix); vec4 intersection = intersectPlane(ray, planeUv); bool reflects = dot(ray.dir, intersection.xyz) < 0.0; clippingVolume.entry = reflects ? backSide : intersection; clippingVolume.exit = reflects ? intersection : farSide; setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume); #elif defined(CLIPPING_PLANES_UNION) vec4 firstTransmission = vec4(ray.dir, +INF_HIT); vec4 lastReflection = vec4(-ray.dir, -INF_HIT); for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) { vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix); vec4 intersection = intersectPlane(ray, planeUv); if (dot(ray.dir, planeUv.xyz) > 0.0) { firstTransmission = intersection.w <= firstTransmission.w ? intersection : firstTransmission; } else { lastReflection = intersection.w >= lastReflection.w ? intersection : lastReflection; } } clippingVolume.entry = backSide; clippingVolume.exit = lastReflection; setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, clippingVolume); clippingVolume.entry = firstTransmission; clippingVolume.exit = farSide; setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, clippingVolume); #else // intersection vec4 lastTransmission = vec4(ray.dir, -INF_HIT); vec4 firstReflection = vec4(-ray.dir, +INF_HIT); for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) { vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix); vec4 intersection = intersectPlane(ray, planeUv); if (dot(ray.dir, planeUv.xyz) > 0.0) { lastTransmission = intersection.w > lastTransmission.w ? intersection : lastTransmission; } else { firstReflection = intersection.w < firstReflection.w ? intersection: firstReflection; } } if (lastTransmission.w < firstReflection.w) { clippingVolume.entry = lastTransmission; clippingVolume.exit = firstReflection; } else { clippingVolume.entry = vec4(-ray.dir, NO_HIT); clippingVolume.exit = vec4(ray.dir, NO_HIT); } setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume); #endif } `,bz=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT, // RayShapeIntersection vec4 intersectLongitude(in Ray ray, in float angle, in bool positiveNormal) { float normalSign = positiveNormal ? 1.0 : -1.0; vec2 planeNormal = vec2(-sin(angle), cos(angle)) * normalSign; vec2 position = ray.pos.xy; vec2 direction = ray.dir.xy; float approachRate = dot(direction, planeNormal); float distance = -dot(position, planeNormal); float t = (approachRate == 0.0) ? NO_HIT : distance / approachRate; return vec4(planeNormal, 0.0, t); } RayShapeIntersection intersectHalfSpace(in Ray ray, in float angle, in bool positiveNormal) { vec4 intersection = intersectLongitude(ray, angle, positiveNormal); vec4 farSide = vec4(normalize(ray.dir), INF_HIT); bool hitFront = (intersection.w > 0.0) == (dot(ray.pos.xy, intersection.xy) > 0.0); if (!hitFront) { return RayShapeIntersection(intersection, farSide); } else { return RayShapeIntersection(-1.0 * farSide, intersection); } } void intersectFlippedWedge(in Ray ray, in vec2 minMaxAngle, out RayShapeIntersection intersections[2]) { intersections[0] = intersectHalfSpace(ray, minMaxAngle.x, false); intersections[1] = intersectHalfSpace(ray, minMaxAngle.y, true); } bool hitPositiveHalfPlane(in Ray ray, in vec4 intersection, in bool positiveNormal) { float normalSign = positiveNormal ? 1.0 : -1.0; vec2 planeDirection = vec2(intersection.y, -intersection.x) * normalSign; vec2 hit = ray.pos.xy + intersection.w * ray.dir.xy; return dot(hit, planeDirection) > 0.0; } void intersectHalfPlane(in Ray ray, in float angle, out RayShapeIntersection intersections[2]) { vec4 intersection = intersectLongitude(ray, angle, true); vec4 farSide = vec4(normalize(ray.dir), INF_HIT); if (hitPositiveHalfPlane(ray, intersection, true)) { intersections[0].entry = -1.0 * farSide; intersections[0].exit = vec4(-1.0 * intersection.xy, 0.0, intersection.w); intersections[1].entry = intersection; intersections[1].exit = farSide; } else { vec4 miss = vec4(normalize(ray.dir), NO_HIT); intersections[0].entry = -1.0 * farSide; intersections[0].exit = farSide; intersections[1].entry = miss; intersections[1].exit = miss; } } RayShapeIntersection intersectRegularWedge(in Ray ray, in vec2 minMaxAngle) { // Note: works for maxAngle > minAngle + pi, where the "regular wedge" // is actually a negative volume. // Compute intersections with the two planes. // Normals will point toward the "outside" (negative space) vec4 intersect1 = intersectLongitude(ray, minMaxAngle.x, false); vec4 intersect2 = intersectLongitude(ray, minMaxAngle.y, true); // Choose intersection with smallest T as the "first", the other as "last" // Note: first or last could be in the "shadow" wedge, beyond the tip bool inOrder = intersect1.w <= intersect2.w; vec4 first = inOrder ? intersect1 : intersect2; vec4 last = inOrder ? intersect2 : intersect1; bool firstIsAhead = first.w >= 0.0; bool startedInsideFirst = dot(ray.pos.xy, first.xy) < 0.0; bool exitFromInside = firstIsAhead == startedInsideFirst; bool lastIsAhead = last.w > 0.0; bool startedOutsideLast = dot(ray.pos.xy, last.xy) >= 0.0; bool enterFromOutside = lastIsAhead == startedOutsideLast; vec4 farSide = vec4(normalize(ray.dir), INF_HIT); vec4 miss = vec4(normalize(ray.dir), NO_HIT); if (exitFromInside && enterFromOutside) { // Ray crosses both faces of negative wedge, exiting then entering the positive shape return RayShapeIntersection(first, last); } else if (!exitFromInside && enterFromOutside) { // Ray starts inside wedge. last is in shadow wedge, and first is actually the entry return RayShapeIntersection(-1.0 * farSide, first); } else if (exitFromInside && !enterFromOutside) { // First intersection was in the shadow wedge, so last is actually the exit return RayShapeIntersection(last, farSide); } else { // !exitFromInside && !enterFromOutside // Both intersections were in the shadow wedge return RayShapeIntersection(miss, miss); } } `,b4e=`// See IntersectionUtils.glsl for the definitions of Ray, RayShapeIntersection, // NO_HIT, Intersections /* Box defines (set in Scene/VoxelBoxShape.js) #define BOX_INTERSECTION_INDEX ### // always 0 */ uniform vec3 u_renderMinBounds; uniform vec3 u_renderMaxBounds; RayShapeIntersection intersectBox(in Ray ray, in vec3 minBound, in vec3 maxBound) { // Consider the box as the intersection of the space between 3 pairs of parallel planes // Compute the distance along the ray to each plane vec3 t0 = (minBound - ray.pos) / ray.dir; vec3 t1 = (maxBound - ray.pos) / ray.dir; // Identify candidate entries/exits based on distance from ray.pos vec3 entries = min(t0, t1); vec3 exits = max(t0, t1); vec3 directions = sign(ray.dir); // The actual intersection points are the furthest entry and the closest exit float lastEntry = maxComponent(entries); bvec3 isLastEntry = equal(entries, vec3(lastEntry)); vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions; vec4 entry = vec4(entryNormal, lastEntry); float firstExit = minComponent(exits); bvec3 isFirstExit = equal(exits, vec3(firstExit)); vec3 exitNormal = vec3(isLastEntry) * directions; vec4 exit = vec4(exitNormal, firstExit); if (entry.w > exit.w) { entry.w = NO_HIT; exit.w = NO_HIT; } return RayShapeIntersection(entry, exit); } void intersectShape(in Ray ray, inout Intersections ix) { RayShapeIntersection intersection = intersectBox(ray, u_renderMinBounds, u_renderMaxBounds); setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection); } `,T4e=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, Intersections, // RayShapeIntersection, setSurfaceIntersection, setShapeIntersection, // intersectIntersections // See IntersectLongitude.glsl for the definitions of intersectHalfPlane, // intersectFlippedWedge, intersectRegularWedge /* Cylinder defines (set in Scene/VoxelCylinderShape.js) #define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN #define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT #define CYLINDER_HAS_RENDER_BOUNDS_ANGLE #define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF #define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF #define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO #define CYLINDER_INTERSECTION_INDEX_RADIUS_MAX #define CYLINDER_INTERSECTION_INDEX_RADIUS_MIN #define CYLINDER_INTERSECTION_INDEX_ANGLE */ // Cylinder uniforms uniform vec2 u_cylinderRenderRadiusMinMax; uniform vec2 u_cylinderRenderHeightMinMax; #if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE) uniform vec2 u_cylinderRenderAngleMinMax; #endif /** * Find the intersection of a ray with the volume defined by two planes of constant z */ RayShapeIntersection intersectHeightBounds(in Ray ray, in vec2 minMaxHeight, in bool convex) { float zPosition = ray.pos.z; float zDirection = ray.dir.z; float tmin = (minMaxHeight.x - zPosition) / zDirection; float tmax = (minMaxHeight.y - zPosition) / zDirection; // Normals point outside the volume float signFlip = convex ? 1.0 : -1.0; vec4 intersectMin = vec4(0.0, 0.0, -1.0 * signFlip, tmin); vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax); bool topEntry = zDirection < 0.0; vec4 entry = topEntry ? intersectMax : intersectMin; vec4 exit = topEntry ? intersectMin : intersectMax; return RayShapeIntersection(entry, exit); } /** * Find the intersection of a ray with a right cylindrical surface of a given radius * about the z-axis. */ RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool convex) { vec2 position = ray.pos.xy; vec2 direction = ray.dir.xy; float a = dot(direction, direction); float b = dot(position, direction); float c = dot(position, position) - radius * radius; float determinant = b * b - a * c; if (determinant < 0.0) { vec4 miss = vec4(normalize(ray.dir), NO_HIT); return RayShapeIntersection(miss, miss); } determinant = sqrt(determinant); float t1 = (-b - determinant) / a; float t2 = (-b + determinant) / a; float signFlip = convex ? 1.0 : -1.0; vec4 intersect1 = vec4(normalize(position + t1 * direction) * signFlip, 0.0, t1); vec4 intersect2 = vec4(normalize(position + t2 * direction) * signFlip, 0.0, t2); return RayShapeIntersection(intersect1, intersect2); } /** * Find the intersection of a ray with a right cylindrical solid of given * radius and height bounds. NOTE: The shape is assumed to be convex. */ RayShapeIntersection intersectBoundedCylinder(in Ray ray, in float radius, in vec2 minMaxHeight) { RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true); RayShapeIntersection heightBoundsIntersection = intersectHeightBounds(ray, minMaxHeight, true); return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection); } void intersectShape(Ray ray, inout Intersections ix) { // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1]. // Direction is scaled as well to be in sync with position. ray.pos = ray.pos * 2.0 - 1.0; ray.dir *= 2.0; RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect); if (outerIntersect.entry.w == NO_HIT) { return; } #if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT) // When the cylinder is perfectly thin it's necessary to sandwich the // inner cylinder intersection inside the outer cylinder intersection. // Without this special case, // [outerMin, outerMax, innerMin, innerMax] will bubble sort to // [outerMin, innerMin, outerMax, innerMax] which will cause the back // side of the cylinder to be invisible because it will think the ray // is still inside the inner (negative) cylinder after exiting the // outer (positive) cylinder. // With this special case, // [outerMin, innerMin, innerMax, outerMax] will bubble sort to // [outerMin, innerMin, innerMax, outerMax] which will work correctly. // Note: If initializeIntersections() changes its sorting function // from bubble sort to something else, this code may need to change. RayShapeIntersection innerIntersect = intersectCylinder(ray, 1.0, false); setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit #elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN) RayShapeIntersection innerIntersect = intersectCylinder(ray, u_cylinderRenderRadiusMinMax.x, false); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect); #endif #if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF) RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect); #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF) RayShapeIntersection wedgeIntersects[2]; intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax, wedgeIntersects); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]); #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO) RayShapeIntersection wedgeIntersects[2]; intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x, wedgeIntersects); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]); setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]); #endif } `,A4e=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT, Intersections, // RayShapeIntersection, setSurfaceIntersection, setShapeIntersection // See IntersectLongitude.glsl for the definitions of intersectHalfPlane, // intersectFlippedWedge, intersectRegularWedge /* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js) #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF #define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF #define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE #define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX #define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN #define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX #define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN */ #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE) uniform vec2 u_ellipsoidRenderLongitudeMinMax; #endif uniform float u_eccentricitySquared; uniform vec2 u_ellipsoidRenderLatitudeSinMinMax; uniform vec2 u_clipMinMaxHeight; RayShapeIntersection intersectZPlane(in Ray ray, in float z) { float t = -ray.pos.z / ray.dir.z; bool startsOutside = sign(ray.pos.z) == sign(z); bool entry = (t >= 0.0) != startsOutside; vec4 intersect = vec4(0.0, 0.0, z, t); vec4 farSide = vec4(normalize(ray.dir), INF_HIT); if (entry) { return RayShapeIntersection(intersect, farSide); } else { return RayShapeIntersection(-1.0 * farSide, intersect); } } RayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex) { // Scale the ray by the ellipsoid axes to make it a unit sphere // Note: approximating ellipsoid + height as an ellipsoid vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight); vec3 position = ray.pos * radiiCorrection; vec3 direction = ray.dir * radiiCorrection; float a = dot(direction, direction); // ~ 1.0 (or maybe 4.0 if ray is scaled) float b = dot(direction, position); // roughly inside [-1.0, 1.0] when zoomed in float c = dot(position, position) - 1.0; // ~ 0.0 when zoomed in. float determinant = b * b - a * c; // ~ b * b when zoomed in if (determinant < 0.0) { vec4 miss = vec4(normalize(direction), NO_HIT); return RayShapeIntersection(miss, miss); } determinant = sqrt(determinant); // Compute larger root using standard formula float signB = b < 0.0 ? -1.0 : 1.0; // The other root may suffer from subtractive cancellation in the standard formula. // Compute it from the first root instead. float t1 = (-b - signB * determinant) / a; float t2 = c / (a * t1); float tmin = min(t1, t2); float tmax = max(t1, t2); float directionScale = convex ? 1.0 : -1.0; vec3 d1 = directionScale * normalize(position + tmin * direction); vec3 d2 = directionScale * normalize(position + tmax * direction); return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax)); } /** * Given a circular cone around the z-axis, with apex at the origin, * find the parametric distance(s) along a ray where that ray intersects * the cone. * The cone opening angle is described by the squared cosine of * its half-angle (the angle between the Z-axis and the surface) */ vec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle) { vec3 o = ray.pos; vec3 d = ray.dir; float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle; float aSin = d.z * d.z * sinSqrHalfAngle; float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle; float a = aSin + aCos; float bSin = d.z * o.z * sinSqrHalfAngle; float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle; float b = bSin + bCos; float cSin = o.z * o.z * sinSqrHalfAngle; float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle; float c = cSin + cCos; // determinant = b * b - a * c. But bSin * bSin = aSin * cSin. // Avoid subtractive cancellation by expanding to eliminate these terms float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos; if (determinant < 0.0) { return vec2(NO_HIT); } else if (a == 0.0) { // Ray is parallel to cone surface return (b == 0.0) ? vec2(NO_HIT) // Ray is on cone surface : vec2(-0.5 * c / b, NO_HIT); } determinant = sqrt(determinant); // Compute larger root using standard formula float signB = b < 0.0 ? -1.0 : 1.0; float t1 = (-b - signB * determinant) / a; // The other root may suffer from subtractive cancellation in the standard formula. // Compute it from the first root instead. float t2 = c / (a * t1); float tmin = min(t1, t2); float tmax = max(t1, t2); return vec2(tmin, tmax); } /** * Given a point on a conical surface, find the surface normal at that point. */ vec3 getConeNormal(in vec3 p, in bool convex) { // Start with radial component pointing toward z-axis vec2 radial = -abs(p.z) * normalize(p.xy); // Z component points toward opening of cone float zSign = (p.z < 0.0) ? -1.0 : 1.0; float z = length(p.xy) * zSign; // Flip normal if shape is convex float flip = (convex) ? -1.0 : 1.0; return normalize(vec3(radial, z) * flip); } /** * Compute the shift between the ellipsoid origin and the apex of a cone of latitude */ float getLatitudeConeShift(in float sinLatitude) { // Find prime vertical radius of curvature: // the distance along the ellipsoid normal to the intersection with the z-axis float x2 = u_eccentricitySquared * sinLatitude * sinLatitude; float primeVerticalRadius = inversesqrt(1.0 - x2); // Compute a shift from the origin to the intersection of the cone with the z-axis return primeVerticalRadius * u_eccentricitySquared * sinLatitude; } void intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) { // Undo the scaling from ellipsoid to sphere ray.pos = ray.pos * u_ellipsoidRadiiUv; ray.dir = ray.dir * u_ellipsoidRadiiUv; // Shift the ray to account for the latitude cone not being centered at the Earth center ray.pos.z += getLatitudeConeShift(cosHalfAngle); float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle; vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle); vec4 miss = vec4(normalize(ray.dir), NO_HIT); vec4 farSide = vec4(normalize(ray.dir), INF_HIT); // Initialize output with no intersections intersections[0].entry = -1.0 * farSide; intersections[0].exit = farSide; intersections[1].entry = miss; intersections[1].exit = miss; if (intersect.x == NO_HIT) { return; } // Find the points of intersection float tmin = intersect.x; float tmax = intersect.y; vec3 p0 = ray.pos + tmin * ray.dir; vec3 p1 = ray.pos + tmax * ray.dir; vec4 intersect0 = vec4(getConeNormal(p0, true), tmin); vec4 intersect1 = vec4(getConeNormal(p1, true), tmax); bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle); bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle); if (p0InShadowCone && p1InShadowCone) { // no valid intersections } else if (p0InShadowCone) { intersections[0].exit = intersect1; } else if (p1InShadowCone) { intersections[0].entry = intersect0; } else { intersections[0].exit = intersect0; intersections[1].entry = intersect1; intersections[1].exit = farSide; } } RayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) { // Undo the scaling from ellipsoid to sphere ray.pos = ray.pos * u_ellipsoidRadiiUv; ray.dir = ray.dir * u_ellipsoidRadiiUv; // Shift the ray to account for the latitude cone not being centered at the Earth center ray.pos.z += getLatitudeConeShift(cosHalfAngle); float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle; vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle); vec4 miss = vec4(normalize(ray.dir), NO_HIT); vec4 farSide = vec4(normalize(ray.dir), INF_HIT); if (intersect.x == NO_HIT) { return RayShapeIntersection(miss, miss); } // Find the points of intersection float tmin = intersect.x; float tmax = intersect.y; vec3 p0 = ray.pos + tmin * ray.dir; vec3 p1 = ray.pos + tmax * ray.dir; vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin); vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax); bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle); bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle); if (p0InShadowCone && p1InShadowCone) { return RayShapeIntersection(miss, miss); } else if (p0InShadowCone) { return RayShapeIntersection(intersect1, farSide); } else if (p1InShadowCone) { return RayShapeIntersection(-1.0 * farSide, intersect0); } else { return RayShapeIntersection(intersect0, intersect1); } } void intersectShape(in Ray ray, inout Intersections ix) { // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1]. // Direction is scaled as well to be in sync with position. ray.pos = ray.pos * 2.0 - 1.0; ray.dir *= 2.0; // Outer ellipsoid RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect); // Exit early if the outer ellipsoid was missed. if (outerIntersect.entry.w == NO_HIT) { return; } // Inner ellipsoid RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false); if (innerIntersect.entry.w == NO_HIT) { setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect); } else { // When the ellipsoid is large and thin it's possible for floating point math // to cause the ray to intersect the inner ellipsoid before the outer ellipsoid. // To prevent this from happening, clamp innerIntersect to outerIntersect and // sandwich the inner ellipsoid intersection inside the outer ellipsoid intersection. // Without this special case, // [outerMin, outerMax, innerMin, innerMax] will bubble sort to // [outerMin, innerMin, outerMax, innerMax] which will cause the back // side of the ellipsoid to be invisible because it will think the ray // is still inside the inner (negative) ellipsoid after exiting the // outer (positive) ellipsoid. // With this special case, // [outerMin, innerMin, innerMax, outerMax] will bubble sort to // [outerMin, innerMin, innerMax, outerMax] which will work correctly. // Note: If initializeIntersections() changes its sorting function // from bubble sort to something else, this code may need to change. innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w); innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w); setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit } // Bottom cone #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF) RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF) RayShapeIntersection bottomConeIntersections[2]; intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]); #endif // Top cone #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF) RayShapeIntersection topConeIntersections[2]; intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF) RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF) RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection); #endif // Wedge #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO) RayShapeIntersection wedgeIntersects[2]; intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF) RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect); #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF) RayShapeIntersection wedgeIntersects[2]; intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]); setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]); #endif } `,Gv=`// Main intersection function for Voxel scenes. // See IntersectBox.glsl, IntersectCylinder.glsl, or IntersectEllipsoid.glsl // for the definition of intersectShape. The appropriate function is selected // based on the VoxelPrimitive shape type, and added to the shader in // Scene/VoxelRenderResources.js. // See also IntersectClippingPlane.glsl and IntersectDepth.glsl. // See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, // getFirstIntersection, initializeIntersections, nextIntersection. /* Intersection defines (set in Scene/VoxelRenderResources.js) #define INTERSECTION_COUNT ### */ RayShapeIntersection intersectScene(in vec2 screenCoord, in Ray ray, out Intersections ix) { // Do a ray-shape intersection to find the exact starting and ending points. intersectShape(ray, ix); // Exit early if the positive shape was completely missed or behind the ray. RayShapeIntersection intersection = getFirstIntersection(ix); if (intersection.entry.w == NO_HIT) { // Positive shape was completely missed - so exit early. return intersection; } // Clipping planes #if defined(CLIPPING_PLANES) intersectClippingPlanes(ray, ix); #endif // Depth #if defined(DEPTH_TEST) intersectDepth(screenCoord, ray, ix); #endif // Find the first intersection that's in front of the ray #if (INTERSECTION_COUNT > 1) initializeIntersections(ix); for (int i = 0; i < INTERSECTION_COUNT; ++i) { intersection = nextIntersection(ix); if (intersection.exit.w > 0.0) { // Set start to 0.0 when ray is inside the shape. intersection.entry.w = max(intersection.entry.w, 0.0); break; } } #else // Set start to 0.0 when ray is inside the shape. intersection.entry.w = max(intersection.entry.w, 0.0); #endif return intersection; } `,x4e=`/* Box defines (set in Scene/VoxelBoxShape.js) #define BOX_HAS_SHAPE_BOUNDS */ #if defined(BOX_HAS_SHAPE_BOUNDS) uniform vec3 u_boxUvToShapeUvScale; uniform vec3 u_boxUvToShapeUvTranslate; #endif PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) { // For BOX, UV space = shape space, so we can use positionUv as-is, // and the Jacobian is the identity matrix, except that a step of 1 // only spans half the shape space [-1, 1], so the identity is scaled. return PointJacobianT(positionUv, mat3(0.5)); } vec3 convertShapeToShapeUvSpace(in vec3 positionShape) { #if defined(BOX_HAS_SHAPE_BOUNDS) return positionShape * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate; #else return positionShape; #endif } PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) { PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv); pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point); return pointJacobian; } vec3 convertShapeUvToUvSpace(in vec3 shapeUv) { #if defined(BOX_HAS_SHAPE_BOUNDS) return (shapeUv - u_boxUvToShapeUvTranslate) / u_boxUvToShapeUvScale; #else return shapeUv; #endif } vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) { #if defined(BOX_HAS_SHAPE_BOUNDS) return shapeUv / u_boxUvToShapeUvScale; #else return shapeUv; #endif }`,C4e=`/* Cylinder defines (set in Scene/VoxelCylinderShape.js) #define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS #define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT #define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE #define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY #define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY #define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED */ #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS) uniform vec2 u_cylinderUvToShapeUvRadius; // x = scale, y = offset #endif #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT) uniform vec2 u_cylinderUvToShapeUvHeight; // x = scale, y = offset #endif #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE) uniform vec2 u_cylinderUvToShapeUvAngle; // x = scale, y = offset #endif #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) uniform vec2 u_cylinderShapeUvAngleMinMax; #endif #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED) uniform float u_cylinderShapeUvAngleRangeZeroMid; #endif PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) { // Convert from Cartesian UV space [0, 1] to Cartesian local space [-1, 1] vec3 position = positionUv * 2.0 - 1.0; float radius = length(position.xy); // [0, 1] vec3 radial = normalize(vec3(position.xy, 0.0)); // Shape space height is defined within [0, 1] float height = positionUv.z; // [0, 1] vec3 z = vec3(0.0, 0.0, 1.0); float angle = atan(position.y, position.x); vec3 east = normalize(vec3(-position.y, position.x, 0.0)); vec3 point = vec3(radius, height, angle); mat3 jacobianT = mat3(radial, z, east / length(position.xy)); return PointJacobianT(point, jacobianT); } vec3 convertShapeToShapeUvSpace(in vec3 positionShape) { float radius = positionShape.x; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS) radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y; #endif float height = positionShape.y; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT) height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y; #endif float angle = (positionShape.z + czm_pi) / czm_twoPi; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE) #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED) // Comparing against u_cylinderShapeUvAngleMinMax has precision problems. u_cylinderShapeUvAngleRangeZeroMid is more conservative. angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid); #endif // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity. #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle; #elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle; #endif angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y; #endif return vec3(radius, height, angle); } PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) { PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv); pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point); return pointJacobian; } vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) { float radius = shapeUv.x; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS) radius /= u_cylinderUvToShapeUvRadius.x; #endif float height = shapeUv.y; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT) height /= u_cylinderUvToShapeUvHeight.x; #endif float angle = shapeUv.z * czm_twoPi; #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE) angle /= u_cylinderUvToShapeUvAngle.x; #endif return vec3(radius, height, angle); } `,E4e=`/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js) #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY #define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY #define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE #define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED #define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE */ uniform vec3 u_ellipsoidRadiiUv; // [0,1] uniform vec2 u_evoluteScale; // (radiiUv.x ^ 2 - radiiUv.z ^ 2) * vec2(1.0, -1.0) / radiiUv; uniform vec3 u_ellipsoidInverseRadiiSquaredUv; #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED) uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid; #endif #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE) uniform vec2 u_ellipsoidUvToShapeUvLongitude; // x = scale, y = offset #endif #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE) uniform vec2 u_ellipsoidUvToShapeUvLatitude; // x = scale, y = offset #endif uniform float u_ellipsoidInverseHeightDifferenceUv; // robust iterative solution without trig functions // https://github.com/0xfaded/ellipse_demo/issues/1 // https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse // Extended to return radius of curvature along with the point vec3 nearestPointAndRadiusOnEllipse(vec2 pos, vec2 radii) { vec2 p = abs(pos); vec2 inverseRadii = 1.0 / radii; // We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t)) // but store the cos and sin of t in a vec2 for efficiency. // Initial guess: t = pi/4 vec2 tTrigs = vec2(0.7071067811865476); // Initial guess of point on ellipsoid vec2 v = radii * tTrigs; // Center of curvature of the ellipse at v vec2 evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs; const int iterations = 3; for (int i = 0; i < iterations; ++i) { // Find the (approximate) intersection of p - evolute with the ellipsoid. vec2 q = normalize(p - evolute) * length(v - evolute); // Update the estimate of t. tTrigs = (q + evolute) * inverseRadii; tTrigs = normalize(clamp(tTrigs, 0.0, 1.0)); v = radii * tTrigs; evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs; } return vec3(v * sign(pos), length(v - evolute)); } PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) { // Convert from UV space [0, 1] to local space [-1, 1] vec3 position = positionUv * 2.0 - 1.0; // Undo the scaling from ellipsoid to sphere position = position * u_ellipsoidRadiiUv; float longitude = atan(position.y, position.x); vec3 east = normalize(vec3(-position.y, position.x, 0.0)); // Convert the 3D position to a 2D position relative to the ellipse (radii.x, radii.z) // (assume radii.y == radii.x) and find the nearest point on the ellipse and its normal float distanceFromZAxis = length(position.xy); vec2 posEllipse = vec2(distanceFromZAxis, position.z); vec3 surfacePointAndRadius = nearestPointAndRadiusOnEllipse(posEllipse, u_ellipsoidRadiiUv.xz); vec2 surfacePoint = surfacePointAndRadius.xy; vec2 normal2d = normalize(surfacePoint * u_ellipsoidInverseRadiiSquaredUv.xz); float latitude = atan(normal2d.y, normal2d.x); vec3 north = vec3(-normal2d.y * normalize(position.xy), abs(normal2d.x)); float heightSign = length(posEllipse) < length(surfacePoint) ? -1.0 : 1.0; float height = heightSign * length(posEllipse - surfacePoint); vec3 up = normalize(cross(east, north)); vec3 point = vec3(longitude, latitude, height); mat3 jacobianT = mat3(east / distanceFromZAxis, north / (surfacePointAndRadius.z + height), up); return PointJacobianT(point, jacobianT); } vec3 convertShapeToShapeUvSpace(in vec3 positionShape) { // Longitude: shift & scale to [0, 1] float longitude = (positionShape.x + czm_pi) / czm_twoPi; // Correct the angle when max < min // Technically this should compare against min longitude - but it has precision problems so compare against the middle of empty space. #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED) longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z); #endif // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity. #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude; #endif #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude; #endif #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE) longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y; #endif // Latitude: shift and scale to [0, 1] float latitude = (positionShape.y + czm_piOverTwo) / czm_pi; #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE) latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y; #endif // Height: scale to the range [0, 1] float height = 1.0 + positionShape.z * u_ellipsoidInverseHeightDifferenceUv; return vec3(longitude, latitude, height); } PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) { PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv); pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point); return pointJacobian; } vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) { // Convert from [0, 1] to radians [-pi, pi] float longitude = shapeUv.x * czm_twoPi; #if defined (ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE) longitude /= u_ellipsoidUvToShapeUvLongitude.x; #endif // Convert from [0, 1] to radians [-pi/2, pi/2] float latitude = shapeUv.y * czm_pi; #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE) latitude /= u_ellipsoidUvToShapeUvLatitude.x; #endif float height = shapeUv.z / u_ellipsoidInverseHeightDifferenceUv; return vec3(longitude, latitude, height); } `,w4e=`// These octree flags must be in sync with GpuOctreeFlag in VoxelTraversal.js #define OCTREE_FLAG_INTERNAL 0 #define OCTREE_FLAG_LEAF 1 #define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2 #define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops uniform sampler2D u_octreeInternalNodeTexture; uniform vec2 u_octreeInternalNodeTexelSizeUv; uniform int u_octreeInternalNodeTilesPerRow; #if (SAMPLE_COUNT > 1) uniform sampler2D u_octreeLeafNodeTexture; uniform vec2 u_octreeLeafNodeTexelSizeUv; uniform int u_octreeLeafNodeTilesPerRow; #endif struct OctreeNodeData { int data; int flag; }; struct TraversalData { ivec4 octreeCoords; int parentOctreeIndex; }; struct SampleData { int megatextureIndex; ivec4 tileCoords; vec3 tileUv; #if (SAMPLE_COUNT > 1) float weight; #endif }; // Integer mod: For WebGL1 only int intMod(in int a, in int b) { return a - (b * (a / b)); } int normU8_toInt(in float value) { return int(value * 255.0); } int normU8x2_toInt(in vec2 value) { return int(value.x * 255.0) + 256 * int(value.y * 255.0); } float normU8x2_toFloat(in vec2 value) { return float(normU8x2_toInt(value)) / 65535.0; } OctreeNodeData getOctreeNodeData(in vec2 octreeUv) { vec4 texData = texture(u_octreeInternalNodeTexture, octreeUv); OctreeNodeData data; data.data = normU8x2_toInt(texData.xy); data.flag = normU8x2_toInt(texData.zw); return data; } OctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) { int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x; int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex; int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow; vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5); return getOctreeNodeData(octreeUv); } int getOctreeParentIndex(in int octreeIndex) { int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9; int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow; vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5); vec4 parentData = texture(u_octreeInternalNodeTexture, octreeUv); int parentOctreeIndex = normU8x2_toInt(parentData.xy); return parentOctreeIndex; } /** * Convert a position in the uv-space of the tileset bounding shape * into the uv-space of a tile within the tileset */ vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) { // PERFORMANCE_IDEA: use bit-shifting (only in WebGL2) float dimAtLevel = exp2(float(octreeCoords.w)); return shapePosition * dimAtLevel - vec3(octreeCoords.xyz); } vec3 getClampedTileUv(in vec3 shapePosition, in ivec4 octreeCoords) { vec3 tileUv = getTileUv(shapePosition, octreeCoords); return clamp(tileUv, vec3(0.0), vec3(1.0)); } void getOctreeLeafSampleData(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleData) { sampleData.megatextureIndex = data.data; sampleData.tileCoords = (data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT) ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1) : octreeCoords; } #if (SAMPLE_COUNT > 1) void getOctreeLeafSampleDatas(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleDatas[SAMPLE_COUNT]) { int leafIndex = data.data; int leafNodeTexelCount = 2; // Adding 0.5 moves to the center of the texel float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5; float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5; // Get an interpolation weight and a flag to determine whether to read the parent texture vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY); vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0); float lerp = normU8x2_toFloat(leafData0.xy); sampleDatas[0].weight = 1.0 - lerp; sampleDatas[1].weight = lerp; // TODO: this looks wrong? Should be comparing to OCTREE_FLAG_PACKED_LEAF_FROM_PARENT sampleDatas[0].tileCoords = (normU8_toInt(leafData0.z) == 1) ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1) : octreeCoords; sampleDatas[1].tileCoords = (normU8_toInt(leafData0.w) == 1) ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1) : octreeCoords; // Get megatexture indices for both samples vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY); vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1); sampleDatas[0].megatextureIndex = normU8x2_toInt(leafData1.xy); sampleDatas[1].megatextureIndex = normU8x2_toInt(leafData1.zw); } #endif OctreeNodeData traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData) { float sizeAtLevel = exp2(-1.0 * float(traversalData.octreeCoords.w)); vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel; vec3 end = start + vec3(sizeAtLevel); OctreeNodeData childData; for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) { // Find out which octree child contains the position // 0 if before center, 1 if after vec3 center = 0.5 * (start + end); vec3 childCoord = step(center, shapePosition); // Get octree coords for the next level down ivec4 octreeCoords = traversalData.octreeCoords; traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1); childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord)); if (childData.flag != OCTREE_FLAG_INTERNAL) { // leaf tile - stop traversing break; } // interior tile - keep going deeper start = mix(start, center, childCoord); end = mix(center, end, childCoord); traversalData.parentOctreeIndex = childData.data; } return childData; } /** * Transform a given position to an octree tile coordinate and a position within that tile, * and find the corresponding megatexture index and texture coordinates */ void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) { traversalData.octreeCoords = ivec4(0); traversalData.parentOctreeIndex = 0; OctreeNodeData nodeData = getOctreeNodeData(vec2(0.0)); if (nodeData.flag != OCTREE_FLAG_LEAF) { nodeData = traverseOctreeDownwards(shapePosition, traversalData); } #if (SAMPLE_COUNT == 1) getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]); sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords); #else getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas); sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords); sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords); #endif } bool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) { return clamp(v, minVal, maxVal) == v; } bool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) { vec3 tileUv = getTileUv(shapePosition, octreeCoords); bool inside = inRange(tileUv, vec3(0.0), vec3(1.0)); // Assume (!) the position is always inside the root tile. return inside || octreeCoords.w == 0; } void traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) { if (insideTile(shapePosition, traversalData.octreeCoords)) { for (int i = 0; i < SAMPLE_COUNT; i++) { sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords); } return; } // Go up tree until we find a parent tile containing shapePosition for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) { traversalData.octreeCoords.xyz /= 2; traversalData.octreeCoords.w -= 1; if (insideTile(shapePosition, traversalData.octreeCoords)) { break; } traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex); } // Go down tree OctreeNodeData nodeData = traverseOctreeDownwards(shapePosition, traversalData); #if (SAMPLE_COUNT == 1) getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]); sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords); #else getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas); sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords); sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords); #endif } `,S4e=`// See Octree.glsl for the definitions of SampleData and intMod /* Megatexture defines (set in Scene/VoxelRenderResources.js) #define SAMPLE_COUNT ### #define NEAREST_SAMPLING #define PADDING */ uniform ivec2 u_megatextureSliceDimensions; // number of slices per tile, in two dimensions uniform ivec2 u_megatextureTileDimensions; // number of tiles per megatexture, in two dimensions uniform vec2 u_megatextureVoxelSizeUv; uniform vec2 u_megatextureSliceSizeUv; uniform vec2 u_megatextureTileSizeUv; uniform ivec3 u_dimensions; // does not include padding #if defined(PADDING) uniform ivec3 u_paddingBefore; uniform ivec3 u_paddingAfter; #endif // Integer min, max, clamp: For WebGL1 only int intMin(int a, int b) { return a <= b ? a : b; } int intMax(int a, int b) { return a >= b ? a : b; } int intClamp(int v, int minVal, int maxVal) { return intMin(intMax(v, minVal), maxVal); } vec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale) { int indexX = intMod(index, dimensions.x); int indexY = index / dimensions.x; return vec2(indexX, indexY) * uvScale; } /* How is 3D data stored in a 2D megatexture? In this example there is only one loaded tile and it has 2x2x2 voxels (8 voxels total). The data is sliced by Z. The data at Z = 0 is placed in texels (0,0), (0,1), (1,0), (1,1) and the data at Z = 1 is placed in texels (2,0), (2,1), (3,0), (3,1). Note that there could be empty space in the megatexture because it's a power of two. 0 1 2 3 +---+---+---+---+ | | | | | 3 +---+---+---+---+ | | | | | 2 +-------+-------+ |010|110|011|111| 1 |--- ---|--- ---| |000|100|001|101| 0 +-------+-------+ When doing linear interpolation the megatexture needs to be sampled twice: once for the Z slice above the voxel coordinate and once for the slice below. The two slices are interpolated with fract(coord.z - 0.5). For example, a Z coordinate of 1.0 is halfway between two Z slices so the interpolation factor is 0.5. Below is a side view of the 3D voxel grid with voxel coordinates on the left side. 2 +---+ |001| 1 +-z-+ |000| 0 +---+ When doing nearest neighbor the megatexture only needs to be sampled once at the closest Z slice. */ Properties getPropertiesFromMegatexture(in SampleData sampleData) { int tileIndex = sampleData.megatextureIndex; vec3 voxelCoord = sampleData.tileUv * vec3(u_dimensions); ivec3 voxelDimensions = u_dimensions; #if defined(PADDING) voxelDimensions += u_paddingBefore + u_paddingAfter; voxelCoord += vec3(u_paddingBefore); #endif #if defined(NEAREST_SAMPLING) // Round to the center of the nearest voxel voxelCoord = floor(voxelCoord) + vec3(0.5); #endif // Tile location vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv); // Slice location float slice = voxelCoord.z - 0.5; int sliceIndex = int(floor(slice)); int sliceIndex0 = intClamp(sliceIndex, 0, voxelDimensions.z - 1); vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv); // Voxel location vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(voxelDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv; // Final location in the megatexture vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset; #if defined(NEAREST_SAMPLING) return getPropertiesFromMegatextureAtUv(uv0); #else float sliceLerp = fract(slice); int sliceIndex1 = intMin(sliceIndex + 1, voxelDimensions.z - 1); vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv); vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset; Properties properties0 = getPropertiesFromMegatextureAtUv(uv0); Properties properties1 = getPropertiesFromMegatextureAtUv(uv1); return mixProperties(properties0, properties1, sliceLerp); #endif } // Convert an array of sample datas to a final weighted properties. Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) { #if (SAMPLE_COUNT == 1) return getPropertiesFromMegatexture(sampleDatas[0]); #else // When more than one sample is taken the accumulator needs to start at 0 Properties properties = clearProperties(); for (int i = 0; i < SAMPLE_COUNT; ++i) { float weight = sampleDatas[i].weight; // Avoid reading the megatexture when the weight is 0 as it can be costly. if (weight > 0.0) { Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]); tempProperties = scaleProperties(tempProperties, weight); properties = sumProperties(properties, tempProperties); } } return properties; #endif } `;function v4e(e){const t=new Es;this.shaderBuilder=t;const n=e._customShader,i=jt(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const _ in o)if(o.hasOwnProperty(_)){const g=o[_];t.addUniform(g.type,_,ge.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",ge.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=c(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([m4e]),t.addFragmentLines([n.fragmentShaderText,"#line 0",w4e,f4e,_4e,S4e]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,ge.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,ge.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,ge.FRAGMENT),t.addFragmentLines([y4e])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,ge.FRAGMENT),t.addFragmentLines([g4e]));const a=e._provider.shape;a==="BOX"?t.addFragmentLines([x4e,b4e,Gv]):a==="CYLINDER"?t.addFragmentLines([C4e,bz,T4e,Gv]):a==="ELLIPSOID"&&(t.addDefine("SHAPE_ELLIPSOID",void 0,ge.FRAGMENT),t.addFragmentLines([E4e,bz,A4e,Gv])),t.addFragmentLines([p4e]);const l=e._shape,u=l.shaderDefines;for(const _ in u)if(u.hasOwnProperty(_)){let g=u[_];c(g)&&(g=g===!0?void 0:g,t.addDefine(_,g,ge.FRAGMENT))}let h=l.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",h,ge.FRAGMENT),s===1?h+=1:r.unionClippingRegions?h+=2:h+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",h,ge.FRAGMENT),h+=1),t.addDefine("INTERSECTION_COUNT",h,ge.FRAGMENT),(!d.equals(e.paddingBefore,d.ZERO)||!d.equals(e.paddingAfter,d.ZERO))&&t.addDefine("PADDING",void 0,ge.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,ge.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,ge.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,ge.FRAGMENT);const f=e._traversal;t.addDefine("SAMPLE_COUNT",`${f._sampleCount}`,ge.FRAGMENT)}function I4e(e,t){const{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,l=o.length,u=c(s)&&c(a);n.addDefine("METADATA_COUNT",l,ge.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=`PropertyStatistics_${U}`,D=`PropertyStatistics_${U}`;n.addStruct(S,D,ge.FRAGMENT);const p=bA(B);n.addStructField(S,p,"min"),n.addStructField(S,p,"max")}const h="Statistics",f="Statistics",_="statistics";n.addStruct(h,f,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=`PropertyStatistics_${U}`,S=U;n.addStructField(h,B,S)}const g="Metadata",m="Metadata",b="metadata";n.addStruct(g,m,ge.FRAGMENT),n.addStructField(g,f,_);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=bA(B);n.addStructField(g,S,U)}for(let M=0;M<l;M++){const U=i[M],B=o[M],S=P4e(B),D=`VoxelProperty_${U}`,p=`VoxelProperty_${U}`;n.addStruct(D,p,ge.FRAGMENT),n.addStructField(D,S,"partialDerivativeLocal"),n.addStructField(D,S,"partialDerivativeWorld"),n.addStructField(D,S,"partialDerivativeView"),n.addStructField(D,S,"partialDerivativeValid")}const T="Voxel",x="Voxel",C="voxel";n.addStruct(T,x,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=`VoxelProperty_${U}`;n.addStructField(T,B,U)}n.addStructField(T,"vec3","positionEC"),n.addStructField(T,"vec3","positionUv"),n.addStructField(T,"vec3","positionShapeUv"),n.addStructField(T,"vec3","positionUvLocal"),n.addStructField(T,"vec3","viewDirUv"),n.addStructField(T,"vec3","viewDirWorld"),n.addStructField(T,"vec3","surfaceNormal"),n.addStructField(T,"float","travelDistance"),n.addStructField(T,"int","stepCount"),n.addStructField(T,"int","tileIndex"),n.addStructField(T,"int","sampleIndex");const w="FragmentInput",v="FragmentInput";n.addStruct(w,v,ge.FRAGMENT),n.addStructField(w,m,b),n.addStructField(w,x,C);const P="Properties",N="Properties",k="properties";n.addStruct(P,N,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=bA(B);n.addStructField(P,S,U)}{const M="clearProperties";n.addFunction(M,`${N} clearProperties()`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U],S=o[U];r[U];const D=bA(S);n.addFunctionLines(M,[`${k}.${B} = ${D}(0.0);`])}n.addFunctionLines(M,[`return ${k};`])}{const M="sumProperties";n.addFunction(M,`${N} sumProperties(${N} propertiesA, ${N} propertiesB)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${k}.${B} = propertiesA.${B} + propertiesB.${B};`])}n.addFunctionLines(M,[`return ${k};`])}{const M="scaleProperties";n.addFunction(M,`${N} scaleProperties(${N} ${k}, float scale)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} scaledProperties = ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`scaledProperties.${B} *= scale;`])}n.addFunctionLines(M,["return scaledProperties;"])}{const M="mixProperties";n.addFunction(M,`${N} mixProperties(${N} propertiesA, ${N} propertiesB, float mixFactor)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${k}.${B} = mix(propertiesA.${B}, propertiesB.${B}, mixFactor);`])}n.addFunctionLines(M,[`return ${k};`])}{const M="copyPropertiesToMetadata";n.addFunction(M,`void copyPropertiesToMetadata(in ${N} ${k}, inout ${m} ${b})`,ge.FRAGMENT);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${b}.${B} = ${k}.${B};`])}}if(u){const M="setStatistics";n.addFunction(M,`void setStatistics(inout ${f} ${_})`,ge.FRAGMENT);for(let U=0;U<l;U++){const B=i[U],S=o[U],D=bt.getComponentCount(S);for(let p=0;p<D;p++){const I=O4e(S,p),O=s[U][p],F=a[U][p];n.addFunctionLines(M,[`${_}.${B}.min${I} = ${Tz(O)};`,`${_}.${B}.max${I} = ${Tz(F)};`])}}}{const M="getPropertiesFromMegatextureAtUv";n.addFunction(M,`${N} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U],S=o[U];r[U];const D=D4e(S);n.addFunctionLines(M,[`properties.${B} = texture(u_megatextureTextures[${U}], texcoord)${D};`])}n.addFunctionLines(M,[`return ${k};`])}}function bA(e){if(e===bt.SCALAR)return"float";if(e===bt.VEC2)return"vec2";if(e===bt.VEC3)return"vec3";if(e===bt.VEC4)return"vec4"}function D4e(e){if(e===bt.SCALAR)return".r";if(e===bt.VEC2)return".ra";if(e===bt.VEC3)return".rgb";if(e===bt.VEC4)return""}function P4e(e){if(e===bt.SCALAR)return"vec3";if(e===bt.VEC2)return"mat2";if(e===bt.VEC3)return"mat3";if(e===bt.VEC4)return"mat4"}function Tz(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function O4e(e,t){return e===bt.SCALAR?"":`[${t}]`}function L4e(e,t){const n=new v4e(e);I4e(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const x="getClippingPlane",C=p1(o,t),w=0,v=C.indexOf(")")+1,P=C.indexOf("{",v)+1,N=C.indexOf("}",P),k=C.slice(w,v),M=C.slice(P,N);i.addFunction(x,k,ge.FRAGMENT),i.addFunctionLines(x,[M])}const s=i.clone();s.addDefine("PICKING",void 0,ge.FRAGMENT);const a=i.clone();a.addDefine("PICKING_VOXEL",void 0,ge.FRAGMENT);const l=i.buildShaderProgram(t),u=s.buildShaderProgram(t),h=a.buildShaderProgram(t),f=Ue.fromCache({cull:{enabled:!0,face:Qi.BACK},depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND}),_=t.getViewportQuadVertexArray(),g=e._depthTest,m=new Ze({vertexArray:_,primitiveType:ze.TRIANGLES,renderState:f,shaderProgram:l,uniformMap:n.uniformMap,modelMatrix:e._compoundModelMatrix,pass:xe.VOXELS,executeInClosestFrustum:!0,owner:this,cull:g,occlude:g}),b=Ze.shallowClone(m,new Ze);b.shaderProgram=u,b.pickOnly=!0;const T=Ze.shallowClone(m,new Ze);if(T.shaderProgram=h,T.pickOnly=!0,c(e._drawCommand)){const x=e._drawCommand;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPick)){const x=e._drawCommandPick;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPickVoxel)){const x=e._drawCommandPickVoxel;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}e._drawCommand=m,e._drawCommandPick=b,e._drawCommandPickVoxel=T}function fs(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._minBounds=d.clone(fs.DefaultMinBounds,new d),this._maxBounds=d.clone(fs.DefaultMaxBounds,new d),this.shaderUniforms={renderMinBounds:new d,renderMaxBounds:new d,boxUvToShapeUvScale:new d,boxUvToShapeUvTranslate:new d},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_SHAPE_BOUNDS:void 0},this.shaderMaximumIntersectionsLength=0}const R4e=new d,nP=new d,N4e=new $,M4e=new d,F4e=new d,B4e=new d,z4e=new d,Az=L.fromRotationTranslation($.fromUniformScale(.5,new $),new d(.5,.5,.5),new L);fs.prototype.update=function(e,t,n,i,o){i=y(i,fs.DefaultMinBounds),o=y(o,fs.DefaultMaxBounds),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const r=fs.DefaultMinBounds,s=fs.DefaultMaxBounds;t=this._minBounds=d.clamp(t,r,s,this._minBounds),n=this._maxBounds=d.clamp(n,r,s,this._maxBounds),i=d.clamp(i,r,s,M4e),o=d.clamp(o,r,s,F4e);const a=d.clamp(t,i,o,B4e),l=d.clamp(n,i,o,z4e),u=L.getScale(e,nP);if(a.x>l.x||a.y>l.y||a.z>l.z||(a.x===l.x)+(a.y===l.y)+(a.z===l.z)>=2||i.x>o.x||i.y>o.y||i.z>o.z||u.x===0||u.y===0||u.z===0)return!1;this.shapeTransform=L.clone(e,this.shapeTransform),this.orientedBoundingBox=X1(a,l,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const{shaderUniforms:h,shaderDefines:f}=this;for(const m in f)f.hasOwnProperty(m)&&(f[m]=void 0);const _=!d.equals(t,r)||!d.equals(n,s);let g=0;if(f.BOX_INTERSECTION_INDEX=g,g+=1,h.renderMinBounds=L.multiplyByPoint(Az,a,h.renderMinBounds),h.renderMaxBounds=L.multiplyByPoint(Az,l,h.renderMaxBounds),_){f.BOX_HAS_SHAPE_BOUNDS=!0;const m=t,b=n;h.boxUvToShapeUvScale=d.fromElements(2/(m.x===b.x?1:b.x-m.x),2/(m.y===b.y?1:b.y-m.y),2/(m.z===b.z?1:b.z-m.z),h.boxUvToShapeUvScale),h.boxUvToShapeUvTranslate=d.fromElements(-h.boxUvToShapeUvScale.x*(m.x*.5+.5),-h.boxUvToShapeUvScale.y*(m.y*.5+.5),-h.boxUvToShapeUvScale.z*(m.z*.5+.5),h.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=g,!0};const fx=new d,iP=new d;fs.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),l=d.fromElements(R.lerp(r.x,s.x,a*t),R.lerp(r.y,s.y,a*n),R.lerp(r.z,s.z,a*i),fx),u=d.fromElements(R.lerp(r.x,s.x,a*(t+1)),R.lerp(r.y,s.y,a*(n+1)),R.lerp(r.z,s.z,a*(i+1)),iP);return X1(l,u,this.shapeTransform,o)};const xz=new d;fs.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,xz),s=d.multiplyByScalar(r,o,xz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,fx),o,fx),l=d.add(a,s,iP),u=this._minBounds,h=this._maxBounds,f=d.fromElements(R.lerp(u.x,h.x,a.x),R.lerp(u.y,h.y,a.y),R.lerp(u.z,h.z,a.z),fx),_=d.fromElements(R.lerp(u.x,h.x,l.x),R.lerp(u.y,h.y,l.y),R.lerp(u.z,h.z,l.z),iP);return X1(f,_,this.shapeTransform,i)};fs.DefaultMinBounds=Object.freeze(new d(-1,-1,-1));fs.DefaultMaxBounds=Object.freeze(new d(1,1,1));function X1(e,t,n,i){const o=fs.DefaultMinBounds,r=fs.DefaultMaxBounds;if(d.equals(e,o)&&d.equals(t,r))i.center=L.getTranslation(n,i.center),i.halfAxes=L.getMatrix3(n,i.halfAxes);else{let a=L.getScale(n,nP);const l=d.midpoint(e,t,R4e);i.center=L.multiplyByPoint(n,l,i.center),a=d.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),nP);const u=L.getRotation(n,N4e);i.halfAxes=$.setScale(u,a,i.halfAxes)}return i}function $i(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._minimumRadius=$i.DefaultMinBounds.x,this._maximumRadius=$i.DefaultMaxBounds.x,this._minimumHeight=$i.DefaultMinBounds.y,this._maximumHeight=$i.DefaultMaxBounds.y,this._minimumAngle=$i.DefaultMinBounds.z,this._maximumAngle=$i.DefaultMaxBounds.z,this.shaderUniforms={cylinderRenderHeightMinMax:new H,cylinderRenderRadiusMinMax:new H,cylinderRenderAngleMinMax:new H,cylinderUvToShapeUvRadius:new H,cylinderUvToShapeUvHeight:new H,cylinderUvToShapeUvAngle:new H,cylinderShapeUvAngleMinMax:new H,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MAX:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MIN:void 0,CYLINDER_INTERSECTION_INDEX_ANGLE:void 0},this.shaderMaximumIntersectionsLength=0}const H6=new d;$i.prototype.update=function(e,t,n,i,o){i=y(i,$i.DefaultMinBounds),o=y(o,$i.DefaultMaxBounds),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const r=$i.DefaultMinBounds.x,s=$i.DefaultMaxBounds.x,a=$i.DefaultMinBounds.y,l=$i.DefaultMaxBounds.y,u=$i.DefaultMinBounds.z,h=$i.DefaultMaxBounds.z,f=h-u,_=.5*f,g=R.EPSILON10,m=R.EPSILON3,b=R.EPSILON10,T=R.clamp(t.x,r,s),x=R.clamp(n.x,r,s),C=R.clamp(i.x,r,s),w=R.clamp(o.x,r,s),v=Math.max(T,C),P=Math.min(x,w),N=R.clamp(t.y,a,l),k=R.clamp(n.y,a,l),M=R.clamp(i.y,a,l),U=R.clamp(o.y,a,l),B=Math.max(N,M),S=Math.min(k,U),D=R.negativePiToPi(t.z),p=R.negativePiToPi(n.z),I=R.negativePiToPi(i.z),O=R.negativePiToPi(o.z),F=Math.max(D,I),V=Math.min(p,O),G=L.getScale(e,H6);if(P===0||v>P||B>S||R.equalsEpsilon(G.x,0,void 0,g)||R.equalsEpsilon(G.y,0,void 0,g)||R.equalsEpsilon(G.z,0,void 0,g))return!1;this._minimumRadius=T,this._maximumRadius=x,this._minimumHeight=N,this._maximumHeight=k,this._minimumAngle=D,this._maximumAngle=p,this.shapeTransform=L.clone(e,this.shapeTransform),this.orientedBoundingBox=Q1(v,P,B,S,F,V,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const X=T===r&&x===s,q=N===a&&k===l,ee=p<D,Y=p-D+ee*f,ne=Y>_+b&&Y<f-b,Q=Y<_-b,le=Y>=_-b&&Y<=_+b,pe=ne||Q||le,re=R.equalsEpsilon(D,u,void 0,m),de=R.equalsEpsilon(p,h,void 0,m),fe=v===r,ye=V<F,Ce=V-F+ye*f,we=Ce>=_-b&&Ce<f-b,Pe=Ce>b&&Ce<_-b,lt=Ce<=b,ft=we||Pe||lt,{shaderUniforms:We,shaderDefines:Fe}=this;for(const st in Fe)Fe.hasOwnProperty(st)&&(Fe[st]=void 0);let Dt=0;if(Fe.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=Dt,Dt+=1,fe||(Fe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,Fe.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=Dt,Dt+=1),We.cylinderRenderRadiusMinMax=H.fromElements(v,P,We.cylinderRenderRadiusMinMax),v===P&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),!X){Fe.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const st=x-T;let et=0,hn=1;st!==0&&(et=1/st,hn=-T/st),We.cylinderUvToShapeUvRadius=H.fromElements(et,hn,We.cylinderUvToShapeUvRadius)}if(!q){Fe.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const st=k-N;let et=0,hn=1;st!==0&&(et=2/st,hn=-(N+1)/st),We.cylinderUvToShapeUvHeight=H.fromElements(et,hn,We.cylinderUvToShapeUvHeight)}if(We.cylinderRenderHeightMinMax=H.fromElements(B,S,We.cylinderRenderHeightMinMax),ee&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),ft&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,Fe.CYLINDER_INTERSECTION_INDEX_ANGLE=Dt,we?(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,Dt+=1):Pe?(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,Dt+=2):lt&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,Dt+=2),We.cylinderRenderAngleMinMax=H.fromElements(F,V,We.cylinderRenderAngleMinMax)),pe){Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,re&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),de&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const st=(D-u)/f,et=(p-u)/f,hn=1-Y/f;if(We.cylinderShapeUvAngleMinMax=H.fromElements(st,et,We.cylinderShapeUvAngleMinMax),We.cylinderShapeUvAngleRangeZeroMid=(et+.5*hn)%1,Y<=b)We.cylinderUvToShapeUvAngle=H.fromElements(0,1,We.cylinderUvToShapeUvAngle);else{const ot=f/Y,at=-(D-u)/Y;We.cylinderUvToShapeUvAngle=H.fromElements(ot,at,We.cylinderUvToShapeUvAngle)}}return this.shaderMaximumIntersectionsLength=Dt,!0};$i.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,l=this._maximumHeight,u=this._minimumAngle,h=this._maximumAngle,f=1/Math.pow(2,e),_=R.lerp(r,s,t*f),g=R.lerp(r,s,(t+1)*f),m=R.lerp(a,l,n*f),b=R.lerp(a,l,(n+1)*f),T=R.lerp(u,h,i*f),x=R.lerp(u,h,(i+1)*f);return Q1(_,g,m,b,T,x,this.shapeTransform,o)};const Cz=new d,Ez=new d,U4e=new d;$i.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,Cz),s=d.multiplyByScalar(r,o,Cz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,Ez),o,Ez),l=d.add(a,s,U4e),u=this._minimumRadius,h=this._maximumRadius,f=this._minimumHeight,_=this._maximumHeight,g=this._minimumAngle,m=this._maximumAngle,b=R.lerp(u,h,a.x),T=R.lerp(u,h,l.x),x=R.lerp(f,_,a.y),C=R.lerp(f,_,l.y),w=R.lerp(g,m,a.z),v=R.lerp(g,m,l.z);return Q1(b,T,x,C,w,v,this.shapeTransform,i)};$i.DefaultMinBounds=Object.freeze(new d(0,-1,-R.PI));$i.DefaultMaxBounds=Object.freeze(new d(1,1,+R.PI));const k4e=5,V4e=new Array(k4e),H4e=new d,G4e=new $,j4e=new L,W4e=new L,q4e=new L,jv=new L,Y4e=new d,$4e=new d,X4e=new d,G6=new Array(8);for(let e=0;e<8;e++)G6[e]=new d;function wz(e,t,n){return Math.abs(te.dot(e,t))<n}function Q4e(e){const t=L.getColumn(e,0,Y4e),n=L.getColumn(e,1,$4e),i=L.getColumn(e,2,X4e),o=R.EPSILON4;return wz(t,n,o)&&wz(n,i,o)}function K4e(e,t){const n=G6;d.fromElements(-.5,-.5,-.5,n[0]),d.fromElements(-.5,-.5,.5,n[1]),d.fromElements(-.5,.5,-.5,n[2]),d.fromElements(-.5,.5,.5,n[3]),d.fromElements(.5,-.5,-.5,n[4]),d.fromElements(.5,-.5,.5,n[5]),d.fromElements(.5,.5,-.5,n[6]),d.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)L.multiplyByPoint(e,n[i],n[i]);return Ct.fromPoints(n,t)}function Q1(e,t,n,i,o,r,s,a){const l=$i.DefaultMinBounds,u=$i.DefaultMaxBounds,h=l.x,f=u.x,_=l.y,g=u.y,m=l.z,b=u.z;if(e===h&&t===f&&n===_&&i===g&&o===m&&r===b)return a.center=L.getTranslation(s,a.center),a.halfAxes=L.getMatrix3(s,a.halfAxes),a;r<o&&(r+=R.TWO_PI);const x=r-o,C=o+x*.5,w=V4e;let v=0;w[v++]=o,w[v++]=r,w[v++]=C,x>R.PI&&(w[v++]=C-R.PI_OVER_TWO,w[v++]=C+R.PI_OVER_TWO);let P=1,N=1,k=-1,M=-1;for(let ee=0;ee<v;++ee){const Y=w[ee]-C,ne=Math.cos(Y),Q=Math.sin(Y),le=ne*e,pe=Q*e,re=ne*t,de=Q*t;P=Math.min(P,le),N=Math.min(N,pe),P=Math.min(P,re),N=Math.min(N,de),k=Math.max(k,le),M=Math.max(M,pe),k=Math.max(k,re),M=Math.max(M,de)}const U=k-P,B=M-N,S=i-n,D=(P+k)*.5,p=(N+M)*.5,I=(n+i)*.5,O=d.fromElements(D,p,I,H4e),F=$.fromRotationZ(C,G4e),V=d.fromElements(U,B,S,H6),G=L.fromScale(V,q4e),j=L.fromRotation(F,W4e),W=L.fromTranslation(O,j4e),X=L.multiplyTransformation(j,L.multiplyTransformation(W,G,jv),jv),q=L.multiplyTransformation(s,X,jv);return Q4e(q)?Ct.fromTransformation(q,a):K4e(q,a)}function El(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._rectangle=new ce,this._minimumHeight=El.DefaultMinBounds.z,this._maximumHeight=El.DefaultMaxBounds.z,this._ellipsoid=new ae,this._translation=new d,this._rotation=new $,this.shaderUniforms={ellipsoidRadiiUv:new d,eccentricitySquared:0,evoluteScale:new H,ellipsoidInverseRadiiSquaredUv:new d,ellipsoidRenderLongitudeMinMax:new H,ellipsoidShapeUvLongitudeMinMaxMid:new d,ellipsoidUvToShapeUvLongitude:new H,ellipsoidUvToShapeUvLatitude:new H,ellipsoidRenderLatitudeSinMinMax:new H,ellipsoidInverseHeightDifferenceUv:0,clipMinMaxHeight:new H},this.shaderDefines={ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LONGITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN:void 0},this.shaderMaximumIntersectionsLength=0}const Z4e=new d,J4e=new d,eHe=new d,tHe=new d,nHe=new d,iHe=new d,oHe=new d,rHe=new d,sHe=new $,Sz=new d,vz=new d,aHe=new ce;El.prototype.update=function(e,t,n,i,o){const{DefaultMinBounds:r,DefaultMaxBounds:s}=El;i=y(i,r),o=y(o,s),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const a=R.EPSILON10,l=R.EPSILON3,u=R.EPSILON10,h=R.EPSILON10,f=R.EPSILON3,_=L.getScale(e,rHe),g=d.clone(r,Z4e);g.z=-d.minimumComponent(_);const m=d.clamp(t,g,s,J4e),b=d.clamp(n,g,s,eHe),T=d.clamp(i,g,s,tHe),x=d.clamp(o,g,s,nHe),C=d.maximumByComponent(m,T,iHe),w=d.minimumByComponent(b,x,oHe),v=d.add(_,d.fromElements(b.z,b.z,b.z,Sz),Sz),P=d.maximumComponent(v),N=d.add(_,d.fromElements(w.z,w.z,w.z,vz),vz);if(C.y>w.y||C.y===s.y||w.y===r.y||C.z>w.z||R.equalsEpsilon(N,d.ZERO,void 0,a))return!1;this._rectangle=ce.fromRadians(m.x,m.y,b.x,b.y),this._translation=L.getTranslation(e,this._translation),this._rotation=L.getRotation(e,this._rotation),this._ellipsoid=ae.fromCartesian3(_,this._ellipsoid),this._minimumHeight=m.z,this._maximumHeight=b.z;const k=ce.fromRadians(C.x,C.y,w.x,w.y,aHe);this.orientedBoundingBox=K1(k,C.z,w.z,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=L.fromRotationTranslation($.setScale(this._rotation,v,sHe),this._translation,this.shapeTransform),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const M=s.x-r.x,U=.5*M,B=w.x<C.x,S=w.x-C.x+B*M,D=S<=u,p=S>=U-u&&S<M-u,I=S>u&&S<U-u,O=D||p||I,F=b.x<m.x,V=b.x-m.x+F*M,G=V>U+u&&V<M-u,j=V>=U-u&&V<=U+u,W=V<U-u,X=G||j||W,q=w.y<-f,ee=w.y>=-f&&w.y<=+f,Y=w.y>+f&&w.y<s.y-h,ne=q||ee||Y,Q=C.y>r.y+h&&C.y<-f,le=C.y>=-f&&C.y<=+f,pe=C.y>+f,re=Q||le||pe,de=ne||re,fe=b.y-m.y,ye=b.y<-f,Ce=b.y>=-f&&b.y<=+f,we=b.y>+f&&b.y<s.y-h,Pe=ye||Ce||we,lt=m.y>r.y+h&&m.y<-f,ft=m.y>=-f&&m.y<=+f,We=m.y>+f,Dt=Pe||(lt||ft||We),{shaderUniforms:st,shaderDefines:et}=this;for(const fi in et)et.hasOwnProperty(fi)&&(et[fi]=void 0);st.ellipsoidRadiiUv=d.divideByScalar(v,P,st.ellipsoidRadiiUv);const{x:hn,z:ot}=st.ellipsoidRadiiUv,at=ot/hn;st.eccentricitySquared=1-at*at,st.evoluteScale=H.fromElements((hn*hn-ot*ot)/hn,(ot*ot-hn*hn)/ot,st.evoluteScale),st.ellipsoidInverseRadiiSquaredUv=d.divideComponents(d.ONE,d.multiplyComponents(st.ellipsoidRadiiUv,st.ellipsoidRadiiUv,st.ellipsoidInverseRadiiSquaredUv),st.ellipsoidInverseRadiiSquaredUv);let Xt=0;et.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=Xt,Xt+=1,et.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=Xt,Xt+=1,st.clipMinMaxHeight=H.fromElements((C.z-b.z)/P,(w.z-b.z)/P,st.clipMinMaxHeight);const it=(b.z-m.z)/P;if(st.ellipsoidInverseHeightDifferenceUv=1/it,m.z===b.z&&(st.ellipsoidInverseHeightDifferenceUv=0),O&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,et.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=Xt,p?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,Xt+=1):I?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,Xt+=2):D&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,Xt+=2),st.ellipsoidRenderLongitudeMinMax=H.fromElements(C.x,w.x,st.ellipsoidRenderLongitudeMinMax)),X)if(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,b.x<m.x&&(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0),V<=u)st.ellipsoidUvToShapeUvLongitude=H.fromElements(0,1,st.ellipsoidUvToShapeUvLongitude);else{const Hi=M/V,Ss=-(m.x-r.x)/V;st.ellipsoidUvToShapeUvLongitude=H.fromElements(Hi,Ss,st.ellipsoidUvToShapeUvLongitude)}if(O){const fi=R.equalsEpsilon(C.x,r.x,void 0,l),Hi=R.equalsEpsilon(w.x,s.x,void 0,l);fi&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),Hi&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const Ss=(m.x-r.x)/M,Qo=(b.x-r.x)/M,No=(w.x-r.x)/M,Gi=1-S/M,Ni=(No+.5*Gi)%1;st.ellipsoidShapeUvLongitudeMinMaxMid=d.fromElements(Ss,Qo,Ni,st.ellipsoidShapeUvLongitudeMinMaxMid)}if(de&&(re&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,et.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=Xt,Q?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,Xt+=1):le?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,Xt+=1):pe&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,Xt+=2)),ne&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,et.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=Xt,q?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,Xt+=2):ee?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,Xt+=1):Y&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,Xt+=1)),st.ellipsoidRenderLatitudeSinMinMax=H.fromElements(Math.sin(C.y),Math.sin(w.y),st.ellipsoidRenderLatitudeSinMinMax)),Dt)if(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,fe<h)st.ellipsoidUvToShapeUvLatitude=H.fromElements(0,1,st.ellipsoidUvToShapeUvLatitude);else{const Hi=(s.y-r.y)/fe,Ss=(r.y-m.y)/fe;st.ellipsoidUvToShapeUvLatitude=H.fromElements(Hi,Ss,st.ellipsoidUvToShapeUvLatitude)}return this.shaderMaximumIntersectionsLength=Xt,!0};const j6=new ce;El.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,l=n*r,u=(n+1)*r,h=i*r,f=(i+1)*r,_=ce.subsection(this._rectangle,s,l,a,u,j6),g=R.lerp(this._minimumHeight,this._maximumHeight,h),m=R.lerp(this._minimumHeight,this._maximumHeight,f);return K1(_,g,m,this._ellipsoid,this._translation,this._rotation,o)};const Iz=new d,Dz=new d,cHe=new d;El.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,Iz),s=d.multiplyByScalar(r,o,Iz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,Dz),o,Dz),l=d.add(a,s,cHe),u=ce.subsection(this._rectangle,a.x,a.y,l.x,l.y,j6),h=R.lerp(this._minimumHeight,this._maximumHeight,a.z),f=R.lerp(this._minimumHeight,this._maximumHeight,l.z);return K1(u,h,f,this._ellipsoid,this._translation,this._rotation,i)};function K1(e,t,n,i,o,r,s){return s=Ct.fromRectangle(e,t,n,i,s),s.center=d.add(s.center,o,s.center),s.halfAxes=$.multiply(s.halfAxes,r,s.halfAxes),s}El.DefaultMinBounds=Object.freeze(new d(-R.PI,-R.PI_OVER_TWO,-ae.WGS84.minimumRadius));El.DefaultMaxBounds=Object.freeze(new d(R.PI,R.PI_OVER_TWO,10*ae.WGS84.maximumRadius));const Ca={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};Ca.getMinBounds=function(e){switch(e){case Ca.BOX:return fs.DefaultMinBounds;case Ca.ELLIPSOID:return El.DefaultMinBounds;case Ca.CYLINDER:return $i.DefaultMinBounds;default:throw new E(`Invalid shape type ${e}`)}};Ca.getMaxBounds=function(e){switch(e){case Ca.BOX:return fs.DefaultMaxBounds;case Ca.ELLIPSOID:return El.DefaultMaxBounds;case Ca.CYLINDER:return $i.DefaultMaxBounds;default:throw new E(`Invalid shape type ${e}`)}};Ca.getShapeConstructor=function(e){switch(e){case Ca.BOX:return fs;case Ca.ELLIPSOID:return El;case Ca.CYLINDER:return $i;default:throw new E(`Invalid shape type ${e}`)}};const ah=Object.freeze(Ca);function wl(e){A.typeOf.object("options",e),A.defined("options.comparator",e.comparator),c(e.maximumLength)&&A.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=c(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(wl.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(c(e)){for(A.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});wl.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new wl({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};wl.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(c(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};wl.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)W6(this,t)};wl.prototype.insert=function(e){let t;const n=this._maximumLength;if(c(n)){if(n===0)return;if(this._length===n){const o=this._array[0];if(this._comparator(e,o)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,W6(this,i),t};wl.prototype.removeMinimum=function(){const e=this._length;if(e===0)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],q6(this,0)),this._array[e-1]=void 0,t};wl.prototype.removeMaximum=function(){const e=this._length;if(e===0)return;this._length--;let t;if(e<=2)t=this._array[e-1];else{const n=Z1(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&q6(this,n)}return this._array[e-1]=void 0,t};wl.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};wl.prototype.getMaximum=function(){const e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[Z1(this,1,2)?1:2]};function lC(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function Yy(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function Z1(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function W6(e,t){if(t===0)return;const n=Math.floor(R.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=Yy(e,t,i);for(o!==n&&(lC(e,t,i),t=i);t>=3;){const r=Math.floor((t-3)/4);if(Yy(e,t,r)!==o)break;lC(e,t,r),t=r}}function q6(e,t){const n=e._length,i=Math.floor(R.log2(t+1))%2===0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){Yy(e,s,r)===i&&(r=s);const a=2*o+1,l=Math.max(Math.min(n-a,4),0);for(let u=0;u<l;u++){const h=a+u;Yy(e,h,r)===i&&(r=h)}}if(Yy(e,r,t)===i&&(lC(e,r,t),r!==o&&r!==s)){const a=Math.floor((r-1)/2);Z1(e,r,a)===i&&lC(e,r,a)}t=r}}const Y6=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function jn(e,t){this.spatialNode=e,this.keyframe=t,this.state=Y6.UNLOADED,this.metadata=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}jn.priorityComparator=function(e,t){return e.priority-t.priority};jn.searchComparator=function(e,t){return e.keyframe-t.keyframe};jn.LoadState=Y6;function Ld(e,t,n,i,o){i===Ot.UNSIGNED_SHORT&&(i=Ot.FLOAT32);const r=e.floatingPointTexture;if(i===Ot.FLOAT32&&!r)throw new Te("Floating point texture not supported");let s;i===Ot.FLOAT32||i===Ot.FLOAT64?s=Me.FLOAT:i===Ot.UINT8&&(s=Me.UNSIGNED_BYTE);let a;n===1?a=e.webgl2?Ve.RED:Ve.LUMINANCE:n===2?a=e.webgl2?Ve.RG:Ve.LUMINANCE_ALPHA:n===3?a=Ve.RGB:n===4&&(a=Ve.RGBA);const l=512*1024*1024,u=128*1024*1024;o=Math.min(y(o,u),l);const h=pt.maximumTextureSize,f=Ot.getSizeInBytes(i),_=Math.floor(o/(n*f)),g=Math.min(h,R.previousPowerOfTwo(Math.floor(Math.sqrt(_)))),m=Math.ceil(Math.sqrt(t.x)),b=Math.ceil(t.z/m),T=m*t.x,x=b*t.y,C=Math.floor(g/T),w=Math.floor(g/x);if(C===0||w===0)throw new Te("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=d.clone(t,new d),this.maximumTileCount=C*w,this.regionCountPerMegatexture=new H(C,w),this.voxelCountPerRegion=new H(T,x),this.sliceCountPerRegion=new H(m,b),this.voxelSizeUv=new H(1/g,1/g),this.sliceSizeUv=new H(t.x/g,t.y/g),this.regionSizeUv=new H(T/g,x/g),this.texture=new xt({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR})});const v=Ot.toComponentDatatype(i);this.tileVoxelDataTemp=Z.createTypedArray(v,T*x*n),this.nodes=new Array(this.maximumTileCount);for(let P=0;P<this.maximumTileCount;P++)this.nodes[P]=new lHe(P);for(let P=0;P<this.maximumTileCount;P++){const N=this.nodes[P];N.previousNode=P>0?this.nodes[P-1]:void 0,N.nextNode=P<this.maximumTileCount-1?this.nodes[P+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function lHe(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}Ld.prototype.add=function(e){if(this.isFull())throw new E("Trying to add when there are no empty spots");const t=this.emptyList;this.emptyList=this.emptyList.nextNode,c(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,c(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;const n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};Ld.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new E("Megatexture index out of bounds");const t=this.nodes[e];c(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),c(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,c(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};Ld.prototype.isFull=function(){return this.emptyList===void 0};Ld.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===Ot.UNSIGNED_SHORT&&(i=Ot.FLOAT32);const o=Ot.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.x)),a=Math.ceil(t.z/s),l=s*t.x,u=a*t.y;let h=R.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){const _=Math.floor(h/l),g=Math.floor(h/u);if(_*g>=e)break;h*=2}return h*h*n*o};Ld.prototype.writeDataToTexture=function(e,t){const n=t.constructor===Uint16Array?new Float32Array(t):t,i=this.voxelCountPerTile,o=this.sliceCountPerRegion,r=this.voxelCountPerRegion,s=this.channelCount,a=this.tileVoxelDataTemp;for(let b=0;b<i.z;b++){const T=b%o.x*i.x,x=Math.floor(b/o.x)*i.y;for(let C=0;C<i.y;C++)for(let w=0;w<i.x;w++){const v=b*i.y*i.x+C*i.x+w,P=(x+C)*r.x+(T+w);for(let N=0;N<s;N++)a[P*s+N]=n[v*s+N]}}const l=this.regionCountPerMegatexture,u=r.x,h=r.y,f=e%l.x*r.x,_=Math.floor(e/l.x)*r.y,m={source:{arrayBufferView:a,width:u,height:h},xOffset:f,yOffset:_};this.texture.copyFrom(m)};Ld.prototype.isDestroyed=function(){return!1};Ld.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),ve(this)};function Fc(e,t,n,i,o,r,s){this.children=void 0,this.parent=o,this.level=e,this.x=t,this.y=n,this.z=i,this.dimensions=d.clone(s),this.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new Ct,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r)}const uHe=new d;Fc.prototype.computeBoundingVolumes=function(e){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);const t=$.getScale(this.orientedBoundingBox.halfAxes,uHe),n=2*d.maximumComponent(t);this.approximateVoxelSize=n/d.minimumComponent(this.dimensions)};Fc.prototype.constructChildNodes=function(e){const{level:t,x:n,y:i,z:o}=this,r=n*2,s=i*2,a=o*2,l=s+1,u=r+1,h=a+1,f=t+1,_=[[f,r,s,a],[f,u,s,a],[f,r,l,a],[f,u,l,a],[f,r,s,h],[f,u,s,h],[f,r,l,h],[f,u,l,h]];this.children=_.map(([g,m,b,T])=>new Fc(g,m,b,T,this,e,this.dimensions))};Fc.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};Fc.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,R.EPSILON7);const o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};const Pz={keyframe:0};function P0(e,t){return Pz.keyframe=e,Hr(t,Pz,jn.searchComparator)}Fc.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this;const n=t.level,i=Math.floor(e),o=Math.ceil(e);let r,s,a=+Number.MAX_VALUE,l=+Number.MAX_VALUE;for(;c(t);){const{renderableKeyframeNodes:f}=t;if(f.length>=1){const _=dHe(i,f),g=f[_],m=o===i||i<g.keyframe?_:Math.min(_+1,f.length-1),b=f[m],T=i-g.keyframe,x=Oz(n-t.level,T);x<a&&(a=x,r=g);const C=b.keyframe-o,w=Oz(n-t.level,C);if(w<l&&(l=w,s=b),T===0&&C===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,!c(r)||!c(s))return;const u=r.keyframe,h=s.keyframe;this.renderableKeyframeNodeLerp=u===h?0:R.clamp((e-u)/(h-u),0,1)};function dHe(e,t){const n=P0(e,t);return n<0?R.clamp(~n-1,0,t.length-1):n}function Oz(e,t){const n=Math.exp(e*4),i=t>=0?1:-200;return e*n+t*i}Fc.prototype.isVisited=function(e){return this.visitedFrameNumber===e};Fc.prototype.createKeyframeNode=function(e){let t=P0(e,this.keyframeNodes);if(t<0){t=~t;const n=new jn(this,e);this.keyframeNodes.splice(t,0,n)}};Fc.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=P0(n,this.keyframeNodes);if(i<0)throw new E("Keyframe node does not exist.");if(this.keyframeNodes.splice(i,1),e.megatextureIndex!==-1){for(let r=0;r<t.length;r++)t[r].remove(e.megatextureIndex);const o=P0(n,this.renderableKeyframeNodes);if(o<0)throw new E("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.spatialNode=void 0,e.state=jn.LoadState.UNLOADED,e.metadata={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};Fc.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==jn.LoadState.RECEIVED||e.megatextureIndex!==-1||e.metadata.length!==t.length)throw new E("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){const r=t[o];e.megatextureIndex=r.add(e.metadata[o])}e.state=jn.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=P0(e.keyframe,n);if(i>=0)throw new E("Keyframe already renderable");i=~i,n.splice(i,0,e)};Fc.prototype.isRenderable=function(e){const t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return c(t)&&c(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};function lu(e,t,n,i,o,r,s){this._primitive=e,this.megatextures=new Array(i.length);for(let m=0;m<i.length;m++){const b=i[m],T=bt.getComponentCount(b),x=o[m];this.megatextures[m]=new Ld(t,n,T,x,s)}const a=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const l=e._shape;this.rootNode=new Fc(0,0,0,0,void 0,l,n),this._priorityQueue=new wl({maximumLength:a,comparator:jn.priorityComparator}),this._highPriorityKeyframeNodes=new Array(a),this._keyframeNodesInMegatexture=new Array(a),this._keyframeCount=r,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(r);const u=this._binaryTreeKeyframeWeighting;u[0]=0,u[r-1]=0,oP(u,1,r-2,0);const h=9,f=2048,_=Math.floor(f/h),g=Math.ceil(a/_);this.internalNodeTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,flipY:!1,width:f,height:g,sampler:new un({minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})}),this.internalNodeTilesPerRow=_,this.internalNodeTexelSizeUv=new H(1/f,1/g),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new H}lu.prototype.findKeyframeNode=function(e){return this._keyframeNodesInMegatexture.find(function(t){return t.megatextureIndex===e})};function oP(e,t,n,i){if(t>n)return;const o=Math.floor((t+n)/2);e[o]=i,oP(e,t,o-1,i+1),oP(e,o+1,n,i+1)}lu.simultaneousRequestCountMaximum=50;lu.prototype.update=function(e,t,n,i){const o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,l=o._levelBlendFactor,u=l>0,h=a>1,f=(u?2:1)*(h?2:1);this._sampleCount=f;const _=f>=2;if(_&&!c(this.leafNodeTexture)){const C=Math.floor(512),w=Math.ceil(s/C);this.leafNodeTexture=new xt({context:r,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,flipY:!1,width:1024,height:w,sampler:new un({minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})}),this.leafNodeTexelSizeUv=H.fromElements(1/1024,1/w,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=C}else!_&&c(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=R.clamp(t,0,a-1),n&&$6(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const g=xo();pHe(this,e);const m=xo();gHe(this,f,l);const b=xo();if(this._debugPrint){const T=m-g,x=b-m,C=b-g;_He(this,T,x,C)}};lu.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};lu.prototype.isDestroyed=function(){return!1};lu.prototype.destroy=function(){const e=this.megatextures,t=e.length;for(let n=0;n<t;n++)e[n]=e[n]&&e[n].destroy();return this.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),ve(this)};function $6(e,t){if(t.computeBoundingVolumes(e._primitive._shape),c(t.children))for(let n=0;n<8;n++){const i=t.children[n];$6(e,i)}}function hHe(e,t){if(e._simultaneousRequestCount>=lu.simultaneousRequestCountMaximum)return;const n=e._primitive._provider;function i(l){e._simultaneousRequestCount--;const u=n.types.length;if(!c(l))t.state=jn.LoadState.UNAVAILABLE;else if(l===jn.LoadState.FAILED)t.state=jn.LoadState.FAILED;else if(!Array.isArray(l)||l.length!==u)t.state=jn.LoadState.FAILED;else{const h=e.megatextures;for(let f=0;f<u;f++){const{voxelCountPerTile:_,channelCount:g}=h[f],{x:m,y:b,z:T}=_,x=m*b*T,C=l[f],w=x*g;if(C.length===w)t.metadata[f]=C,t.state=jn.LoadState.RECEIVED;else{t.state=jn.LoadState.FAILED;break}}}}function o(){e._simultaneousRequestCount--,t.state=jn.LoadState.FAILED}const{keyframe:r,spatialNode:s}=t,a=n.requestData({tileLevel:s.level,tileX:s.x,tileY:s.y,tileZ:s.z,keyframe:r});c(a)?(e._simultaneousRequestCount++,t.state=jn.LoadState.RECEIVING,a.then(i).catch(o)):t.state=jn.LoadState.FAILED}function fHe(e){return e/(1+e)}function pHe(e,t){const n=e._frameNumber,i=e._primitive,o=i._shape,r=i.screenSpaceError,s=e._priorityQueue,a=e._keyframeCount,l=R.clamp(Math.floor(e._keyframeLocation),0,a-2),u=l+1,{camera:h,context:f,pixelRatio:_}=t,{positionWC:g,frustum:m}=h,T=f.drawingBufferHeight/_/m.sseDenominator;function x(B,S){if(B.computeScreenSpaceError(g,T),S=B.visibility(t,S),S===_o.MASK_OUTSIDE)return;if(B.visitedFrameNumber=n,a===1)B.createKeyframeNode(0);else if(B.keyframeNodes.length!==a)for(let F=0;F<a;F++)B.createKeyframeNode(F);const{screenSpaceError:D,keyframeNodes:p}=B,I=fHe(D);let O=!1;for(let F=0;F<p.length;F++){const V=p[F];V.priority=10*I+mHe(l,V.keyframe,u,e),V.state!==jn.LoadState.UNAVAILABLE&&V.state!==jn.LoadState.FAILED&&V.priority!==-Number.MAX_VALUE&&s.insert(V),V.state===jn.LoadState.LOADED&&(O=!0)}if(D<r||!O){B.children=void 0;return}c(B.children)||B.constructChildNodes(o);for(let F=0;F<8;F++){const V=B.children[F];x(V,S)}}s.reset(),x(e.rootNode,_o.MASK_INDETERMINATE);const C=e._highPriorityKeyframeNodes;let w=0,v;for(;s.length>0;)v=s.removeMaximum(),v.highPriorityFrameNumber=n,C[w]=v,w++;const P=e._keyframeNodesInMegatexture,N=e.megatextures[0],k=N.occupiedCount;P.length=k,P.sort(function(B,S){return B.highPriorityFrameNumber===S.highPriorityFrameNumber?S.priority-B.priority:S.highPriorityFrameNumber-B.highPriorityFrameNumber});let M=0,U=0;for(let B=0;B<w;B++)if(v=C[B],!(v.state===jn.LoadState.LOADED||v.spatialNode===void 0)&&(v.state===jn.LoadState.UNLOADED&&hHe(e,v),v.state===jn.LoadState.RECEIVED)){let S=0;if(N.isFull()){S=k-1-M,M++;const D=P[S];D.spatialNode.destroyKeyframeNode(D,e.megatextures)}else S=k+U,U++;v.spatialNode.addKeyframeNodeToMegatextures(v,e.megatextures),P[S]=v}}function mHe(e,t,n,i){const o=Math.min(Math.abs(t-e),Math.abs(t-n)),r=Math.max(e,i._keyframeCount-n-1,1),s=Math.pow(1-o/r,4),a=Math.exp(-i._binaryTreeKeyframeWeighting[t]);return R.lerp(a,s,.15+.85*s)}function _He(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(jn.LoadState).length,a=new Array(s),l=new Array(s);let u=0;for(let x=0;x<s;x++){const C=new Array(o);a[x]=C;for(let w=0;w<o;w++)C[w]=0;l[x]=0}function h(x){const C=x.keyframeNodes;for(let w=0;w<C.length;w++){const v=C[w],P=v.keyframe,N=v.state;a[N][P]+=1,l[N]+=1,u++}if(c(x.children))for(let w=0;w<8;w++){const v=x.children[w];h(v)}}h(r);const f=`KEYFRAMES: ${a[jn.LoadState.LOADED]}`,_=`UNLOADED: ${l[jn.LoadState.UNLOADED]} | RECEIVING: ${l[jn.LoadState.RECEIVING]} | RECEIVED: ${l[jn.LoadState.RECEIVED]} | LOADED: ${l[jn.LoadState.LOADED]} | FAILED: ${l[jn.LoadState.FAILED]} | UNAVAILABLE: ${l[jn.LoadState.UNAVAILABLE]} | TOTAL: ${u}`,g=Math.round(t*100)/100,m=Math.round(n*100)/100,b=Math.round(i*100)/100,T=`LOAD: ${g} | OCT: ${m} | ALL: ${b}`;console.log(`${f} || ${_} || ${T}`)}const TA={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function gHe(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,l=0;const u=[],h=[];function f(g,m,b,T,x){let C=!1;if(c(g.children))for(let w=0;w<8;w++){const v=g.children[w];v.computeSurroundingRenderableKeyframeNodes(o),v.isRenderable(r)&&(C=!0)}if(C){u[x]=TA.INTERNAL<<16|m,u[b]=T,a++,T=m,x=T*9+1;for(let w=0;w<8;w++){const v=g.children[w];m=a,b=m*9+0,f(v,m,b,T,x+w)}}else{if(s){const w=l*5,v=g.renderableKeyframeNodePrevious,P=g.level-v.spatialNode.level,N=v.spatialNode.parent,k=c(N)?N.renderableKeyframeNodePrevious:v,M=yHe(g,i,n),U=P,B=1,S=v.megatextureIndex,D=k.megatextureIndex;h[w+0]=M,h[w+1]=U,h[w+2]=B,h[w+3]=S,h[w+4]=D,u[x]=TA.LEAF<<16|l}else{const w=g.renderableKeyframeNodePrevious,P=g.level-w.spatialNode.level===0?TA.LEAF:TA.PACKED_LEAF_FROM_PARENT;u[x]=P<<16|w.megatextureIndex}l++}}const _=e.rootNode;_.computeSurroundingRenderableKeyframeNodes(o),_.isRenderable(r)&&f(_,0,0,0,0),bHe(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&THe(h,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function yHe(e,t,n){if(e.parent===void 0)return 0;const i=e.screenSpaceError,o=e.parent.screenSpaceError,s=((t-i)/(o-i)+n-1)/n;return R.clamp(s,0,1)}function bHe(e,t,n,i){const o=Ve.componentsLength(i.pixelFormat),r=Math.ceil(e.length/t),s=Math.max(1,t*Math.min(r,n)),a=Math.max(1,Math.ceil(r/n)),l=new Uint8Array(s*a*o);for(let f=0;f<e.length;f++){const _=e[f],g=f*o;for(let m=0;m<o;m++)l[g+m]=_>>>m*8&255}const h={source:{arrayBufferView:l,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(h)}function THe(e,t,n,i){const o=Ve.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),l=Math.max(1,Math.ceil(s/n)),u=new Uint8Array(a*l*o);for(let _=0;_<s;_++){const g=e[_*r+0],m=e[_*r+1],b=e[_*r+2],T=e[_*r+3],x=e[_*r+4],C=R.clamp(Math.floor(65536*g),0,65535);u[_*8+0]=C>>>0&255,u[_*8+1]=C>>>8&255,u[_*8+2]=m&255,u[_*8+3]=b&255,u[_*8+4]=T>>>0&255,u[_*8+5]=T>>>8&255,u[_*8+6]=x>>>0&255,u[_*8+7]=x>>>8&255}const f={source:{arrayBufferView:u,width:a,height:l},xOffset:0,yOffset:0};i.copyFrom(f)}lu.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0;const r=n.length;for(let s=0;s<r;s++){const a=n[s],l=i[s],u=bt.getComponentCount(a);o+=Ld.getApproximateTextureMemoryByteLength(e,t,u,l)}return o};const AHe={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:"mat3",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},rP=Object.freeze(AHe);function xHe(e,t,n){const i=new Uint8ClampedArray(e.buffer),o=new ImageData(i,t,n),r=document.createElement("canvas");return r.width=t,r.height=n,r.getContext("2d").putImageData(o,0,0),r}function ag(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}ag.prototype.getTexture=function(e){return this._textures[e]};function CHe(e,t,n){n.resource.fetchImage().then(function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})}).catch(function(){const i=e._textures[t];c(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}ag.prototype.loadTexture2D=function(e,t){c(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):CHe(this,e,t)};function EHe(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?px(o,r,n):wHe(o,r,n),a=e._textures[i];c(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function px(e,t,n){const{typedArray:i,sampler:o}=e,r=c(i)?Q6(e,n):new xt({context:n,source:t,sampler:o});return X6(o)&&r.generateMipmap(),r}function wHe(e,t,n){const{typedArray:i,sampler:o}=e,r=X6(o),s=o.wrapS===Fn.REPEAT||o.wrapS===Fn.MIRRORED_REPEAT||o.wrapT===Fn.REPEAT||o.wrapT===Fn.MIRRORED_REPEAT,{width:a,height:l}=c(i)?e:t,u=[a,l].every(R.isPowerOfTwo);if((r||s)&&!u)if(c(i)){if(e.pixelDatatype===Me.UNSIGNED_BYTE){const f=xHe(i,a,l),_=$I(f);return px({sampler:o},_,n)}}else{const f=$I(t);return px(e,f,n)}else return px(e,t,n);return r?console.warn("Texture requires resizing for mipmaps but pixelDataType cannot be resized. The texture may be rendered incorrectly."):s&&console.warn("Texture requires resizing for wrapping but pixelDataType cannot be resized. The texture may be rendered incorrectly."),Q6(e,n)}function X6(e){return[en.NEAREST_MIPMAP_NEAREST,en.NEAREST_MIPMAP_LINEAR,en.LINEAR_MIPMAP_NEAREST,en.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function Q6(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new xt({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}ag.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 i=0;i<n.length;i++){const o=n[i];EHe(this,o,t)}n.length=0};ag.prototype.isDestroyed=function(){return!1};ag.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 ve(this)};function pb(e){e=y(e,y.EMPTY_OBJECT),this.mode=y(e.mode,RO.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=y(e.uniforms,y.EMPTY_OBJECT),this.varyings=y(e.varyings,y.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=y(e.translucencyMode,rD.INHERIT),this._textureManager=new ag,this._defaultTexture=void 0,this.uniformMap=SHe(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},DHe(this),PHe(this)}function SHe(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===rP.SAMPLER_CUBE)throw new E("CustomShader does not support samplerCube uniforms");r===rP.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=vHe(e,i)):n[i]=IHe(e,i)}return n}function vHe(e,t){return function(){return y(e._textureManager.getTexture(t),e._defaultTexture)}}function IHe(e,t){return function(){return e.uniforms[t].value}}function Rf(e,t,n){let i;for(;(i=t.exec(e))!==null;){const o=i[1];n[o]=!0}}function DHe(e){const t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g;let o;const r=e.vertexShaderText;c(r)&&(o=e.usedVariablesVertex.attributeSet,Rf(r,t,o),o=e.usedVariablesVertex.featureIdSet,Rf(r,n,o),o=e.usedVariablesVertex.metadataSet,Rf(r,i,o));const s=e.fragmentShaderText;if(c(s)){o=e.usedVariablesFragment.attributeSet,Rf(s,t,o),o=e.usedVariablesFragment.featureIdSet,Rf(s,n,o),o=e.usedVariablesFragment.metadataSet,Rf(s,i,o);const a=/material\.(\w+)/g,l=e.usedVariablesFragment.materialSet;Rf(s,a,l)}}function Lz(e){const t=/^.*MC$/,n=/^.*WC$/,i=/^.*EC$/;return t.test(e)?`${e} (model coordinates)`:n.test(e)?`${e} (Cartesian world coordinates)`:i.test(e)?`${e} (eye coordinates)`:e}function ns(e,t,n,i){if(e.hasOwnProperty(t)){const o=`${Lz(t)} is not available in the ${i} shader. Did you mean ${Lz(n)} instead?`;throw new E(o)}}function PHe(e){const t=e.usedVariablesVertex.attributeSet;ns(t,"position","positionMC","vertex"),ns(t,"normal","normalMC","vertex"),ns(t,"tangent","tangentMC","vertex"),ns(t,"bitangent","bitangentMC","vertex"),ns(t,"positionWC","positionMC","vertex"),ns(t,"positionEC","positionMC","vertex"),ns(t,"normalEC","normalMC","vertex"),ns(t,"tangentEC","tangentMC","vertex"),ns(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;ns(n,"position","positionEC","fragment"),ns(n,"normal","normalEC","fragment"),ns(n,"tangent","tangentEC","fragment"),ns(n,"bitangent","bitangentEC","fragment"),ns(n,"normalMC","normalEC","fragment"),ns(n,"tangentMC","tangentEC","fragment"),ns(n,"bitangentMC","bitangentEC","fragment")}pb.prototype.setUniform=function(e,t){if(A.typeOf.string("uniformName",e),A.defined("value",t),!c(this.uniforms[e]))throw new E(`Uniform ${e} must be declared in the CustomShader constructor.`);const n=this.uniforms[e];n.type===rP.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):c(t.clone)?n.value=t.clone(n.value):n.value=t};pb.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};pb.prototype.isDestroyed=function(){return!1};pb.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),ve(this)};function Bc(e){e=y(e,y.EMPTY_OBJECT),this._ready=!1,this._provider=y(e.provider,Bc.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new d,this._paddingAfter=new d,this._minBounds=new d,this._minBoundsOld=new d,this._maxBounds=new d,this._maxBoundsOld=new d,this._exaggeratedMinBounds=new d,this._exaggeratedMinBoundsOld=new d,this._exaggeratedMaxBounds=new d,this._exaggeratedMaxBoundsOld=new d,this._minClippingBounds=new d,this._minClippingBoundsOld=new d,this._maxClippingBounds=new d,this._maxClippingBoundsOld=new d,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._exaggeratedModelMatrix=L.clone(this._modelMatrix),this._compoundModelMatrix=new L,this._compoundModelMatrixOld=new L,this._customShader=y(e.customShader,Bc.DefaultCustomShader),this._customShaderCompilationEvent=new Le,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new L,this._transformPositionUvToWorld=new L,this._transformDirectionWorldToLocal=new $,this._transformNormalLocalToWorld=new $,this._jitter=!1,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new la,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new H,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new H,megatextureTextures:[],megatextureSliceDimensions:new H,megatextureTileDimensions:new H,megatextureVoxelSizeUv:new H,megatextureSliceSizeUv:new H,megatextureTileSizeUv:new H,dimensions:new d,paddingBefore:new d,paddingAfter:new d,transformPositionViewToUv:new L,transformPositionUvToView:new L,transformDirectionViewToLocal:new $,transformNormalLocalToWorld:new $,cameraPositionUv:new d,ndcSpaceAxisAlignedBoundingBox:new te,clippingPlanesTexture:void 0,clippingPlanesMatrix:new L,stepSize:0,pickColor:new z},this._shapeDefinesOld={},this._uniformMap={};const t=this._uniforms,n=this._uniformMap;for(const o in t)if(t.hasOwnProperty(o)){const r=`u_${o}`;n[r]=function(){return t[o]}}const i=this._provider;OHe(this,i)}function OHe(e,t){const{shape:n,minBounds:i=ah.getMinBounds(n),maxBounds:o=ah.getMaxBounds(n)}=t;e.minBounds=i,e.maxBounds=o,e.minClippingBounds=ah.getMinBounds(n),e.maxClippingBounds=ah.getMaxBounds(n),e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e._exaggeratedModelMatrix=L.clone(e._modelMatrix,e._exaggeratedModelMatrix),K6(e,t);const r=ah.getShapeConstructor(n);e._shape=new r,e._shapeVisible=Z6(e,e._shape)}Object.defineProperties(Bc.prototype,{ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){A.typeOf.object("modelMatrix",e),this._modelMatrix=L.clone(e,this._modelMatrix)}},shape:{get:function(){return this._provider.shape}},dimensions:{get:function(){return this._provider.dimensions}},minimumValues:{get:function(){return this._provider.minimumValues}},maximumValues:{get:function(){return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){A.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){A.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){A.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){A.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){A.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){A.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){A.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=R.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){A.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){A.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){A.defined("minBounds",e),this._minBounds=d.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){A.defined("maxBounds",e),this._maxBounds=d.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){A.defined("minClippingBounds",e),this._minClippingBounds=d.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){A.defined("maxClippingBounds",e),this._maxClippingBounds=d.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){const t=this._uniformMap,i=this._customShader.uniformMap;for(const o in i)i.hasOwnProperty(o)&&delete t[o];c(e)?this._customShader=e:this._customShader=Bc.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const LHe=new d,RHe=new te,NHe=new te,MHe=new d,FHe=new d,BHe=new $,zHe=new $,UHe=new L,kHe=new L,VHe=new L,HHe=L.fromRotationTranslation($.fromUniformScale(.5,new $),new d(.5,.5,.5),new L),GHe=L.fromRotationTranslation($.fromUniformScale(2,new $),new d(-1,-1,-1),new L);Bc.prototype.update=function(e){const t=this._provider;this._customShader.update(e);const n=e.context;if(!this._ready){XHe(this,t,n),e.afterRender.push(()=>(this._ready=!0,!0));return}YHe(this,e);const i=K6(this,t),o=this._shape;if(i&&(this._shapeVisible=Z6(this,o),ZHe(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=JHe(t.timeIntervalCollection,this._clock),s=this._traversal,a=s._sampleCount;if(s.update(e,r,i,this._disableUpdate),a!==s._sampleCount&&(this._shaderDirty=!0),!s.isRenderable(s.rootNode)||(this._debugDraw&&a5e(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),e5e(this,e)&&(this._shaderDirty=!0);const u=s.leafNodeTexture,h=this._uniforms;c(u)&&(h.octreeLeafNodeTexture=s.leafNodeTexture,h.octreeLeafNodeTexelSizeUv=H.clone(s.leafNodeTexelSizeUv,h.octreeLeafNodeTexelSizeUv),h.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(L4e(this,n),this._shaderDirty=!1);const f=n.uniformState.viewProjection,_=o.orientedBoundingBox,g=i5e(_,f,NHe);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;h.ndcSpaceAxisAlignedBoundingBox=te.clone(g,h.ndcSpaceAxisAlignedBoundingBox);const b=n.uniformState.inverseView;h.transformPositionViewToUv=L.multiplyTransformation(this._transformPositionWorldToUv,b,h.transformPositionViewToUv);const T=n.uniformState.view;h.transformPositionUvToView=L.multiplyTransformation(T,this._transformPositionUvToWorld,h.transformPositionUvToView);const x=n.uniformState.inverseViewRotation;h.transformDirectionViewToLocal=$.multiply(this._transformDirectionWorldToLocal,x,h.transformDirectionViewToLocal),h.transformNormalLocalToWorld=$.clone(this._transformNormalLocalToWorld,h.transformNormalLocalToWorld);const C=e.camera.positionWC;h.cameraPositionUv=L.multiplyByPoint(this._transformPositionWorldToUv,C,h.cameraPositionUv),h.stepSize=this._stepSizeMultiplier;const w=e.passes.pick?this._drawCommandPick:e.passes.pickVoxel?this._drawCommandPickVoxel:this._drawCommand;w.boundingVolume=o.boundingSphere,e.commandList.push(w)};const jHe=new d,Wv=new d,WHe=new he,qHe=new d;function YHe(e,t){if(e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e.shape===ah.ELLIPSOID){const n=t.verticalExaggerationRelativeHeight,i=t.verticalExaggeration;e._exaggeratedMinBounds.z=(e._minBounds.z-n)*i+n,e._exaggeratedMaxBounds.z=(e._maxBounds.z-n)*i+n}else if(e.shape===ah.BOX){const n=d.fromElements(1,1,t.verticalExaggeration,jHe);e._exaggeratedModelMatrix=L.multiplyByScale(e._modelMatrix,n,e._exaggeratedModelMatrix),e._exaggeratedModelMatrix=L.multiplyByTranslation(e._exaggeratedModelMatrix,$He(e,t),e._exaggeratedModelMatrix)}}function $He(e,t){const{shapeTransform:n=L.IDENTITY,globalTransform:i=L.IDENTITY}=e._provider,o=L.getTranslation(n,Wv),r=L.multiplyByPoint(e._modelMatrix,o,Wv),s=L.multiplyByPoint(i,r,Wv),l=ae.WGS84.cartesianToCartographic(s,WHe);let u=0;c(l)&&(u=l.height);const h=oa.getHeight(u,t.verticalExaggeration,t.verticalExaggerationRelativeHeight);return d.fromElements(0,0,(h-u)/t.verticalExaggeration,qHe)}function XHe(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=z.clone(e._pickId.color,i.pickColor);const{shaderDefines:o,shaderUniforms:r}=e._shape;e._shapeDefinesOld=Je(o,!0);const s=e._uniformMap;for(const a in r)if(r.hasOwnProperty(a)){const l=`u_${a}`;c(s[l])&&$n(`VoxelPrimitive: Uniform name "${l}" is already defined`),s[l]=function(){return r[a]}}i.dimensions=d.clone(t.dimensions,i.dimensions),e._paddingBefore=d.clone(y(t.paddingBefore,d.ZERO),e._paddingBefore),i.paddingBefore=d.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=d.clone(y(t.paddingAfter,d.ZERO),e._paddingBefore),i.paddingAfter=d.clone(e._paddingAfter,i.paddingAfter),e._traversal=QHe(e,t,n),KHe(e._traversal,i)}function K6(e,t){const n=y(t.shapeTransform,L.IDENTITY),i=y(t.globalTransform,L.IDENTITY);return L.multiplyTransformation(i,e._exaggeratedModelMatrix,e._compoundModelMatrix),L.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),Nf(e,"_compoundModelMatrix","_compoundModelMatrixOld")+Nf(e,"_minBounds","_minBoundsOld")+Nf(e,"_maxBounds","_maxBoundsOld")+Nf(e,"_exaggeratedMinBounds","_exaggeratedMinBoundsOld")+Nf(e,"_exaggeratedMaxBounds","_exaggeratedMaxBoundsOld")+Nf(e,"_minClippingBounds","_minClippingBoundsOld")+Nf(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function Nf(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function Z6(e,t,n){if(!t.update(e._compoundModelMatrix,e._exaggeratedMinBounds,e._exaggeratedMaxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;const o=t.shapeTransform,r=L.inverse(o,UHe),s=L.getRotation(o,BHe),a=L.getScale(o,MHe),l=d.maximumComponent(a),u=d.divideByScalar(a,l,FHe),h=$.multiplyByScale(s,u,zHe);return e._transformPositionWorldToUv=L.multiplyTransformation(HHe,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=L.multiplyTransformation(o,GHe,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=L.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=$.inverseTranspose(h,e._transformNormalLocalToWorld),!0}function QHe(e,t,n){const i=d.clone(t.dimensions,LHe);d.add(i,e._paddingBefore,i),d.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=c(o)?lu.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=y(t.keyframeCount,1);return new lu(e,n,i,t.types,t.componentTypes,s,r)}function KHe(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=H.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;const n=e.megatextures,i=n[0],o=n.length;t.megatextureTextures=new Array(o);for(let r=0;r<o;r++)t.megatextureTextures[r]=n[r].texture;t.megatextureSliceDimensions=H.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=H.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=H.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=H.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=H.clone(i.regionSizeUv,t.megatextureTileSizeUv)}function ZHe(e,t){const n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=Je(n,!0)),i}function JHe(e,t){if(!c(e)||!c(t))return 0;let n=t.currentTime,i,o=e.indexOf(n);o>=0?i=e.get(o):(o=~o,o===e.length?(o=e.length-1,i=e.get(o),n=i.stop):(i=e.get(o),n=i.start));const r=ie.secondsDifference(i.stop,i.start),a=ie.secondsDifference(n,i.start)/r;return o+a}function e5e(e,t){const n=e.clippingPlanes;if(!c(n))return!1;n.update(t);const{clippingPlanesState:i,enabled:o}=n;if(o){const r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=L.transpose(L.multiplyTransformation(L.inverse(n.modelMatrix,r.clippingPlanesMatrix),e._transformPositionUvToWorld,r.clippingPlanesMatrix),r.clippingPlanesMatrix)}return e._clippingPlanesState===i&&e._clippingPlanesEnabled===o?!1:(e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0)}Bc.prototype.isDestroyed=function(){return!1};Bc.prototype.destroy=function(){const e=this._drawCommand;c(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());const t=this._drawCommandPick;return c(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),ve(this)};const Rz=new Array(new te(-1,-1,-1,1),new te(1,-1,-1,1),new te(-1,1,-1,1),new te(1,1,-1,1),new te(-1,-1,1,1),new te(1,-1,1,1),new te(-1,1,1,1),new te(1,1,1,1)),t5e=new Array(1,2,4,0,3,5,0,3,6,1,2,7,0,5,6,1,4,7,2,4,7,3,5,6),n5e=new Array(new te,new te,new te,new te,new te,new te,new te,new te);function i5e(e,t,n){const i=L.fromRotationTranslation(e.halfAxes,e.center,kHe),o=L.multiply(t,i,VHe);let r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,l=-Number.MAX_VALUE,u;const h=n5e,f=Rz.length;for(u=0;u<f;u++)L.multiplyByVector(o,Rz[u],h[u]);for(u=0;u<f;u++){const _=h[u];if(_.z>=-_.w){const g=_.x/_.w,m=_.y/_.w;r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,m),l=Math.max(l,m)}else for(let g=0;g<3;g++){const m=t5e[u*3+g],b=h[m];if(b.z>=-b.w){const T=_.z+_.w,x=b.z+b.w,C=T/(T-x),w=te.lerp(_,b,C,RHe),v=w.x/w.w,P=w.y/w.w;r=Math.min(r,v),s=Math.max(s,v),a=Math.min(a,P),l=Math.max(l,P)}}}return r=R.clamp(r,-1,1),a=R.clamp(a,-1,1),s=R.clamp(s,-1,1),l=R.clamp(l,-1,1),n=te.fromElements(r,a,s,l,n),n}const J1=3e7,o5e=new d(J1,0,0),r5e=new d(0,J1,0),s5e=new d(0,0,J1);function a5e(e,t){const n=e._traversal,i=e._debugPolylines;i.removeAll();function o(l,u,h,f){i.add({positions:[l,u],width:f,material:Se.fromType("Color",{color:h})})}function r(l,u,h){const f=l.computeCorners();o(f[0],f[1],u,h),o(f[2],f[3],u,h),o(f[4],f[5],u,h),o(f[6],f[7],u,h),o(f[0],f[2],u,h),o(f[4],f[6],u,h),o(f[1],f[3],u,h),o(f[5],f[7],u,h),o(f[0],f[4],u,h),o(f[2],f[6],u,h),o(f[1],f[5],u,h),o(f[3],f[7],u,h)}function s(l){if(!n.isRenderable(l))return;const u=l.level,f=Math.max(1,5/Math.pow(2,u)),g=[z.RED,z.LIME,z.BLUE][u%3];if(r(l.orientedBoundingBox,g,f),c(l.children))for(let m=0;m<8;m++)s(l.children[m])}r(e._shape.orientedBoundingBox,z.WHITE,5),s(n.rootNode);const a=10;o(d.ZERO,o5e,z.RED,a),o(d.ZERO,r5e,z.LIME,a),o(d.ZERO,s5e,z.BLUE,a),i.update(t)}Bc.DefaultCustomShader=new pb({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) { material.diffuse = vec3(1.0); material.alpha = 1.0; }`});function J6(){this.ready=!0,this.shape=ah.BOX,this.dimensions=new d(1,1,1),this.names=["data"],this.types=[bt.SCALAR],this.componentTypes=[Ot.FLOAT32],this.maximumTileCount=1}J6.prototype.requestData=function(e){if(!((c(e)?y(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};Bc.DefaultProvider=new J6;const uC=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function gn(e){e=y(e,y.EMPTY_OBJECT);const t=e.canvas;let n=e.creditContainer,i=e.creditViewport;const o=Je(e.contextOptions);if(!c(t))throw new E("options and options.canvas are required.");const r=c(n),s=new Va(t,o);r||(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)),c(i)||(i=t.parentNode),this._id=Wr(),this._jobScheduler=new Sh,this._frameState=new _Be(s,new ki(n," \u2022 ",i),this._jobScheduler),this._frameState.scene3DOnly=y(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new yC(s),this._globe=void 0,this._globeTranslucencyState=new Wp,this._primitives=new eo,this._groundPrimitives=new eo,this._globeHeight=void 0,this._globeHeightDirty=!0,this._cameraUnderground=!1,this._removeUpdateHeightCallback=void 0,this._logDepthBuffer=gn.defaultLogDepthBuffer&&s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new Wc,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=y(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new lb(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new bi({color:new z,stencil:0,owner:this}),this._depthClearCommand=new bi({depth:1,owner:this}),this._stencilClearCommand=new bi({stencil:0}),this._classificationStencilClearCommand=new bi({stencil:0,renderState:Ue.fromCache({stencilMask:At.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new Qp(this),this._preUpdate=new Le,this._postUpdate=new Le,this._renderError=new Le,this._preRender=new Le,this._postRender=new Le,this._minimumDisableDepthTestDistance=0,this._debugInspector=new V6,this._msaaSamples=y(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Le,this.morphComplete=new Le,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=z.clone(z.BLACK),this._mode=oe.SCENE3D,this._mapProjection=c(e.mapProjection)?e.mapProjection:new co,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,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.atmosphere=new OMe,this.fog=new RW,this._shadowMapCamera=new Ye(this),this.shadowMap=new Wa({context:s,lightCamera:this._shadowMapCamera,enabled:y(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=z.clone(z.WHITE),this._actualInvertClassificationColor=z.clone(this._invertClassificationColor),this._invertClassification=new kl,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new js,this._brdfLutGenerator=new ab,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new fb(this),this._cameraUnderground=!1,this._mapMode2D=y(e.mapMode2D,Wh.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=y(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=y(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=Nn.requestCompletedEvent.addEventListener(uC(this)),this._removeTaskProcessorListenerCallback=Kn.taskCompletedEvent.addEventListener(uC(this)),this._removeGlobeCallbacks=[],this._removeTerrainProviderReadyListener=void 0;const a=new Re(0,0,s.drawingBufferWidth,s.drawingBufferHeight),l=new Ye(this);this._logDepthBuffer&&(l.frustum.near=.1,l.frustum.far=1e10),this.preloadFlightCamera=new Ye(this),this.preloadFlightCullingVolume=void 0,this._picking=new Or(this),this._defaultView=new db(this,l,a),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 bC,eq(this,0,ie.now()),this.updateFrameState(),this.initializeFrame()}gn.defaultLogDepthBuffer=!0;function c5e(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;const n=[];c(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(uC(e))),n.push(t.terrainProviderChanged.addEventListener(uC(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(gn.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 pt.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return pt.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 yl.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,c5e(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(!!c(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(!!c(this.globe))return this.globe.terrainProvider},set:function(e){this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),c(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(!!c(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){if(this.scene3DOnly&&e!==oe.SCENE3D)throw new E("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===oe.SCENE2D)this.morphTo2D(0);else if(e===oe.SCENE3D)this.morphTo3D(0);else if(e===oe.COLUMBUS_VIEW)this.morphToColumbusView(0);else throw new E("value must be a valid SceneMode enumeration.");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){if(this.camera.frustum instanceof It)throw new E("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Ye(this),c(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new oE(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}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!c(e)||e<0)throw new E("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");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}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,pt.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},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}}});gn.prototype.getCompressedTextureFormatSupported=function(e){const t=this.context;return(e==="WEBGL_compressed_texture_s3tc"||e==="s3tc")&&t.s3tc||(e==="WEBGL_compressed_texture_pvrtc"||e==="pvrtc")&&t.pvrtc||(e==="WEBGL_compressed_texture_etc"||e==="etc")&&t.etc||(e==="WEBGL_compressed_texture_etc1"||e==="etc1")&&t.etc1||(e==="WEBGL_compressed_texture_astc"||e==="astc")&&t.astc||(e==="EXT_texture_compression_bptc"||e==="bc7")&&t.bc7};function Nz(e,t,n){const i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled;let l=t.derivedCommands;c(t.pickId)&&(l.picking=sd.createPickDerivedCommand(e,t,o,l.picking)),t.pickOnly||(l.depth=sd.createDepthOnlyDerivedCommand(e,t,o,l.depth)),l.originalCommand=t,e._hdr&&(l.hdr=sd.createHdrCommand(t,o,l.hdr),t=l.hdr.command,l=t.derivedCommands),a&&t.receiveShadows&&(l.shadows=Wa.createReceiveDerivedCommand(s,t,n,o,l.shadows)),t.pass===xe.TRANSLUCENT&&c(r)&&r.isSupported()&&(a&&t.receiveShadows?(l.oit=c(l.oit)?l.oit:{},l.oit.shadows=r.createDerivedCommands(l.shadows.receiveCommand,o,l.oit.shadows)):l.oit=r.createDerivedCommands(t,o,l.oit))}gn.prototype.updateDerivedCommands=function(e){if(!c(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);const r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,l=c(a.logDepth),u=c(a.hdr),h=c(a.originalCommand),f=r&&!l,_=s&&!u,g=(!r||!s)&&!h;if(e.dirty=e.dirty||f||_||g,e.dirty){e.dirty=!1;const m=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=Wa.createCastDerivedCommand(m,e,i,n,a.shadows)),(l||f)&&(a.logDepth=sd.createLogDepthCommand(e,n,a.logDepth),Nz(this,a.logDepth.command,i)),(h||g)&&Nz(this,e,i)}};const l5e=new jp({pass:wr.RENDER}),qv=new jp({pass:wr.PRELOAD}),Yv=new jp({pass:wr.PRELOAD_FLIGHT}),u5e=new jp({pass:wr.REQUEST_RENDER_MODE_DEFER_CHECK}),Mz=new se;let $v;function d5e(e){const t=e.globe;if(e._mode===oe.SCENE3D&&c(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return Mz.radius=n.minimumRadius+i,$v=ms.fromBoundingSphere(Mz,e.camera.positionWC,$v),$v}}gn.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.pickVoxel=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function eq(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=ie.clone(n,i.time)}gn.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=d5e(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof It||this.camera.frustum instanceof Ki),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState;const{globe:n}=this;c(n)&&n._terrainExaggerationChanged&&(this.verticalExaggeration=n._terrainExaggeration,this.verticalExaggerationRelativeHeight=n._terrainExaggerationRelativeHeight,n._terrainExaggerationChanged=!1),t.verticalExaggeration=this.verticalExaggeration,t.verticalExaggerationRelativeHeight=this.verticalExaggerationRelativeHeight,c(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=z.clone(this.invertClassificationColor,this._actualInvertClassificationColor),kl.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,c(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0};gn.prototype.isVisible=function(e,t,n){return c(e)&&(!c(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Bt.OUTSIDE&&(!c(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let mx=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);mx=L.inverseTransformation(mx,mx);function h5e(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;c(t._debugVolume)&&t._debugVolume.destroy();let a,l=d.clone(s.center);if(o.mode!==oe.SCENE3D){l=L.multiplyByPoint(mx,l,l);const _=o.mapProjection,g=_.unproject(l);l=_.ellipsoid.cartographicToCartesian(g)}if(c(s.radius)){const _=s.radius;a=ti.toWireframe(va.createGeometry(new va({radii:new d(_,_,_),vertexFormat:tn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Mt({geometryInstances:new Gt({geometry:a,modelMatrix:L.fromTranslation(l),attributes:{color:new $t(1,0,0,1)}}),appearance:new tn({flat:!0,translucent:!1}),asynchronous:!1})}else{const _=s.halfAxes;a=ti.toWireframe(rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:tn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Mt({geometryInstances:new Gt({geometry:a,modelMatrix:L.fromRotationTranslation(_,l,new L),attributes:{color:new $t(1,0,0,1)}}),appearance:new tn({flat:!0,translucent:!1}),asynchronous:!1})}const u=o.commandList,h=o.commandList=[];t._debugVolume.update(o),e=h[0],o.useLogDepth&&(e=sd.createLogDepthCommand(e,r).command);let f;c(i)&&(f=n.framebuffer,n.framebuffer=i),e.execute(r,n),c(f)&&(n.framebuffer=f),o.commandList=u}function Mr(e,t,n,i,o){const r=t._frameState;if(c(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof bi){e.execute(n,i);return}e.debugShowBoundingVolume&&c(e.boundingVolume)&&h5e(e,t,i,o),r.useLogDepth&&c(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.pickVoxel&&!s.depth&&t._hdr&&c(e.derivedCommands)&&c(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&c(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(n,i);return}else if(c(e.derivedCommands.depth)){e=e.derivedCommands.depth.depthOnlyCommand,e.execute(n,i);return}}if(t.debugShowCommands||t.debugShowFrustums){t._debugInspector.executeDebugShowFrustumsCommand(t,e,i);return}r.shadowState.lightShadowsEnabled&&e.receiveShadows&&c(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function cy(e,t,n,i){const o=t._frameState;let r=e.derivedCommands;!c(r)||(o.useLogDepth&&c(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,c(r.picking)?(e=r.picking.pickCommand,e.execute(n,i)):c(r.depth)&&(e=r.depth.depthOnlyCommand,e.execute(n,i)))}function tq(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function f5e(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+R.EPSILON12}function p5e(e,t,n,i,o){const r=e.context;x1(i,tq,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function m5e(e,t,n,i,o){const r=e.context;x1(i,f5e,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function _5e(e,t,n,i){const o=e.context;x1(i,tq,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}const g5e=new _n,y5e=new xs,b5e=new It,T5e=new Ki;function sP(e,t){const{camera:n,context:i,frameState:o}=e,{uniformState:r}=i;r.updateCamera(n);let s;c(n.frustum.fov)?s=n.frustum.clone(g5e):c(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(y5e):c(n.frustum.width)?s=n.frustum.clone(b5e):s=n.frustum.clone(T5e),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(xe.ENVIRONMENT);const a=o.passes,l=a.pick||a.pickVoxel,u=e._environmentState,h=e._view,f=u.renderTranslucentDepthForPick,_=u.useWebVR;if(!l){const D=u.skyBoxCommand;if(c(D)&&Mr(D,e,i,t),u.isSkyAtmosphereVisible&&Mr(u.skyAtmosphereCommand,e,i,t),u.isSunVisible&&(u.sunDrawCommand.execute(i,t),e.sunBloom&&!_)){let p;u.useGlobeDepthFramebuffer?p=h.globeDepth.framebuffer:u.usePostProcess?p=h.sceneFramebuffer.framebuffer:p=u.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,p),t.framebuffer=p}u.isMoonVisible&&u.moonCommand.execute(i,t)}let g;u.useOIT?(c(e._executeOITFunction)||(e._executeOITFunction=function(D,p,I,O,F){h.globeDepth.prepareColorTextures(i),h.oit.executeCommands(D,p,I,O,F)}),g=e._executeOITFunction):a.render?g=p5e:g=m5e;const m=h.frustumCommandsList,b=m.length,T=u.clearGlobeDepth,x=u.useDepthPlane,C=e._globeTranslucencyState,w=C.translucent,v=e._view.globeTranslucencyFramebuffer,P=e._depthClearCommand,N=e._stencilClearCommand,k=e._classificationStencilClearCommand,M=e._depthPlane,U=u.usePostProcessSelected,B=n.position.z;let S;for(let D=0;D<b;++D){const p=b-D-1,I=m[p];e.mode===oe.SCENE2D?(n.position.z=B-I.near+1,s.far=Math.max(1,I.far-I.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=p!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s)),P.execute(i,t),i.stencilBuffer&&N.execute(i,t),r.updatePass(xe.GLOBE);let O=I.commands[xe.GLOBE],F=I.indices[xe.GLOBE];if(w)C.executeGlobeCommands(I,Mr,v,e,t);else for(S=0;S<F;++S)Mr(O[S],e,i,t);const V=h.globeDepth;if(c(V)&&u.useGlobeDepthFramebuffer&&V.executeCopyDepth(i,t),!u.renderTranslucentDepthForPick)if(r.updatePass(xe.TERRAIN_CLASSIFICATION),O=I.commands[xe.TERRAIN_CLASSIFICATION],F=I.indices[xe.TERRAIN_CLASSIFICATION],w)C.executeGlobeClassificationCommands(I,Mr,v,e,t);else for(S=0;S<F;++S)Mr(O[S],e,i,t);if(T&&(P.execute(i,t),x&&M.execute(i,t)),!u.useInvertClassification||l||u.renderTranslucentDepthForPick){for(r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)Mr(O[S],e,i,t);if(F>0&&(c(V)&&u.useGlobeDepthFramebuffer&&(V.prepareColorTextures(i,T),V.executeUpdateDepth(i,t,T,V.depthStencilTexture)),!u.renderTranslucentDepthForPick))for(r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION],S=0;S<F;++S)Mr(O[S],e,i,t)}else{e._invertClassification.clear(i,t);const X=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)Mr(O[S],e,i,t);for(c(V)&&u.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),V.executeUpdateDepth(i,t,T,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],S=0;S<F;++S)Mr(O[S],e,i,t);for(t.framebuffer=X,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),F>0&&i.stencilBuffer&&k.execute(i,t),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION],S=0;S<F;++S)Mr(O[S],e,i,t)}for(F>0&&i.stencilBuffer&&N.execute(i,t),r.updatePass(xe.VOXELS),O=I.commands[xe.VOXELS],F=I.indices[xe.VOXELS],O.length=F,_5e(e,Mr,t,O),r.updatePass(xe.OPAQUE),O=I.commands[xe.OPAQUE],F=I.indices[xe.OPAQUE],S=0;S<F;++S)Mr(O[S],e,i,t);p!==0&&e.mode!==oe.SCENE2D&&(s.near=I.near,r.updateFrustum(s));let G;if(!l&&u.useInvertClassification&&o.invertClassificationColor.alpha<1&&(G=e._invertClassification),r.updatePass(xe.TRANSLUCENT),O=I.commands[xe.TRANSLUCENT],O.length=I.indices[xe.TRANSLUCENT],g(e,Mr,t,O,G),I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION]>0&&h.translucentTileClassification.isSupported()&&(h.translucentTileClassification.executeTranslucentCommands(e,Mr,t,O,V.depthStencilTexture),h.translucentTileClassification.executeClassificationCommands(e,Mr,t,I)),i.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||f)){const X=V.depthStencilTexture,q=e._picking.getPickDepth(e,p);q.update(i,X),q.executeCopyDepth(i,t)}if(l||!U)continue;const W=t.framebuffer;if(t.framebuffer=h.sceneFramebuffer.getIdFramebuffer(),s.near=p!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s),r.updatePass(xe.GLOBE),O=I.commands[xe.GLOBE],F=I.indices[xe.GLOBE],w)C.executeGlobeCommands(I,cy,v,e,t);else for(S=0;S<F;++S)cy(O[S],e,i,t);for(T&&(P.framebuffer=t.framebuffer,P.execute(i,t),P.framebuffer=void 0),T&&x&&M.execute(i,t),r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)cy(O[S],e,i,t);for(r.updatePass(xe.OPAQUE),O=I.commands[xe.OPAQUE],F=I.indices[xe.OPAQUE],S=0;S<F;++S)cy(O[S],e,i,t);for(r.updatePass(xe.TRANSLUCENT),O=I.commands[xe.TRANSLUCENT],F=I.indices[xe.TRANSLUCENT],S=0;S<F;++S)cy(O[S],e,i,t);t.framebuffer=W}}function nq(e){e.context.uniformState.updatePass(xe.COMPUTE);const n=e._environmentState.sunComputeCommand;c(n)&&n.execute(e._computeEngine);const i=e._computeCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(e._computeEngine)}function A5e(e,t){e.context.uniformState.updatePass(xe.OVERLAY);const i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function x5e(e,t,n){const i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let l=0;l<a;++l){const u=t[l];if(e.updateDerivedCommands(u),u.castShadows&&(u.pass===xe.GLOBE||u.pass===xe.CESIUM_3D_TILE||u.pass===xe.OPAQUE||u.pass===xe.TRANSLUCENT)&&e.isVisible(u,i))if(o)for(let h=0;h<s;++h)r[h].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let h=!1;for(let f=s-1;f>=0;--f){const _=r[f].cullingVolume;if(e.isVisible(u,_))r[f].commandList.push(u),h=!0;else if(h)break}}}}function iq(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const o=e.context,r=o.uniformState;for(let s=0;s<i;++s){const a=n[s];if(a.outOfView)continue;const l=a.passes,u=l.length;for(let f=0;f<u;++f)l[f].commandList.length=0;const h=e.frameState.commandList;x5e(e,h,a);for(let f=0;f<u;++f){const _=a.passes[f];r.updateCamera(_.camera),a.updatePass(o,f);const g=_.commandList.length;for(let m=0;m<g;++m){const b=_.commandList[m];r.updatePass(b.pass),Mr(b.derivedCommands.shadows.castCommands[s],e,o,_.passState)}}}}const C5e=new d;gn.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?E5e(this,e,t):i!==oe.SCENE2D||this._mapMode2D===Wh.ROTATE?nh(!0,this,e,t):(eL(this,e,t),R5e(this,e))};function E5e(e,t,n){const i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;eL(e,t,n),oq(e),i.createPotentiallyVisibleSet(e),nq(e),s||iq(e);const a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;const l=Ye.clone(o,e._cameraVR);l.frustum=o.frustum;const u=o.frustum.near,h=u*y(e.focalLength,5),f=y(e.eyeSeparation,h/30),_=d.multiplyByScalar(l.right,f*.5,C5e);o.frustum.aspectRatio=a.width/a.height;const g=.5*f*u/h;d.add(l.position,_,o.position),o.frustum.xOffset=g,sP(e,t),a.x=a.width,d.subtract(l.position,_,o.position),o.frustum.xOffset=-g,sP(e,t),Ye.clone(l,o)}const w5e=new he(Math.PI,R.PI_OVER_TWO),S5e=new d,v5e=new d,I5e=new L,D5e=new L,P5e=new d,O5e=new d,L5e=new Re;function R5e(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=Re.clone(r,L5e);t.viewport=s;const a=w5e,l=S5e;e.mapProjection.project(a,l);const h=d.clone(o.position,v5e),f=L.clone(o.transform,D5e),_=o.frustum.clone();o._setTransform(L.IDENTITY);const g=L.computeViewportTransformation(s,0,1,I5e),m=o.frustum.projectionMatrix,b=o.positionWC.y,T=d.fromElements(R.sign(b)*l.x-b,0,-o.positionWC.x,P5e),x=zt.pointToGLWindowCoordinates(m,g,T,O5e);x.x=Math.floor(x.x);const C=s.x,w=s.width;if(b===0||x.x<=C||x.x>=C+w)nh(!0,e,t);else if(Math.abs(C+w*.5-x.x)<1)s.width=x.x-s.x,o.position.x*=R.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=x.x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t);else if(x.x>C+w*.5){s.width=x.x-C;const v=o.frustum.right;o.frustum.right=l.x-b,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=x.x,s.width=C+w-x.x,o.position.x=-o.position.x,o.frustum.left=-o.frustum.right,o.frustum.right=v-o.frustum.right*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t)}else{s.x=x.x,s.width=C+w-x.x;const v=o.frustum.left;o.frustum.left=-l.x-b,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=C,s.width=x.x-C,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=v-o.frustum.left*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t)}o._setTransform(f),d.clone(h,o.position),o.frustum=_.clone(),t.viewport=r}function nh(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),oq(t),r.createPotentiallyVisibleSet(t),e&&(c(i)&&eL(t,n,i),nq(t),s||iq(t)),sP(t,n)}const Fz=new _o;gn.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.atmosphere,s=this.skyAtmosphere,a=this.globe,l=this._globeTranslucencyState;if(!i||this._mode!==oe.SCENE2D&&t.camera.frustum instanceof It||!l.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{if(c(s)){if(c(a))s.setDynamicLighting(aW.fromGlobeFlags(a)),n.isReadyForAtmosphere=n.isReadyForAtmosphere||!a.show||a._surface._tilesToRender.length>0;else{const x=r.dynamicLighting;s.setDynamicLighting(x),n.isReadyForAtmosphere=!0}n.skyAtmosphereCommand=s.update(e,a),c(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)}else n.skyAtmosphereCommand=void 0;n.skyBoxCommand=c(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const T=c(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=c(T)?T.drawCommand:void 0,n.sunComputeCommand=c(T)?T.computeCommand:void 0,n.moonCommand=c(this.moon)?this.moon.update(e):void 0}const u=n.clearGlobeDepth=c(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===oe.SCENE2D);(n.useDepthPlane=u&&this.mode===oe.SCENE3D&&l.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==oe.SCENE2D&&!o;const f=e.mode===oe.SCENE3D&&!l.sunVisibleThroughGlobe?e.occluder:void 0;let _=e.cullingVolume;const g=Fz.planes;for(let T=0;T<5;++T)g[T]=_.planes[T];_=Fz,n.isSkyAtmosphereVisible=c(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,_,f),n.isMoonVisible=this.isVisible(n.moonCommand,_,f);const m=this.specularEnvironmentMaps;let b=this._specularEnvironmentMapAtlas;c(m)&&(!c(b)||b.url!==m)?(b=b&&b.destroy(),this._specularEnvironmentMapAtlas=new yl(m)):!c(m)&&c(b)&&(b.destroy(),this._specularEnvironmentMapAtlas=void 0),c(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function N5e(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new ph({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),c(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function M5e(e){const t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&!t.passes.pickVoxel&&e.mode===oe.SCENE3D;if(o!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=o),t.shadowState.lightShadowsEnabled=!1,!!o){for(let r=0;r<i;++r)if(n[r]!==t.shadowState.shadowMaps[r]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let r=0;r<i;++r){const s=n[r];s.update(t),t.shadowState.shadowMaps.push(s),s.fromLightSource&&(t.shadowState.lightShadowMaps.push(s),t.shadowState.lightShadowsEnabled=!0),s.dirty&&(++t.shadowState.lastDirtyTime,s.dirty=!1)}}}function oq(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),N5e(e),M5e(e),e._globe&&e._globe.render(t)}function eL(e,t,n){const i=e._context,o=e._frameState,r=e._environmentState,s=e._view,a=e._frameState.passes,l=a.pick||a.pickVoxel;c(s.globeDepth)&&(s.globeDepth.picking=l);const u=r.useWebVR;r.originalFramebuffer=t.framebuffer,c(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!u?e._sunPostProcess=new Od:c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!c(e.sun)&&c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const h=e._clearColorCommand;z.clone(n,h.color),h.execute(i,t);const f=r.useGlobeDepthFramebuffer=c(s.globeDepth);f&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));const _=s.oit,g=r.useOIT=!l&&c(_)&&_.isSupported();g&&(_.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),_.clear(i,t,n),r.useOIT=_.isSupported());const m=e.postProcessStages;let b=r.usePostProcess=!l&&(e._hdr||m.length>0||m.ambientOcclusion.enabled||m.fxaa.enabled||m.bloom.enabled);if(r.usePostProcessSelected=!1,b&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),m.update(i,o.useLogDepth,e._hdr),m.clear(i),b=r.usePostProcess=m.ready,r.usePostProcessSelected=b&&m.hasSelected),r.isSunVisible&&e.sunBloom&&!u?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):f?t.framebuffer=s.globeDepth.framebuffer:b&&(t.framebuffer=s.sceneFramebuffer.framebuffer),c(t.framebuffer)&&h.execute(i,t),r.useInvertClassification=!l&&c(t.framebuffer)&&e.invertClassification){let x;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(x=s.globeDepth.framebuffer),c(x)||i.depthTexture){if(e._invertClassification.previousFramebuffer=x,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&g){const C=e._invertClassification.unclassifiedCommand,w=C.derivedCommands;w.oit=_.createDerivedCommands(C,i,w.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}gn.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;c(o)&&o.prepareColorTextures(t);const r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,l=n.originalFramebuffer,u=s?o.colorFramebufferManager:void 0,h=i.sceneFramebuffer._colorFramebuffer,f=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?h.framebuffer:l,i.oit.execute(t,e));const _=i.translucentTileClassification;if(_.hasTranslucentDepth&&_.isSupported()&&_.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=h;s&&!r&&(g=u);const m=this.postProcessStages,b=g.getColorTexture(0),T=f.getColorTexture(0),x=y(u,h).getDepthStencilTexture();m.execute(t,b,x,T),m.copy(t,l)}!r&&!a&&s&&(e.framebuffer=l,o.executeCopyColor(t,e))};function F5e(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function B5e(e){if(e.mode===oe.MORPHING)return;const n=e.camera.positionCartographic;return e.getHeight(n)}gn.prototype.getHeight=function(e,t){if(!c(e))return;const n=t===gt.CLAMP_TO_TERRAIN||t===gt.RELATIVE_TO_TERRAIN,i=t===gt.CLAMP_TO_3D_TILE||t===gt.RELATIVE_TO_3D_TILE;if(!c(e))return;let o=Number.NEGATIVE_INFINITY;if(!n){const s=this.primitives.length;for(let a=0;a<s;++a){const l=this.primitives.get(a);if(!l.isCesium3DTileset||!l.show||!l.enableCollision)continue;const u=l.getHeight(e,this);c(u)&&u>o&&(o=u)}}const r=this._globe;if(!i&&c(r)&&r.show){const s=r.getHeight(e);s>o&&(o=s)}if(o>Number.NEGATIVE_INFINITY)return o};const Xv=new he;gn.prototype.updateHeight=function(e,t,n){var g;A.typeOf.func("callback",t);const i=()=>{he.clone(e,Xv);const m=this.getHeight(e,n);c(m)&&(Xv.height=m,t(Xv))},o=n===gt.CLAMP_TO_TERRAIN||n===gt.RELATIVE_TO_TERRAIN,r=n===gt.CLAMP_TO_3D_TILE||n===gt.RELATIVE_TO_3D_TILE;let s;!r&&c(this.globe)&&(s=this.globe._surface.updateHeight(e,i));let a={};const l=(g=this.globe)==null?void 0:g.ellipsoid,u=m=>{if(o||m.isDestroyed()||!m.isCesium3DTileset)return;const b=m.updateHeight(e,i,l);a[m.id]=b};if(!o){const m=this.primitives.length;for(let b=0;b<m;++b){const T=this.primitives.get(b);u(T)}}const h=this.primitives.primitiveAdded.addEventListener(u),f=this.primitives.primitiveRemoved.addEventListener(m=>{m.isDestroyed()||!m.isCesium3DTileset||(c(a[m.id])&&a[m.id](),delete a[m.id])});return()=>{s=s&&s(),Object.values(a).forEach(m=>m()),a={},h(),f()}};function z5e(e){const t=e.camera,n=e._mode,i=e._screenSpaceCameraController,o=t.positionCartographic;if(!c(o))return!1;if(!i.onMap()&&o.height<0)return!0;if(n===oe.SCENE2D||n===oe.MORPHING)return!1;const r=e._globeHeight;return c(r)&&o.height<r}gn.prototype.initializeFrame=function(){if(this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeightDirty){c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),this._globeHeight=B5e(this),this._globeHeightDirty=!1;const e=this.camera.positionCartographic;this._removeUpdateHeightCallback=this.updateHeight(e,t=>{this.isDestroyed()||(this._globeHeight=t.height)})}this._cameraUnderground=z5e(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),c(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function U5e(e,t){if(e.debugShowFramesPerSecond){if(!c(e._performanceDisplay)){const n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);const o=new rE({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else c(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function k5e(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),c(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function V5e(e){const t=e._frameState;e.primitives.postPassesUpdate(t),Nn.update()}const H5e=new z;function G5e(e){const t=e._frameState,n=e.context,i=n.uniformState,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=l5e;let r=y(e.backgroundColor,z.BLACK);e._hdr&&(r=z.clone(r,H5e),r.red=Math.pow(r.red,e.gamma),r.green=Math.pow(r.green,e.gamma),r.blue=Math.pow(r.blue,e.gamma)),t.backgroundColor=r,t.atmosphere=e.atmosphere,e.fog.update(t),i.update(t);const s=e.shadowMap;c(s)&&s.enabled&&(!c(e.light)||e.light instanceof bC?d.negate(i.sunDirectionWC,e._shadowMapCamera.direction):d.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;const l=o.passState;l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0,l.viewport=Re.clone(a,l.viewport),c(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,r),e.resolveFramebuffers(l),l.framebuffer=void 0,A5e(e,l),c(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function Mf(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function j5e(e){return e._picking.updateMostDetailedRayPicks(e)}gn.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,c(e)||(e=ie.now());const n=this._view.checkForCameraUpdates(this);n&&(this._globeHeightDirty=!0);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===oe.MORPHING;if(!i&&c(this.maximumRenderTimeChange)&&c(this._lastRenderTime)){const o=Math.abs(ie.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=ie.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;const o=R.incrementWrap(t.frameNumber,15e6,1);eq(this,o,e),t.newFrame=!0}Mf(this,k5e),this.primitives.show&&(Mf(this,j5e),Mf(this,W5e),Mf(this,q5e),i||Mf(this,Y5e)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),Mf(this,G5e)),U5e(this,i),Mf(this,V5e),F5e(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};gn.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};gn.prototype.requestRender=function(){this._renderRequested=!0};gn.prototype.clampLineWidth=function(e){return Math.max(pt.minimumAliasedLineWidth,Math.min(e,pt.maximumAliasedLineWidth))};gn.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};gn.prototype.pickVoxel=function(e,t,n){const i=this.pick(e,t,n);if(!c(i))return;const o=i.primitive;if(!(o instanceof Bc))return;const r=this._picking.pickVoxelCoordinate(this,e,t,n),s=255*r[0]+r[1],a=o._traversal.findKeyframeNode(s);if(!c(a))return;const l=255*r[2]+r[3];return Sp.fromKeyframeNode(o,s,l,a)};gn.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};gn.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};gn.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function W5e(e){const t=e._frameState;qv.camera=t.camera,qv.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,qv)}function q5e(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;Yv.camera=e.preloadFlightCamera,Yv.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,Yv)}function Y5e(e){e.primitives.updateForPass(e._frameState,u5e)}gn.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};gn.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};gn.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};gn.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};gn.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};gn.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};gn.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};gn.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};gn.prototype.cartesianToCanvasCoordinates=function(e,t){return Ao.wgs84ToWindowCoordinates(this,e,t)};gn.prototype.completeMorph=function(){this._transitioner.completeMorph()};gn.prototype.morphTo2D=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo2D(e,t)};gn.prototype.morphToColumbusView=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphToColumbusView(e,t)};gn.prototype.morphTo3D=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo3D(e,t)};function $5e(e,t){if(e._removeTerrainProviderReadyListener=e._removeTerrainProviderReadyListener&&e._removeTerrainProviderReadyListener(),t.ready){c(e.globe)&&(e.globe.terrainProvider=t.provider);return}e.globe.terrainProvider=void 0,e._removeTerrainProviderReadyListener=t.readyEvent.addEventListener(n=>{c(e)&&c(e.globe)&&(e.globe.terrainProvider=n),e._removeTerrainProviderReadyListener()})}gn.prototype.setTerrain=function(e){return A.typeOf.object("terrain",e),$5e(this,e),e};gn.prototype.isDestroyed=function(){return!1};gn.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._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),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(),c(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,c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),ve(this)};function cg(e){e=y(e,ae.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=1.025,n=d.multiplyByScalar(e.radii,t,new d);this._scaleMatrix=L.fromScale(n),this._modelMatrix=new L,this._command=new Ze({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new d;const i=new d;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;const o=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return o._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return o._hueSaturationBrightness.x=o.hueShift,o._hueSaturationBrightness.y=o.saturationShift,o._hueSaturationBrightness.z=o.brightnessShift,o._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return o.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return o.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return o.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return o.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return o.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return o.atmosphereMieAnisotropy}}}Object.defineProperties(cg.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});cg.prototype.setDynamicLighting=function(e){this._radiiAndDynamicAtmosphereColor.z=e};const Qv=new L;cg.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==oe.SCENE3D&&n!==oe.MORPHING||!e.passes.render)return;const i=L.fromRotationTranslation(e.context.uniformState.inverseViewRotation,d.ZERO,Qv),o=L.multiplyTransformation(i,Cr.Y_UP_TO_Z_UP,Qv),r=L.multiply(this._scaleMatrix,o,Qv);L.clone(r,this._modelMatrix);const s=e.context,a=X5e(this),l=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||l||!c(t)||!t.show,h=this._command;if(!c(h.vertexArray)){const _=va.createGeometry(new va({radii:new d(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ee.POSITION_ONLY}));h.vertexArray=Ci.fromGeometry({context:s,geometry:_,attributeLocations:ti.createAttributeLocations(_),bufferUsage:ke.STATIC_DRAW}),h.renderState=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},blending:Zn.ALPHA_BLEND,depthMask:!1})}const f=a|u<<2|l<<3;if(f!==this._flags){this._flags=f;const _=[];a&&_.push("COLOR_CORRECT"),u&&_.push("PER_FRAGMENT_ATMOSPHERE"),l&&_.push("GLOBE_TRANSLUCENT");const g=new Oe({defines:_,sources:[tC,PB,z1e]}),m=new Oe({defines:_,sources:[tC,PB,B1e]});this._spSkyAtmosphere=Jt.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:m}),h.shaderProgram=this._spSkyAtmosphere}return h};function X5e(e){return!(R.equalsEpsilon(e.hueShift,0,R.EPSILON7)&&R.equalsEpsilon(e.saturationShift,0,R.EPSILON7)&&R.equalsEpsilon(e.brightnessShift,0,R.EPSILON7))}cg.prototype.isDestroyed=function(){return!1};cg.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),ve(this)};function pE(e){this.sources=e.sources,this._sources=void 0,this.show=y(e.show,!0),this._command=new Ze({modelMatrix:L.clone(L.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}pE.prototype.update=function(e,t){const n=this;if(!this.show||e.mode!==oe.SCENE3D&&e.mode!==oe.MORPHING||!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const r=this.sources;if(!c(r.positiveX)||!c(r.negativeX)||!c(r.positiveY)||!c(r.negativeY)||!c(r.positiveZ)||!c(r.negativeZ))throw new E("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof r.positiveX!=typeof r.negativeX||typeof r.positiveX!=typeof r.positiveY||typeof r.positiveX!=typeof r.negativeY||typeof r.positiveX!=typeof r.positiveZ||typeof r.positiveX!=typeof r.negativeZ)throw new E("this.sources properties must all be the same type.");typeof r.positiveX=="string"?aee(i,this._sources).then(function(s){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=s}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Sl({context:i,source:r}))}const o=this._command;if(!c(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const r=rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ee.POSITION_ONLY})),s=this._attributeLocations=ti.createAttributeLocations(r);o.vertexArray=Ci.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:ke.STATIC_DRAW}),o.renderState=Ue.fromCache({blending:Zn.ALPHA_BLEND})}if(!c(o.shaderProgram)||this._useHdr!==t){const r=new Oe({defines:[t?"HDR":""],sources:[U1e]});o.shaderProgram=Jt.fromCache({context:i,vertexShaderSource:k1e,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(!!c(this._cubeMap))return o};pE.prototype.isDestroyed=function(){return!1};pE.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(),ve(this)};function mb(){this.show=!0,this._drawCommand=new Ze({primitiveType:ze.TRIANGLES,boundingVolume:new se,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new se,this._boundingVolume2D=new se,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(mb.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const Q5e=new H,K5e=new H,Z5e=new te,ly=new te;mb.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===oe.SCENE2D||i===oe.MORPHING||!e.passes.render)return;const o=e.context,r=t.viewport.width,s=t.viewport.height;if(!c(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let v=Math.max(r,s);v=Math.pow(2,Math.ceil(Math.log(v)/Math.log(2))-2),v=Math.max(1,v);const P=n?o.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._texture=new xt({context:o,width:v,height:v,pixelFormat:Ve.RGBA,pixelDatatype:P}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const N=this,k={u_radiusTS:function(){return N._radiusTS}};this._commands.computeCommand=new A_({fragmentShaderSource:H1e,outputTexture:this._texture,uniformMap:k,persists:!1,owner:this,postExecute:function(){N._commands.computeCommand=void 0}})}const a=this._drawCommand;if(!c(a.vertexArray)){const v={direction:0},P=new Uint8Array(4*2);P[0]=0,P[1]=0,P[2]=255,P[3]=0,P[4]=255,P[5]=255,P[6]=0,P[7]=255;const N=ct.createVertexBuffer({context:o,typedArray:P,usage:ke.STATIC_DRAW}),k=[{index:v.direction,vertexBuffer:N,componentsPerAttribute:2,normalize:!0,componentDatatype:Z.UNSIGNED_BYTE}],M=ct.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});a.vertexArray=new Ci({context:o,attributes:k,indexBuffer:M}),a.shaderProgram=Jt.fromCache({context:o,vertexShaderSource:G1e,fragmentShaderSource:V1e,attributeLocations:v}),a.renderState=Ue.fromCache({blending:Zn.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const l=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,h=this._boundingVolume,f=this._boundingVolume2D;d.clone(l,h.center),f.center.x=u.z,f.center.y=u.x,f.center.z=u.y,h.radius=R.SOLAR_RADIUS+R.SOLAR_RADIUS*this._glowLengthTS,f.radius=h.radius,i===oe.SCENE3D?se.clone(h,a.boundingVolume):i===oe.COLUMBUS_VIEW&&se.clone(f,a.boundingVolume);const _=Ao.computeActualWgs84Position(e,l,ly),g=d.magnitude(d.subtract(_,e.camera.position,ly)),m=o.uniformState.projection,b=Z5e;b.x=0,b.y=0,b.z=-g,b.w=1;const T=L.multiplyByVector(m,b,ly),x=Ao.clipToGLWindowCoordinates(t.viewport,T,Q5e);b.x=R.SOLAR_RADIUS;const C=L.multiplyByVector(m,b,ly),w=Ao.clipToGLWindowCoordinates(t.viewport,C,K5e);return this._size=H.magnitude(H.subtract(w,x,ly)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};mb.prototype.isDestroyed=function(){return!1};mb.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(),ve(this)};function Lm(e){return Zt(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function J5e(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const o=e._targetFrameRate;if(!c(o))e.resize(),e.render(),requestAnimationFrame(n);else{const r=1e3/o,s=i-t;s>r&&(e.resize(),e.render(),t=i-s%r),requestAnimationFrame(n)}}catch(o){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){const r="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(r,void 0,o)}}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function rq(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,c(e._scene)&&(e._scene.pixelRatio=t),t}function sq(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=rq(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=o,i*=o,t.width=n,t.height=i,e._canRender=n!==0&&i!==0,e._lastDevicePixelRatio=window.devicePixelRatio}function aq(e){const t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){const o=e._scene.camera.frustum;c(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function Kp(e,t){if(!c(e))throw new E("container is required.");e=Do(e),t=y(t,y.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),o=Yt.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=Yt.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}y(t.blurActiveElementOnCanvasFocus,!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);const a=document.createElement("div");a.className="cesium-widget-credits";const l=c(t.creditContainer)?Do(t.creditContainer):n;l.appendChild(a);const u=c(t.creditViewport)?Do(t.creditViewport):n,h=y(t.showRenderLoopErrors,!0),f=y(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=u,this._creditContainer=l,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=h,this._resolutionScale=1,this._useBrowserRecommendedResolution=f,this._forceResize=!1,this._clock=c(t.clock)?t.clock:new tb,sq(this);try{const _=new gn({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:u,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:y(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=_,_.camera.constrainedAxis=d.UNIT_Z,rq(this),aq(this);const g=y(_.mapProjection.ellipsoid,ae.WGS84);let m=t.globe;c(m)||(m=new Ul(g)),m!==!1&&(_.globe=m,_.globe.shadows=y(t.terrainShadows,Vi.RECEIVE_ONLY));let b=t.skyBox;c(b)||(b=new pE({sources:{positiveX:Lm("px"),negativeX:Lm("mx"),positiveY:Lm("py"),negativeY:Lm("my"),positiveZ:Lm("pz"),negativeZ:Lm("mz")}})),b!==!1&&(_.skyBox=b,_.sun=new mb,_.moon=new sb);let T=t.skyAtmosphere;c(T)||(T=new cg(g),T.show=t.globe!==!1&&m.show),T!==!1&&(_.skyAtmosphere=T);let x=t.baseLayer;if(t.globe!==!1&&x!==!1&&(c(x)||(x=Qt.fromWorldImagery()),_.imageryLayers.add(x)),c(t.terrainProvider)&&t.globe!==!1&&(_.terrainProvider=t.terrainProvider),c(t.terrain)&&t.globe!==!1){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");_.setTerrain(t.terrain)}this._screenSpaceEventHandler=new da(i),c(t.sceneMode)&&(t.sceneMode===oe.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===oe.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=y(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const C=this;this._onRenderError=function(w,v){if(C._useDefaultRenderLoop=!1,C._renderLoopRunning=!1,C._showRenderLoopErrors){const P="An error occurred while rendering. Rendering has stopped.";C.showErrorPanel(P,void 0,v)}},_.renderError.addEventListener(this._onRenderError)}catch(_){if(h){const g="Error constructing CesiumWidget.",m='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(g,m,_)}throw _}}Object.defineProperties(Kp.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}},creditDisplay:{get:function(){return this._scene.frameState.creditDisplay}},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){if(e<=0)throw new E("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&J5e(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new E("resolutionScale must be greater than 0.");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)}}});Kp.prototype.showErrorPanel=function(e,t,n){const i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";const r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);const s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);const a=document.createElement("div");a.className="cesium-widget-errorPanel-scroll",r.appendChild(a);function l(){a.style.maxHeight=`${Math.max(Math.round(i.clientHeight*.9-100),30)}px`}l(),c(window.addEventListener)&&window.addEventListener("resize",l,!1);const u=c(t),h=c(n);if(u||h){const g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),h){let m=DD(n);u||(typeof n=="string"&&(n=new Error(n)),t=DD({name:n.name,message:n.message}),m=n.stack),typeof console<"u"&&console.error(`${e} ${t} ${m}`);const b=document.createElement("div");b.className="cesium-widget-errorPanel-message-details collapsed";const T=document.createElement("span");T.className="cesium-widget-errorPanel-more-details",T.appendChild(document.createTextNode("See more...")),b.appendChild(T),b.onclick=function(x){b.removeChild(T),b.appendChild(document.createTextNode(m)),b.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",b.onclick=void 0},a.appendChild(b)}g.innerHTML=`<p>${t}</p>`}const f=document.createElement("div");f.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(f);const _=document.createElement("button");_.setAttribute("type","button"),_.className="cesium-button",_.appendChild(document.createTextNode("OK")),_.onclick=function(){c(l)&&c(window.removeEventListener)&&window.removeEventListener("resize",l,!1),i.removeChild(o)},f.appendChild(_),i.appendChild(o)};Kp.prototype.isDestroyed=function(){return!1};Kp.prototype.destroy=function(){c(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),ve(this)};Kp.prototype.resize=function(){const e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,sq(this),aq(this),this._scene.requestRender())};Kp.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};function ad(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}const zf=new ce;function e8e(e,t,n,i){const o=i.length;for(let r=0;r<o;++r){const s=i[r];if(s.x===t&&s.y===n&&s.level===e)return!0}return!1}ad.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let _=n;_<=o;++_)for(let g=t;g<=i;++g)e8e(e,g,_,s)||s.push(new Hm(r,void 0,0,g,_));r.tileXYToRectangle(t,n,e,zf);const a=zf.west,l=zf.north;r.tileXYToRectangle(i,o,e,zf);const u=zf.east,h=zf.south,f=new r8e(e,a,h,u,l);for(let _=0;_<s.length;++_){const g=s[_];tL(g.extent,f)&&s8e(this._maximumLevel,g,f)}};ad.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(Gm(i.extent,e)){t=i;break}}return c(t)?Cy(void 0,t,e):-1};const t8e=[],n8e=[],i8e=new ce,o8e=new ce;ad.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=t8e;t.length=0,e.east<e.west?(t.push(ce.fromRadians(-Math.PI,e.south,e.east,e.north,i8e)),t.push(ce.fromRadians(e.west,e.south,Math.PI,e.north,o8e))):t.push(e);const n=n8e;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)Ey(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(c(n[i])&&n[i].length===0)return i;return 0};const Bz=new he;ad.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,zf);return ce.center(i,Bz),this.computeMaximumLevelAtPosition(Bz)>=e};ad.prototype.computeChildMaskForTile=function(e,t,n){const i=e+1;if(i>=this._maximumLevel)return 0;let o=0;return o|=this.isTileAvailable(i,2*t,2*n+1)?1:0,o|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,o|=this.isTileAvailable(i,2*t,2*n)?4:0,o|=this.isTileAvailable(i,2*t+1,2*n)?8:0,o};function Hm(e,t,n,i,o){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=o,this.extent=e.tileXYToRectangle(i,o,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}Object.defineProperties(Hm.prototype,{nw:{get:function(){return this._nw||(this._nw=new Hm(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new Hm(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new Hm(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new Hm(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function r8e(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function tL(e,t){const n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east),r=Math.min(e.north,t.north);return i<r&&n<o}function s8e(e,t,n){for(;t.level<e;)if(AA(t.nw.extent,n))t=t.nw;else if(AA(t.ne.extent,n))t=t.ne;else if(AA(t.sw.extent,n))t=t.sw;else if(AA(t.se.extent,n))t=t.se;else break;if(t.rectangles.length===0||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let i=Hr(t.rectangles,n.level,a8e);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function a8e(e,t){return e.level-t}function AA(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Gm(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function Cy(e,t,n){let i=0,o=!1;for(;!o;){const r=t._nw&&Gm(t._nw.extent,n),s=t._ne&&Gm(t._ne.extent,n),a=t._sw&&Gm(t._sw.extent,n),l=t._se&&Gm(t._se.extent,n);if(r+s+a+l>1){r&&(i=Math.max(i,Cy(t,t._nw,n))),s&&(i=Math.max(i,Cy(t,t._ne,n))),a&&(i=Math.max(i,Cy(t,t._sw,n))),l&&(i=Math.max(i,Cy(t,t._se,n)));break}else r?t=t._nw:s?t=t._ne:a?t=t._sw:l?t=t._se:o=!0}for(;t!==e;){const r=t.rectangles;for(let s=r.length-1;s>=0&&r[s].level>i;--s){const a=r[s];Gm(a,n)&&(i=a.level)}t=t.parent}return i}function Ey(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||tL(t.extent,n[i]);if(!o)return;const r=t.rectangles;for(i=0;i<r.length;++i){const s=r[i];e[s.level]||(e[s.level]=n),e[s.level]=c8e(e[s.level],s)}Ey(e,t._nw,n),Ey(e,t._ne,n),Ey(e,t._sw,n),Ey(e,t._se,n)}function c8e(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];tL(o,t)?(o.west<t.west&&n.push(new ce(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new ce(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new ce(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new ce(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}const mE={};mE.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){if(!c(e))throw new E("threshold is required.");if(!c(t))throw new E("keepAbove is required.");if(!c(n))throw new E("u0 is required.");if(!c(i))throw new E("u1 is required.");if(!c(o))throw new E("u2 is required.");c(r)?r.length=0:r=[];let s,a,l;t?(s=n<e,a=i<e,l=o<e):(s=n>e,a=i>e,l=o>e);const u=s+a+l;let h,f,_,g,m,b;return u===1?s?(h=(e-n)/(i-n),f=(e-n)/(o-n),r.push(1),r.push(2),f!==1&&(r.push(-1),r.push(0),r.push(2),r.push(f)),h!==1&&(r.push(-1),r.push(0),r.push(1),r.push(h))):a?(_=(e-i)/(o-i),g=(e-i)/(n-i),r.push(2),r.push(0),g!==1&&(r.push(-1),r.push(1),r.push(0),r.push(g)),_!==1&&(r.push(-1),r.push(1),r.push(2),r.push(_))):l&&(m=(e-o)/(n-o),b=(e-o)/(i-o),r.push(0),r.push(1),b!==1&&(r.push(-1),r.push(2),r.push(1),r.push(b)),m!==1&&(r.push(-1),r.push(2),r.push(0),r.push(m))):u===2?!s&&n!==e?(g=(e-i)/(n-i),m=(e-o)/(n-o),r.push(0),r.push(-1),r.push(1),r.push(0),r.push(g),r.push(-1),r.push(2),r.push(0),r.push(m)):!a&&i!==e?(b=(e-o)/(i-o),h=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(b),r.push(-1),r.push(0),r.push(1),r.push(h)):!l&&o!==e&&(f=(e-n)/(o-n),_=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(f),r.push(-1),r.push(1),r.push(2),r.push(_)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};mE.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,l){if(!c(e))throw new E("x is required.");if(!c(t))throw new E("y is required.");if(!c(n))throw new E("x1 is required.");if(!c(i))throw new E("y1 is required.");if(!c(o))throw new E("x2 is required.");if(!c(r))throw new E("y2 is required.");if(!c(s))throw new E("x3 is required.");if(!c(a))throw new E("y3 is required.");const u=n-s,h=s-o,f=r-a,_=i-a,g=1/(f*u+h*_),m=t-a,b=e-s,T=(f*b+h*m)*g,x=(-_*b+u*m)*g,C=1-T-x;return c(l)?(l.x=T,l.y=x,l.z=C,l):new d(T,x,C)};mE.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,l){A.typeOf.number("x00",e),A.typeOf.number("y00",t),A.typeOf.number("x01",n),A.typeOf.number("y01",i),A.typeOf.number("x10",o),A.typeOf.number("y10",r),A.typeOf.number("x11",s),A.typeOf.number("y11",a);const u=(s-o)*(t-r)-(a-r)*(e-o),h=(n-e)*(t-r)-(i-t)*(e-o),f=(a-r)*(n-e)-(s-o)*(i-t);if(f===0)return;const _=u/f,g=h/f;if(_>=0&&_<=1&&g>=0&&g<=1)return c(l)||(l=new H),l.x=e+_*(n-e),l.y=t+_*(i-t),l};const cq=mE;function Yh(e){if(!c(e)||!c(e.quantizedVertices))throw new E("options.quantizedVertices is required.");if(!c(e.indices))throw new E("options.indices is required.");if(!c(e.minimumHeight))throw new E("options.minimumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.boundingSphere))throw new E("options.boundingSphere is required.");if(!c(e.horizonOcclusionPoint))throw new E("options.horizonOcclusionPoint is required.");if(!c(e.westIndices))throw new E("options.westIndices is required.");if(!c(e.southIndices))throw new E("options.southIndices is required.");if(!c(e.eastIndices))throw new E("options.eastIndices is required.");if(!c(e.northIndices))throw new E("options.northIndices is required.");if(!c(e.westSkirtHeight))throw new E("options.westSkirtHeight is required.");if(!c(e.southSkirtHeight))throw new E("options.southSkirtHeight is required.");if(!c(e.eastSkirtHeight))throw new E("options.eastSkirtHeight is required.");if(!c(e.northSkirtHeight))throw new E("options.northSkirtHeight is required.");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);this._heightValues=this._quantizedVertices.subarray(2*t,3*t);function o(s,a){return i[s]-i[a]}function r(s,a){return n[s]-n[a]}this._westIndices=CA(e.westIndices,o,t),this._southIndices=CA(e.southIndices,r,t),this._eastIndices=CA(e.eastIndices,o,t),this._northIndices=CA(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=y(e.childTileMask,15),this._createdByUpsampling=y(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(Yh.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return c(this._mesh)}}});const xA=[];function CA(e,t,n){xA.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)xA[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(xA.sort(t),je.createTypedArray(n,xA)):e}const lq="createVerticesFromQuantizedTerrainMesh",l8e=new Kn(lq),u8e=new Kn(lq,xu.maximumAsynchronousTasks);Yh.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.tilingScheme",e.tilingScheme),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),A.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),l=t.ellipsoid,u=t.tileXYToRectangle(n,i,o),f=(a?u8e:l8e).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:u,relativeToCenter:this._boundingSphere.center,ellipsoid:l,exaggeration:r,exaggerationRelativeHeight:s});if(!c(f))return;const _=this;return Promise.resolve(f).then(function(g){const m=_._quantizedVertices.length/3,b=m+_._westIndices.length+_._southIndices.length+_._eastIndices.length+_._northIndices.length,T=je.createTypedArray(b,g.indices),x=new Float32Array(g.vertices),C=g.center,w=g.minimumHeight,v=g.maximumHeight,P=_._boundingSphere,N=_._orientedBoundingBox,k=y(d.clone(g.occludeePointInScaledSpace),_._horizonOcclusionPoint),M=g.vertexStride,U=Oo.clone(g.encoding);return _._mesh=new YC(C,x,T,g.indexCountWithoutSkirts,m,w,v,P,k,M,N,U,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),_._quantizedVertices=void 0,_._encodedNormals=void 0,_._indices=void 0,_._uValues=void 0,_._vValues=void 0,_._heightValues=void 0,_._westIndices=void 0,_._southIndices=void 0,_._eastIndices=void 0,_._northIndices=void 0,_._mesh})};const d8e=new Kn("upsampleQuantizedTerrainMesh",xu.maximumAsynchronousTasks);Yh.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");const l=this._mesh;if(!c(this._mesh))return;const u=t*2!==o,h=n*2===r,f=e.ellipsoid,_=e.tileXYToRectangle(o,r,s),g=d8e.scheduleTask({vertices:l.vertices,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,indices:l.indices,indexCountWithoutSkirts:l.indexCountWithoutSkirts,encoding:l.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:h,childRectangle:_,ellipsoid:f});if(!c(g))return;let m=Math.min(this._westSkirtHeight,this._eastSkirtHeight);m=Math.min(m,this._southSkirtHeight),m=Math.min(m,this._northSkirtHeight);const b=u?m*.5:this._westSkirtHeight,T=h?m*.5:this._southSkirtHeight,x=u?this._eastSkirtHeight:m*.5,C=h?this._northSkirtHeight:m*.5,w=this._credits;return Promise.resolve(g).then(function(v){const P=new Uint16Array(v.vertices),N=je.createTypedArray(P.length/3,v.indices);let k;return c(v.encodedNormals)&&(k=new Uint8Array(v.encodedNormals)),new Yh({quantizedVertices:P,indices:N,encodedNormals:k,minimumHeight:v.minimumHeight,maximumHeight:v.maximumHeight,boundingSphere:se.clone(v.boundingSphere),orientedBoundingBox:Ct.clone(v.orientedBoundingBox),horizonOcclusionPoint:d.clone(v.horizonOcclusionPoint),westIndices:v.westIndices,southIndices:v.southIndices,eastIndices:v.eastIndices,northIndices:v.northIndices,westSkirtHeight:b,southSkirtHeight:T,eastSkirtHeight:x,northSkirtHeight:C,childTileMask:0,credits:w,createdByUpsampling:!0})})};const aP=32767,uq=new d;Yh.prototype.interpolateHeight=function(e,t,n){let i=R.clamp((t-e.west)/e.width,0,1);i*=aP;let o=R.clamp((n-e.south)/e.height,0,1);return o*=aP,c(this._mesh)?m8e(this,i,o):_8e(this,i,o)};function dq(e,t,n,i,o,r,s,a){const l=Math.min(n,o,s),u=Math.max(n,o,s),h=Math.min(i,r,a),f=Math.max(i,r,a);return e>=l&&e<=u&&t>=h&&t<=f}const h8e=new H,f8e=new H,p8e=new H;function m8e(e,t,n){const i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,l=s.length;a<l;a+=3){const u=s[a],h=s[a+1],f=s[a+2],_=r.decodeTextureCoordinates(o,u,h8e),g=r.decodeTextureCoordinates(o,h,f8e),m=r.decodeTextureCoordinates(o,f,p8e);if(dq(t,n,_.x,_.y,g.x,g.y,m.x,m.y)){const b=cq.computeBarycentricCoordinates(t,n,_.x,_.y,g.x,g.y,m.x,m.y,uq);if(b.x>=-1e-15&&b.y>=-1e-15&&b.z>=-1e-15){const T=r.decodeHeight(o,u),x=r.decodeHeight(o,h),C=r.decodeHeight(o,f);return b.x*T+b.y*x+b.z*C}}}}function _8e(e,t,n){const i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,l=s.length;a<l;a+=3){const u=s[a],h=s[a+1],f=s[a+2],_=i[u],g=i[h],m=i[f],b=o[u],T=o[h],x=o[f];if(dq(t,n,_,b,g,T,m,x)){const C=cq.computeBarycentricCoordinates(t,n,_,b,g,T,m,x,uq);if(C.x>=-1e-15&&C.y>=-1e-15&&C.z>=-1e-15){const w=C.x*r[u]+C.y*r[h]+C.z*r[f];return R.lerp(e._minimumHeight,e._maximumHeight,w/aP)}}}}Yh.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Yh.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function g8e(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 hq(e){this.requestVertexNormals=y(e.requestVertexNormals,!1),this.requestWaterMask=y(e.requestWaterMask,!1),this.requestMetadata=y(e.requestMetadata,!0),this.ellipsoid=e.ellipsoid,this.heightmapWidth=65,this.heightmapStructure=void 0,this.hasWaterMask=!1,this.hasMetadata=!1,this.hasVertexNormals=!1,this.scheme=void 0,this.lastResource=void 0,this.layerJsonResource=void 0,this.previousError=void 0,this.availability=void 0,this.tilingScheme=void 0,this.levelZeroMaximumGeometricError=void 0,this.heightmapStructure=void 0,this.layers=[],this.attribution="",this.overallAvailability=[],this.overallMaxZoom=0,this.tileCredits=[]}hq.prototype.build=function(e){e._heightmapWidth=this.heightmapWidth,e._scheme=this.scheme;const t=c(this.lastResource.credits)?this.lastResource.credits:[];e._tileCredits=t.concat(this.tileCredits),e._availability=this.availability,e._tilingScheme=this.tilingScheme,e._requestWaterMask=this.requestWaterMask,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._heightmapStructure=this.heightmapStructure,e._layers=this.layers,e._hasWaterMask=this.hasWaterMask,e._hasVertexNormals=this.hasVertexNormals,e._hasMetadata=this.hasMetadata};async function fq(e,t,n){if(!t.format){const b="The tile format is not specified in the layer.json file.";throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}if(!t.tiles||t.tiles.length===0){const b="The layer.json file does not specify any tile URL templates.";throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}let i=!1,o=!1,r=!1,s=!0,a=!1;if(t.format==="heightmap-1.0")a=!0,c(e.heightmapStructure)||(e.heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),o=!0,e.requestWaterMask=!0;else if(t.format.indexOf("quantized-mesh-1.")!==0){const b=`The tile format "${t.format}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}const l=t.tiles,u=t.maxzoom;if(e.overallMaxZoom=Math.max(e.overallMaxZoom,u),!t.projection||t.projection==="EPSG:4326")e.tilingScheme=new Yr({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else if(t.projection==="EPSG:3857")e.tilingScheme=new ws({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else{const b=`The projection "${t.projection}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}if(e.levelZeroMaximumGeometricError=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.tilingScheme.ellipsoid,e.heightmapWidth,e.tilingScheme.getNumberOfXTilesAtLevel(0)),!t.scheme||t.scheme==="tms"||t.scheme==="slippyMap")e.scheme=t.scheme;else{const b=`The scheme "${t.scheme}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}let h;c(t.extensions)&&t.extensions.indexOf("octvertexnormals")!==-1?i=!0:c(t.extensions)&&t.extensions.indexOf("vertexnormals")!==-1&&(i=!0,s=!1),c(t.extensions)&&t.extensions.indexOf("watermask")!==-1&&(o=!0),c(t.extensions)&&t.extensions.indexOf("metadata")!==-1&&(r=!0);const f=t.metadataAvailability,_=t.available;let g;if(c(_)&&!c(f)){g=new ad(e.tilingScheme,_.length);for(let b=0;b<_.length;++b){const T=_[b],x=e.tilingScheme.getNumberOfYTilesAtLevel(b);c(e.overallAvailability[b])||(e.overallAvailability[b]=[]);for(let C=0;C<T.length;++C){const w=T[C],v=x-w.endY-1,P=x-w.startY-1;e.overallAvailability[b].push([w.startX,v,w.endX,P]),g.addAvailableTileRange(b,w.startX,v,w.endX,P)}}}else c(f)&&(h=new ad(e.tilingScheme,u),g=new ad(e.tilingScheme,u),e.overallAvailability[0]=[[0,0,1,0]],g.addAvailableTileRange(0,0,0,1,0));e.hasWaterMask=e.hasWaterMask||o,e.hasVertexNormals=e.hasVertexNormals||i,e.hasMetadata=e.hasMetadata||r,c(t.attribution)&&(e.attribution.length>0&&(e.attribution+=" "),e.attribution+=t.attribution),e.layers.push(new g8e({resource:e.lastResource,version:t.version,isHeightmap:a,tileUrlTemplates:l,availability:g,hasVertexNormals:i,hasWaterMask:o,hasMetadata:r,availabilityLevels:f,availabilityTilesLoaded:h,littleEndianExtensionSize:s}));const m=t.parentUrl;return c(m)?c(g)?(e.lastResource=e.lastResource.getDerivedResource({url:m}),e.lastResource.appendForwardSlash(),e.layerJsonResource=e.lastResource.getDerivedResource({url:"layer.json"}),await nL(e),!0):(console.log("A layer.json can't have a parentUrl if it does't have an available array."),!0):!0}function y8e(e,t,n){let i=`An error occurred while accessing ${e.layerJsonResource.url}.`;if(c(t)&&(i+=` ${t.message}`),e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,i),e.previousError.retry)return nL(e,n);throw new Te(i)}async function b8e(e,t,n){await fq(e,t,n);const i=e.overallAvailability.length;if(i>0){const o=e.availability=new ad(e.tilingScheme,e.overallMaxZoom);for(let r=0;r<i;++r){const s=e.overallAvailability[r];for(let a=0;a<s.length;++a){const l=s[a];o.addAvailableTileRange(r,l[0],l[1],l[2],l[3])}}}if(e.attribution.length>0){const o=new Wt(e.attribution);e.tileCredits.push(o)}return!0}async function nL(e,t){try{const n=await e.layerJsonResource.fetchJson();return b8e(e,n,t)}catch(n){return c(n)&&n.statusCode===404?(await fq(e,{tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]},t),!0):y8e(e,n,t)}}function zc(e){e=y(e,y.EMPTY_OBJECT),this._heightmapWidth=void 0,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._hasMetadata=!1,this._scheme=void 0,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=y(e.requestVertexNormals,!1),this._requestWaterMask=y(e.requestWaterMask,!1),this._requestMetadata=y(e.requestMetadata,!0),this._errorEvent=new Le;let t=e.credit;typeof t=="string"&&(t=new Wt(t)),this._credit=t,this._availability=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._layers=void 0,this._tileCredits=void 0}const Kv={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function zz(e){return!c(e)||e.length===0?{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function T8e(e,t,n,i,o){const r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new Cl({buffer:r,childTileMask:new Uint8Array(t,r.byteLength,1)[0],waterMask:new Uint8Array(t,r.byteLength+1,t.byteLength-r.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function A8e(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const l=3,u=l+1,h=Float64Array.BYTES_PER_ELEMENT*l,f=Float64Array.BYTES_PER_ELEMENT*u,_=3,g=Uint16Array.BYTES_PER_ELEMENT*_,m=3;let b=Uint16Array.BYTES_PER_ELEMENT,T=b*m;const x=new DataView(t),C=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=h;const w=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const v=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const P=new se(new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0)),x.getFloat64(a+h,!0));a+=f;const N=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=h;const k=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const M=new Uint16Array(t,a,k*3);a+=k*g,k>64*1024&&(b=Uint32Array.BYTES_PER_ELEMENT,T=b*m);const U=M.subarray(0,k),B=M.subarray(k,2*k),S=M.subarray(k*2,3*k);En.zigZagDeltaDecode(U,B,S),a%b!==0&&(a+=b-a%b);const D=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const p=je.createTypedArrayFromArrayBuffer(k,t,a,D*m);a+=D*T;let I=0;const O=p.length;for(let re=0;re<O;++re){const de=p[re];p[re]=I-de,de===0&&++I}const F=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const V=je.createTypedArrayFromArrayBuffer(k,t,a,F);a+=F*b;const G=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const j=je.createTypedArrayFromArrayBuffer(k,t,a,G);a+=G*b;const W=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const X=je.createTypedArrayFromArrayBuffer(k,t,a,W);a+=W*b;const q=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const ee=je.createTypedArrayFromArrayBuffer(k,t,a,q);a+=q*b;let Y,ne;for(;a<x.byteLength;){const re=x.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const de=x.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,re===Kv.OCT_VERTEX_NORMALS&&e._requestVertexNormals)Y=new Uint8Array(t,a,k*2);else if(re===Kv.WATER_MASK&&e._requestWaterMask)ne=new Uint8Array(t,a,de);else if(re===Kv.METADATA&&e._requestMetadata){const fe=x.getUint32(a,!0);if(fe>0){const Ce=sa(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,fe).available;if(c(Ce))for(let we=0;we<Ce.length;++we){const Pe=n+we+1,lt=Ce[we],ft=e._tilingScheme.getNumberOfYTilesAtLevel(Pe);for(let We=0;We<lt.length;++We){const Fe=lt[We],Dt=ft-Fe.endY-1,st=ft-Fe.startY-1;e.availability.addAvailableTileRange(Pe,Fe.startX,Dt,Fe.endX,st),r.availability.addAvailableTileRange(Pe,Fe.startX,Dt,Fe.endX,st)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=de}const Q=e.getLevelMaximumGeometricError(n)*5,le=e._tilingScheme.tileXYToRectangle(i,o,n),pe=Ct.fromRectangle(le,w,v,e._tilingScheme.ellipsoid);return new Yh({center:C,minimumHeight:w,maximumHeight:v,boundingSphere:P,orientedBoundingBox:pe,horizonOcclusionPoint:N,quantizedVertices:M,encodedNormals:Y,indices:p,westIndices:V,southIndices:j,eastIndices:X,northIndices:ee,westSkirtHeight:Q,southSkirtHeight:Q,eastSkirtHeight:Q,northSkirtHeight:Q,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:ne,credits:e._tileCredits})}zc.prototype.requestTileGeometry=function(e,t,n,i){const o=this._layers;let r;const s=o.length;let a=!1,l=Promise.resolve();if(s===1)r=o[0];else for(let u=0;u<s;++u){const h=o[u];if(!c(h.availability)||h.availability.isTileAvailable(n,e,t)){r=h;break}const f=iL(this,e,t,n,h,u===0);f.result&&(a=!0,l=l.then(()=>f.promise))}return!c(r)&&a?l.then(()=>new Promise(u=>{setTimeout(()=>{const h=this.requestTileGeometry(e,t,n,i);u(h)},0)})):pq(this,e,t,n,r,i)};function pq(e,t,n,i,o,r){if(!c(o))return Promise.reject(new Te("Terrain tile doesn't exist"));const s=o.tileUrlTemplates;if(s.length===0)return;let a;!e._scheme||e._scheme==="tms"?a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1:a=n;const l=[];e._requestVertexNormals&&o.hasVertexNormals&&l.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&l.push("watermask"),e._requestMetadata&&o.hasMetadata&&l.push("metadata");let u,h;const f=s[(t+a+i)%s.length],_=o.resource;c(_._ionEndpoint)&&!c(_._ionEndpoint.externalType)?(l.length!==0&&(h={extensions:l.join("-")}),u=zz(void 0)):u=zz(l);const g=_.getDerivedResource({url:f,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:h,headers:u,request:r}).fetchArrayBuffer();if(!!c(g))return g.then(function(m){return c(m)?c(e._heightmapStructure)?T8e(e,m):A8e(e,m,i,t,n,o):Promise.reject(new Te("Mesh buffer doesn't exist."))})}Object.defineProperties(zc.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},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}}});zc.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};zc.fromIonAssetId=async function(e,t){A.defined("assetId",e);const n=await ar.fromAssetId(e);return zc.fromUrl(n,t)};zc.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT),e=await Promise.resolve(e);const n=Ae.createIfNeeded(e);n.appendForwardSlash();const i=new hq(t);i.lastResource=n,i.layerJsonResource=i.lastResource.getDerivedResource({url:"layer.json"}),await nL(i);const o=new zc(t);return i.build(o),o};zc.prototype.getTileDataAvailable=function(e,t,n){if(!c(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,o=i.length;for(let r=0;r<o;++r)if(iL(this,e,t,n,i[r],r===0).result)return;return!1};zc.prototype.loadTileDataAvailability=function(e,t,n){if(!c(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,o=i.length;for(let r=0;r<o;++r){const s=iL(this,e,t,n,i[r],r===0);if(c(s.promise))return s.promise}};function cP(e,t,n,i){if(i===0)return;const o=e.availabilityLevels,r=i%o===0?i-o:(i/o|0)*o,s=1<<i-r,a=t/s|0,l=n/s|0;return{level:r,x:a,y:l}}function iL(e,t,n,i,o,r){if(!c(o.availabilityLevels))return{result:!1};let s;const a=function(){delete o.availabilityPromiseCache[s]},l=o.availabilityTilesLoaded,u=o.availability;let h=cP(o,t,n,i);for(;c(h);){if(u.isTileAvailable(h.level,h.x,h.y)&&!l.isTileAvailable(h.level,h.x,h.y)){let f;if(!r&&(s=`${h.level}-${h.x}-${h.y}`,f=o.availabilityPromiseCache[s],!c(f))){const _=new iu({throttle:!1,throttleByServer:!0,type:Ip.TERRAIN});f=pq(e,h.x,h.y,h.level,o,_),c(f)&&(o.availabilityPromiseCache[s]=f,f.then(a))}return{result:!0,promise:f}}h=cP(o,h.x,h.y,h.level)}return{result:!1}}zc._getAvailabilityTile=cP;const x8e={SEARCH:0,AUTOCOMPLETE:1},oL=Object.freeze(x8e);function _b(){E.throwInstantiationError()}Object.defineProperties(_b.prototype,{credit:{get:E.throwInstantiationError}});_b.getCreditsFromResult=function(e){if(c(e.attributions))return e.attributions.map(Wt.getIonCredit)};_b.prototype.geocode=E.throwInstantiationError;function rL(e){A.defined("url",e),this._url=Ae.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(rL.prototype,{url:{get:function(){return this._url}},credit:{get:function(){}}});rL.prototype.geocode=async function(e,t){return A.typeOf.string("query",e),this._url.getDerivedResource({url:t===oL.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r;const s=o.bbox;if(c(s))r=ce.fromDegrees(s[0],s[1],s[2],s[3]);else{const a=o.geometry.coordinates[0],l=o.geometry.coordinates[1];r=d.fromDegrees(a,l)}return{displayName:o.properties.label,destination:r,attributions:i.attributions}})})};function sL(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.scene",e.scene);const t=y(e.accessToken,Zf.defaultAccessToken),n=Ae.createIfNeeded(y(e.server,Zf.defaultServer));n.appendForwardSlash();const i=Zf.getDefaultTokenCredit(t);c(i)&&e.scene.frameState.creditDisplay.addStaticCredit(Wt.clone(i));const o=n.getDerivedResource({url:"v1/geocode"});c(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new rL(o)}Object.defineProperties(sL.prototype,{credit:{get:function(){}}});sL.prototype.geocode=async function(e,t){return this._pelias.geocode(e,t)};function C8e(e){return e=y(e,y.EMPTY_OBJECT),zc.fromIonAssetId(2426648,{requestVertexNormals:y(e.requestVertexNormals,!1)})}function mq(e){return e=y(e,y.EMPTY_OBJECT),zc.fromIonAssetId(1,{requestVertexNormals:y(e.requestVertexNormals,!1),requestWaterMask:y(e.requestWaterMask,!1)})}async function E8e(e,t,n,i){return c(i)||(i=!1),A.typeOf.object("terrainProvider",e),A.typeOf.number("level",t),A.typeOf.bool("rejectOnTileFail",i),A.defined("positions",n),v8e(e,t,n,i)}function w8e(e,t,n){const i=e[0],o=i.terrainProvider.requestTileGeometry(i.x,i.y,i.level);if(!o)return!1;let r;return n?r=o.then(kz(i)):r=o.then(kz(i)).catch(I8e(i)),e.shift(),t.push(r),!0}function S8e(e){return new Promise(function(t){setTimeout(t,e)})}function lP(e,t,n){return e.length?w8e(e,t,n)?lP(e,t):S8e(100).then(()=>lP(e,t)):Promise.resolve()}function v8e(e,t,n,i){const o=e.tilingScheme;let r;const s=[],a={};for(r=0;r<n.length;++r){const u=o.positionToTileXY(n[r],t);if(!c(u))continue;const h=u.toString();if(!a.hasOwnProperty(h)){const f={x:u.x,y:u.y,level:t,tilingScheme:o,terrainProvider:e,positions:[]};a[h]=f,s.push(f)}a[h].positions.push(n[r])}const l=[];return lP(s,l,i).then(function(){return Promise.all(l).then(function(){return n})})}function Uz(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function kz(e){const t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let r=0;r<t.length;++r){const s=t[r];if(!Uz(s,i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then(function(){for(let r=0;r<t.length;++r){const s=t[r];Uz(s,i,n)}}):Promise.resolve()}}function I8e(e){const t=e.positions;return function(){for(let n=0;n<t.length;++n){const i=t[n];i.height=void 0}}}const Zv=new H;async function aL(e,t,n){if(c(n)||(n=!1),!c(e))throw new E("terrainProvider is required.");if(!c(t))throw new E("positions is required.");const i=[],o=[],r=e.availability;if(!c(r))throw new E("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");const s=[];for(let l=0;l<t.length;++l){const u=t[l],h=r.computeMaximumLevelAtPosition(u);if(o[l]=h,h===0){e.tilingScheme.positionToTileXY(u,1,Zv);const _=e.loadTileDataAvailability(Zv.x,Zv.y,1);c(_)&&s.push(_)}let f=i[h];c(f)||(i[h]=f=[]),f.push(u)}await Promise.all(s),await Promise.all(i.map(function(l,u){if(c(l))return E8e(e,u,l,n)}));const a=[];for(let l=0;l<t.length;++l){const u=t[l];r.computeMaximumLevelAtPosition(u)!==o[l]&&a.push(u)}return a.length>0&&await aL(e,a,n),t}const D8e=new Wt("MapQuest, Open Street Map and contributors, CC-BY-SA");function ch(e){e=y(e,y.EMPTY_OBJECT);const t=Ae.createIfNeeded(y(e.url,"https://tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}${e.retinaTiles?"@2x":""}.${y(e.fileExtension,"png")}`;const n=new ws({ellipsoid:e.ellipsoid}),i=256,o=256,r=y(e.minimumLevel,0),s=e.maximumLevel,a=y(e.rectangle,n.rectangle),l=n.positionToTileXY(ce.southwest(a),r),u=n.positionToTileXY(ce.northeast(a),r),h=(Math.abs(u.x-l.x)+1)*(Math.abs(u.y-l.y)+1);if(h>4)throw new E(`The rectangle and minimumLevel indicate that there are ${h} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let f=y(e.credit,D8e);typeof f=="string"&&(f=new Wt(f)),zl.call(this,{url:t,credit:f,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}c(Object.create)&&(ch.prototype=Object.create(zl.prototype),ch.prototype.constructor=ch);function P8e(e,t,n){return A.typeOf.string("samplerUniformName",e),A.typeOf.string("matrixUniformName",t),A.typeOf.string("styleUniformName",n),` float clipDistance = clip(gl_FragCoord, ${e}, ${t}); vec4 clippingPlanesEdgeColor = vec4(1.0); clippingPlanesEdgeColor.rgb = ${n}.rgb; float clippingPlanesEdgeWidth = ${n}.a; if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) { out_FragColor = clippingPlanesEdgeColor; } `}const O8e={modifyFragmentShader:function(t){return t=Oe.replaceMain(t,"czm_splitter_main"),t+=`uniform float czm_splitDirection; void main() { #ifndef SHADOW_MAP if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard; if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; #endif czm_splitter_main(); } `,t},addUniforms:function(t,n){n.czm_splitDirection=function(){return t.splitDirection}}},_q=O8e,Gf={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function gb(e){A.typeOf.object("options",e),A.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=z.clone(z.DARKGRAY),this._highlightColor=z.clone(z.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=Gf.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._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=y(e.opaquePass,xe.OPAQUE),this._cull=y(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=L.clone(L.IDENTITY),this._modelMatrix=L.clone(L.IDENTITY),this.time=0,this.shadows=Vi.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,this.splitDirection=y(e.splitDirection,zp.NONE),this._splittingEnabled=!1,this._error=void 0,L8e(this,e)}Object.defineProperties(gb.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},color:{get:function(){return z.clone(this._highlightColor)},set:function(e){this._highlightColor=z.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(c(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=se.clone(e,this._boundingSphere)}}});function L8e(e,t){const n=U5.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&&c(n.batchTableBinary)&&(n.styleableProperties=Hn.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),c(n.draco)){const a=n.draco;e._decodingState=Gf.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}const i=n.positions;c(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const o=n.normals;c(o)&&(e._isOctEncoded16P=o.octEncoded);const r=n.colors;c(r)&&(c(r.constantColor)&&(e._constantColor=z.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);const s=n.batchIds;c(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength}const R8e=new d,N8e=new d,M8e=new d;let Vz,EA;function F8e(e){if(!c(EA)){Vz=new fC(0),EA=new Array(e);for(let t=0;t<e;++t)EA[t]=Vz.random()}return EA}function B8e(e){const n=e.length/3,i=Math.min(n,20),o=F8e(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=d.fromElements(r,r,r,R8e),l=d.fromElements(s,s,s,N8e);for(let h=0;h<i;++h){const f=Math.floor(o[h]*n),_=d.unpack(e,f*3,M8e);d.minimumByComponent(a,_,a),d.maximumByComponent(l,_,l)}const u=se.fromCornerPoints(a,l);return u.radius+=R.EPSILON2,u}function Hz(e,t){const n=Z.fromTypedArray(e);return n===Z.INT||n===Z.UNSIGNED_INT||n===Z.DOUBLE?($n("Cast pnts property to floats",`Point cloud property "${t}" will be cast 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 z8e=new te,U8e=new te,k8e=new z,gq=0,dC=1,uP=2,yq=3,V8e=4,Jv=new L,H8e=new L;function G8e(e,t){const n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,l=i.batchIds,u=i.styleableProperties,h=c(u),f=e._isQuantized,_=e._isQuantizedDraco,g=e._isOctEncoded16P,m=e._isOctEncodedDraco,b=e._quantizedRange,T=e._octEncodedRange,x=e._isRGB565,C=e._isTranslucent,w=e._hasColors,v=e._hasNormals,P=e._hasBatchIds;let N,k;const M=[],U={};if(e._styleableShaderAttributes=U,h){let G=V8e;for(const j in u)if(u.hasOwnProperty(j)){const W=u[j],X=Hz(W.typedArray,j);N=W.componentCount,k=Z.fromTypedArray(X);const q=ct.createVertexBuffer({context:n,typedArray:X,usage:ke.STATIC_DRAW});e._geometryByteLength+=q.sizeInBytes;const ee={index:G,vertexBuffer:q,componentsPerAttribute:N,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0};M.push(ee),U[j]={location:G,componentCount:N},++G}}const B=ct.createVertexBuffer({context:n,typedArray:r.typedArray,usage:ke.STATIC_DRAW});e._geometryByteLength+=B.sizeInBytes;let S;w&&(S=ct.createVertexBuffer({context:n,typedArray:s.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=S.sizeInBytes);let D;v&&(D=ct.createVertexBuffer({context:n,typedArray:a.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes);let p;P&&(l.typedArray=Hz(l.typedArray,"batchIds"),p=ct.createVertexBuffer({context:n,typedArray:l.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=p.sizeInBytes);let I=[];if(f?k=Z.UNSIGNED_SHORT:_?k=b<=255?Z.UNSIGNED_BYTE:Z.UNSIGNED_SHORT:k=Z.FLOAT,I.push({index:gq,vertexBuffer:B,componentsPerAttribute:3,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(f||_?e._boundingSphere=se.fromCornerPoints(d.ZERO,e._quantizedVolumeScale):e._boundingSphere=B8e(r.typedArray)),w)if(x)I.push({index:dC,vertexBuffer:S,componentsPerAttribute:1,componentDatatype:Z.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const G=C?4:3;I.push({index:dC,vertexBuffer:S,componentsPerAttribute:G,componentDatatype:Z.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}v&&(g?(N=2,k=Z.UNSIGNED_BYTE):m?(N=2,k=T<=255?Z.UNSIGNED_BYTE:Z.UNSIGNED_SHORT):(N=3,k=Z.FLOAT),I.push({index:uP,vertexBuffer:D,componentsPerAttribute:N,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0})),P&&I.push({index:yq,vertexBuffer:p,componentsPerAttribute:1,componentDatatype:Z.fromTypedArray(l.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),h&&(I=I.concat(M));const O=new Ci({context:n,attributes:I}),F={depthTest:{enabled:!0}},V={depthTest:{enabled:!0},depthMask:!1,blending:Zn.ALPHA_BLEND};e._opaquePass===xe.CESIUM_3D_TILE&&(F.stencilTest=At.setCesium3DTileBit(),F.stencilMask=At.CESIUM_3D_TILE_MASK,V.stencilTest=At.setCesium3DTileBit(),V.stencilMask=At.CESIUM_3D_TILE_MASK),e._opaqueRenderState=Ue.fromCache(F),e._translucentRenderState=Ue.fromCache(V),e._drawCommand=new Ze({boundingVolume:new se,cull:e._cull,modelMatrix:new L,primitiveType:ze.POINTS,vertexArray:O,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:C?e._translucentRenderState:e._opaqueRenderState,pass:C?xe.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function j8e(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const a=z8e;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){const l=t.camera.frustum;let u;t.mode===oe.SCENE2D||l instanceof It?u=Number.POSITIVE_INFINITY:u=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=u}return a},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const a=e.clippingPlanes;return e.isClipped?a.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const a=e.clippingPlanes;if(!c(a))return z.TRANSPARENT;const l=z.clone(a.edgeColor,k8e);return l.alpha=a.edgeWidth,l},u_clippingPlanesMatrix:function(){const a=e.clippingPlanes;if(!c(a))return L.IDENTITY;const l=y(e.clippingPlanesOriginMatrix,e._modelMatrix);L.multiply(n.uniformState.view3D,l,Jv);const u=L.multiply(Jv,a.modelMatrix,Jv);return L.inverseTranspose(u,H8e)}};_q.addUniforms(e,s),(i||o||r)&&(s=jt(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const a=U8e;if(c(e._quantizedVolumeScale)){const l=d.clone(e._quantizedVolumeScale,a);d.divideByScalar(l,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),c(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function eI(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;i!==null;){const o=parseInt(i[1]);t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function tI(e,t){e=e.slice(e.indexOf(` `));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function nI(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const o=e.getAttribute(i);if(o.index===t)return o}}const W8e={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 q8e(e,t,n){let i,o,r;const s=t.context,a=c(n),l=e._isQuantized,u=e._isQuantizedDraco,h=e._isOctEncoded16P,f=e._isOctEncodedDraco,_=e._isRGB565,g=e._isTranslucent,m=e._hasColors,b=e._hasNormals,T=e._hasBatchIds,x=e._backFaceCulling,C=e._normalShading,w=e._drawCommand.vertexArray,v=e.clippingPlanes,P=e._attenuation;let N,k,M,U=g;const B=Je(W8e),S={},D=e._styleableShaderAttributes;for(o in D)D.hasOwnProperty(o)&&(r=D[o],B[o]=`czm_3dtiles_property_${r.location}`,S[r.location]=r);if(a){const re={translucent:!1},de="(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)";N=n.getColorShaderFunction(`getColorFromStyle${de}`,B,re),k=n.getShowShaderFunction(`getShowFromStyle${de}`,B,re),M=n.getPointSizeShaderFunction(`getPointSizeFromStyle${de}`,B,re),c(N)&&re.translucent&&(U=!0)}e._styleTranslucent=U;const p=c(N),I=c(k),O=c(M),F=e.isClipped,V=[],G=[];p&&(eI(N,V),tI(N,G)),I&&(eI(k,V),tI(k,G)),O&&(eI(M,V),tI(M,G));const j=G.indexOf("COLOR")>=0,W=G.indexOf("NORMAL")>=0;if(W&&!b)throw new Te("Style references the NORMAL semantic but the point cloud does not have normals");for(o in D)if(D.hasOwnProperty(o)){r=D[o];const re=V.indexOf(r.location)>=0,de=nI(w,r.location);de.enabled=re}const X=m&&(!p||j);if(m){const re=nI(w,dC);re.enabled=X}const q=b&&(C||x||W);if(b){const re=nI(w,uP);re.enabled=q}const ee={a_position:gq};X&&(ee.a_color=dC),q&&(ee.a_normal=uP),T&&(ee.a_batchId=yq);let Y="";const ne=V.length;for(i=0;i<ne;++i){const re=V[i];r=S[re];const de=r.componentCount,fe=`czm_3dtiles_property_${re}`;let ye;de===1?ye="float":ye=`vec${de}`,Y+=`in ${ye} ${fe}; `,ee[fe]=r.location}j8e(e,t);let Q=`in vec3 a_position; out vec4 v_color; uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; uniform vec4 u_constantColor; uniform vec4 u_highlightColor; `;Q+=`float u_pointSize; float tiles3d_tileset_time; `,P&&(Q+=`float u_geometricError; float u_depthMultiplier; `),Q+=Y,X&&(g?Q+=`in vec4 a_color; `:_?Q+=`in float a_color; const float SHIFT_RIGHT_11 = 1.0 / 2048.0; const float SHIFT_RIGHT_5 = 1.0 / 32.0; const float SHIFT_LEFT_11 = 2048.0; const float SHIFT_LEFT_5 = 32.0; const float NORMALIZE_6 = 1.0 / 64.0; const float NORMALIZE_5 = 1.0 / 32.0; `:Q+=`in vec3 a_color; `),q&&(h||f?Q+=`in vec2 a_normal; `:Q+=`in vec3 a_normal; `),T&&(Q+=`in float a_batchId; `),(l||u||f)&&(Q+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; `),p&&(Q+=N),I&&(Q+=k),O&&(Q+=M),Q+=`void main() { u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; `,P&&(Q+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; `),X?g?Q+=` vec4 color = a_color; `:_?Q+=` float compressed = a_color; float r = floor(compressed * SHIFT_RIGHT_11); compressed -= r * SHIFT_LEFT_11; float g = floor(compressed * SHIFT_RIGHT_5); compressed -= g * SHIFT_LEFT_5; float b = compressed; vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); vec4 color = vec4(rgb, 1.0); `:Q+=` vec4 color = vec4(a_color, 1.0); `:Q+=` vec4 color = u_constantColor; `,l||u?Q+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; `:Q+=` vec3 position = a_position; `,Q+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); `,q?(h?Q+=` vec3 normal = czm_octDecode(a_normal); `:f?Q+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; `:Q+=` vec3 normal = a_normal; `,Q+=` vec3 normalEC = czm_normal * normal; `):Q+=` vec3 normal = vec3(1.0); `,p&&(Q+=` color = getColorFromStyle(position, position_absolute, color, normal); `),I&&(Q+=` float show = float(getShowFromStyle(position, position_absolute, color, normal)); `),O?Q+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; `:P?Q+=` vec4 positionEC = czm_modelView * vec4(position, 1.0); float depth = -positionEC.z; gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); `:Q+=` gl_PointSize = u_pointSize; `,Q+=` color = color * u_highlightColor; `,q&&C&&(Q+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); diffuseStrength = max(diffuseStrength, 0.4); color.xyz *= diffuseStrength * czm_lightColor; `),Q+=` v_color = color; gl_Position = czm_modelViewProjection * vec4(position, 1.0); `,q&&x&&(Q+=` float visible = step(-normalEC.z, 0.0); gl_Position *= visible; gl_PointSize *= visible; `),I&&(Q+=` gl_Position.w *= float(show); gl_PointSize *= float(show); `),Q+=`} `;let le=`in vec4 v_color; `;F&&(le+=`uniform highp sampler2D u_clippingPlanes; uniform mat4 u_clippingPlanesMatrix; uniform vec4 u_clippingPlanesEdgeStyle; `,le+=` `,le+=p1(v,s),le+=` `),le+=`void main() { out_FragColor = czm_gammaCorrect(v_color); `,F&&(le+=P8e("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),le+=`} `,e.splitDirection!==zp.NONE&&(le=_q.modifyFragmentShader(le)),c(e._vertexShaderLoaded)&&(Q=e._vertexShaderLoaded(Q)),c(e._fragmentShaderLoaded)&&(le=e._fragmentShaderLoaded(le));const pe=e._drawCommand;c(pe.shaderProgram)&&pe.shaderProgram.destroy(),pe.shaderProgram=Jt.fromCache({context:s,vertexShaderSource:Q,fragmentShaderSource:le,attributeLocations:ee});try{pe.shaderProgram._bind()}catch{throw new Te("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function Y8e(e,t){if(e._decodingState===Gf.READY)return!1;if(e._decodingState===Gf.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,o=Fi.decodePointCloud(i,t);c(o)&&(e._decodingState=Gf.DECODING,o.then(function(r){e._decodingState=Gf.READY;const s=c(r.POSITION)?r.POSITION.array:void 0,a=c(r.RGB)?r.RGB.array:void 0,l=c(r.RGBA)?r.RGBA.array:void 0,u=c(r.NORMAL)?r.NORMAL.array:void 0,h=c(r.BATCH_ID)?r.BATCH_ID.array:void 0,f=c(s)&&c(r.POSITION.data.quantization),_=c(u)&&c(r.NORMAL.data.quantization);if(f){const T=r.POSITION.data.quantization,x=T.range;e._quantizedVolumeScale=d.fromElements(x,x,x),e._quantizedVolumeOffset=d.unpack(T.minValues),e._quantizedRange=(1<<T.quantizationBits)-1,e._isQuantizedDraco=!0}_&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties;const m=i.batchTableProperties;for(const T in m)if(m.hasOwnProperty(T)){const x=r[T];c(g)||(g={}),g[T]={typedArray:x.array,componentCount:x.data.componentsPerAttribute}}c(s)&&(n.positions={typedArray:s});const b=y(l,a);c(b)&&(n.colors={typedArray:b}),c(u)&&(n.normals={typedArray:u}),c(h)&&(n.batchIds={typedArray:h}),n.styleableProperties=g}).catch(function(r){e._decodingState=Gf.FAILED,e._error=r}))}return!0}const $8e=new te,X8e=new d;gb.prototype.update=function(e){const t=e.context;if(c(this._error)){const u=this._error;throw this._error=void 0,u}if(Y8e(this,t))return;let i=!1,o=!L.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),c(this._drawCommand)||(G8e(this,e),o=!0,i=!0,this._ready=!0,this._parsedContent=void 0),o){L.clone(this.modelMatrix,this._modelMatrix);const u=this._drawCommand.modelMatrix;if(L.clone(this._modelMatrix,u),c(this._rtcCenter)&&L.multiplyByTranslation(u,this._rtcCenter,u),c(this._quantizedVolumeOffset)&&L.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==oe.SCENE3D){const f=e.mapProjection,_=L.getColumn(u,3,$8e);te.equals(_,te.UNIT_W)||zt.basisTo2D(f,u,u)}const h=this._drawCommand.boundingVolume;if(se.clone(this._boundingSphere,h),this._cull){const f=h.center;L.multiplyByPoint(u,f,f);const _=L.getScale(u,X8e);h.radius*=d.maximumComponent(_)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);const r=this.splitDirection!==zp.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&q8e(this,e,this._style),this._drawCommand.castShadows=Vi.castShadows(this.shadows),this._drawCommand.receiveShadows=Vi.receiveShadows(this.shadows);const s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?xe.TRANSLUCENT:this._opaquePass;const a=e.commandList,l=e.passes;(l.render||l.pick)&&a.push(this._drawCommand)};gb.prototype.isDestroyed=function(){return!1};gb.prototype.destroy=function(){const e=this._drawCommand;return c(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),ve(this)};function U_(e){A.typeOf.object("terrainProviderPromise",e),this._ready=!1,this._provider=void 0,this._errorEvent=new Le,this._readyEvent=new Le,K8e(this,e)}Object.defineProperties(U_.prototype,{errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}}});U_.fromWorldTerrain=function(e){return new U_(mq(e))};U_.fromWorldBathymetry=function(e){return new U_(C8e(e))};function Q8e(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function K8e(e,t){let n;try{n=await Promise.resolve(t),e._provider=n,e._ready=!0,e._readyEvent.raiseEvent(n)}catch(i){Q8e(e._errorEvent,i)}}function af(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.clock",e.clock),A.typeOf.object("options.intervals",e.intervals),this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.shadows=y(e.shadows,Vi.ENABLED),this.maximumMemoryUsage=y(e.maximumMemoryUsage,256),this.shading=new q0(e.shading),this.style=e.style,this.frameFailed=new Le,this.frameChanged=new Le,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new Jh,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._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}Object.defineProperties(af.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(c(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}}});function Z8e(e){return`uniform vec4 czm_pickColor; ${e}`}function J8e(e){return function(t){return jt(t,{czm_pickColor:function(){return e._pickId.color}})}}function eGe(){return"czm_pickColor"}af.prototype.makeStyleDirty=function(){this._styleDirty=!0};af.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};const tGe=new ie;function cL(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function vp(e,t){return e._intervals.indexOf(t.start)}function nGe(e,t){const n=e._intervals,i=e._clock,o=cL(e);if(o===0)return;const r=e._getAverageLoadTime(),s=ie.addSeconds(i.currentTime,r*o,tGe);let a=n.indexOf(s);const l=vp(e,t);return a===l&&(o>=0?++a:--a),n.get(a)}function iGe(e){const t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function oGe(e,t,n){const i=cL(e),o=vp(e,t),r=vp(e,n);return i>=0?o>=r:o<=r}function bq(e,t){return function(n){const i=c(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 rGe(e,t,n){const i=vp(e,t),o=e._frames;let r=o[i];if(!c(r)){const s=t.data.transform,a=c(s)?L.fromArray(s):void 0,l=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:xo(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber,uri:l},o[i]=r,Ae.fetchArrayBuffer({url:l}).then(function(u){r.pointCloud=new gb({arrayBuffer:u,cull:!0,fragmentShaderLoaded:Z8e,uniformMapLoaded:J8e(e),pickIdLoaded:eGe})}).catch(bq(e,l))}return r}function sGe(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 aGe(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const o=t.pointCloud;if(c(o)&&!t.ready){const r=i.commandList,s=r.length;if(Tq(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){const a=(xo()-t.timestamp)/1e3;sGe(e,a)}}t.touchedFrameNumber=i.frameNumber}const cGe=new L;function lGe(e,t){const n=e.shading;return c(n)&&c(n.baseResolution)?n.baseResolution:c(t.boundingSphere)?R.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function uGe(e){const t=e.shading;return c(t)&&c(t.maximumAttenuation)?t.maximumAttenuation:10}const dGe=new q0;function Tq(e,t,n,i){const o=y(e.shading,dGe),r=t.pointCloud,s=y(t.transform,L.IDENTITY);r.modelMatrix=L.multiplyTransformation(e.modelMatrix,s,cGe),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=lGe(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=uGe(e);try{r.update(i)}catch(a){bq(e,t.uri)(a)}t.touchedFrameNumber=i.frameNumber}function dP(e,t,n,i){const o=rGe(e,t,i);aGe(e,o,n,i)}function hGe(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function Aq(e,t){const n=e._frames,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(c(r)&&(!c(t)||t(r))){const s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),c(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function fGe(e,t){const n=vp(e,t),i=e._frames[n];if(c(i)&&i.ready)return i}function Gz(e,t,n,i,o){return c(n)?n.ready?!0:(dP(e,t,i,o),n.ready):!1}function pGe(e,t,n,i,o){let r,s,a;const l=e._intervals,u=e._frames,h=vp(e,n),f=vp(e,t);if(h>=f){for(r=h;r>=f;--r)if(s=l.get(r),a=u[r],Gz(e,s,a,i,o))return s}else for(r=h;r<=f;++r)if(s=l.get(r),a=u[r],Gz(e,s,a,i,o))return s;return t}function mGe(e,t,n){const i=e._frames,o=i.length;for(let r=0;r<o;++r){const s=i[r];c(s)&&c(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}const Rm={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};af.prototype.update=function(e){if(e.mode===oe.MORPHING||!this.show)return;c(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),c(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time));const t=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes;let i=0,o=!1;const r=c(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);const s=this._styleDirty;this._styleDirty=!1,(o||s)&&mGe(this,o,s),Rm.timeSinceLoad=t,Rm.isClipped=r;const a=this.shading,l=this._pointCloudEyeDomeLighting,u=e.commandList,h=u.length;let f=this._previousInterval,_=this._nextInterval;const g=iGe(this);if(!c(g))return;let m=!1;const b=cL(this),T=b===0;b!==this._clockMultiplier&&(m=!0,this._clockMultiplier=b),(!c(f)||T)&&(f=g),(!c(_)||m||oGe(this,g,_))&&(_=nGe(this,g)),f=pGe(this,f,g,Rm,e);let x=fGe(this,f);c(x)||(dP(this,f,Rm,e),x=this._lastRenderedFrame),c(x)&&Tq(this,x,Rm,e),c(_)&&dP(this,_,Rm,e);const C=this;c(x)&&!c(this._lastRenderedFrame)&&e.afterRender.push(function(){return!0}),c(x)&&x!==this._lastRenderedFrame&&C.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return C.frameChanged.raiseEvent(C),!0}),this._previousInterval=f,this._nextInterval=_,this._lastRenderedFrame=x;const w=this._totalMemoryUsageInBytes,v=this.maximumMemoryUsage*1024*1024;w>v&&Aq(this,hGe(e));const N=u.length-h;c(a)&&a.attenuation&&a.eyeDomeLighting&&N>0&&l.update(e,h,a,this.boundingSphere)};af.prototype.isDestroyed=function(){return!1};af.prototype.destroy=function(){return Aq(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),ve(this)};async function _E(e,t){const n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid;let r;const s=t.camera.getRectangleCameraCoordinates(e);if(t.mode===oe.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),!c(n))return r;const a=n.availability;if(!c(a)||t.mode===oe.SCENE2D)return r;const l=[ce.center(e),ce.southeast(e),ce.southwest(e),ce.northeast(e),ce.northwest(e)],u=await _E._sampleTerrainMostDetailed(n,l);let h=!1;const f=u.reduce(function(g,m){return c(m.height)?(h=!0,Math.max(m.height,g)):g},-Number.MAX_VALUE),_=r;return h&&(_.height+=f),_}_E._sampleTerrainMostDetailed=aL;var wy;typeof ko<"u"&&(wy=ko);(function(){/*! * Knockout JavaScript library v3.5.1 * (c) The Knockout.js team - http://knockoutjs.com/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||typeof jQuery>"u"||(o=jQuery),function(s){s(t.ko={})}(function(s,a){function l(S,D){return S===null||typeof S in b?S===D:!1}function u(S,D){var p;return function(){p||(p=m.a.setTimeout(function(){p=e,S()},D))}}function h(S,D){var p;return function(){clearTimeout(p),p=m.a.setTimeout(S,D)}}function f(S,D){D&&D!=="change"?D==="beforeChange"?this.pc(S):this.gb(S,D):this.qc(S)}function _(S,D){D!==null&&D.s&&D.s()}function g(S,D){var p=this.qd,I=p[v];I.ra||(this.Qb&&this.mb[D]?(p.uc(D,S,this.mb[D]),this.mb[D]=null,--this.Qb):I.I[D]||p.uc(D,S,I.J?{da:S}:p.$c(S)),S.Ja&&S.gd())}var m=typeof s<"u"?s:{};m.b=function(S,D){for(var p=S.split("."),I=m,O=0;O<p.length-1;O++)I=I[p[O]];I[p[p.length-1]]=D},m.L=function(S,D,p){S[D]=p},m.version="3.5.1",m.b("version",m.version),m.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},m.a=function(){function S(Y,ne){for(var Q in Y)O.call(Y,Q)&&ne(Q,Y[Q])}function D(Y,ne){if(ne)for(var Q in ne)O.call(ne,Q)&&(Y[Q]=ne[Q]);return Y}function p(Y,ne){return Y.__proto__=ne,Y}function I(Y,ne,Q,le){var pe=Y[ne].match(q)||[];m.a.D(Q.match(q),function(re){m.a.Na(pe,re,le)}),Y[ne]=pe.join(" ")}var O=Object.prototype.hasOwnProperty,F={__proto__:[]}instanceof Array,V=typeof Symbol=="function",G={},j={};G[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],G.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),S(G,function(Y,ne){if(ne.length)for(var Q=0,le=ne.length;Q<le;Q++)j[ne[Q]]=Y});var W={propertychange:!0},X=n&&function(){for(var Y=3,ne=n.createElement("div"),Q=ne.getElementsByTagName("i");ne.innerHTML="<!--[if gt IE "+ ++Y+"]><i></i><![endif]-->",Q[0];);return 4<Y?Y:e}(),q=/\S+/g,ee;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(Y,ne,Q){for(var le=0,pe=Y.length;le<pe;le++)ne.call(Q,Y[le],le,Y)},A:typeof Array.prototype.indexOf=="function"?function(Y,ne){return Array.prototype.indexOf.call(Y,ne)}:function(Y,ne){for(var Q=0,le=Y.length;Q<le;Q++)if(Y[Q]===ne)return Q;return-1},Lb:function(Y,ne,Q){for(var le=0,pe=Y.length;le<pe;le++)if(ne.call(Q,Y[le],le,Y))return Y[le];return e},Pa:function(Y,ne){var Q=m.a.A(Y,ne);0<Q?Y.splice(Q,1):Q===0&&Y.shift()},wc:function(Y){var ne=[];return Y&&m.a.D(Y,function(Q){0>m.a.A(ne,Q)&&ne.push(Q)}),ne},Mb:function(Y,ne,Q){var le=[];if(Y)for(var pe=0,re=Y.length;pe<re;pe++)le.push(ne.call(Q,Y[pe],pe));return le},jb:function(Y,ne,Q){var le=[];if(Y)for(var pe=0,re=Y.length;pe<re;pe++)ne.call(Q,Y[pe],pe)&&le.push(Y[pe]);return le},Nb:function(Y,ne){if(ne instanceof Array)Y.push.apply(Y,ne);else for(var Q=0,le=ne.length;Q<le;Q++)Y.push(ne[Q]);return Y},Na:function(Y,ne,Q){var le=m.a.A(m.a.bc(Y),ne);0>le?Q&&Y.push(ne):Q||Y.splice(le,1)},Ba:F,extend:D,setPrototypeOf:p,Ab:F?p:D,P:S,Ga:function(Y,ne,Q){if(!Y)return Y;var le={},pe;for(pe in Y)O.call(Y,pe)&&(le[pe]=ne.call(Q,Y[pe],pe,Y));return le},Tb:function(Y){for(;Y.firstChild;)m.removeNode(Y.firstChild)},Yb:function(Y){Y=m.a.la(Y);for(var ne=(Y[0]&&Y[0].ownerDocument||n).createElement("div"),Q=0,le=Y.length;Q<le;Q++)ne.appendChild(m.oa(Y[Q]));return ne},Ca:function(Y,ne){for(var Q=0,le=Y.length,pe=[];Q<le;Q++){var re=Y[Q].cloneNode(!0);pe.push(ne?m.oa(re):re)}return pe},va:function(Y,ne){if(m.a.Tb(Y),ne)for(var Q=0,le=ne.length;Q<le;Q++)Y.appendChild(ne[Q])},Xc:function(Y,ne){var Q=Y.nodeType?[Y]:Y;if(0<Q.length){for(var le=Q[0],pe=le.parentNode,re=0,de=ne.length;re<de;re++)pe.insertBefore(ne[re],le);for(re=0,de=Q.length;re<de;re++)m.removeNode(Q[re])}},Ua:function(Y,ne){if(Y.length){for(ne=ne.nodeType===8&&ne.parentNode||ne;Y.length&&Y[0].parentNode!==ne;)Y.splice(0,1);for(;1<Y.length&&Y[Y.length-1].parentNode!==ne;)Y.length--;if(1<Y.length){var Q=Y[0],le=Y[Y.length-1];for(Y.length=0;Q!==le;)Y.push(Q),Q=Q.nextSibling;Y.push(le)}}return Y},Zc:function(Y,ne){7>X?Y.setAttribute("selected",ne):Y.selected=ne},Db:function(Y){return Y===null||Y===e?"":Y.trim?Y.trim():Y.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(Y,ne){return Y=Y||"",ne.length>Y.length?!1:Y.substring(0,ne.length)===ne},vd:function(Y,ne){if(Y===ne)return!0;if(Y.nodeType===11)return!1;if(ne.contains)return ne.contains(Y.nodeType!==1?Y.parentNode:Y);if(ne.compareDocumentPosition)return(ne.compareDocumentPosition(Y)&16)==16;for(;Y&&Y!=ne;)Y=Y.parentNode;return!!Y},Sb:function(Y){return m.a.vd(Y,Y.ownerDocument.documentElement)},kd:function(Y){return!!m.a.Lb(Y,m.a.Sb)},R:function(Y){return Y&&Y.tagName&&Y.tagName.toLowerCase()},Ac:function(Y){return m.onError?function(){try{return Y.apply(this,arguments)}catch(ne){throw m.onError&&m.onError(ne),ne}}:Y},setTimeout:function(Y,ne){return setTimeout(m.a.Ac(Y),ne)},Gc:function(Y){setTimeout(function(){throw m.onError&&m.onError(Y),Y},0)},B:function(Y,ne,Q){var le=m.a.Ac(Q);if(Q=W[ne],m.options.useOnlyNativeEvents||Q||!o)if(Q||typeof Y.addEventListener!="function")if(typeof Y.attachEvent<"u"){var pe=function(de){le.call(Y,de)},re="on"+ne;Y.attachEvent(re,pe),m.a.K.za(Y,function(){Y.detachEvent(re,pe)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else Y.addEventListener(ne,le,!1);else ee||(ee=typeof o(Y).on=="function"?"on":"bind"),o(Y)[ee](ne,le)},Fb:function(Y,ne){if(!Y||!Y.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var Q;if(m.a.R(Y)==="input"&&Y.type&&ne.toLowerCase()=="click"?(Q=Y.type,Q=Q=="checkbox"||Q=="radio"):Q=!1,m.options.useOnlyNativeEvents||!o||Q)if(typeof n.createEvent=="function")if(typeof Y.dispatchEvent=="function")Q=n.createEvent(j[ne]||"HTMLEvents"),Q.initEvent(ne,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,Y),Y.dispatchEvent(Q);else throw Error("The supplied element doesn't support dispatchEvent");else if(Q&&Y.click)Y.click();else if(typeof Y.fireEvent<"u")Y.fireEvent("on"+ne);else throw Error("Browser doesn't support triggering events");else o(Y).trigger(ne)},f:function(Y){return m.O(Y)?Y():Y},bc:function(Y){return m.O(Y)?Y.v():Y},Eb:function(Y,ne,Q){var le;ne&&(typeof Y.classList=="object"?(le=Y.classList[Q?"add":"remove"],m.a.D(ne.match(q),function(pe){le.call(Y.classList,pe)})):typeof Y.className.baseVal=="string"?I(Y.className,"baseVal",ne,Q):I(Y,"className",ne,Q))},Bb:function(Y,ne){var Q=m.a.f(ne);(Q===null||Q===e)&&(Q="");var le=m.h.firstChild(Y);!le||le.nodeType!=3||m.h.nextSibling(le)?m.h.va(Y,[Y.ownerDocument.createTextNode(Q)]):le.data=Q,m.a.Ad(Y)},Yc:function(Y,ne){if(Y.name=ne,7>=X)try{var Q=Y.name.replace(/[&<>'"]/g,function(le){return"&#"+le.charCodeAt(0)+";"});Y.mergeAttributes(n.createElement("<input name='"+Q+"'/>"),!1)}catch{}},Ad:function(Y){9<=X&&(Y=Y.nodeType==1?Y:Y.parentNode,Y.style&&(Y.style.zoom=Y.style.zoom))},wd:function(Y){if(X){var ne=Y.style.width;Y.style.width=0,Y.style.width=ne}},Pd:function(Y,ne){Y=m.a.f(Y),ne=m.a.f(ne);for(var Q=[],le=Y;le<=ne;le++)Q.push(le);return Q},la:function(Y){for(var ne=[],Q=0,le=Y.length;Q<le;Q++)ne.push(Y[Q]);return ne},Da:function(Y){return V?Symbol(Y):Y},Zd:X===6,$d:X===7,W:X,Lc:function(Y,ne){for(var Q=m.a.la(Y.getElementsByTagName("input")).concat(m.a.la(Y.getElementsByTagName("textarea"))),le=typeof ne=="string"?function(de){return de.name===ne}:function(de){return ne.test(de.name)},pe=[],re=Q.length-1;0<=re;re--)le(Q[re])&&pe.push(Q[re]);return pe},Nd:function(Y){return typeof Y=="string"&&(Y=m.a.Db(Y))?r&&r.parse?r.parse(Y):new Function("return "+Y)():null},hc:function(Y,ne,Q){if(!r||!r.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 r.stringify(m.a.f(Y),ne,Q)},Od:function(Y,ne,Q){Q=Q||{};var le=Q.params||{},pe=Q.includeFields||this.Jc,re=Y;if(typeof Y=="object"&&m.a.R(Y)==="form")for(var re=Y.action,de=pe.length-1;0<=de;de--)for(var fe=m.a.Lc(Y,pe[de]),ye=fe.length-1;0<=ye;ye--)le[fe[ye].name]=fe[ye].value;ne=m.a.f(ne);var Ce=n.createElement("form");Ce.style.display="none",Ce.action=re,Ce.method="post";for(var we in ne)Y=n.createElement("input"),Y.type="hidden",Y.name=we,Y.value=m.a.hc(m.a.f(ne[we])),Ce.appendChild(Y);S(le,function(Pe,lt){var ft=n.createElement("input");ft.type="hidden",ft.name=Pe,ft.value=lt,Ce.appendChild(ft)}),n.body.appendChild(Ce),Q.submitter?Q.submitter(Ce):Ce.submit(),setTimeout(function(){Ce.parentNode.removeChild(Ce)},0)}}}(),m.b("utils",m.a),m.b("utils.arrayForEach",m.a.D),m.b("utils.arrayFirst",m.a.Lb),m.b("utils.arrayFilter",m.a.jb),m.b("utils.arrayGetDistinctValues",m.a.wc),m.b("utils.arrayIndexOf",m.a.A),m.b("utils.arrayMap",m.a.Mb),m.b("utils.arrayPushAll",m.a.Nb),m.b("utils.arrayRemoveItem",m.a.Pa),m.b("utils.cloneNodes",m.a.Ca),m.b("utils.createSymbolOrString",m.a.Da),m.b("utils.extend",m.a.extend),m.b("utils.fieldsIncludedWithJsonPost",m.a.Jc),m.b("utils.getFormFields",m.a.Lc),m.b("utils.objectMap",m.a.Ga),m.b("utils.peekObservable",m.a.bc),m.b("utils.postJson",m.a.Od),m.b("utils.parseJson",m.a.Nd),m.b("utils.registerEventHandler",m.a.B),m.b("utils.stringifyJson",m.a.hc),m.b("utils.range",m.a.Pd),m.b("utils.toggleDomNodeCssClass",m.a.Eb),m.b("utils.triggerEvent",m.a.Fb),m.b("utils.unwrapObservable",m.a.f),m.b("utils.objectForEach",m.a.P),m.b("utils.addOrRemoveItem",m.a.Na),m.b("utils.setTextContent",m.a.Bb),m.b("unwrap",m.a.f),Function.prototype.bind||(Function.prototype.bind=function(S){var D=this;if(arguments.length===1)return function(){return D.apply(S,arguments)};var p=Array.prototype.slice.call(arguments,1);return function(){var I=p.slice(0);return I.push.apply(I,arguments),D.apply(S,I)}}),m.a.g=new function(){var S=0,D="__ko__"+new Date().getTime(),p={},I,O;return m.a.W?(I=function(F,V){var G=F[D];if(!G||G==="null"||!p[G]){if(!V)return e;G=F[D]="ko"+S++,p[G]={}}return p[G]},O=function(F){var V=F[D];return V?(delete p[V],F[D]=null,!0):!1}):(I=function(F,V){var G=F[D];return!G&&V&&(G=F[D]={}),G},O=function(F){return F[D]?(delete F[D],!0):!1}),{get:function(F,V){var G=I(F,!1);return G&&G[V]},set:function(F,V,G){(F=I(F,G!==e))&&(F[V]=G)},Ub:function(F,V,G){return F=I(F,!0),F[V]||(F[V]=G)},clear:O,Z:function(){return S+++D}}},m.b("utils.domData",m.a.g),m.b("utils.domData.clear",m.a.g.clear),m.a.K=new function(){function S(V,G){var j=m.a.g.get(V,I);return j===e&&G&&(j=[],m.a.g.set(V,I,j)),j}function D(V){var G=S(V,!1);if(G)for(var G=G.slice(0),j=0;j<G.length;j++)G[j](V);m.a.g.clear(V),m.a.K.cleanExternalData(V),F[V.nodeType]&&p(V.childNodes,!0)}function p(V,G){for(var j=[],W,X=0;X<V.length;X++)if((!G||V[X].nodeType===8)&&(D(j[j.length]=W=V[X]),V[X]!==W))for(;X--&&m.a.A(j,V[X])==-1;);}var I=m.a.g.Z(),O={1:!0,8:!0,9:!0},F={1:!0,9:!0};return{za:function(V,G){if(typeof G!="function")throw Error("Callback must be a function");S(V,!0).push(G)},yb:function(V,G){var j=S(V,!1);j&&(m.a.Pa(j,G),j.length==0&&m.a.g.set(V,I,e))},oa:function(V){return m.u.G(function(){O[V.nodeType]&&(D(V),F[V.nodeType]&&p(V.getElementsByTagName("*")))}),V},removeNode:function(V){m.oa(V),V.parentNode&&V.parentNode.removeChild(V)},cleanExternalData:function(V){o&&typeof o.cleanData=="function"&&o.cleanData([V])}}},m.oa=m.a.K.oa,m.removeNode=m.a.K.removeNode,m.b("cleanNode",m.oa),m.b("removeNode",m.removeNode),m.b("utils.domNodeDisposal",m.a.K),m.b("utils.domNodeDisposal.addDisposeCallback",m.a.K.za),m.b("utils.domNodeDisposal.removeDisposeCallback",m.a.K.yb),function(){var S=[0,"",""],D=[1,"<table>","</table>"],p=[3,"<table><tbody><tr>","</tr></tbody></table>"],I=[1,"<select multiple='multiple'>","</select>"],O={thead:D,tbody:D,tfoot:D,tr:[2,"<table><tbody>","</tbody></table>"],td:p,th:p,option:I,optgroup:I},F=8>=m.a.W;m.a.ua=function(V,G){var j;if(o){if(o.parseHTML)j=o.parseHTML(V,G)||[];else if((j=o.clean([V],G))&&j[0]){for(var W=j[0];W.parentNode&&W.parentNode.nodeType!==11;)W=W.parentNode;W.parentNode&&W.parentNode.removeChild(W)}}else{(j=G)||(j=n);var W=j.parentWindow||j.defaultView||t,X=m.a.Db(V).toLowerCase(),q=j.createElement("div"),ee;for(ee=(X=X.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&O[X[1]]||S,X=ee[0],ee="ignored<div>"+ee[1]+V+ee[2]+"</div>",typeof W.innerShiv=="function"?q.appendChild(W.innerShiv(ee)):(F&&j.body.appendChild(q),q.innerHTML=ee,F&&q.parentNode.removeChild(q));X--;)q=q.lastChild;j=m.a.la(q.lastChild.childNodes)}return j},m.a.Md=function(V,G){var j=m.a.ua(V,G);return j.length&&j[0].parentElement||m.a.Yb(j)},m.a.fc=function(V,G){if(m.a.Tb(V),G=m.a.f(G),G!==null&&G!==e)if(typeof G!="string"&&(G=G.toString()),o)o(V).html(G);else for(var j=m.a.ua(G,V.ownerDocument),W=0;W<j.length;W++)V.appendChild(j[W])}}(),m.b("utils.parseHtmlFragment",m.a.ua),m.b("utils.setHtml",m.a.fc),m.aa=function(){function S(p,I){if(p){if(p.nodeType==8){var O=m.aa.Uc(p.nodeValue);O!=null&&I.push({ud:p,Kd:O})}else if(p.nodeType==1)for(var O=0,F=p.childNodes,V=F.length;O<V;O++)S(F[O],I)}}var D={};return{Xb:function(p){if(typeof p!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var I=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return D[I]=p,"<!--[ko_memo:"+I+"]-->"},bd:function(p,I){var O=D[p];if(O===e)throw Error("Couldn't find any memo with ID "+p+". Perhaps it's already been unmemoized.");try{return O.apply(null,I||[]),!0}finally{delete D[p]}},cd:function(p,I){var O=[];S(p,O);for(var F=0,V=O.length;F<V;F++){var G=O[F].ud,j=[G];I&&m.a.Nb(j,I),m.aa.bd(O[F].Kd,j),G.nodeValue="",G.parentNode&&G.parentNode.removeChild(G)}},Uc:function(p){return(p=p.match(/^\[ko_memo\:(.*?)\]$/))?p[1]:null}}}(),m.b("memoization",m.aa),m.b("memoization.memoize",m.aa.Xb),m.b("memoization.unmemoize",m.aa.bd),m.b("memoization.parseMemoText",m.aa.Uc),m.b("memoization.unmemoizeDomNodeAndDescendants",m.aa.cd),m.na=function(){function S(){if(O){for(var G=O,j=0,W;V<O;)if(W=I[V++]){if(V>G){if(5e3<=++j){V=O,m.a.Gc(Error("'Too much recursion' after processing "+j+" task groups."));break}G=O}try{W()}catch(X){m.a.Gc(X)}}}}function D(){S(),V=O=I.length=0}var p,I=[],O=0,F=1,V=0;return t.MutationObserver?p=function(G){var j=n.createElement("div");return new MutationObserver(G).observe(j,{attributes:!0}),function(){j.classList.toggle("foo")}}(D):p=n&&"onreadystatechange"in n.createElement("script")?function(G){var j=n.createElement("script");j.onreadystatechange=function(){j.onreadystatechange=null,n.documentElement.removeChild(j),j=null,G()},n.documentElement.appendChild(j)}:function(G){setTimeout(G,0)},{scheduler:p,zb:function(G){return O||m.na.scheduler(D),I[O++]=G,F++},cancel:function(G){G=G-(F-O),G>=V&&G<O&&(I[G]=null)},resetForTesting:function(){var G=O-V;return V=O=I.length=0,G},Sd:S}}(),m.b("tasks",m.na),m.b("tasks.schedule",m.na.zb),m.b("tasks.runEarly",m.na.Sd),m.Ta={throttle:function(S,D){S.throttleEvaluation=D;var p=null;return m.$({read:S,write:function(I){clearTimeout(p),p=m.a.setTimeout(function(){S(I)},D)}})},rateLimit:function(S,D){var p,I,O;typeof D=="number"?p=D:(p=D.timeout,I=D.method),S.Hb=!1,O=typeof I=="function"?I:I=="notifyWhenChangesStop"?h:u,S.ub(function(F){return O(F,p,D)})},deferred:function(S,D){if(D!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");S.Hb||(S.Hb=!0,S.ub(function(p){var I,O=!1;return function(){if(!O){m.na.cancel(I),I=m.na.zb(p);try{O=!0,S.notifySubscribers(e,"dirty")}finally{O=!1}}}}))},notify:function(S,D){S.equalityComparer=D=="always"?null:l}};var b={undefined:1,boolean:1,number:1,string:1};m.b("extenders",m.Ta),m.ic=function(S,D,p){this.da=S,this.lc=D,this.mc=p,this.Ib=!1,this.fb=this.Jb=null,m.L(this,"dispose",this.s),m.L(this,"disposeWhenNodeIsRemoved",this.l)},m.ic.prototype.s=function(){this.Ib||(this.fb&&m.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},m.ic.prototype.l=function(S){this.Jb=S,m.a.K.za(S,this.fb=this.s.bind(this))},m.T=function(){m.a.Ab(this,T),T.qb(this)};var T={qb:function(S){S.U={change:[]},S.sc=1},subscribe:function(S,D,p){var I=this;p=p||"change";var O=new m.ic(I,D?S.bind(D):S,function(){m.a.Pa(I.U[p],O),I.hb&&I.hb(p)});return I.Qa&&I.Qa(p),I.U[p]||(I.U[p]=[]),I.U[p].push(O),O},notifySubscribers:function(S,D){if(D=D||"change",D==="change"&&this.Gb(),this.Wa(D)){var p=D==="change"&&this.ed||this.U[D].slice(0);try{m.u.xc();for(var I=0,O;O=p[I];++I)O.Ib||O.lc(S)}finally{m.u.end()}}},ob:function(){return this.sc},Dd:function(S){return this.ob()!==S},Gb:function(){++this.sc},ub:function(S){var D=this,p=m.O(D),I,O,F,V,G;D.gb||(D.gb=D.notifySubscribers,D.notifySubscribers=f);var j=S(function(){D.Ja=!1,p&&V===D&&(V=D.nc?D.nc():D());var W=O||G&&D.sb(F,V);G=O=I=!1,W&&D.gb(F=V)});D.qc=function(W,X){X&&D.Ja||(G=!X),D.ed=D.U.change.slice(0),D.Ja=I=!0,V=W,j()},D.pc=function(W){I||(F=W,D.gb(W,"beforeChange"))},D.rc=function(){G=!0},D.gd=function(){D.sb(F,D.v(!0))&&(O=!0)}},Wa:function(S){return this.U[S]&&this.U[S].length},Bd:function(S){if(S)return this.U[S]&&this.U[S].length||0;var D=0;return m.a.P(this.U,function(p,I){p!=="dirty"&&(D+=I.length)}),D},sb:function(S,D){return!this.equalityComparer||!this.equalityComparer(S,D)},toString:function(){return"[object Object]"},extend:function(S){var D=this;return S&&m.a.P(S,function(p,I){var O=m.Ta[p];typeof O=="function"&&(D=O(D,I)||D)}),D}};m.L(T,"init",T.qb),m.L(T,"subscribe",T.subscribe),m.L(T,"extend",T.extend),m.L(T,"getSubscriptionsCount",T.Bd),m.a.Ba&&m.a.setPrototypeOf(T,Function.prototype),m.T.fn=T,m.Qc=function(S){return S!=null&&typeof S.subscribe=="function"&&typeof S.notifySubscribers=="function"},m.b("subscribable",m.T),m.b("isSubscribable",m.Qc),m.S=m.u=function(){function S(F){p.push(I),I=F}function D(){I=p.pop()}var p=[],I,O=0;return{xc:S,end:D,cc:function(F){if(I){if(!m.Qc(F))throw Error("Only subscribable things can act as dependencies");I.od.call(I.pd,F,F.fd||(F.fd=++O))}},G:function(F,V,G){try{return S(),F.apply(V,G||[])}finally{D()}},qa:function(){if(I)return I.o.qa()},Va:function(){if(I)return I.o.Va()},Ya:function(){if(I)return I.Ya},o:function(){if(I)return I.o}}}(),m.b("computedContext",m.S),m.b("computedContext.getDependenciesCount",m.S.qa),m.b("computedContext.getDependencies",m.S.Va),m.b("computedContext.isInitial",m.S.Ya),m.b("computedContext.registerDependency",m.S.cc),m.b("ignoreDependencies",m.Yd=m.u.G);var x=m.a.Da("_latestValue");m.ta=function(S){function D(){return 0<arguments.length?(D.sb(D[x],arguments[0])&&(D.ya(),D[x]=arguments[0],D.xa()),this):(m.u.cc(D),D[x])}return D[x]=S,m.a.Ba||m.a.extend(D,m.T.fn),m.T.fn.qb(D),m.a.Ab(D,C),m.options.deferUpdates&&m.Ta.deferred(D,!0),D};var C={equalityComparer:l,v:function(){return this[x]},xa:function(){this.notifySubscribers(this[x],"spectate"),this.notifySubscribers(this[x])},ya:function(){this.notifySubscribers(this[x],"beforeChange")}};m.a.Ba&&m.a.setPrototypeOf(C,m.T.fn);var w=m.ta.Ma="__ko_proto__";C[w]=m.ta,m.O=function(S){if((S=typeof S=="function"&&S[w])&&S!==C[w]&&S!==m.o.fn[w])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!S},m.Za=function(S){return typeof S=="function"&&(S[w]===C[w]||S[w]===m.o.fn[w]&&S.Nc)},m.b("observable",m.ta),m.b("isObservable",m.O),m.b("isWriteableObservable",m.Za),m.b("isWritableObservable",m.Za),m.b("observable.fn",C),m.L(C,"peek",C.v),m.L(C,"valueHasMutated",C.xa),m.L(C,"valueWillMutate",C.ya),m.Ha=function(S){if(S=S||[],typeof S!="object"||!("length"in S))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return S=m.ta(S),m.a.Ab(S,m.Ha.fn),S.extend({trackArrayChanges:!0})},m.Ha.fn={remove:function(S){for(var D=this.v(),p=[],I=typeof S!="function"||m.O(S)?function(V){return V===S}:S,O=0;O<D.length;O++){var F=D[O];if(I(F)){if(p.length===0&&this.ya(),D[O]!==F)throw Error("Array modified during remove; cannot remove item");p.push(F),D.splice(O,1),O--}}return p.length&&this.xa(),p},removeAll:function(S){if(S===e){var D=this.v(),p=D.slice(0);return this.ya(),D.splice(0,D.length),this.xa(),p}return S?this.remove(function(I){return 0<=m.a.A(S,I)}):[]},destroy:function(S){var D=this.v(),p=typeof S!="function"||m.O(S)?function(F){return F===S}:S;this.ya();for(var I=D.length-1;0<=I;I--){var O=D[I];p(O)&&(O._destroy=!0)}this.xa()},destroyAll:function(S){return S===e?this.destroy(function(){return!0}):S?this.destroy(function(D){return 0<=m.a.A(S,D)}):[]},indexOf:function(S){var D=this();return m.a.A(D,S)},replace:function(S,D){var p=this.indexOf(S);0<=p&&(this.ya(),this.v()[p]=D,this.xa())},sorted:function(S){var D=this().slice(0);return S?D.sort(S):D.sort()},reversed:function(){return this().slice(0).reverse()}},m.a.Ba&&m.a.setPrototypeOf(m.Ha.fn,m.ta.fn),m.a.D("pop push reverse shift sort splice unshift".split(" "),function(S){m.Ha.fn[S]=function(){var D=this.v();this.ya(),this.zc(D,S,arguments);var p=D[S].apply(D,arguments);return this.xa(),p===D?this:p}}),m.a.D(["slice"],function(S){m.Ha.fn[S]=function(){var D=this();return D[S].apply(D,arguments)}}),m.Pc=function(S){return m.O(S)&&typeof S.remove=="function"&&typeof S.push=="function"},m.b("observableArray",m.Ha),m.b("isObservableArray",m.Pc),m.Ta.trackArrayChanges=function(S,D){function p(){function q(){if(G){var ee=[].concat(S.v()||[]),Y;S.Wa("arrayChange")&&((!O||1<G)&&(O=m.a.Pb(j,ee,S.Ob)),Y=O),j=ee,O=null,G=0,Y&&Y.length&&S.notifySubscribers(Y,"arrayChange")}}I?q():(I=!0,V=S.subscribe(function(){++G},null,"spectate"),j=[].concat(S.v()||[]),O=null,F=S.subscribe(q))}if(S.Ob={},D&&typeof D=="object"&&m.a.extend(S.Ob,D),S.Ob.sparse=!0,!S.zc){var I=!1,O=null,F,V,G=0,j,W=S.Qa,X=S.hb;S.Qa=function(q){W&&W.call(S,q),q==="arrayChange"&&p()},S.hb=function(q){X&&X.call(S,q),q!=="arrayChange"||S.Wa("arrayChange")||(F&&F.s(),V&&V.s(),V=F=null,I=!1,j=e)},S.zc=function(q,ee,Y){function ne(Ce,we,Pe){return Q[Q.length]={status:Ce,value:we,index:Pe}}if(I&&!G){var Q=[],le=q.length,pe=Y.length,re=0;switch(ee){case"push":re=le;case"unshift":for(ee=0;ee<pe;ee++)ne("added",Y[ee],re+ee);break;case"pop":re=le-1;case"shift":le&&ne("deleted",q[re],re);break;case"splice":ee=Math.min(Math.max(0,0>Y[0]?le+Y[0]:Y[0]),le);for(var le=pe===1?le:Math.min(ee+(Y[1]||0),le),pe=ee+pe-2,re=Math.max(le,pe),de=[],fe=[],ye=2;ee<re;++ee,++ye)ee<le&&fe.push(ne("deleted",q[ee],ee)),ee<pe&&de.push(ne("added",Y[ye],ee));m.a.Kc(fe,de);break;default:return}O=Q}}}};var v=m.a.Da("_state");m.o=m.$=function(S,D,p){function I(){if(0<arguments.length){if(typeof O=="function")O.apply(F.nb,arguments);else 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 this}return F.ra||m.u.cc(I),(F.ka||F.J&&I.Xa())&&I.ha(),F.X}if(typeof S=="object"?p=S:(p=p||{},S&&(p.read=S)),typeof p.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var O=p.write,F={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:p.read,nb:D||p.owner,l:p.disposeWhenNodeIsRemoved||p.l||null,Sa:p.disposeWhen||p.Sa,Rb:null,I:{},V:0,Ic:null};return I[v]=F,I.Nc=typeof O=="function",m.a.Ba||m.a.extend(I,m.T.fn),m.T.fn.qb(I),m.a.Ab(I,P),p.pure?(F.wb=!0,F.J=!0,m.a.extend(I,N)):p.deferEvaluation&&m.a.extend(I,k),m.options.deferUpdates&&m.Ta.deferred(I,!0),F.l&&(F.jc=!0,F.l.nodeType||(F.l=null)),F.J||p.deferEvaluation||I.ha(),F.l&&I.ja()&&m.a.K.za(F.l,F.Rb=function(){I.s()}),I};var P={equalityComparer:l,qa:function(){return this[v].V},Va:function(){var S=[];return m.a.P(this[v].I,function(D,p){S[p.Ka]=p.da}),S},Vb:function(S){if(!this[v].V)return!1;var D=this.Va();return m.a.A(D,S)!==-1?!0:!!m.a.Lb(D,function(p){return p.Vb&&p.Vb(S)})},uc:function(S,D,p){if(this[v].wb&&D===this)throw Error("A 'pure' computed must not be called recursively");this[v].I[S]=p,p.Ka=this[v].V++,p.La=D.ob()},Xa:function(){var S,D,p=this[v].I;for(S in p)if(Object.prototype.hasOwnProperty.call(p,S)&&(D=p[S],this.Ia&&D.da.Ja||D.da.Dd(D.La)))return!0},Jd:function(){this.Ia&&!this[v].rb&&this.Ia(!1)},ja:function(){var S=this[v];return S.ka||0<S.V},Rd:function(){this.Ja?this[v].ka&&(this[v].sa=!0):this.Hc()},$c:function(S){if(S.Hb){var D=S.subscribe(this.Jd,this,"dirty"),p=S.subscribe(this.Rd,this);return{da:S,s:function(){D.s(),p.s()}}}return S.subscribe(this.Hc,this)},Hc:function(){var S=this,D=S.throttleEvaluation;D&&0<=D?(clearTimeout(this[v].Ic),this[v].Ic=m.a.setTimeout(function(){S.ha(!0)},D)):S.Ia?S.Ia(!0):S.ha(!0)},ha:function(S){var D=this[v],p=D.Sa,I=!1;if(!D.rb&&!D.ra){if(D.l&&!m.a.Sb(D.l)||p&&p()){if(!D.jc){this.s();return}}else D.jc=!1;D.rb=!0;try{I=this.zd(S)}finally{D.rb=!1}return I}},zd:function(S){var D=this[v],I=!1,p=D.wb?e:!D.V,I={qd:this,mb:D.I,Qb:D.V};m.u.xc({pd:I,od:g,o:this,Ya:p}),D.I={},D.V=0;var O=this.yd(D,I);return D.V?I=this.sb(D.X,O):(this.s(),I=!0),I&&(D.J?this.Gb():this.notifySubscribers(D.X,"beforeChange"),D.X=O,this.notifySubscribers(D.X,"spectate"),!D.J&&S&&this.notifySubscribers(D.X),this.rc&&this.rc()),p&&this.notifySubscribers(D.X,"awake"),I},yd:function(S,D){try{var p=S.Wc;return S.nb?p.call(S.nb):p()}finally{m.u.end(),D.Qb&&!S.J&&m.a.P(D.mb,_),S.sa=S.ka=!1}},v:function(S){var D=this[v];return(D.ka&&(S||!D.V)||D.J&&this.Xa())&&this.ha(),D.X},ub:function(S){m.T.fn.ub.call(this,S),this.nc=function(){return this[v].J||(this[v].sa?this.ha():this[v].ka=!1),this[v].X},this.Ia=function(D){this.pc(this[v].X),this[v].ka=!0,D&&(this[v].sa=!0),this.qc(this,!D)}},s:function(){var S=this[v];!S.J&&S.I&&m.a.P(S.I,function(D,p){p.s&&p.s()}),S.l&&S.Rb&&m.a.K.yb(S.l,S.Rb),S.I=e,S.V=0,S.ra=!0,S.sa=!1,S.ka=!1,S.J=!1,S.l=e,S.Sa=e,S.Wc=e,this.Nc||(S.nb=e)}},N={Qa:function(S){var D=this,p=D[v];if(!p.ra&&p.J&&S=="change"){if(p.J=!1,p.sa||D.Xa())p.I=null,p.V=0,D.ha()&&D.Gb();else{var I=[];m.a.P(p.I,function(O,F){I[F.Ka]=O}),m.a.D(I,function(O,F){var V=p.I[O],G=D.$c(V.da);G.Ka=F,G.La=V.La,p.I[O]=G}),D.Xa()&&D.ha()&&D.Gb()}p.ra||D.notifySubscribers(p.X,"awake")}},hb:function(S){var D=this[v];D.ra||S!="change"||this.Wa("change")||(m.a.P(D.I,function(p,I){I.s&&(D.I[p]={da:I.da,Ka:I.Ka,La:I.La},I.s())}),D.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var S=this[v];return S.J&&(S.sa||this.Xa())&&this.ha(),m.T.fn.ob.call(this)}},k={Qa:function(S){S!="change"&&S!="beforeChange"||this.v()}};m.a.Ba&&m.a.setPrototypeOf(P,m.T.fn);var M=m.ta.Ma;P[M]=m.o,m.Oc=function(S){return typeof S=="function"&&S[M]===P[M]},m.Fd=function(S){return m.Oc(S)&&S[v]&&S[v].wb},m.b("computed",m.o),m.b("dependentObservable",m.o),m.b("isComputed",m.Oc),m.b("isPureComputed",m.Fd),m.b("computed.fn",P),m.L(P,"peek",P.v),m.L(P,"dispose",P.s),m.L(P,"isActive",P.ja),m.L(P,"getDependenciesCount",P.qa),m.L(P,"getDependencies",P.Va),m.xb=function(S,D){return typeof S=="function"?m.o(S,D,{pure:!0}):(S=m.a.extend({},S),S.pure=!0,m.o(S,D))},m.b("pureComputed",m.xb),function(){function S(I,O,F){if(F=F||new p,I=O(I),typeof I!="object"||I===null||I===e||I instanceof RegExp||I instanceof Date||I instanceof String||I instanceof Number||I instanceof Boolean)return I;var V=I instanceof Array?[]:{};return F.save(I,V),D(I,function(G){var j=O(I[G]);switch(typeof j){case"boolean":case"number":case"string":case"function":V[G]=j;break;case"object":case"undefined":var W=F.get(j);V[G]=W!==e?W:S(j,O,F)}}),V}function D(I,O){if(I instanceof Array){for(var F=0;F<I.length;F++)O(F);typeof I.toJSON=="function"&&O("toJSON")}else for(F in I)O(F)}function p(){this.keys=[],this.values=[]}m.ad=function(I){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return S(I,function(O){for(var F=0;m.O(O)&&10>F;F++)O=O();return O})},m.toJSON=function(I,O,F){return I=m.ad(I),m.a.hc(I,O,F)},p.prototype={constructor:p,save:function(I,O){var F=m.a.A(this.keys,I);0<=F?this.values[F]=O:(this.keys.push(I),this.values.push(O))},get:function(I){return I=m.a.A(this.keys,I),0<=I?this.values[I]:e}}}(),m.b("toJS",m.ad),m.b("toJSON",m.toJSON),m.Wd=function(S,D,p){function I(O){var F=m.xb(S,p).extend({ma:"always"}),V=F.subscribe(function(G){G&&(V.s(),O(G))});return F.notifySubscribers(F.v()),V}return typeof Promise!="function"||D?I(D.bind(p)):new Promise(I)},m.b("when",m.Wd),function(){m.w={M:function(S){switch(m.a.R(S)){case"option":return S.__ko__hasDomDataOptionValue__===!0?m.a.g.get(S,m.c.options.$b):7>=m.a.W?S.getAttributeNode("value")&&S.getAttributeNode("value").specified?S.value:S.text:S.value;case"select":return 0<=S.selectedIndex?m.w.M(S.options[S.selectedIndex]):e;default:return S.value}},cb:function(S,D,p){switch(m.a.R(S)){case"option":typeof D=="string"?(m.a.g.set(S,m.c.options.$b,e),"__ko__hasDomDataOptionValue__"in S&&delete S.__ko__hasDomDataOptionValue__,S.value=D):(m.a.g.set(S,m.c.options.$b,D),S.__ko__hasDomDataOptionValue__=!0,S.value=typeof D=="number"?D:"");break;case"select":(D===""||D===null)&&(D=e);for(var I=-1,O=0,F=S.options.length,V;O<F;++O)if(V=m.w.M(S.options[O]),V==D||V===""&&D===e){I=O;break}(p||0<=I||D===e&&1<S.size)&&(S.selectedIndex=I,m.a.W===6&&m.a.setTimeout(function(){S.selectedIndex=I},0));break;default:(D===null||D===e)&&(D=""),S.value=D}}}}(),m.b("selectExtensions",m.w),m.b("selectExtensions.readValue",m.w.M),m.b("selectExtensions.writeValue",m.w.cb),m.m=function(){function S(G){G=m.a.Db(G),G.charCodeAt(0)===123&&(G=G.slice(1,-1)),G+=` ,`;var j=[],W=G.match(I),X,q=[],ee=0;if(1<W.length){for(var Y=0,ne;ne=W[Y];++Y){var Q=ne.charCodeAt(0);if(Q===44){if(0>=ee){j.push(X&&q.length?{key:X,value:q.join("")}:{unknown:X||q.join("")}),X=ee=0,q=[];continue}}else if(Q===58){if(!ee&&!X&&q.length===1){X=q.pop();continue}}else{if(Q===47&&1<ne.length&&(ne.charCodeAt(1)===47||ne.charCodeAt(1)===42))continue;Q===47&&Y&&1<ne.length?(Q=W[Y-1].match(O))&&!F[Q[0]]&&(G=G.substr(G.indexOf(ne)+1),W=G.match(I),Y=-1,ne="/"):Q===40||Q===123||Q===91?++ee:Q===41||Q===125||Q===93?--ee:X||q.length||Q!==34&&Q!==39||(ne=ne.slice(1,-1))}q.push(ne)}if(0<ee)throw Error("Unbalanced parentheses, braces, or brackets")}return j}var D=["true","false","null","undefined"],p=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,I=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.* |/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),O=/[\])"'A-Za-z0-9_$]+$/,F={in:1,return:1,typeof:1},V={};return{Ra:[],wa:V,ac:S,vb:function(G,j){function W(Q,le){var pe;if(!Y){var re=m.getBindingHandler(Q);if(re&&re.preprocess&&!(le=re.preprocess(le,Q,W)))return;(re=V[Q])&&(pe=le,0<=m.a.A(D,pe)?pe=!1:(re=pe.match(p),pe=re===null?!1:re[1]?"Object("+re[1]+")"+re[2]:pe),re=pe),re&&q.push("'"+(typeof V[Q]=="string"?V[Q]:Q)+"':function(_z){"+pe+"=_z}")}ee&&(le="function(){return "+le+" }"),X.push("'"+Q+"':"+le)}j=j||{};var X=[],q=[],ee=j.valueAccessors,Y=j.bindingParams,ne=typeof G=="string"?S(G):G;return m.a.D(ne,function(Q){W(Q.key||Q.unknown,Q.value)}),q.length&&W("_ko_property_writers","{"+q.join(",")+" }"),X.join(",")},Id:function(G,j){for(var W=0;W<G.length;W++)if(G[W].key==j)return!0;return!1},eb:function(G,j,W,X,q){G&&m.O(G)?!m.Za(G)||q&&G.v()===X||G(X):(G=j.get("_ko_property_writers"))&&G[W]&&G[W](X)}}}(),m.b("expressionRewriting",m.m),m.b("expressionRewriting.bindingRewriteValidators",m.m.Ra),m.b("expressionRewriting.parseObjectLiteral",m.m.ac),m.b("expressionRewriting.preProcessBindings",m.m.vb),m.b("expressionRewriting._twoWayBindings",m.m.wa),m.b("jsonExpressionRewriting",m.m),m.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",m.m.vb),function(){function S(W){return W.nodeType==8&&F.test(O?W.text:W.nodeValue)}function D(W){return W.nodeType==8&&V.test(O?W.text:W.nodeValue)}function p(W,X){for(var q=W,ee=1,Y=[];q=q.nextSibling;){if(D(q)&&(m.a.g.set(q,j,!0),ee--,ee===0))return Y;Y.push(q),S(q)&&ee++}if(!X)throw Error("Cannot find closing comment tag to match: "+W.nodeValue);return null}function I(W,X){var q=p(W,X);return q?0<q.length?q[q.length-1].nextSibling:W.nextSibling:null}var O=n&&n.createComment("test").text==="<!--test-->",F=O?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,V=O?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,G={ul:!0,ol:!0},j="__ko_matchedEndComment__";m.h={ea:{},childNodes:function(W){return S(W)?p(W):W.childNodes},Ea:function(W){if(S(W)){W=m.h.childNodes(W);for(var X=0,q=W.length;X<q;X++)m.removeNode(W[X])}else m.a.Tb(W)},va:function(W,X){if(S(W)){m.h.Ea(W);for(var q=W.nextSibling,ee=0,Y=X.length;ee<Y;ee++)q.parentNode.insertBefore(X[ee],q)}else m.a.va(W,X)},Vc:function(W,X){var q;S(W)?(q=W.nextSibling,W=W.parentNode):q=W.firstChild,q?X!==q&&W.insertBefore(X,q):W.appendChild(X)},Wb:function(W,X,q){q?(q=q.nextSibling,S(W)&&(W=W.parentNode),q?X!==q&&W.insertBefore(X,q):W.appendChild(X)):m.h.Vc(W,X)},firstChild:function(W){if(S(W))return!W.nextSibling||D(W.nextSibling)?null:W.nextSibling;if(W.firstChild&&D(W.firstChild))throw Error("Found invalid end comment, as the first child of "+W);return W.firstChild},nextSibling:function(W){if(S(W)&&(W=I(W)),W.nextSibling&&D(W.nextSibling)){var X=W.nextSibling;if(D(X)&&!m.a.g.get(X,j))throw Error("Found end comment without a matching opening comment, as child of "+W);return null}return W.nextSibling},Cd:S,Vd:function(W){return(W=(O?W.text:W.nodeValue).match(F))?W[1]:null},Sc:function(W){if(G[m.a.R(W)]){var X=W.firstChild;if(X)do if(X.nodeType===1){var q;q=X.firstChild;var ee=null;if(q)do if(ee)ee.push(q);else if(S(q)){var Y=I(q,!0);Y?q=Y:ee=[q]}else D(q)&&(ee=[q]);while(q=q.nextSibling);if(q=ee)for(ee=X.nextSibling,Y=0;Y<q.length;Y++)ee?W.insertBefore(q[Y],ee):W.appendChild(q[Y])}while(X=X.nextSibling)}}}}(),m.b("virtualElements",m.h),m.b("virtualElements.allowedBindings",m.h.ea),m.b("virtualElements.emptyNode",m.h.Ea),m.b("virtualElements.insertAfter",m.h.Wb),m.b("virtualElements.prepend",m.h.Vc),m.b("virtualElements.setDomNodeChildren",m.h.va),function(){m.ga=function(){this.nd={}},m.a.extend(m.ga.prototype,{nodeHasBindings:function(S){switch(S.nodeType){case 1:return S.getAttribute("data-bind")!=null||m.j.getComponentNameForNode(S);case 8:return m.h.Cd(S);default:return!1}},getBindings:function(S,D){var p=this.getBindingsString(S,D),p=p?this.parseBindingsString(p,D,S):null;return m.j.tc(p,S,D,!1)},getBindingAccessors:function(S,D){var p=this.getBindingsString(S,D),p=p?this.parseBindingsString(p,D,S,{valueAccessors:!0}):null;return m.j.tc(p,S,D,!0)},getBindingsString:function(S){switch(S.nodeType){case 1:return S.getAttribute("data-bind");case 8:return m.h.Vd(S);default:return null}},parseBindingsString:function(S,D,p,I){try{var O=this.nd,F=S+(I&&I.valueAccessors||""),V;if(!(V=O[F])){var G,j="with($context){with($data||{}){return{"+m.m.vb(S,I)+"}}}";G=new Function("$context","$element",j),V=O[F]=G}return V(D,p)}catch(W){throw W.message=`Unable to parse bindings. Bindings value: `+S+` Message: `+W.message,W}}}),m.ga.instance=new m.ga}(),m.b("bindingProvider",m.ga),function(){function S(re){var de=(re=m.a.g.get(re,pe))&&re.N;de&&(re.N=null,de.Tc())}function D(re,de,fe){this.node=re,this.yc=de,this.kb=[],this.H=!1,de.N||m.a.K.za(re,S),fe&&fe.N&&(fe.N.kb.push(re),this.Kb=fe)}function p(re){return function(){return re}}function I(re){return re()}function O(re){return m.a.Ga(m.u.G(re),function(de,fe){return function(){return re()[fe]}})}function F(re,de,fe){return typeof re=="function"?O(re.bind(null,de,fe)):m.a.Ga(re,p)}function V(re,de){return O(this.getBindings.bind(this,re,de))}function G(re,de){var fe=m.h.firstChild(de);if(fe){var ye,Ce=m.ga.instance,we=Ce.preprocessNode;if(we){for(;ye=fe;)fe=m.h.nextSibling(ye),we.call(Ce,ye);fe=m.h.firstChild(de)}for(;ye=fe;)fe=m.h.nextSibling(ye),j(re,ye)}m.i.ma(de,m.i.H)}function j(re,de){var fe=re,ye=de.nodeType===1;ye&&m.h.Sc(de),(ye||m.ga.instance.nodeHasBindings(de))&&(fe=X(de,null,re).bindingContextForDescendants),fe&&!Q[m.a.R(de)]&&G(fe,de)}function W(re){var de=[],fe={},ye=[];return m.a.P(re,function Ce(we){if(!fe[we]){var Pe=m.getBindingHandler(we);Pe&&(Pe.after&&(ye.push(we),m.a.D(Pe.after,function(lt){if(re[lt]){if(m.a.A(ye,lt)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+ye.join(", "));Ce(lt)}}),ye.length--),de.push({key:we,Mc:Pe})),fe[we]=!0}}),de}function X(re,de,fe){var ye=m.a.g.Ub(re,pe,{}),Ce=ye.hd;if(!de){if(Ce)throw Error("You cannot apply bindings multiple times to the same element.");ye.hd=!0}Ce||(ye.context=fe),ye.Zb||(ye.Zb={});var we;if(de&&typeof de!="function")we=de;else{var Pe=m.ga.instance,lt=Pe.getBindingAccessors||V,ft=m.$(function(){return(we=de?de(fe,re):lt.call(Pe,re,fe))&&(fe[ee]&&fe[ee](),fe[ne]&&fe[ne]()),we},null,{l:re});we&&ft.ja()||(ft=null)}var We=fe,Fe;if(we){var Dt=function(){return m.a.Ga(ft?ft():we,I)},st=ft?function(et){return function(){return I(ft()[et])}}:function(et){return we[et]};Dt.get=function(et){return we[et]&&I(st(et))},Dt.has=function(et){return et in we},m.i.H in we&&m.i.subscribe(re,m.i.H,function(){var et=(0,we[m.i.H])();if(et){var hn=m.h.childNodes(re);hn.length&&et(hn,m.Ec(hn[0]))}}),m.i.pa in we&&(We=m.i.Cb(re,fe),m.i.subscribe(re,m.i.pa,function(){var et=(0,we[m.i.pa])();et&&m.h.firstChild(re)&&et(re)})),ye=W(we),m.a.D(ye,function(et){var hn=et.Mc.init,ot=et.Mc.update,at=et.key;if(re.nodeType===8&&!m.h.ea[at])throw Error("The binding '"+at+"' cannot be used with virtual elements");try{typeof hn=="function"&&m.u.G(function(){var Xt=hn(re,st(at),Dt,We.$data,We);if(Xt&&Xt.controlsDescendantBindings){if(Fe!==e)throw Error("Multiple bindings ("+Fe+" and "+at+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Fe=at}}),typeof ot=="function"&&m.$(function(){ot(re,st(at),Dt,We.$data,We)},null,{l:re})}catch(Xt){throw Xt.message='Unable to process binding "'+at+": "+we[at]+`" Message: `+Xt.message,Xt}})}return ye=Fe===e,{shouldBindDescendants:ye,bindingContextForDescendants:ye&&We}}function q(re,de){return re&&re instanceof m.fa?re:new m.fa(re,e,e,de)}var ee=m.a.Da("_subscribable"),Y=m.a.Da("_ancestorBindingInfo"),ne=m.a.Da("_dataDependency");m.c={};var Q={script:!0,textarea:!0,template:!0};m.getBindingHandler=function(re){return m.c[re]};var le={};m.fa=function(re,de,fe,ye,Ce){function we(){var st=We?ft():ft,et=m.a.f(st);return de?(m.a.extend(Pe,de),Y in de&&(Pe[Y]=de[Y])):(Pe.$parents=[],Pe.$root=et,Pe.ko=m),Pe[ee]=Fe,lt?et=Pe.$data:(Pe.$rawData=st,Pe.$data=et),fe&&(Pe[fe]=et),ye&&ye(Pe,de,et),de&&de[ee]&&!m.S.o().Vb(de[ee])&&de[ee](),Dt&&(Pe[ne]=Dt),Pe.$data}var Pe=this,lt=re===le,ft=lt?e:re,We=typeof ft=="function"&&!m.O(ft),Fe,Dt=Ce&&Ce.dataDependency;Ce&&Ce.exportDependencies?we():(Fe=m.xb(we),Fe.v(),Fe.ja()?Fe.equalityComparer=null:Pe[ee]=e)},m.fa.prototype.createChildContext=function(re,de,fe,ye){if(!ye&&de&&typeof de=="object"&&(ye=de,de=ye.as,fe=ye.extend),de&&ye&&ye.noChildContext){var Ce=typeof re=="function"&&!m.O(re);return new m.fa(le,this,null,function(we){fe&&fe(we),we[de]=Ce?re():re},ye)}return new m.fa(re,this,de,function(we,Pe){we.$parentContext=Pe,we.$parent=Pe.$data,we.$parents=(Pe.$parents||[]).slice(0),we.$parents.unshift(we.$parent),fe&&fe(we)},ye)},m.fa.prototype.extend=function(re,de){return new m.fa(le,this,null,function(fe){m.a.extend(fe,typeof re=="function"?re(fe):re)},de)};var pe=m.a.g.Z();D.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},D.prototype.sd=function(re){m.a.Pa(this.kb,re),!this.kb.length&&this.H&&this.Cc()},D.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,m.a.K.yb(this.node,S),m.i.ma(this.node,m.i.pa),this.Tc())},m.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(re,de,fe,ye,Ce){var we=m.a.g.Ub(re,pe,{});return we.Fa||(we.Fa=new m.T),Ce&&Ce.notifyImmediately&&we.Zb[de]&&m.u.G(fe,ye,[re]),we.Fa.subscribe(fe,ye,de)},ma:function(re,de){var fe=m.a.g.get(re,pe);if(fe&&(fe.Zb[de]=!0,fe.Fa&&fe.Fa.notifySubscribers(re,de),de==m.i.H)){if(fe.N)fe.N.Cc();else if(fe.N===e&&fe.Fa&&fe.Fa.Wa(m.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(re,de){var fe=m.a.g.Ub(re,pe,{});return fe.N||(fe.N=new D(re,fe,de[Y])),de[Y]==fe?de:de.extend(function(ye){ye[Y]=fe})}},m.Td=function(re){return(re=m.a.g.get(re,pe))&&re.context},m.ib=function(re,de,fe){return re.nodeType===1&&m.h.Sc(re),X(re,de,q(fe))},m.ld=function(re,de,fe){return fe=q(fe),m.ib(re,F(de,fe,re),fe)},m.Oa=function(re,de){de.nodeType!==1&&de.nodeType!==8||G(q(re),de)},m.vc=function(re,de,fe){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(de=n.body,!de)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!de||de.nodeType!==1&&de.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");j(q(re,fe),de)},m.Dc=function(re){return!re||re.nodeType!==1&&re.nodeType!==8?e:m.Td(re)},m.Ec=function(re){return(re=m.Dc(re))?re.$data:e},m.b("bindingHandlers",m.c),m.b("bindingEvent",m.i),m.b("bindingEvent.subscribe",m.i.subscribe),m.b("bindingEvent.startPossiblyAsyncContentBinding",m.i.Cb),m.b("applyBindings",m.vc),m.b("applyBindingsToDescendants",m.Oa),m.b("applyBindingAccessorsToNode",m.ib),m.b("applyBindingsToNode",m.ld),m.b("contextFor",m.Dc),m.b("dataFor",m.Ec)}(),function(S){function D(V,G){var j=Object.prototype.hasOwnProperty.call(O,V)?O[V]:S,W;j?j.subscribe(G):(j=O[V]=new m.T,j.subscribe(G),p(V,function(X,q){var ee=!(!q||!q.synchronous);F[V]={definition:X,Gd:ee},delete O[V],W||ee?j.notifySubscribers(X):m.na.zb(function(){j.notifySubscribers(X)})}),W=!0)}function p(V,G){I("getConfig",[V],function(j){j?I("loadComponent",[V,j],function(W){G(W,j)}):G(null,null)})}function I(V,G,j,W){W||(W=m.j.loaders.slice(0));var X=W.shift();if(X){var q=X[V];if(q){var ee=!1;if(q.apply(X,G.concat(function(Y){ee?j(null):Y!==null?j(Y):I(V,G,j,W)}))!==S&&(ee=!0,!X.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else I(V,G,j,W)}else j(null)}var O={},F={};m.j={get:function(V,G){var j=Object.prototype.hasOwnProperty.call(F,V)?F[V]:S;j?j.Gd?m.u.G(function(){G(j.definition)}):m.na.zb(function(){G(j.definition)}):D(V,G)},Bc:function(V){delete F[V]},oc:I},m.j.loaders=[],m.b("components",m.j),m.b("components.get",m.j.get),m.b("components.clearCachedDefinition",m.j.Bc)}(),function(){function S(j,W,X,q){function ee(){--ne===0&&q(Y)}var Y={},ne=2,Q=X.template;X=X.viewModel,Q?O(W,Q,function(le){m.j.oc("loadTemplate",[j,le],function(pe){Y.template=pe,ee()})}):ee(),X?O(W,X,function(le){m.j.oc("loadViewModel",[j,le],function(pe){Y[G]=pe,ee()})}):ee()}function D(j,W,X){if(typeof W=="function")X(function(ee){return new W(ee)});else if(typeof W[G]=="function")X(W[G]);else if("instance"in W){var q=W.instance;X(function(){return q})}else"viewModel"in W?D(j,W.viewModel,X):j("Unknown viewModel value: "+W)}function p(j){switch(m.a.R(j)){case"script":return m.a.ua(j.text);case"textarea":return m.a.ua(j.value);case"template":if(I(j.content))return m.a.Ca(j.content.childNodes)}return m.a.Ca(j.childNodes)}function I(j){return t.DocumentFragment?j instanceof DocumentFragment:j&&j.nodeType===11}function O(j,W,X){typeof W.require=="string"?a||t.require?(a||t.require)([W.require],function(q){q&&typeof q=="object"&&q.Xd&&q.default&&(q=q.default),X(q)}):j("Uses require, but no AMD loader is present"):X(W)}function F(j){return function(W){throw Error("Component '"+j+"': "+W)}}var V={};m.j.register=function(j,W){if(!W)throw Error("Invalid configuration for "+j);if(m.j.tb(j))throw Error("Component "+j+" is already registered");V[j]=W},m.j.tb=function(j){return Object.prototype.hasOwnProperty.call(V,j)},m.j.unregister=function(j){delete V[j],m.j.Bc(j)},m.j.Fc={getConfig:function(j,W){W(m.j.tb(j)?V[j]:null)},loadComponent:function(j,W,X){var q=F(j);O(q,W,function(ee){S(j,q,ee,X)})},loadTemplate:function(j,W,X){if(j=F(j),typeof W=="string")X(m.a.ua(W));else if(W instanceof Array)X(W);else if(I(W))X(m.a.la(W.childNodes));else if(W.element)if(W=W.element,t.HTMLElement?W instanceof HTMLElement:W&&W.tagName&&W.nodeType===1)X(p(W));else if(typeof W=="string"){var q=n.getElementById(W);q?X(p(q)):j("Cannot find element with ID "+W)}else j("Unknown element type: "+W);else j("Unknown template value: "+W)},loadViewModel:function(j,W,X){D(F(j),W,X)}};var G="createViewModel";m.b("components.register",m.j.register),m.b("components.isRegistered",m.j.tb),m.b("components.unregister",m.j.unregister),m.b("components.defaultLoader",m.j.Fc),m.j.loaders.push(m.j.Fc),m.j.dd=V}(),function(){function S(p,I){var O=p.getAttribute("params");if(O){var O=D.parseBindingsString(O,I,p,{valueAccessors:!0,bindingParams:!0}),O=m.a.Ga(O,function(G){return m.o(G,null,{l:p})}),F=m.a.Ga(O,function(G){var j=G.v();return G.ja()?m.o({read:function(){return m.a.f(G())},write:m.Za(j)&&function(W){G()(W)},l:p}):j});return Object.prototype.hasOwnProperty.call(F,"$raw")||(F.$raw=O),F}return{$raw:{}}}m.j.getComponentNameForNode=function(p){var I=m.a.R(p);if(m.j.tb(I)&&(I.indexOf("-")!=-1||""+p=="[object HTMLUnknownElement]"||8>=m.a.W&&p.tagName===I))return I},m.j.tc=function(p,I,O,F){if(I.nodeType===1){var V=m.j.getComponentNameForNode(I);if(V){if(p=p||{},p.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var G={name:V,params:S(I,O)};p.component=F?function(){return G}:G}}return p};var D=new m.ga;9>m.a.W&&(m.j.register=function(p){return function(I){return p.apply(this,arguments)}}(m.j.register),n.createDocumentFragment=function(p){return function(){var I=p();return m.j.dd,I}}(n.createDocumentFragment))}(),function(){function S(I,O,F){if(O=O.template,!O)throw Error("Component '"+I+"' has no template");I=m.a.Ca(O),m.h.va(F,I)}function D(I,O,F){var V=I.createViewModel;return V?V.call(I,O,F):O}var p=0;m.c.component={init:function(I,O,F,V,G){function j(){var Y=W&&W.dispose;typeof Y=="function"&&Y.call(W),q&&q.s(),X=W=q=null}var W,X,q,ee=m.a.la(m.h.childNodes(I));return m.h.Ea(I),m.a.K.za(I,j),m.o(function(){var Y=m.a.f(O()),ne,Q;if(typeof Y=="string"?ne=Y:(ne=m.a.f(Y.name),Q=m.a.f(Y.params)),!ne)throw Error("No component name specified");var le=m.i.Cb(I,G),pe=X=++p;m.j.get(ne,function(re){if(X===pe){if(j(),!re)throw Error("Unknown component '"+ne+"'");S(ne,re,I);var de=D(re,Q,{element:I,templateNodes:ee});re=le.createChildContext(de,{extend:function(fe){fe.$component=de,fe.$componentTemplateNodes=ee}}),de&&de.koDescendantsComplete&&(q=m.i.subscribe(I,m.i.pa,de.koDescendantsComplete,de)),W=de,m.Oa(re,I)}})},null,{l:I}),{controlsDescendantBindings:!0}}},m.h.ea.component=!0}();var U={class:"className",for:"htmlFor"};m.c.attr={update:function(S,D){var p=m.a.f(D())||{};m.a.P(p,function(I,O){O=m.a.f(O);var F=I.indexOf(":"),F="lookupNamespaceURI"in S&&0<F&&S.lookupNamespaceURI(I.substr(0,F)),V=O===!1||O===null||O===e;V?F?S.removeAttributeNS(F,I):S.removeAttribute(I):O=O.toString(),8>=m.a.W&&I in U?(I=U[I],V?S.removeAttribute(I):S[I]=O):V||(F?S.setAttributeNS(F,I,O):S.setAttribute(I,O)),I==="name"&&m.a.Yc(S,V?"":O)})}},function(){m.c.checked={after:["value","attr"],init:function(S,D,p){function I(){var Y=S.checked,ne=F();if(!m.S.Ya()&&(Y||!G&&!m.S.qa())){var Q=m.u.G(D);if(W){var le=X?Q.v():Q,pe=ee;ee=ne,pe!==ne?Y&&(m.a.Na(le,ne,!0),m.a.Na(le,pe,!1)):m.a.Na(le,ne,Y),X&&m.Za(Q)&&Q(le)}else V&&(ne===e?ne=Y:Y||(ne=e)),m.m.eb(Q,p,"checked",ne,!0)}}function O(){var Y=m.a.f(D()),ne=F();W?(S.checked=0<=m.a.A(Y,ne),ee=ne):S.checked=V&&ne===e?!!Y:F()===Y}var F=m.xb(function(){if(p.has("checkedValue"))return m.a.f(p.get("checkedValue"));if(q)return p.has("value")?m.a.f(p.get("value")):S.value}),V=S.type=="checkbox",G=S.type=="radio";if(V||G){var j=D(),W=V&&m.a.f(j)instanceof Array,X=!(W&&j.push&&j.splice),q=G||W,ee=W?F():e;G&&!S.name&&m.c.uniqueName.init(S,function(){return!0}),m.o(I,null,{l:S}),m.a.B(S,"click",I),m.o(O,null,{l:S}),j=e}}},m.m.wa.checked=!0,m.c.checkedValue={update:function(S,D){S.value=m.a.f(D())}}}(),m.c.class={update:function(S,D){var p=m.a.Db(m.a.f(D()));m.a.Eb(S,S.__ko__cssValue,!1),S.__ko__cssValue=p,m.a.Eb(S,p,!0)}},m.c.css={update:function(S,D){var p=m.a.f(D());p!==null&&typeof p=="object"?m.a.P(p,function(I,O){O=m.a.f(O),m.a.Eb(S,I,O)}):m.c.class.update(S,D)}},m.c.enable={update:function(S,D){var p=m.a.f(D());p&&S.disabled?S.removeAttribute("disabled"):p||S.disabled||(S.disabled=!0)}},m.c.disable={update:function(S,D){m.c.enable.update(S,function(){return!m.a.f(D())})}},m.c.event={init:function(S,D,p,I,O){var F=D()||{};m.a.P(F,function(V){typeof V=="string"&&m.a.B(S,V,function(G){var j,W=D()[V];if(W){try{var X=m.a.la(arguments);I=O.$data,X.unshift(I),j=W.apply(I,X)}finally{j!==!0&&(G.preventDefault?G.preventDefault():G.returnValue=!1)}p.get(V+"Bubble")===!1&&(G.cancelBubble=!0,G.stopPropagation&&G.stopPropagation())}})})}},m.c.foreach={Rc:function(S){return function(){var D=S(),p=m.a.bc(D);return!p||typeof p.length=="number"?{foreach:D,templateEngine:m.ba.Ma}:(m.a.f(D),{foreach:p.data,as:p.as,noChildContext:p.noChildContext,includeDestroyed:p.includeDestroyed,afterAdd:p.afterAdd,beforeRemove:p.beforeRemove,afterRender:p.afterRender,beforeMove:p.beforeMove,afterMove:p.afterMove,templateEngine:m.ba.Ma})}},init:function(S,D){return m.c.template.init(S,m.c.foreach.Rc(D))},update:function(S,D,p,I,O){return m.c.template.update(S,m.c.foreach.Rc(D),p,I,O)}},m.m.Ra.foreach=!1,m.h.ea.foreach=!0,m.c.hasfocus={init:function(S,D,p){function I(V){S.__ko_hasfocusUpdating=!0;var G=S.ownerDocument;if("activeElement"in G){var j;try{j=G.activeElement}catch{j=G.body}V=j===S}G=D(),m.m.eb(G,p,"hasfocus",V,!0),S.__ko_hasfocusLastValue=V,S.__ko_hasfocusUpdating=!1}var O=I.bind(null,!0),F=I.bind(null,!1);m.a.B(S,"focus",O),m.a.B(S,"focusin",O),m.a.B(S,"blur",F),m.a.B(S,"focusout",F),S.__ko_hasfocusLastValue=!1},update:function(S,D){var p=!!m.a.f(D());S.__ko_hasfocusUpdating||S.__ko_hasfocusLastValue===p||(p?S.focus():S.blur(),!p&&S.__ko_hasfocusLastValue&&S.ownerDocument.body.focus(),m.u.G(m.a.Fb,null,[S,p?"focusin":"focusout"]))}},m.m.wa.hasfocus=!0,m.c.hasFocus=m.c.hasfocus,m.m.wa.hasFocus="hasfocus",m.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(S,D){m.a.fc(S,D())}},function(){function S(D,p,I){m.c[D]={init:function(O,F,V,G,j){var W,X,q={},ee,Y,ne;if(p){G=V.get("as");var Q=V.get("noChildContext");ne=!(G&&Q),q={as:G,noChildContext:Q,exportDependencies:ne}}return Y=(ee=V.get("completeOn")=="render")||V.has(m.i.pa),m.o(function(){var le=m.a.f(F()),pe=!I!=!le,re=!X,de;(ne||pe!==W)&&(Y&&(j=m.i.Cb(O,j)),pe&&((!p||ne)&&(q.dataDependency=m.S.o()),de=p?j.createChildContext(typeof le=="function"?le:F,q):m.S.qa()?j.extend(null,q):j),re&&m.S.qa()&&(X=m.a.Ca(m.h.childNodes(O),!0)),pe?(re||m.h.va(O,m.a.Ca(X)),m.Oa(de,O)):(m.h.Ea(O),ee||m.i.ma(O,m.i.H)),W=pe)},null,{l:O}),{controlsDescendantBindings:!0}}},m.m.Ra[D]=!1,m.h.ea[D]=!0}S("if"),S("ifnot",!1,!0),S("with",!0)}(),m.c.let={init:function(S,D,p,I,O){return D=O.extend(D),m.Oa(D,S),{controlsDescendantBindings:!0}}},m.h.ea.let=!0;var B={};m.c.options={init:function(S){if(m.a.R(S)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<S.length;)S.remove(0);return{controlsDescendantBindings:!0}},update:function(S,D,p){function I(){return m.a.jb(S.options,function(Q){return Q.selected})}function O(Q,le,pe){var re=typeof le;return re=="function"?le(Q):re=="string"?Q[le]:pe}function F(Q,le){if(Y&&W)m.i.ma(S,m.i.H);else if(ee.length){var pe=0<=m.a.A(ee,m.w.M(le[0]));m.a.Zc(le[0],pe),Y&&!pe&&m.u.G(m.a.Fb,null,[S,"change"])}}var V=S.multiple,G=S.length!=0&&V?S.scrollTop:null,j=m.a.f(D()),W=p.get("valueAllowUnset")&&p.has("value"),X=p.get("optionsIncludeDestroyed");D={};var q,ee=[];W||(V?ee=m.a.Mb(I(),m.w.M):0<=S.selectedIndex&&ee.push(m.w.M(S.options[S.selectedIndex]))),j&&(typeof j.length>"u"&&(j=[j]),q=m.a.jb(j,function(Q){return X||Q===e||Q===null||!m.a.f(Q._destroy)}),p.has("optionsCaption")&&(j=m.a.f(p.get("optionsCaption")),j!==null&&j!==e&&q.unshift(B)));var Y=!1;if(D.beforeRemove=function(Q){S.removeChild(Q)},j=F,p.has("optionsAfterRender")&&typeof p.get("optionsAfterRender")=="function"&&(j=function(Q,le){F(0,le),m.u.G(p.get("optionsAfterRender"),null,[le[0],Q!==B?Q:e])}),m.a.ec(S,q,function(Q,le,pe){return pe.length&&(ee=!W&&pe[0].selected?[m.w.M(pe[0])]:[],Y=!0),le=S.ownerDocument.createElement("option"),Q===B?(m.a.Bb(le,p.get("optionsCaption")),m.w.cb(le,e)):(pe=O(Q,p.get("optionsValue"),Q),m.w.cb(le,m.a.f(pe)),Q=O(Q,p.get("optionsText"),pe),m.a.Bb(le,Q)),[le]},D,j),!W){var ne;V?ne=ee.length&&I().length<ee.length:ne=ee.length&&0<=S.selectedIndex?m.w.M(S.options[S.selectedIndex])!==ee[0]:ee.length||0<=S.selectedIndex,ne&&m.u.G(m.a.Fb,null,[S,"change"])}(W||m.S.Ya())&&m.i.ma(S,m.i.H),m.a.wd(S),G&&20<Math.abs(G-S.scrollTop)&&(S.scrollTop=G)}},m.c.options.$b=m.a.g.Z(),m.c.selectedOptions={init:function(S,D,p){function I(){var V=D(),G=[];m.a.D(S.getElementsByTagName("option"),function(j){j.selected&&G.push(m.w.M(j))}),m.m.eb(V,p,"selectedOptions",G)}function O(){var V=m.a.f(D()),G=S.scrollTop;V&&typeof V.length=="number"&&m.a.D(S.getElementsByTagName("option"),function(j){var W=0<=m.a.A(V,m.w.M(j));j.selected!=W&&m.a.Zc(j,W)}),S.scrollTop=G}if(m.a.R(S)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var F;m.i.subscribe(S,m.i.H,function(){F?I():(m.a.B(S,"change",I),F=m.o(O,null,{l:S}))},null,{notifyImmediately:!0})},update:function(){}},m.m.wa.selectedOptions=!0,m.c.style={update:function(S,D){var p=m.a.f(D()||{});m.a.P(p,function(I,O){if(O=m.a.f(O),(O===null||O===e||O===!1)&&(O=""),o)o(S).css(I,O);else if(/^--/.test(I))S.style.setProperty(I,O);else{I=I.replace(/-(\w)/g,function(V,G){return G.toUpperCase()});var F=S.style[I];S.style[I]=O,O===F||S.style[I]!=F||isNaN(O)||(S.style[I]=O+"px")}})}},m.c.submit={init:function(S,D,p,I,O){if(typeof D()!="function")throw Error("The value for a submit binding must be a function");m.a.B(S,"submit",function(F){var V,G=D();try{V=G.call(O.$data,S)}finally{V!==!0&&(F.preventDefault?F.preventDefault():F.returnValue=!1)}})}},m.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(S,D){m.a.Bb(S,D())}},m.h.ea.text=!0,function(){if(t&&t.navigator){var S=function(q){if(q)return parseFloat(q[1])},D=t.navigator.userAgent,p,I,O,F,V;(p=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(V=S(D.match(/Edge\/([^ ]+)$/)))||S(D.match(/Chrome\/([^ ]+)/))||(I=S(D.match(/Version\/([^ ]+) Safari/)))||(O=S(D.match(/Firefox\/([^ ]+)/)))||(F=m.a.W||S(D.match(/MSIE ([^ ]+)/)))||(F=S(D.match(/rv:([^ )]+)/)))}if(8<=F&&10>F)var G=m.a.g.Z(),j=m.a.g.Z(),W=function(q){var ee=this.activeElement;(ee=ee&&m.a.g.get(ee,j))&&ee(q)},X=function(q,ee){var Y=q.ownerDocument;m.a.g.get(Y,G)||(m.a.g.set(Y,G,!0),m.a.B(Y,"selectionchange",W)),m.a.g.set(q,j,ee)};m.c.textInput={init:function(q,ee,Y){function ne(we,Pe){m.a.B(q,we,Pe)}function Q(){var we=m.a.f(ee());(we===null||we===e)&&(we=""),fe!==e&&we===fe?m.a.setTimeout(Q,4):q.value!==we&&(Ce=!0,q.value=we,Ce=!1,re=q.value)}function le(){de||(fe=q.value,de=m.a.setTimeout(pe,4))}function pe(){clearTimeout(de),fe=de=e;var we=q.value;re!==we&&(re=we,m.m.eb(ee(),Y,"textInput",we))}var re=q.value,de,fe,ye=m.a.W==9?le:pe,Ce=!1;F&&ne("keypress",pe),11>F&&ne("propertychange",function(we){Ce||we.propertyName!=="value"||ye()}),F==8&&(ne("keyup",pe),ne("keydown",pe)),X&&(X(q,ye),ne("dragend",le)),(!F||9<=F)&&ne("input",ye),5>I&&m.a.R(q)==="textarea"?(ne("keydown",le),ne("paste",le),ne("cut",le)):11>p?ne("keydown",le):4>O?(ne("DOMAutoComplete",pe),ne("dragdrop",pe),ne("drop",pe)):V&&q.type==="number"&&ne("keydown",le),ne("change",pe),ne("blur",pe),m.o(Q,null,{l:q})}},m.m.wa.textInput=!0,m.c.textinput={preprocess:function(q,ee,Y){Y("textInput",q)}}}(),m.c.uniqueName={init:function(S,D){if(D()){var p="ko_unique_"+ ++m.c.uniqueName.rd;m.a.Yc(S,p)}}},m.c.uniqueName.rd=0,m.c.using={init:function(S,D,p,I,O){var F;return p.has("as")&&(F={as:p.get("as"),noChildContext:p.get("noChildContext")}),D=O.createChildContext(D,F),m.Oa(D,S),{controlsDescendantBindings:!0}}},m.h.ea.using=!0,m.c.value={init:function(S,D,p){var I=m.a.R(S),O=I=="input";if(!O||S.type!="checkbox"&&S.type!="radio"){var F=[],V=p.get("valueUpdate"),G=!1,j=null;V&&(typeof V=="string"?F=[V]:F=m.a.wc(V),m.a.Pa(F,"change"));var W=function(){j=null,G=!1;var ee=D(),Y=m.w.M(S);m.m.eb(ee,p,"value",Y)};!m.a.W||!O||S.type!="text"||S.autocomplete=="off"||S.form&&S.form.autocomplete=="off"||m.a.A(F,"propertychange")!=-1||(m.a.B(S,"propertychange",function(){G=!0}),m.a.B(S,"focus",function(){G=!1}),m.a.B(S,"blur",function(){G&&W()})),m.a.D(F,function(ee){var Y=W;m.a.Ud(ee,"after")&&(Y=function(){j=m.w.M(S),m.a.setTimeout(W,0)},ee=ee.substring(5)),m.a.B(S,ee,Y)});var X;if(X=O&&S.type=="file"?function(){var ee=m.a.f(D());ee===null||ee===e||ee===""?S.value="":m.u.G(W)}:function(){var ee=m.a.f(D()),Y=m.w.M(S);j!==null&&ee===j?m.a.setTimeout(X,0):(ee!==Y||Y===e)&&(I==="select"?(Y=p.get("valueAllowUnset"),m.w.cb(S,ee,Y),Y||ee===m.w.M(S)||m.u.G(W)):m.w.cb(S,ee))},I==="select"){var q;m.i.subscribe(S,m.i.H,function(){q?p.get("valueAllowUnset")?X():W():(m.a.B(S,"change",W),q=m.o(X,null,{l:S}))},null,{notifyImmediately:!0})}else m.a.B(S,"change",W),m.o(X,null,{l:S})}else m.ib(S,{checkedValue:D})},update:function(){}},m.m.wa.value=!0,m.c.visible={update:function(S,D){var p=m.a.f(D()),I=S.style.display!="none";p&&!I?S.style.display="":!p&&I&&(S.style.display="none")}},m.c.hidden={update:function(S,D){m.c.visible.update(S,function(){return!m.a.f(D())})}},function(S){m.c[S]={init:function(D,p,I,O,F){return m.c.event.init.call(this,D,function(){var V={};return V[S]=p(),V},I,O,F)}}}("click"),m.ca=function(){},m.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},m.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},m.ca.prototype.makeTemplateSource=function(S,D){if(typeof S=="string"){D=D||n;var p=D.getElementById(S);if(!p)throw Error("Cannot find template with ID "+S);return new m.C.F(p)}if(S.nodeType==1||S.nodeType==8)return new m.C.ia(S);throw Error("Unknown template type: "+S)},m.ca.prototype.renderTemplate=function(S,D,p,I){return S=this.makeTemplateSource(S,I),this.renderTemplateSource(S,D,p,I)},m.ca.prototype.isTemplateRewritten=function(S,D){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(S,D).data("isRewritten")},m.ca.prototype.rewriteTemplate=function(S,D,p){S=this.makeTemplateSource(S,p),D=D(S.text()),S.text(D),S.data("isRewritten",!0)},m.b("templateEngine",m.ca),m.kc=function(){function S(I,O,F,V){I=m.m.ac(I);for(var G=m.m.Ra,j=0;j<I.length;j++){var W=I[j].key;if(Object.prototype.hasOwnProperty.call(G,W)){var X=G[W];if(typeof X=="function"){if(W=X(I[j].value))throw Error(W)}else if(!X)throw Error("This template engine does not support the '"+W+"' binding within its templates")}}return F="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+m.m.vb(I,{valueAccessors:!0})+" } })()},'"+F.toLowerCase()+"')",V.createJavaScriptEvaluatorBlock(F)+O}var D=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,p=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(I,O,F){O.isTemplateRewritten(I,F)||O.rewriteTemplate(I,function(V){return m.kc.Ld(V,O)},F)},Ld:function(I,O){return I.replace(D,function(F,V,G,j,W){return S(W,V,G,O)}).replace(p,function(F,V){return S(V,"<!-- ko -->","#comment",O)})},md:function(I,O){return m.aa.Xb(function(F,V){var G=F.nextSibling;G&&G.nodeName.toLowerCase()===O&&m.ib(G,I,V)})}}}(),m.b("__tr_ambtns",m.kc.md),function(){m.C={},m.C.F=function(p){if(this.F=p){var I=m.a.R(p);this.ab=I==="script"?1:I==="textarea"?2:I=="template"&&p.content&&p.content.nodeType===11?3:4}},m.C.F.prototype.text=function(){var p=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[p];var I=arguments[0];p==="innerHTML"?m.a.fc(this.F,I):this.F[p]=I};var S=m.a.g.Z()+"_";m.C.F.prototype.data=function(p){if(arguments.length===1)return m.a.g.get(this.F,S+p);m.a.g.set(this.F,S+p,arguments[1])};var D=m.a.g.Z();m.C.F.prototype.nodes=function(){var p=this.F;if(arguments.length==0){var I=m.a.g.get(p,D)||{},O=I.lb||(this.ab===3?p.content:this.ab===4?p:e);if(!O||I.jd){var F=this.text();F&&F!==I.bb&&(O=m.a.Md(F,p.ownerDocument),m.a.g.set(p,D,{lb:O,bb:F,jd:!0}))}return O}I=arguments[0],this.ab!==e&&this.text(""),m.a.g.set(p,D,{lb:I})},m.C.ia=function(p){this.F=p},m.C.ia.prototype=new m.C.F,m.C.ia.prototype.constructor=m.C.ia,m.C.ia.prototype.text=function(){if(arguments.length==0){var p=m.a.g.get(this.F,D)||{};return p.bb===e&&p.lb&&(p.bb=p.lb.innerHTML),p.bb}m.a.g.set(this.F,D,{bb:arguments[0]})},m.b("templateSources",m.C),m.b("templateSources.domElement",m.C.F),m.b("templateSources.anonymousTemplate",m.C.ia)}(),function(){function S(j,W,X){var q;for(W=m.h.nextSibling(W);j&&(q=j)!==W;)j=m.h.nextSibling(q),X(q,j)}function D(j,W){if(j.length){var X=j[0],q=j[j.length-1],ee=X.parentNode,Y=m.ga.instance,ne=Y.preprocessNode;if(ne){if(S(X,q,function(Q,le){var pe=Q.previousSibling,re=ne.call(Y,Q);re&&(Q===X&&(X=re[0]||le),Q===q&&(q=re[re.length-1]||pe))}),j.length=0,!X)return;X===q?j.push(X):(j.push(X,q),m.a.Ua(j,ee))}S(X,q,function(Q){Q.nodeType!==1&&Q.nodeType!==8||m.vc(W,Q)}),S(X,q,function(Q){Q.nodeType!==1&&Q.nodeType!==8||m.aa.cd(Q,[W])}),m.a.Ua(j,ee)}}function p(j){return j.nodeType?j:0<j.length?j[0]:null}function I(j,W,X,q,ee){ee=ee||{};var Y=(j&&p(j)||X||{}).ownerDocument,ne=ee.templateEngine||F;if(m.kc.xd(X,ne,Y),X=ne.renderTemplate(X,q,ee,Y),typeof X.length!="number"||0<X.length&&typeof X[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(Y=!1,W){case"replaceChildren":m.h.va(j,X),Y=!0;break;case"replaceNode":m.a.Xc(j,X),Y=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+W)}return Y&&(D(X,q),ee.afterRender&&m.u.G(ee.afterRender,null,[X,q[ee.as||"$data"]]),W=="replaceChildren"&&m.i.ma(j,m.i.H)),X}function O(j,W,X){return m.O(j)?j():typeof j=="function"?j(W,X):j}var F;m.gc=function(j){if(j!=e&&!(j instanceof m.ca))throw Error("templateEngine must inherit from ko.templateEngine");F=j},m.dc=function(j,W,X,q,ee){if(X=X||{},(X.templateEngine||F)==e)throw Error("Set a template engine before calling renderTemplate");if(ee=ee||"replaceChildren",q){var Y=p(q);return m.$(function(){var Q=W&&W instanceof m.fa?W:new m.fa(W,null,null,null,{exportDependencies:!0}),ne=O(j,Q.$data,Q),Q=I(q,ee,ne,Q,X);ee=="replaceNode"&&(q=Q,Y=p(q))},null,{Sa:function(){return!Y||!m.a.Sb(Y)},l:Y&&ee=="replaceNode"?Y.parentNode:Y})}return m.aa.Xb(function(ne){m.dc(j,W,X,ne,"replaceNode")})},m.Qd=function(j,W,X,q,ee){function Y(fe,ye){m.u.G(m.a.ec,null,[q,fe,Q,X,ne,ye]),m.i.ma(q,m.i.H)}function ne(fe,ye){D(ye,le),X.afterRender&&X.afterRender(ye,fe),le=null}function Q(fe,ye){le=ee.createChildContext(fe,{as:pe,noChildContext:X.noChildContext,extend:function(we){we.$index=ye,pe&&(we[pe+"Index"]=ye)}});var Ce=O(j,fe,le);return I(q,"ignoreTargetNode",Ce,le,X)}var le,pe=X.as,re=X.includeDestroyed===!1||m.options.foreachHidesDestroyed&&!X.includeDestroyed;if(re||X.beforeRemove||!m.Pc(W))return m.$(function(){var fe=m.a.f(W)||[];typeof fe.length>"u"&&(fe=[fe]),re&&(fe=m.a.jb(fe,function(ye){return ye===e||ye===null||!m.a.f(ye._destroy)})),Y(fe)},null,{l:q});Y(W.v());var de=W.subscribe(function(fe){Y(W(),fe)},null,"arrayChange");return de.l(q),de};var V=m.a.g.Z(),G=m.a.g.Z();m.c.template={init:function(j,W){var X=m.a.f(W());if(typeof X=="string"||"name"in X)m.h.Ea(j);else if("nodes"in X){if(X=X.nodes||[],m.O(X))throw Error('The "nodes" option must be a plain, non-observable array.');var q=X[0]&&X[0].parentNode;q&&m.a.g.get(q,G)||(q=m.a.Yb(X),m.a.g.set(q,G,!0)),new m.C.ia(j).nodes(q)}else if(X=m.h.childNodes(j),0<X.length)q=m.a.Yb(X),new m.C.ia(j).nodes(q);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(j,W,X,q,ee){var Y=W();W=m.a.f(Y),X=!0,q=null,typeof W=="string"?W={}:(Y="name"in W?W.name:j,"if"in W&&(X=m.a.f(W.if)),X&&"ifnot"in W&&(X=!m.a.f(W.ifnot)),X&&!Y&&(X=!1)),"foreach"in W?q=m.Qd(Y,X&&W.foreach||[],W,j,ee):X?(X=ee,"data"in W&&(X=ee.createChildContext(W.data,{as:W.as,noChildContext:W.noChildContext,exportDependencies:!0})),q=m.dc(Y,X,W,j)):m.h.Ea(j),ee=q,(W=m.a.g.get(j,V))&&typeof W.s=="function"&&W.s(),m.a.g.set(j,V,!ee||ee.ja&&!ee.ja()?e:ee)}},m.m.Ra.template=function(j){return j=m.m.ac(j),j.length==1&&j[0].unknown||m.m.Id(j,"name")?null:"This template engine does not support anonymous templates nested within its templates"},m.h.ea.template=!0}(),m.b("setTemplateEngine",m.gc),m.b("renderTemplate",m.dc),m.a.Kc=function(S,D,p){if(S.length&&D.length){var I,O,F,V,G;for(I=O=0;(!p||I<p)&&(V=S[O]);++O){for(F=0;G=D[F];++F)if(V.value===G.value){V.moved=G.index,G.moved=V.index,D.splice(F,1),I=F=0;break}I+=F}}},m.a.Pb=function(){function S(D,p,I,O,F){var V=Math.min,G=Math.max,j=[],W,X=D.length,q,ee=p.length,Y=ee-X||1,ne=X+ee+1,Q,le,pe;for(W=0;W<=X;W++)for(le=Q,j.push(Q=[]),pe=V(ee,W+Y),q=G(0,W-1);q<=pe;q++)Q[q]=q?W?D[W-1]===p[q-1]?le[q-1]:V(le[q]||ne,Q[q-1]||ne)+1:q+1:W+1;for(V=[],G=[],Y=[],W=X,q=ee;W||q;)ee=j[W][q]-1,q&&ee===j[W][q-1]?G.push(V[V.length]={status:I,value:p[--q],index:q}):W&&ee===j[W-1][q]?Y.push(V[V.length]={status:O,value:D[--W],index:W}):(--q,--W,F.sparse||V.push({status:"retained",value:p[q]}));return m.a.Kc(Y,G,!F.dontLimitMoves&&10*X),V.reverse()}return function(D,p,I){return I=typeof I=="boolean"?{dontLimitMoves:I}:I||{},D=D||[],p=p||[],D.length<p.length?S(D,p,"added","deleted",I):S(p,D,"deleted","added",I)}}(),m.b("utils.compareArrays",m.a.Pb),function(){function S(I,O,F,V,G){var j=[],W=m.$(function(){var X=O(F,G,m.a.Ua(j,I))||[];0<j.length&&(m.a.Xc(j,X),V&&m.u.G(V,null,[F,X,G])),j.length=0,m.a.Nb(j,X)},null,{l:I,Sa:function(){return!m.a.kd(j)}});return{Y:j,$:W.ja()?W:e}}var D=m.a.g.Z(),p=m.a.g.Z();m.a.ec=function(I,O,F,V,G,j){function W(et){Ce={Aa:et,pb:m.ta(le++)},ne.push(Ce),Y||ye.push(Ce)}function X(et){Ce=ee[et],le!==Ce.pb.v()&&fe.push(Ce),Ce.pb(le++),m.a.Ua(Ce.Y,I),ne.push(Ce)}function q(et,hn){if(et)for(var ot=0,at=hn.length;ot<at;ot++)m.a.D(hn[ot].Y,function(Xt){et(Xt,ot,hn[ot].Aa)})}O=O||[],typeof O.length>"u"&&(O=[O]),V=V||{};var ee=m.a.g.get(I,D),Y=!ee,ne=[],Q=0,le=0,pe=[],re=[],de=[],fe=[],ye=[],Ce,we=0;if(Y)m.a.D(O,W);else{if(!j||ee&&ee._countWaitingForRemove){var Pe=m.a.Mb(ee,function(et){return et.Aa});j=m.a.Pb(Pe,O,{dontLimitMoves:V.dontLimitMoves,sparse:!0})}for(var Pe=0,lt,ft,We;lt=j[Pe];Pe++)switch(ft=lt.moved,We=lt.index,lt.status){case"deleted":for(;Q<We;)X(Q++);ft===e&&(Ce=ee[Q],Ce.$&&(Ce.$.s(),Ce.$=e),m.a.Ua(Ce.Y,I).length&&(V.beforeRemove&&(ne.push(Ce),we++,Ce.Aa===p?Ce=null:de.push(Ce)),Ce&&pe.push.apply(pe,Ce.Y))),Q++;break;case"added":for(;le<We;)X(Q++);ft!==e?(re.push(ne.length),X(ft)):W(lt.value)}for(;le<O.length;)X(Q++);ne._countWaitingForRemove=we}m.a.g.set(I,D,ne),q(V.beforeMove,fe),m.a.D(pe,V.beforeRemove?m.oa:m.removeNode);var Fe,Dt,st;try{st=I.ownerDocument.activeElement}catch{}if(re.length)for(;(Pe=re.shift())!=e;){for(Ce=ne[Pe],Fe=e;Pe;)if((Dt=ne[--Pe].Y)&&Dt.length){Fe=Dt[Dt.length-1];break}for(O=0;Q=Ce.Y[O];Fe=Q,O++)m.h.Wb(I,Q,Fe)}for(Pe=0;Ce=ne[Pe];Pe++){for(Ce.Y||m.a.extend(Ce,S(I,F,Ce.Aa,G,Ce.pb)),O=0;Q=Ce.Y[O];Fe=Q,O++)m.h.Wb(I,Q,Fe);!Ce.Ed&&G&&(G(Ce.Aa,Ce.Y,Ce.pb),Ce.Ed=!0,Fe=Ce.Y[Ce.Y.length-1])}for(st&&I.ownerDocument.activeElement!=st&&st.focus(),q(V.beforeRemove,de),Pe=0;Pe<de.length;++Pe)de[Pe].Aa=p;q(V.afterMove,fe),q(V.afterAdd,ye)}}(),m.b("utils.setDomNodeChildrenFromArrayMapping",m.a.ec),m.ba=function(){this.allowTemplateRewriting=!1},m.ba.prototype=new m.ca,m.ba.prototype.constructor=m.ba,m.ba.prototype.renderTemplateSource=function(S,D,p,I){return(D=!(9>m.a.W)&&S.nodes?S.nodes():null)?m.a.la(D.cloneNode(!0).childNodes):(S=S.text(),m.a.ua(S,I))},m.ba.Ma=new m.ba,m.gc(m.ba.Ma),m.b("nativeTemplateEngine",m.ba),function(){m.$a=function(){var D=this.Hd=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(p,I,O,F){if(F=F||n,O=O||{},2>D)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var V=p.data("precompiled");return V||(V=p.text()||"",V=o.template(null,"{{ko_with $item.koBindingContext}}"+V+"{{/ko_with}}"),p.data("precompiled",V)),p=[I.$data],I=o.extend({koBindingContext:I},O.templateOptions),I=o.tmpl(V,p,I),I.appendTo(F.createElement("div")),o.fragments={},I},this.createJavaScriptEvaluatorBlock=function(p){return"{{ko_code ((function() { return "+p+" })()) }}"},this.addTemplate=function(p,I){n.write("<script type='text/html' id='"+p+"'>"+I+"<\/script>")},0<D&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},m.$a.prototype=new m.ca,m.$a.prototype.constructor=m.$a;var S=new m.$a;0<S.Hd&&m.gc(S),m.b("jqueryTmplTemplateEngine",m.$a)}()})})()})()})();var _Ge=ko;typeof window<"u"?(ko=window.ko,typeof wy<"u"?window.ko=wy:delete window.ko):(ko=global.ko,typeof wy<"u"?global.ko=wy:delete global.ko);const He=_Ge;/** * @license * Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5 * Copyright (c) Steve Sanderson * MIT license */var hP="__knockoutObservables",fP="__knockoutSubscribable";function xq(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Cq(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===hP||o===fP)&&!(o in i)){var r=e[o],s=r instanceof Array,a=n.isObservable(r)?r:s?n.observableArray(r):n.observable(r);Object.defineProperty(e,o,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[o]=a,s&&yGe(n,a)}}),e}function Cq(e,t){var n=e[hP];return!n&&t&&(n={},Object.defineProperty(e,hP,{value:n})),n}function gGe(e,t,n){var i=this,o={owner:e,deferEvaluation:!0};if(typeof n=="function")o.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(typeof n.get!="function")throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=n.get,o.write=n.set}return e[t]=i.computed(o),xq.call(i,e,[t]),e}function yGe(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=bGe(e,t,i))})}function bGe(e,t,n){var i=TGe(e,n);return i.subscribe(t)}function TGe(e,t){var n=t[fP];if(!n){n=new e.subscribable,Object.defineProperty(t,fP,{value:n});var i={};AGe(t,n,i),xGe(e,t,n,i)}return n}function AGe(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(i){var o=e[i];e[i]=function(){var r=o.apply(this,arguments);return n.pause!==!0&&t.notifySubscribers(this),r}})}function xGe(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})})}function Eq(e,t){if(!e)return null;var n=Cq(e,!1);return n&&n[t]||null}function CGe(e,t){var n=Eq(e,t);n&&n.valueHasMutated()}function EGe(e){e.track=xq,e.getObservable=Eq,e.valueHasMutated=CGe,e.defineProperty=gGe}const wGe={attachToKo:EGe},jz="http://www.w3.org/2000/svg",Wz="cesium-svgPath-svg",SGe={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(jz,"svg:svg");i.setAttribute("class",Wz);const o=document.createElementNS(jz,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));const s=e.unwrap(r.width),a=e.unwrap(r.height);i.setAttribute("width",s),i.setAttribute("height",a),i.setAttribute("viewBox",`0 0 ${s} ${a}`),r.css&&i.setAttribute("class",`${Wz} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},vGe=SGe;wGe.attachToKo(He);vGe.register(He);function yb(e){c(e)||(e=new tb),this._clock=e,this._eventHelper=new Tu,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=He.observable(ie.now()),this.systemTime.equalityComparer=ie.equals,this.startTime=He.observable(e.startTime),this.startTime.equalityComparer=ie.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=He.observable(e.stopTime),this.stopTime.equalityComparer=ie.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=He.observable(e.currentTime),this.currentTime.equalityComparer=ie.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=He.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=He.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=He.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=He.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=He.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),He.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(yb.prototype,{clock:{get:function(){return this._clock}}});yb.prototype.synchronize=function(){const e=this._clock;this.systemTime=ie.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};yb.prototype.isDestroyed=function(){return!1};yb.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};function Sy(e,t){if(!c(e))throw new E("command is required.");this._command=e,t=y(t,y.EMPTY_OBJECT),this.toggled=y(t.toggled,!1),this.tooltip=y(t.tooltip,""),He.track(this,["toggled","tooltip"])}Object.defineProperties(Sy.prototype,{command:{get:function(){return this._command}}});function mo(e,t){if(!c(e))throw new E("func is required.");t=y(t,!0);const n=new Le,i=new Le;function o(){if(!o.canExecute)throw new E("Cannot execute command, canExecute is false.");const r={args:arguments,cancel:!1};let s;return n.raiseEvent(r),r.cancel||(s=e.apply(null,arguments),i.raiseEvent(s)),s}return o.canExecute=t,He.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function fc(e,t,n,i,o){return n.call(i,e[t]),He.getObservable(e,t).subscribe(n,i,o)}function wq(e){e=y(e,y.EMPTY_OBJECT);const t=e.globe,n=y(e.imageryProviderViewModels,[]),i=y(e.terrainProviderViewModels,[]);if(!c(t))throw new E("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,He.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=He.getObservable(this,"imageryProviderViewModels"),r=He.pureComputed(function(){const f=o(),_={};let g;for(g=0;g<f.length;g++){const T=f[g],x=T.category;c(_[x])?_[x].push(T):_[x]=[T]}const m=Object.keys(_),b=[];for(g=0;g<m.length;g++){const T=m[g];b.push({name:T,providers:_[T]})}return b});this._imageryProviders=r;const s=He.getObservable(this,"terrainProviderViewModels"),a=He.pureComputed(function(){const f=s(),_={};let g;for(g=0;g<f.length;g++){const T=f[g],x=T.category;c(_[x])?_[x].push(T):_[x]=[T]}const m=Object.keys(_),b=[];for(g=0;g<m.length;g++){const T=m[g];b.push({name:T,providers:_[T]})}return b});this._terrainProviders=a,this.buttonTooltip=void 0,He.defineProperty(this,"buttonTooltip",function(){const f=this.selectedImagery,_=this.selectedTerrain,g=c(f)?f.name:void 0,m=c(_)?_.name:void 0;return c(g)&&c(m)?`${g} ${m}`:c(g)?g:m}),this.buttonImageUrl=void 0,He.defineProperty(this,"buttonImageUrl",function(){const f=this.selectedImagery;if(c(f))return f.iconUrl}),this.selectedImagery=void 0;const l=He.observable();this._currentImageryLayers=[],He.defineProperty(this,"selectedImagery",{get:function(){return l()},set:function(f){if(l()===f){this.dropDownVisible=!1;return}let _;const g=this._currentImageryLayers,m=g.length,b=this._globe.imageryLayers;let T=!1;for(_=0;_<m;_++){const x=b.length;for(let C=0;C<x;C++){const w=b.get(C);if(w===g[_]){b.remove(w),T=!0;break}}}if(c(f)){const x=f.creationCommand();if(Array.isArray(x)){const C=x.length;for(this._currentImageryLayers=[],_=C-1;_>=0;_--){const w=Qt.fromProviderAsync(x[_]);b.add(w,0),this._currentImageryLayers.push(w)}}else{this._currentImageryLayers=[];const C=Qt.fromProviderAsync(x);if(C.name=f.name,T)b.add(C,0);else{const w=b.get(0);c(w)&&b.remove(w),b.add(C,0)}this._currentImageryLayers.push(C)}}l(f),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const u=He.observable();He.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(f){if(u()===f){this.dropDownVisible=!1;return}let _;if(c(f)&&(_=f.creationCommand()),c(_)&&!c(_.then))this._globe.depthTestAgainstTerrain=!(_ instanceof _d),this._globe.terrainProvider=_;else if(c(_)){let g=!1;const m=this._globe.terrainProviderChanged.addEventListener(()=>{g=!0,m()}),T=new U_(_).readyEvent.addEventListener(x=>{g||(this._globe.depthTestAgainstTerrain=!(x instanceof _d),this._globe.terrainProvider=x,T())})}u(f),this.dropDownVisible=!1}});const h=this;this._toggleDropDown=mo(function(){h.dropDownVisible=!h.dropDownVisible}),this.selectedImagery=y(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=y(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(wq.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});function gE(e,t){if(!c(e))throw new E("container is required.");e=Do(e);const n=new wq(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 o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);const r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);const s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);const a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);const l=document.createElement("div");l.className="cesium-baseLayerPicker-category",a.appendChild(l);const u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),l.appendChild(u);const h=document.createElement("div");h.className="cesium-baseLayerPicker-choices",h.setAttribute("data-bind","foreach: providers"),l.appendChild(h);const f=document.createElement("div");f.className="cesium-baseLayerPicker-item",f.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),h.appendChild(f);const _=document.createElement("img");_.className="cesium-baseLayerPicker-itemIcon",_.setAttribute("data-bind","attr: { src: iconUrl }"),_.setAttribute("draggable","false"),f.appendChild(_);const g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),f.appendChild(g);const m=document.createElement("div");m.className="cesium-baseLayerPicker-sectionTitle",m.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),m.innerHTML="Terrain",r.appendChild(m);const b=document.createElement("div");b.className="cesium-baseLayerPicker-section",b.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(b);const T=document.createElement("div");T.className="cesium-baseLayerPicker-category",b.appendChild(T);const x=document.createElement("div");x.className="cesium-baseLayerPicker-categoryTitle",x.setAttribute("data-bind","text: name"),T.appendChild(x);const C=document.createElement("div");C.className="cesium-baseLayerPicker-choices",C.setAttribute("data-bind","foreach: providers"),T.appendChild(C);const w=document.createElement("div");w.className="cesium-baseLayerPicker-item",w.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),C.appendChild(w);const v=document.createElement("img");v.className="cesium-baseLayerPicker-itemIcon",v.setAttribute("data-bind","attr: { src: iconUrl }"),v.setAttribute("draggable","false"),w.appendChild(v);const P=document.createElement("div");P.className="cesium-baseLayerPicker-itemLabel",P.setAttribute("data-bind","text: name"),w.appendChild(P),He.applyBindings(n,i),He.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(N){i.contains(N.target)||r.contains(N.target)||(n.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(gE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});gE.prototype.isDestroyed=function(){return!1};gE.prototype.destroy=function(){return Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._element),He.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),ve(this)};function yr(e){if(!c(e.name))throw new E("options.name is required.");if(!c(e.tooltip))throw new E("options.tooltip is required.");if(!c(e.iconUrl))throw new E("options.iconUrl is required.");if(typeof e.creationFunction!="function")throw new E("options.creationFunction is required.");let t=e.creationFunction;c(t.canExecute)||(t=mo(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=y(e.category,""),He.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(yr.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});function IGe(){const e=[],t=devicePixelRatio>=2;return e.push(new yr({name:"Bing Maps Aerial",iconUrl:Zt("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.AERIAL})}})),e.push(new yr({name:"Bing Maps Aerial with Labels",iconUrl:Zt("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.AERIAL_WITH_LABELS})}})),e.push(new yr({name:"Bing Maps Roads",iconUrl:Zt("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.ROAD})}})),e.push(new yr({name:"ArcGIS World Imagery",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png"),tooltip:`ArcGIS 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 15m TerraColor imagery at small and mid-scales (~1:591M down to ~1:288k) for the world. The map features Maxar imagery at 0.3m resolution for select metropolitan areas around the world, 0.5m resolution across the United States and parts of Western Europe, and 1m resolution imagery across the rest of the world. In addition to commercial sources, the World Imagery map features high-resolution aerial photography contributed by the GIS User Community. This imagery ranges from 0.3m to 0.03m resolution (down to ~1:280 nin select communities). For more information on this map, including the terms of use, visit us online at https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.SATELLITE,{enablePickFeatures:!1})}})),e.push(new yr({name:"ArcGIS World Hillshade",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"),tooltip:`ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available down to ~1:9k. For more information on this map, including the terms of use, visit us online at https://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.HILLSHADE,{enablePickFeatures:!1})}})),e.push(new yr({name:"Esri World Ocean",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"),tooltip:`ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data. The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. For more information on this map, including our terms of use, visit us online at https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.OCEANS,{enablePickFeatures:!1})}})),e.push(new yr({name:"Open\xADStreet\xADMap",iconUrl:Zt("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:`OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world. http://www.openstreetmap.org`,category:"Other",creationFunction:function(){return new ch({url:"https://tile.openstreetmap.org/"})}})),e.push(new yr({name:"Stadia x Stamen Watercolor",iconUrl:Zt("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and reminiscent of hand drawn maps, the watercolor maps from Stamen Design apply raster effect area washes and organic edges over a paper texture to add warm pop to any map. https://docs.stadiamaps.com/map-styles/stamen-watercolor/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/stamen_watercolor/",fileExtension:"jpg",credit:`© <a href="https://stamen.com/" target="_blank">Stamen Design</a> © <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia x Stamen Toner",iconUrl:Zt("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and the most popular of the excellent styles from Stamen Design, these high-contrast B+W (black and white) maps are the perfect backdrop for your colorful and eye-catching overlays. https://docs.stadiamaps.com/map-styles/stamen-toner/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/stamen_toner/",retinaTiles:t,credit:`© <a href="https://stamen.com/" target="_blank">Stamen Design</a> © <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia Alidade Smooth",iconUrl:Zt("Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png"),tooltip:`Stadia's custom Alidade Smooth style is designed for maps that use a lot of markers or overlays. It features a muted color scheme and fewer points of interest to allow your added data to shine. https://docs.stadiamaps.com/map-styles/alidade-smooth/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth/",retinaTiles:t,credit:`© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia Alidade Smooth Dark",iconUrl:Zt("Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png"),tooltip:`Stadia Alidade Smooth Dark, like its lighter cousin, is also designed to stay out of the way. It just flips the dark mode switch on the color scheme. With the lights out, your data can now literally shine. https://docs.stadiamaps.com/map-styles/alidade-smooth-dark/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/",retinaTiles:t,credit:`© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Sentinel-2",iconUrl:Zt("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 xa.fromAssetId(3954)}})),e.push(new yr({name:"Blue Marble",iconUrl:Zt("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return xa.fromAssetId(3845)}})),e.push(new yr({name:"Earth at night",iconUrl:Zt("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 xa.fromAssetId(3812)}})),e.push(new yr({name:"Natural Earth\xA0II",iconUrl:Zt("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast. http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return ra.fromUrl(Zt("Assets/Textures/NaturalEarthII"))}})),e}function DGe(){const e=[];return e.push(new yr({name:"WGS84 Ellipsoid",iconUrl:Zt("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new _d}})),e.push(new yr({name:"Cesium World Terrain",iconUrl:Zt("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 mq({requestWaterMask:!0,requestVertexNormals:!0})}})),e}const $f="http://www.w3.org/2000/svg",Sq="http://www.w3.org/1999/xlink";let wA;const uy=z.fromCssColorString("rgba(247,250,255,0.384)"),SA=z.fromCssColorString("rgba(143,191,255,0.216)"),iI=z.fromCssColorString("rgba(153,197,255,0.098)"),vA=z.fromCssColorString("rgba(255,255,255,0.086)"),PGe=z.fromCssColorString("rgba(255,255,255,0.267)"),OGe=z.fromCssColorString("rgba(255,255,255,0)"),qz=z.fromCssColorString("rgba(66,67,68,0.3)"),Yz=z.fromCssColorString("rgba(0,0,0,0.5)");function Kd(e){return z.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const O0={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 rl(e){const t=document.createElementNS($f,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&n!=="tagName")if(n==="children"){const i=e.children.length;for(let o=0;o<i;++o)t.appendChild(rl(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(Sq,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function oI(e,t,n){const i=document.createElementNS($f,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS($f,"tspan");return o.textContent=n,i.appendChild(o),i}function LGe(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}const IA=new z;function po(e,t){const n=t.alpha,i=1-n;return IA.red=e.red*i+t.red*n,IA.green=e.green*i+t.green*n,IA.blue=e.blue*i+t.blue*n,IA.toCssColorString()}function rI(e,t,n){const i=O0[n],o={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:""}]};return rl(o)}function RGe(e,t,n){const i=O0[n],o=O0.animation_pathWingButton,r={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return rl(r)}function NGe(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&wA!==e))if(t.type==="mousedown"||i&&t.type==="mousemove"||t.type==="touchstart"&&t.touches.length===1||i&&t.type==="touchmove"&&t.touches.length===1){const o=e._centerX,r=e._centerY,a=e._svgNode.getBoundingClientRect();let l,u;if(t.type==="touchstart"||t.type==="touchmove"?(l=t.touches[0].clientX,u=t.touches[0].clientY):(l=t.clientX,u=t.clientY),!i&&(l>a.right||l<a.left||u<a.top||u>a.bottom))return;const h=e._shuttleRingPointer.getBoundingClientRect(),f=l-o-a.left,_=u-r-a.top;let g=Math.atan2(_,f)*180/Math.PI+90;g>180&&(g-=360);const m=n.shuttleRingAngle;i||l<h.right&&l>h.left&&u>h.top&&u<h.bottom?(wA=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<m?n.slower():g>m&&n.faster(),t.preventDefault()}else e===wA&&(wA=void 0),n.shuttleRingDragging=!1}function Xu(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const i=n._viewModel.command;i.canExecute&&i()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[fc(t,"toggled",this.setToggled,this),fc(t,"tooltip",this.setTooltip,this),fc(t.command,"canExecute",this.setEnabled,this)]}Xu.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();ve(this)};Xu.prototype.isDestroyed=function(){return!1};Xu.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e){this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");return}if(this._toggled){this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");return}this.svgElement.setAttribute("class","cesium-animation-rectButton")}};Xu.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")))};Xu.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function lg(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("viewModel is required.");e=Do(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 o=document.createElement("div");o.className="cesium-animation-theme",o.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=o,this._themeNormal=o.childNodes[0],this._themeHover=o.childNodes[1],this._themeSelect=o.childNodes[2],this._themeDisabled=o.childNodes[3],this._themeKnob=o.childNodes[4],this._themePointer=o.childNodes[5],this._themeSwoosh=o.childNodes[6],this._themeSwooshHover=o.childNodes[7];const r=document.createElementNS($f,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",Sq);const s=document.createElementNS($f,"g");this._topG=s,this._realtimeSVG=new Xu(RGe(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new Xu(rI(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new Xu(rI(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new Xu(rI(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS($f,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const l=rl({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=l;const u=O0.animation_pathSwooshFX,h=O0.animation_pathPointer,f=rl({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:u.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:u.d},{tagName:u.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:u.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=f,this._shuttleRingPointer=rl({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:h.tagName,d:h.d});const _=rl({tagName:"g",transform:"translate(100,100)"});this._knobOuter=rl({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const g=61,m=rl({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=oI(0,-24,""),this._knobTime=oI(0,-7,""),this._knobStatus=oI(0,-41,"");const b=rl({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),T=document.createElementNS($f,"g");T.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(T),s.appendChild(_),s.appendChild(a),T.appendChild(l),T.appendChild(f),T.appendChild(this._shuttleRingPointer),_.appendChild(this._knobOuter),_.appendChild(m),_.appendChild(this._knobDate),_.appendChild(this._knobTime),_.appendChild(this._knobStatus),_.appendChild(b),r.appendChild(s),e.appendChild(r);const x=this;function C(k){NGe(x,k)}this._mouseCallback=C,l.addEventListener("mousedown",C,!0),l.addEventListener("touchstart",C,!0),f.addEventListener("mousedown",C,!0),f.addEventListener("touchstart",C,!0),n.addEventListener("mousemove",C,!0),n.addEventListener("touchmove",C,!0),n.addEventListener("mouseup",C,!0),n.addEventListener("touchend",C,!0),n.addEventListener("touchcancel",C,!0),this._shuttleRingPointer.addEventListener("mousedown",C,!0),this._shuttleRingPointer.addEventListener("touchstart",C,!0),this._knobOuter.addEventListener("mousedown",C,!0),this._knobOuter.addEventListener("touchstart",C,!0);const w=this._knobTime.childNodes[0],v=this._knobDate.childNodes[0],P=this._knobStatus.childNodes[0];let N;this._subscriptions=[fc(t.pauseViewModel,"toggled",function(k){N!==k&&(N=k,N?x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),fc(t,"shuttleRingAngle",function(k){LGe(x._shuttleRingPointer,x._knobOuter,k)}),fc(t,"dateLabel",function(k){v.textContent!==k&&(v.textContent=k)}),fc(t,"timeLabel",function(k){w.textContent!==k&&(w.textContent=k)}),fc(t,"multiplierLabel",function(k){P.textContent!==k&&(P.textContent=k)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(lg.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});lg.prototype.isDestroyed=function(){return!1};lg.prototype.destroy=function(){c(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 i=0,o=n.length;i<o;i++)n[i].dispose();return ve(this)};lg.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,o=132;let r=e,s=t;e===0&&t===0?(r=i,s=o):e===0?(s=t,r=i*(t/o)):t===0&&(r=e,s=o*(e/i));const a=r/i,l=s/o;n.style.cssText=`width: ${r}px; height: ${s}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`,n.setAttribute("width",r),n.setAttribute("height",s),n.setAttribute("viewBox",`0 0 ${r} ${s}`),this._topG.setAttribute("transform",`scale(${a},${l})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*l),this._lastHeight=e,this._lastWidth=t};lg.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(c(this._observer))return;const h=this;h._observer=new MutationObserver(function(){e.body.contains(h._container)&&(h._observer.disconnect(),h._observer=void 0,h.applyThemeChanges())}),h._observer.observe(e,{childList:!0,subtree:!0});return}const t=Kd(this._themeNormal),n=Kd(this._themeHover),i=Kd(this._themeSelect),o=Kd(this._themeDisabled),r=Kd(this._themeKnob),s=Kd(this._themePointer),a=Kd(this._themeSwoosh),l=Kd(this._themeSwooshHover),u=rl({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(t,uy)},{tagName:"stop",offset:"12%","stop-color":po(t,SA)},{tagName:"stop",offset:"46%","stop-color":po(t,iI)},{tagName:"stop",offset:"81%","stop-color":po(t,vA)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(n,uy)},{tagName:"stop",offset:"12%","stop-color":po(n,SA)},{tagName:"stop",offset:"46%","stop-color":po(n,iI)},{tagName:"stop",offset:"81%","stop-color":po(n,vA)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(i,uy)},{tagName:"stop",offset:"12%","stop-color":po(i,SA)},{tagName:"stop",offset:"46%","stop-color":po(i,iI)},{tagName:"stop",offset:"81%","stop-color":po(i,vA)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(o,PGe)},{tagName:"stop",offset:"75%","stop-color":po(o,OGe)}]},{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":a.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":a.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":l.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":po(s,Yz)},{tagName:"stop",offset:"100%","stop-color":po(s,Yz)}]},{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":po(r,uy)},{tagName:"stop",offset:"60%","stop-color":po(r,qz)},{tagName:"stop",offset:"85%","stop-color":po(r,SA)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":po(r,qz)},{tagName:"stop",offset:"60%","stop-color":po(r,uy)},{tagName:"stop",offset:"85%","stop-color":po(r,vA)}]}]});c(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};const MGe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vh=15,T_=105;function vq(e,t){return e-t}function sI(e,t){const n=Hr(t,e,vq);return n<0?~n:n}function FGe(e,t){if(Math.abs(e)<=vh)return e/vh;const n=vh,i=T_;let o;const r=0;let s;return e>0?(o=Math.log(t[t.length-1]),s=(o-r)/(i-n),Math.exp(r+s*(e-n))):(o=Math.log(-t[0]),s=(o-r)/(i-n),-Math.exp(r+s*(Math.abs(e)-n)))}function BGe(e,t,n){if(n.clockStep===as.SYSTEM_CLOCK)return vh;if(Math.abs(e)<=1)return e*vh;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const o=vh,r=T_;let s;const a=0;let l;return e>0?(s=Math.log(i),l=(s-a)/(r-o),(Math.log(e)-a)/l+o):(s=Math.log(-t[0]),l=(s-a)/(r-o),-((Math.log(Math.abs(e))-a)/l+o))}function xc(e){if(!c(e))throw new E("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=xc.defaultDateFormatter,this._timeFormatter=xc.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,He.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(xc.defaultTicks),this.timeLabel=void 0,He.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,He.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,He.defineProperty(this,"multiplierLabel",function(){const s=t._clockViewModel;if(s.clockStep===as.SYSTEM_CLOCK)return"Today";const a=s.multiplier;return a%1===0?`${a.toFixed(0)}x`:`${a.toFixed(3).replace(/0{0,3}$/,"")}x`}),this.shuttleRingAngle=void 0,He.defineProperty(this,"shuttleRingAngle",{get:function(){return BGe(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,T_),-T_);const a=t._allShuttleRingTicks,l=t._clockViewModel;if(l.clockStep=as.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===T_){l.multiplier=s>0?a[a.length-1]:a[0];return}let u=FGe(s,a);if(t.snapToTicks)u=a[sI(u,a)];else if(u!==0){const h=Math.abs(u);if(h>100){const f=h.toFixed(0).length-2,_=Math.pow(10,f);u=Math.round(u/_)*_|0}else h>vh?u=Math.round(u):h>1?u=+u.toFixed(1):h>0&&(u=+u.toFixed(2))}l.multiplier=u}}),this._canAnimate=void 0,He.defineProperty(this,"_canAnimate",function(){const s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===rp.UNBOUNDED)return!0;const l=s.multiplier,u=s.currentTime,h=s.startTime;let f=!1;if(a===rp.LOOP_STOP)f=ie.greaterThan(u,h)||u.equals(h)&&l>0;else{const _=s.stopTime;f=ie.greaterThan(u,h)&&ie.lessThan(u,_)||u.equals(h)&&l>0||u.equals(_)&&l<0}return f||(s.shouldAnimate=!1),f}),this._isSystemTimeAvailable=void 0,He.defineProperty(this,"_isSystemTimeAvailable",function(){const s=t._clockViewModel;if(s.clockRange===rp.UNBOUNDED)return!0;const l=s.systemTime;return ie.greaterThanOrEquals(l,s.startTime)&&ie.lessThanOrEquals(l,s.stopTime)}),this._isAnimating=void 0,He.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});const n=mo(function(){const s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Sy(n,{toggled:He.computed(function(){return!t._isAnimating}),tooltip:"Pause"});const i=mo(function(){const s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Sy(i,{toggled:He.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});const o=mo(function(){const s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Sy(o,{toggled:He.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==as.SYSTEM_CLOCK}),tooltip:"Play Forward"});const r=mo(function(){t._clockViewModel.clockStep=as.SYSTEM_CLOCK},He.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Sy(r,{toggled:He.computed(function(){return e.clockStep===as.SYSTEM_CLOCK}),tooltip:He.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=mo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=sI(l,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=mo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=sI(l,a)+1;u<a.length&&(s.multiplier=a[u])})}xc.defaultDateFormatter=function(e,t){const n=ie.toGregorianDate(e);return`${MGe[n.month-1]} ${n.day} ${n.year}`};xc.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];xc.defaultTimeFormatter=function(e,t){const n=ie.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`};xc.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};xc.prototype.setShuttleRingTicks=function(e){if(!c(e))throw new E("positiveTicks is required.");let t,n,i;const o={},r=this._sortedFilteredPositiveTicks;for(r.length=0,t=0,n=e.length;t<n;++t)i=e[t],o.hasOwnProperty(i)||(o[i]=!0,r.push(i));r.sort(vq);const s=[];for(n=r.length,t=n-1;t>=0;--t)i=r[t],i!==0&&s.push(-i);Array.prototype.push.apply(s,r),this._allShuttleRingTicks=s};Object.defineProperties(xc.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){if(typeof e!="function")throw new E("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if(typeof e!="function")throw new E("timeFormatter must be a function");this._timeFormatter=e}}});xc._maxShuttleRingAngle=T_;xc._realtimeShuttleRingAngle=vh;function yE(e,t){c(t)||(t=document.body),t=Do(t);const n=this,i=He.observable(Tr.fullscreen),o=He.observable(Tr.enabled),r=t.ownerDocument;this.isFullscreen=void 0,He.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,He.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&Tr.enabled)}}),this.tooltip=void 0,He.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=mo(function(){Tr.fullscreen?Tr.exitFullscreen():Tr.requestFullscreen(n._fullscreenElement)},He.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=y(Do(e),r.body),this._callback=function(){i(Tr.fullscreen)},r.addEventListener(Tr.changeEventName,this._callback)}Object.defineProperties(yE.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}});yE.prototype.isDestroyed=function(){return!1};yE.prototype.destroy=function(){document.removeEventListener(Tr.changeEventName,this._callback),ve(this)};const zGe="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",UGe="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 bE(e,t){if(!c(e))throw new E("container is required.");e=Do(e);const n=new yE(t,e);n._exitFullScreenPath=UGe,n._enterFullScreenPath=zGe;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),He.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(bE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});bE.prototype.isDestroyed=function(){return!1};bE.prototype.destroy=function(){return this._viewModel.destroy(),He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const $z=1e3;function Uc(e){if(!c(e)||!c(e.scene))throw new E("options.scene is required.");c(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new sL({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._wasGeocodeCancelled=!1,this._previousCredits=[],this._complete=new Le,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=Qz,this._handleArrowUp=Xz;const t=this;this._suggestionsVisible=He.pureComputed(function(){const o=He.getObservable(t,"_suggestions")().length>0,r=He.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=mo(function(i){if(i=y(i,oL.SEARCH),t._focusTextbox=!1,c(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;if(t.hideSuggestions(),t.isSearchInProgress)WGe(t);else return GGe(t,t._geocoderServices,i)}),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38;return(r||s)&&o.preventDefault(),!0},this.handleKeyUp=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38,a=o.key==="Enter"||o.keyCode===13;return s?Xz(t):r?Qz(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;const o=i.destination;Pq(t),t.destinationFound(t,o)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(i,o){i!==t._selectedSuggestion&&(t._selectedSuggestion=i)},this.keepExpanded=!1,this.autoComplete=y(e.autocomplete,!0),this.destinationFound=y(e.destinationFound,Uc.flyToDestination),this._focusTextbox=!1,He.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=He.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){Uc._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,He.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,He.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){if(typeof i!="string")throw new E("value must be a valid string.");this._searchText=i}}),this.flightDuration=void 0,He.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){if(c(i)&&i<0)throw new E("value must be positive.");this._flightDuration=i}})}Object.defineProperties(Uc.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}}});Uc.prototype.destroy=function(){this._suggestionSubscription.dispose()};function Xz(e){if(e._suggestions.length===0)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(t===-1||t===0){e._selectedSuggestion=void 0;return}const n=t-1;e._selectedSuggestion=e._suggestions[n],Uc._adjustSuggestionsScroll(e,n)}function Qz(e){if(e._suggestions.length===0)return;const t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],Uc._adjustSuggestionsScroll(e,i)}function kGe(e,t){const n=c(t)?t.availability:void 0;return c(n)?aL(t,[e]).then(function(i){return e=i[0],e.height+=$z,e}):(e.height+=$z,Promise.resolve(e))}function VGe(e,t){const n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider;let a=t,l;return t instanceof ce?R.equalsEpsilon(t.south,t.north,R.EPSILON7)&&R.equalsEpsilon(t.east,t.west,R.EPSILON7)?t=ce.center(t):l=_E(t,n):t=o.cartesianToCartographic(t),c(l)||(l=kGe(t,s)),l.then(function(u){a=o.cartographicToCartesian(u)}).finally(function(){r.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:L.IDENTITY})})}async function HGe(e,t,n){try{return{state:"fulfilled",value:await e.geocode(t,n),credits:e.credit}}catch(i){return{state:"rejected",reason:i}}}async function GGe(e,t,n){const i=e._searchText;if(Dq(i)){e.showSuggestions();return}e._isSearchInProgress=!0,e._wasGeocodeCancelled=!1;let o,r;for(o=0;o<t.length;o++){if(e._wasGeocodeCancelled)return;if(r=await HGe(t[o],i,n),c(r)&&r.state==="fulfilled"&&r.value.length>0)break}if(e._wasGeocodeCancelled)return;e._isSearchInProgress=!1,uL(e);const s=r.value;if(r.state==="fulfilled"&&c(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);const a=Iq(e,_b.getCreditsFromResult(s[0]));c(a)||lL(e,t[o].credit);return}e._searchText=`${i} (not found)`}function lL(e,t){c(t)&&!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&(e._scene.frameState.creditDisplay.addStaticCredit(t),e._previousCredits.push(t))}function Iq(e,t){return c(t)&&t.forEach(n=>lL(e,n)),t}function uL(e){!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&e._previousCredits.forEach(t=>{e._scene.frameState.creditDisplay.removeStaticCredit(t)}),e._previousCredits.length=0}function jGe(e,t){const n=Do(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(t===0){i.scrollTop=0;return}const s=r.offsetTop;s+r.clientHeight>i.clientHeight?i.scrollTop=s+r.clientHeight:s<i.scrollTop&&(i.scrollTop=s)}function WGe(e){e._isSearchInProgress&&(e._isSearchInProgress=!1,e._wasGeocodeCancelled=!0)}function Dq(e){return/^\s*$/.test(e)}function Pq(e){He.getObservable(e,"_suggestions").removeAll()}async function qGe(e){if(!e.autoComplete)return;const t=e._searchText;if(Pq(e),uL(e),!Dq(t))for(const n of e._geocoderServices){const i=await n.geocode(t,oL.AUTOCOMPLETE);if(e._suggestions=e._suggestions.concat(i),i.length>0){let o=!0;i.forEach(r=>{const s=_b.getCreditsFromResult(r);o=o&&!c(s),Iq(e,s)}),o&&lL(e,n.credit)}if(e._suggestions.length>=5)return}}Uc.flyToDestination=VGe;Uc._updateSearchSuggestions=qGe;Uc._adjustSuggestionsScroll=jGe;Uc.prototype.isDestroyed=function(){return!1};Uc.prototype.destroy=function(){return uL(this),ve(this)};const YGe="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",$Ge="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 TE(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");if(!c(e.scene))throw new E("options.scene is required.");const t=Do(e.container),n=new Uc(e);n._startSearchPath=YGe,n._stopSearchPath=$Ge;const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const o=document.createElement("input");o.type="search",o.className="cesium-geocoder-input",o.setAttribute("placeholder","Enter an address or landmark..."),o.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(){o.select()},0)},o.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(o),this._textBox=o;const r=document.createElement("span");r.className="cesium-geocoder-searchButton",r.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(r),t.appendChild(i);const s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");const a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");const l=document.createElement("li");a.appendChild(l),l.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),He.applyBindings(n,i),He.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let h=u.target;typeof u.composedPath=="function"&&(h=u.composedPath()[0]),t.contains(h)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},Yt.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))}Object.defineProperties(TE.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});TE.prototype.isDestroyed=function(){return!1};TE.prototype.destroy=function(){const e=this._container;return Yt.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(),He.cleanNode(this._form),He.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),ve(this)};function Oq(e,t){if(!c(e))throw new E("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=mo(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",He.track(this,["tooltip"])}Object.defineProperties(Oq.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(c(e)&&e<0)throw new E("value must be positive.");this._duration=e}}});function AE(e,t,n){if(!c(e))throw new E("container is required.");e=Do(e);const i=new Oq(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 o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-home-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(o),He.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(AE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});AE.prototype.isDestroyed=function(){return!1};AE.prototype.destroy=function(){return He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const XGe="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",QGe="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 dL(){this._cameraClicked=new Le,this._closeClicked=new Le,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",He.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,He.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?QGe:XGe}}),He.defineProperty(this,"_bodyless",{get:function(){return!c(this.description)||this.description.length===0}})}dL.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(dL.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});function xE(e){A.defined("container",e),e=Do(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 o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="×",t.appendChild(o);const r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);const s=new dL;He.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;const a=this;r.addEventListener("load",function(){const l=r.contentDocument,u=l.createElement("link");u.href=Zt("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";const h=l.createElement("div");h.className="cesium-infoBox-description",l.head.appendChild(u),l.body.appendChild(h),a._descriptionSubscription=fc(s,"description",function(f){r.style.height="5px",h.innerHTML=f;let _=null;const g=h.firstElementChild;if(g!==null&&h.childNodes.length===1){const b=window.getComputedStyle(g);if(b!==null){const T=b["background-color"],x=z.fromCssColorString(T);c(x)&&x.alpha!==0&&(_=b["background-color"])}}t.style["background-color"]=_;const m=h.getBoundingClientRect().height;r.style.height=`${m}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(xE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});xE.prototype.isDestroyed=function(){return!1};xE.prototype.destroy=function(){const e=this._container;return He.cleanNode(this._element),e.removeChild(this._element),c(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),ve(this)};function Lq(){this.showInstructions=!1;const e=this;this._command=mo(function(){e.showInstructions=!e.showInstructions}),this._showClick=mo(function(){e._touch=!1}),this._showTouch=mo(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",He.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(Lq.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});function CE(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");const t=Do(e.container),n=new Lq,i=y(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 o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),o.appendChild(r);const s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-navigation-button cesium-navigation-button-left",a.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const l=document.createElement("img");l.src=Zt("Widgets/Images/NavigationHelp/Mouse.svg"),l.className="cesium-navigation-button-icon",l.style.width="25px",l.style.height="25px",a.appendChild(l),a.appendChild(document.createTextNode("Mouse"));const u=document.createElement("button");u.type="button",u.className="cesium-navigation-button cesium-navigation-button-right",u.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const h=document.createElement("img");h.src=Zt("Widgets/Images/NavigationHelp/Touch.svg"),h.className="cesium-navigation-button-icon",h.style.width="25px",h.style.height="25px",u.appendChild(h),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);const f=document.createElement("div");f.className="cesium-click-navigation-help cesium-navigation-help-instructions",f.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),f.innerHTML=` <table> <tr> <td><img src="${Zt("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="${Zt("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="${Zt("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>`,s.appendChild(f);const _=document.createElement("div");_.className="cesium-touch-navigation-help cesium-navigation-help-instructions",_.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),_.innerHTML=` <table> <tr> <td><img src="${Zt("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="${Zt("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="${Zt("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="${Zt("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>`,s.appendChild(_),He.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(CE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});CE.prototype.isDestroyed=function(){return!1};CE.prototype.destroy=function(){return Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};function EE(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof It,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,He.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;He.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=mo(function(){t.sceneMode===oe.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new Tu,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===oe.SCENE2D||t._scene.camera.frustum instanceof It}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=c(e.camera._currentFlight)}),this._switchToPerspective=mo(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=mo(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=oe}Object.defineProperties(EE.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}}});EE.prototype.isDestroyed=function(){return!1};EE.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};const KGe="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",ZGe="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 wE(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const n=new EE(t);n._perspectivePath=KGe,n._orthographicPath=ZGe;const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.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'),o.innerHTML='<!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --><!-- /ko -->',i.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",r.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(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",s.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(s),He.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(wE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});wE.prototype.isDestroyed=function(){return!1};wE.prototype.destroy=function(){return this._viewModel.destroy(),Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};function SE(e,t){if(!c(e))throw new E("scene is required.");this._scene=e;const n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new Tu,this._eventHelper.add(e.morphStart,i),this._duration=y(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",He.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,He.defineProperty(this,"selectedTooltip",function(){const o=n.sceneMode;return o===oe.SCENE2D?n.tooltip2D:o===oe.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=mo(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=mo(function(){e.morphTo2D(n._duration)}),this._morphTo3D=mo(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=mo(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=oe}Object.defineProperties(SE.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new E("duration value must be positive.");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}}});SE.prototype.isDestroyed=function(){return!1};SE.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};const JGe="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",eje="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",tje="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 vE(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const i=new SE(t,n);i._globePath=JGe,i._flatMapPath=eje,i._columbusViewPath=tje;const o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.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'),r.innerHTML='<!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --><!-- /ko -->',o.appendChild(r);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.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 }'),o.appendChild(s);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.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),o.appendChild(a);const l=document.createElement("button");l.type="button",l.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",l.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 }'),o.appendChild(l),He.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(vE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});vE.prototype.isDestroyed=function(){return!1};vE.prototype.destroy=function(){return this._viewModel.destroy(),Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};const nje=new H,hC="-1000px";function bb(e,t,n){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("selectionIndicatorElement is required.");if(!c(n))throw new E("container is required.");this._scene=e,this._screenPositionX=hC,this._screenPositionY=hC,this._tweens=e.tweens,this._container=y(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,He.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,He.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&c(this.position)}}),He.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return Ao.wgs84ToWindowCoordinates(e,i,o)}}bb.prototype.update=function(){if(this.showSelection&&c(this.position)){const e=this.computeScreenSpacePosition(this.position,nje);if(!c(e))this._screenPositionX=hC,this._screenPositionY=hC;else{const t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,r=o*.5;e.x=Math.min(Math.max(e.x,-o),n+o)-r,e.y=Math.min(Math.max(e.y,-o),i+o)-r,this._screenPositionX=`${Math.floor(e.x+.25)}px`,this._screenPositionY=`${Math.floor(e.y+.25)}px`}}};bb.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:ka.EXPONENTIAL_OUT})};bb.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:ka.EXPONENTIAL_OUT})};Object.defineProperties(bb.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});function IE(e,t){if(!c(e))throw new E("container is required.");e=Do(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",o="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",r=document.createElementNS(i,"svg:svg");r.setAttribute("width",160),r.setAttribute("height",160),r.setAttribute("viewBox","0 0 160 160");const s=document.createElementNS(i,"g");s.setAttribute("transform","translate(80,80)"),r.appendChild(s);const a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d",o),s.appendChild(a),n.appendChild(r);const l=new bb(t,this._element,this._container);this._viewModel=l,He.applyBindings(this._viewModel,this._element)}Object.defineProperties(IE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});IE.prototype.isDestroyed=function(){return!1};IE.prototype.destroy=function(){const e=this._container;return He.cleanNode(this._element),e.removeChild(this._element),ve(this)};function Zp(e,t,n){this._color=e,this._height=t,this._base=y(n,0)}Zp.prototype.getHeight=function(){return this._height};Zp.prototype.getBase=function(){return this._base};Zp.prototype.getStartTime=function(){return this._start};Zp.prototype.getStopTime=function(){return this._stop};Zp.prototype.setRange=function(e,t){this._start=e,this._stop=t};Zp.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=ie.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=ie.secondsDifference(this._stop,e.epochJulian);let r=Math.round(e.timeBarWidth*e.getAlpha(o))-i;i<0&&(r+=i,i=0),i+r>e.timeBarWidth&&(r=e.timeBarWidth-i),r>0&&(t=`<span class="cesium-timeline-highlight" style="left: ${i.toString()}px; width: ${r.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`)}return t};function Rq(e,t,n,i){this.interval=e,this.height=t,this.color=n||new z(.5,.5,.5,1),this.backgroundColor=i||new z(0,0,0,0)}Rq.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=ie.addSeconds(t.startJulian,t.duration,new ie);if(ie.lessThan(n,o)&&ie.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(ie.lessThanOrEquals(n,r)&&ie.greaterThanOrEquals(i,o)){let s,a,l;for(s=0;s<t.timeBarWidth;++s){const u=ie.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new ie);!c(a)&&ie.greaterThanOrEquals(u,n)?a=s:!c(l)&&ie.greaterThanOrEquals(u,i)&&(l=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),c(a)&&(c(l)||(l=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(l-a,1),this.height))}};let aI=1e12;const gc={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},Rs={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},Zd=[.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],ije=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ws(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("clock is required.");e=Do(e);const n=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=gc.none,this._touchMode=Rs.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=oje(this),this._onMouseUp=rje(this),this._onMouseMove=sje(this),this._onMouseWheel=aje(this),this._onTouchStart=cje(this),this._onTouchMove=uje(this),this._onTouchEnd=lje(this);const o=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.addEventListener("mousemove",this._onMouseMove,!1),o.addEventListener("mousedown",this._onMouseDown,!1),o.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),o.addEventListener("mousewheel",this._onMouseWheel,!1),o.addEventListener("touchstart",this._onTouchStart,!1),o.addEventListener("touchmove",this._onTouchMove,!1),o.addEventListener("touchend",this._onTouchEnd,!1),o.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}Ws.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};Ws.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};Ws.prototype.isDestroyed=function(){return!1};Ws.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),ve(this)};Ws.prototype.addHighlightRange=function(e,t,n){const i=new Zp(e,t,n);return this._highlightRanges.push(i),this.resize(),i};Ws.prototype.addTrack=function(e,t,n,i){const o=new Rq(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};Ws.prototype.zoomTo=function(e,t){if(!c(e))throw new E("startTime is required.");if(!c(t))throw new E("stopTime is required");if(ie.lessThanOrEquals(t,e))throw new E("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=ie.secondsDifference(t,e),this._clock&&this._clock.clockRange!==rp.UNBOUNDED){const i=this._clock.startTime,o=this._clock.stopTime,r=ie.secondsDifference(o,i),s=ie.secondsDifference(i,this._startJulian),a=ie.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=ie.addSeconds(this._endJulian,s,new ie),this._startJulian=i,this._timeBarSecondsSpan=ie.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=ie.addSeconds(this._startJulian,a,new ie),this._endJulian=o,this._timeBarSecondsSpan=ie.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)};Ws.prototype.zoomFrom=function(e){let t=ie.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=this._timeBarSecondsSpan*.5:t+=t-this._timeBarSecondsSpan*.5;const n=this._timeBarSecondsSpan-t;this.zoomTo(ie.addSeconds(this._startJulian,t-t*e,new ie),ie.addSeconds(this._endJulian,n*e-n,new ie))};function cI(e){return e<10?`0${e.toString()}`:e.toString()}Ws.prototype.makeLabel=function(e){const t=ie.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`${ije[t.month-1]} ${t.day} ${t.year} ${cI(t.hour)}:${cI(t.minute)}:${cI(t.second)}${i}`};Ws.prototype.smallestTicInPixels=7;Ws.prototype._makeTics=function(){const e=this._timeBarEle,t=ie.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let o;const r=this;this._needleEle.style.left=`${n.toString()}px`;let s="";const a=.01,l=31536e6,u=1e-10;let h=0,f=this._timeBarSecondsSpan;f<a?(f=a,this._timeBarSecondsSpan=a,this._endJulian=ie.addSeconds(this._startJulian,a,new ie)):f>l&&(f=l,this._timeBarSecondsSpan=l,this._endJulian=ie.addSeconds(this._startJulian,l,new ie));let _=this._timeBarEle.clientWidth;_<10&&(_=10);const g=this._startJulian,m=Math.min(f/_*1e-5,.4);let b;const T=ie.toGregorianDate(g);f>31536e4?b=ie.fromDate(new Date(Date.UTC(Math.floor(T.year/100)*100,0))):f>31536e3?b=ie.fromDate(new Date(Date.UTC(Math.floor(T.year/10)*10,0))):f>86400?b=ie.fromDate(new Date(Date.UTC(T.year,0))):b=ie.fromDate(new Date(Date.UTC(T.year,T.month,T.day)));const x=ie.secondsDifference(this._startJulian,ie.addSeconds(b,m,new ie));let C=x+f;this._epochJulian=b;function w(W){return Math.floor(x/W)*W}function v(W,X){return Math.ceil(W/X+.5)*X}function P(W){return(W-x)/f}function N(W,X){return W-X*Math.round(W/X)}this._rulerEle.innerHTML=this.makeLabel(ie.addSeconds(this._endJulian,-a,new ie));let k=this._rulerEle.offsetWidth+20;k<30&&(k=180);const M=h;h-=u;const U={startTime:x,startJulian:g,epochJulian:b,duration:f,timeBarWidth:_,getAlpha:P};this._highlightRanges.forEach(function(W){s+=W.render(U)});let B=0,S=0,D=0,p=k/_;p>1&&(p=1),p*=this._timeBarSecondsSpan;let I=-1,O=-1;const F=Zd.length;let V;for(V=0;V<F;++V){const W=Zd[V];if(++I,B=W,W>p&&W>h)break;O<0&&_*(W/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(O=I)}if(I>0){for(;I>0;)if(--I,Math.abs(N(B,Zd[I]))<1e-5){Zd[I]>=h&&(S=Zd[I]);break}if(O>=0)for(;O<I;){if(Math.abs(N(S,Zd[O]))<1e-5&&Zd[O]>=h){D=Zd[O];break}++O}}h=M,h>u&&D<1e-5&&Math.abs(h-B)>u&&(D=h,h<=B+u&&(S=0));let G=-999999,j;if(_*(D/this._timeBarSecondsSpan)>=3)for(o=w(D);o<=C;o=v(o,D))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(S/this._timeBarSecondsSpan)>=3)for(o=w(S);o<=C;o=v(o,S))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(B/this._timeBarSecondsSpan)>=2){this._mainTicSpan=B,C+=B,o=w(B);const W=ie.computeTaiMinusUtc(b);for(;o<=C;){let X=ie.addSeconds(g,o-x,new ie);if(B>2.1){const ne=ie.computeTaiMinusUtc(X);Math.abs(ne-W)>.1&&(o+=ne-W,X=ie.addSeconds(g,o-x,new ie))}const q=Math.round(_*P(o)),ee=this.makeLabel(X);this._rulerEle.innerHTML=ee,j=this._rulerEle.offsetWidth,j<10&&(j=k);const Y=q-(j/2-1);Y>G?(G=Y+j+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${q.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${Y.toString()}px;">${ee}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${q.toString()}px;"></span>`,o=v(o,B)}}else this._mainTicSpan=-1;s+=`<span class="cesium-timeline-icon16" style="left:${i}px;bottom:0;background-position: 0 0;"></span>`,e.innerHTML=s,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),U.y=0,this._trackList.forEach(function(W){W.render(r._context,U),U.y+=W.height})};Ws.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(c(this._scrubElement)){const t=ie.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`)}c(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(ie.addSeconds(this._startJulian,this._timelineDrag,new ie),ie.addSeconds(this._endJulian,this._timelineDrag,new ie)))};Ws.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=ie.addSeconds(this._startJulian,t,new ie),this._scrubElement){const i=e-8;this._scrubElement.style.left=`${i.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)};function oje(e){return function(t){e._mouseMode!==gc.touchOnly&&(t.button===0?(e._mouseMode=gc.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=gc.zoom:e._mouseMode=gc.slide)),t.preventDefault()}}function rje(e){return function(t){e._mouseMode=gc.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function sje(e){return function(t){let n;if(e._mouseMode===gc.scrub){t.preventDefault();const i=t.clientX-e._topDiv.getBoundingClientRect().left;i<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):i>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===gc.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){const i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(ie.addSeconds(e._startJulian,i,new ie),ie.addSeconds(e._endJulian,i,new ie))}}else e._mouseMode===gc.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function aje(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;aI=Math.max(Math.min(Math.abs(n),aI),1),n/=aI,e.zoomFrom(Math.pow(1.05,-n))}}function cje(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=gc.touchOnly,n===1?(i=ie.secondsDifference(e._scrubJulian,e._startJulian),o=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+r),Math.abs(t.touches[0].clientX-o)<50?(e._touchMode=Rs.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=Rs.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=Rs.slideZoom,e._touchState.centerX=(t.touches[0].clientX+t.touches[1].clientX)*.5-r,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=Rs.ignore}}function lje(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===Rs.singleTap?(e._touchMode=Rs.scrub,e._onTouchMove(t)):e._touchMode===Rs.scrub&&e._onTouchMove(t),e._mouseMode=gc.touchOnly,n!==1?e._touchMode=n>0?Rs.ignore:Rs.none:e._touchMode===Rs.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function uje(e){return function(t){let n,i,o,r,s,a,l=1;const u=e._topDiv.getBoundingClientRect().left;e._touchMode===Rs.singleTap&&(e._touchMode=Rs.slideZoom),e._mouseMode=gc.touchOnly,e._touchMode===Rs.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-u,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===Rs.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-u,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-u,s=0),c(r)&&(s>0&&e._touchState.spanX>0?(l=e._touchState.spanX/s,a=ie.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*l)/e._topDiv.clientWidth,new ie)):(n=e._touchState.centerX-r,a=ie.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new ie)),e.zoomTo(a,ie.addSeconds(a,e._timeBarSecondsSpan*l,new ie)),e._touchState.centerX=r,e._touchState.spanX=s))}}Ws.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(i){n+=i.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};var dje={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",mp4:"data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"};const{webm:hje,mp4:fje}=dje,lI=()=>typeof navigator<"u"&&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,uI=()=>"wakeLock"in navigator;class pje{constructor(){if(this.enabled=!1,uI()){this._wakeLock=null;const t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else lI()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",hje),this._addSourceToVideo(this.noSleepVideo,"mp4",fje),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(t,n,i){var o=document.createElement("source");o.src=i,o.type=`video/${n}`,t.appendChild(o)}get isEnabled(){return this.enabled}enable(){return uI()?navigator.wakeLock.request("screen").then(t=>{this._wakeLock=t,this.enabled=!0,console.log("Wake Lock active."),this._wakeLock.addEventListener("release",()=>{console.log("Wake Lock released.")})}).catch(t=>{throw this.enabled=!1,console.error(`${t.name}, ${t.message}`),t}):lI()?(this.disable(),console.warn(` NoSleep enabled for older iOS devices. This can interrupt active or long-running network requests from completing successfully. See https://github.com/richtr/NoSleep.js/issues/15 for more details. `),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(n=>(this.enabled=!0,n)).catch(n=>{throw this.enabled=!1,n})}disable(){uI()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):lI()?this.noSleepTimer&&(console.warn(` NoSleep now disabled for older iOS devices. `),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var mje=pje;function _je(e){let t=!1;const n=window.screen;return c(n)&&(c(n.lockOrientation)?t=n.lockOrientation(e):c(n.mozLockOrientation)?t=n.mozLockOrientation(e):c(n.msLockOrientation)?t=n.msLockOrientation(e):c(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function Nq(){const e=window.screen;c(e)&&(c(e.unlockOrientation)?e.unlockOrientation():c(e.mozUnlockOrientation)?e.mozUnlockOrientation():c(e.msUnlockOrientation)?e.msUnlockOrientation():c(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function gje(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(Nq(),e._locked=!1),e._noSleep.disable(),Tr.exitFullscreen(),n(!1)):(Tr.fullscreen||Tr.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=_je("landscape")),t.useWebVR=!0,n(!0)))}function DE(e,t){if(!c(e))throw new E("scene is required.");const n=this,i=He.observable(Tr.enabled),o=He.observable(!1);this.isVRMode=void 0,He.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,He.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&Tr.enabled)}}),this.tooltip=void 0,He.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});const r=He.observable(!1);this._isOrthographic=void 0,He.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new Tu,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof It)}),this._locked=!1,this._noSleep=new mje,this._command=mo(function(){gje(n,e,o,r)},He.getObservable(this,"isVREnabled")),this._vrElement=y(Do(t),document.body),this._callback=function(){!Tr.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(Nq(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(Tr.changeEventName,this._callback)}Object.defineProperties(DE.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}});DE.prototype.isDestroyed=function(){return!1};DE.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Tr.changeEventName,this._callback),ve(this)};const yje="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",bje="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 PE(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const i=new DE(t,n);i._exitVRPath=bje,i._enterVRPath=yje;const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-vrButton",o.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(o),He.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(PE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});PE.prototype.isDestroyed=function(){return!1};PE.prototype.destroy=function(){return this._viewModel.destroy(),He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const gh=new se;function Mq(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function Tje(e){const t=e.getPropertyIds();let n="";return t.forEach(function(i){const o=e.getProperty(i);c(o)&&(n+=`<tr><th>${i}</th><td>${o}</td></tr>`)}),n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function Aje(e){let t;const n=[],i=e.getPropertyIds();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 o=n.length;for(t=0;t<o;t++){const r=n[t];if(c(r)&&r!=="")return r}return"Unnamed Feature"}function Kz(e,t){const n=e.scene.pick(t.position);if(c(n)){const i=y(n.id,n.primitive.id);if(i instanceof Eo)return i;if(n instanceof Ir)return new Eo({name:Aje(n),description:Tje(n),feature:n})}if(c(e.scene.globe))return Eje(e,t.position)}const xje=new ie;function Fq(e,t,n){if(c(n)){const i=n.clock;if(c(i)&&(i.getValue(t),c(e))){const o=i.startTime;let r=i.stopTime;ie.equals(o,r)&&(r=ie.addSeconds(o,R.EPSILON2,xje)),e.updateFromClock(),e.zoomTo(o,r)}}}const Cje=new d;function Eje(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!c(o))return;const r=new Eo({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!c(s)||s.length===0){e.selectedEntity=Zz();return}const a=s[0],l=new Eo({id:a.name,description:a.description});if(c(a.position)){const u=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,Cje);l.position=new hd(u)}e.selectedEntity=l},function(){e.selectedEntity===r&&(e.selectedEntity=Zz())}),r}function Zz(){return new Eo({id:"None",description:"No features found."})}function wje(e,t){const n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,l=e._timeline,u=e._fullscreenButton,h=e._infoBox,f=e._selectionIndicator,_=t?"hidden":"visible";if(c(n)&&(n.container.style.visibility=_),c(i)&&(i.container.style.visibility=_),c(o)&&(o.container.style.visibility=_),c(r)&&(r.container.style.visibility=_),c(s)&&(s.container.style.visibility=_),c(a)&&(a.container.style.visibility=_),c(l)&&(l.container.style.visibility=_),c(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=_),c(h)&&(h.container.style.visibility=_),c(f)&&(f.container.style.visibility=_),e._container){const g=t||!c(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function xn(e,t){if(!c(e))throw new E("container is required.");e=Do(e),t=y(t,y.EMPTY_OBJECT);const n=(!c(t.globe)||t.globe!==!1)&&(!c(t.baseLayerPicker)||t.baseLayerPicker!==!1);if(!n&&c(t.selectedImageryProviderViewModel))throw new E("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.baseLayer instead or set options.baseLayerPicker to true.");if(!n&&c(t.selectedTerrainProviderViewModel))throw new E("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");const i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);const r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);const s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);const a=y(t.scene3DOnly,!1);let l,u,h=!1;c(t.clockViewModel)?(u=t.clockViewModel,l=u.clock):(l=new tb,u=new yb(l),h=!0),c(t.shouldAnimate)&&(l.shouldAnimate=t.shouldAnimate);const f=new Kp(r,{baseLayer:n||c(t.baseLayer)||c(t.imageryProvider)?!1:void 0,clock:l,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:c(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,scene3DOnly:a,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,blurActiveElementOnCanvasFocus:t.blurActiveElementOnCanvasFocus,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});let _=t.dataSources,g=!1;c(_)||(_=new Gs,g=!0);const m=f.scene,b=new ua({scene:m,dataSourceCollection:_}),T=new Tu;T.add(l.onTick,xn.prototype._onTick,this),T.add(m.morphStart,xn.prototype._clearTrackedObject,this);let x;if(!c(t.selectionIndicator)||t.selectionIndicator!==!1){const q=document.createElement("div");q.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(q),x=new IE(q,m)}let C;if(!c(t.infoBox)||t.infoBox!==!1){const q=document.createElement("div");q.className="cesium-viewer-infoBoxContainer",o.appendChild(q),C=new xE(q);const ee=C.viewModel;T.add(ee.cameraClicked,xn.prototype._onInfoBoxCameraClicked,this),T.add(ee.closeClicked,xn.prototype._onInfoBoxClockClicked,this)}const w=document.createElement("div");w.className="cesium-viewer-toolbar",o.appendChild(w);let v;if(!c(t.geocoder)||t.geocoder!==!1){const q=document.createElement("div");q.className="cesium-viewer-geocoderContainer",w.appendChild(q);let ee;c(t.geocoder)&&typeof t.geocoder!="boolean"&&(ee=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),v=new TE({container:q,geocoderServices:ee,scene:m}),T.add(v.viewModel.search.beforeExecute,xn.prototype._clearObjects,this)}let P;if((!c(t.homeButton)||t.homeButton!==!1)&&(P=new AE(w,m),c(v)&&T.add(P.viewModel.command.afterExecute,function(){const q=v.viewModel;q.searchText="",q.isSearchInProgress&&q.search()}),T.add(P.viewModel.command.beforeExecute,xn.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new E("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let N;!a&&(!c(t.sceneModePicker)||t.sceneModePicker!==!1)&&(N=new vE(w,m));let k;t.projectionPicker&&(k=new wE(w,m));let M,U;if(n){const q=y(t.imageryProviderViewModels,IGe()),ee=y(t.terrainProviderViewModels,DGe());M=new gE(w,{globe:m.globe,imageryProviderViewModels:q,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:ee,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),U=w.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(c(t.baseLayer)&&t.baseLayer!==!1&&(n&&(M.viewModel.selectedImagery=void 0),m.imageryLayers.removeAll(),m.imageryLayers.add(t.baseLayer)),c(t.terrainProvider)&&(n&&(M.viewModel.selectedTerrain=void 0),m.terrainProvider=t.terrainProvider),c(t.terrain)){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");n&&(M.viewModel.selectedTerrain=void 0,m.globe.depthTestAgainstTerrain=!0),m.setTerrain(t.terrain)}let B;if(!c(t.navigationHelpButton)||t.navigationHelpButton!==!1){let q=!0;try{if(c(window.localStorage)){const ee=window.localStorage.getItem("cesium-hasSeenNavHelp");c(ee)&&Boolean(ee)?q=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}B=new CE({container:w,instructionsInitiallyVisible:y(t.navigationInstructionsInitiallyVisible,q)})}let S;if(!c(t.animation)||t.animation!==!1){const q=document.createElement("div");q.className="cesium-viewer-animationContainer",o.appendChild(q),S=new lg(q,new xc(u))}let D;if(!c(t.timeline)||t.timeline!==!1){const q=document.createElement("div");q.className="cesium-viewer-timelineContainer",o.appendChild(q),D=new Ws(q,l),D.addEventListener("settime",Mq,!1),D.zoomTo(l.startTime,l.stopTime)}let p,I,O;(!c(t.fullscreenButton)||t.fullscreenButton!==!1)&&(O=document.createElement("div"),O.className="cesium-viewer-fullscreenContainer",o.appendChild(O),p=new bE(O,t.fullscreenElement),I=fc(p.viewModel,"isFullscreenEnabled",function(q){O.style.display=q?"block":"none",c(D)&&(D.container.style.right=`${O.clientWidth}px`,D.resize())}));let F,V,G;if(t.vrButton){const q=document.createElement("div");q.className="cesium-viewer-vrContainer",o.appendChild(q),F=new PE(q,m,t.fullScreenElement),V=fc(F.viewModel,"isVREnabled",function(ee){q.style.display=ee?"block":"none",c(p)&&(q.style.right=`${O.clientWidth}px`),c(D)&&(D.container.style.right=`${q.clientWidth}px`,D.resize())}),G=fc(F.viewModel,"isVRMode",function(ee){wje(i,ee)})}this._baseLayerPickerDropDown=U,this._fullscreenSubscription=I,this._vrSubscription=V,this._vrModeSubscription=G,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=y(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=f,this._selectionIndicator=x,this._infoBox=C,this._dataSourceCollection=_,this._destroyDataSourceCollection=g,this._dataSourceDisplay=b,this._clockViewModel=u,this._destroyClockViewModel=h,this._toolbar=w,this._homeButton=P,this._sceneModePicker=N,this._projectionPicker=k,this._baseLayerPicker=M,this._navigationHelpButton=B,this._animation=S,this._timeline=D,this._fullscreenButton=p,this._vrButton=F,this._geocoder=v,this._eventHelper=T,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=c(C)||c(x),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new Le,this._trackedEntityChanged=new Le,He.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),T.add(_.dataSourceAdded,xn.prototype._onDataSourceAdded,this),T.add(_.dataSourceRemoved,xn.prototype._onDataSourceRemoved,this),T.add(m.postUpdate,xn.prototype.resize,this),T.add(m.postRender,xn.prototype._postRender,this);const j=_.length;for(let q=0;q<j;q++)this._dataSourceAdded(_,_.get(q));this._dataSourceAdded(void 0,b.defaultDataSource),T.add(_.dataSourceAdded,xn.prototype._dataSourceAdded,this),T.add(_.dataSourceRemoved,xn.prototype._dataSourceRemoved,this);function W(q){const ee=Kz(i,q);c(ee)?K.getValueOrUndefined(ee.position,i.clock.currentTime)?i.trackedEntity=ee:i.zoomTo(ee):c(i.trackedEntity)&&(i.trackedEntity=void 0)}function X(q){i.selectedEntity=Kz(i,q)}f.screenSpaceEventHandler.setInputAction(X,pn.LEFT_CLICK),f.screenSpaceEventHandler.setInputAction(W,pn.LEFT_DOUBLE_CLICK)}Object.defineProperties(xn.prototype,{container:{get:function(){return this._container}},creditDisplay:{get:function(){return this._cesiumWidget.creditDisplay}},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,hL(this);const t=this.scene,n=t.mode;!c(e)||!c(e.position)?(this._needTrackedEntityUpdate=!1,(n===oe.COLUMBUS_VIEW||n===oe.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===oe.COLUMBUS_VIEW||n===oe.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(L.IDENTITY)):this._needTrackedEntityUpdate=!0,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=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(e)?c(t)&&t.animateAppear():c(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,Fq(this._timeline,this.clock,e))}}});xn.prototype.extend=function(e,t){if(!c(e))throw new E("mixin is required.");e(this,t)};xn.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=c(this._animation),r=c(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const s=i-125,a=this._baseLayerPickerDropDown;if(c(a)&&(a.style.maxHeight=`${s}px`),c(this._geocoder)){const g=this._geocoder.searchSuggestionsContainer;g.style.maxHeight=`${s}px`}c(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);const l=this._timeline;let u,h=0,f=0,_=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){const g=this._lastWidth;u=this._animation.container,n>900?(h=169,g<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(h=136,(g<600||g>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(h=106,(g>600||g===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),f=h+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){const g=this._fullscreenButton,m=this._vrButton,b=l.container,T=b.style;_=b.clientHeight+3,T.left=`${h}px`;let x=0;c(g)&&(x+=g.container.clientWidth),c(m)&&(x+=m.container.clientWidth),T.right=`${x}px`,l.resize()}this._bottomContainer.style.left=`${f}px`,this._bottomContainer.style.bottom=`${_}px`,this._lastWidth=n,this._lastHeight=i};xn.prototype.forceResize=function(){this._lastWidth=0,this.resize()};xn.prototype.render=function(){this._cesiumWidget.render()};xn.prototype.isDestroyed=function(){return!1};xn.prototype.destroy=function(){let e;c(this.screenSpaceEventHandler)&&!this.screenSpaceEventHandler.isDestroyed()&&(this.screenSpaceEventHandler.removeInputAction(pn.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(pn.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(),c(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),c(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),c(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),c(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),c(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),c(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),c(this._timeline)&&(this._timeline.removeEventListener("settime",Mq,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),c(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),c(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),c(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),c(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()),ve(this)};xn.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(xn.prototype._onEntityCollectionChanged,this)};xn.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(xn.prototype._onEntityCollectionChanged,this),c(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),c(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};xn.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(c(i)){const h=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(h,!1,gh)===rt.DONE&&i.update(t,gh)}let o,r=!1;const s=this.selectedEntity,a=c(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,gh)!==rt.FAILED?o=gh.center:c(s.position)&&(o=s.position.getValue(t,o)),r=c(o));const l=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(l)&&(l.position=d.clone(o,l.position),l.showSelection=a&&r,l.update());const u=c(this._infoBox)?this._infoBox.viewModel:void 0;c(u)&&(u.showInfo=a,u.enableCamera=r,u.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(u.titleText=y(s.name,s.id),u.description=K.getValueOrDefault(s.description,t,"")):(u.titleText="",u.description=""))};xn.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let o=0;o<i;o++){const r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0),this.selectedEntity===r&&(this.selectedEntity=void 0)}};xn.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{const n=this.selectedEntity.position;c(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};xn.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};xn.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};xn.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};xn.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&Fq(this.timeline,this.clock,e)};xn.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,xn.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};xn.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 o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};xn.prototype.zoomTo=function(e,t){return Bq(this,e,{offset:t},!1)};xn.prototype.flyTo=function(e,t){return Bq(this,e,t,!0)};function Bq(e,t,n,i){if(!c(t))throw new E("zoomTarget is required.");hL(e);const o=new Promise(r=>{e._completeZoom=function(s){r(s)}});return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then(function(r){if(e._zoomPromise===o){if(r instanceof Qt){let s;c(r.imageryProvider)?s=Promise.resolve(r.getImageryRectangle()):s=new Promise(a=>{const l=r.readyEvent.addEventListener(()=>{l(),a(r.getImageryRectangle())})}),s.then(function(a){return _E(a,e.scene)}).then(function(a){e._zoomPromise===o&&(e._zoomTarget=a)});return}if(r instanceof hi||r instanceof af||r instanceof Bc){e._zoomTarget=r;return}if(r.isLoading&&c(r.loadingEvent)){const s=r.loadingEvent.addEventListener(function(){s(),e._zoomPromise===o&&(e._zoomTarget=r.entities.values.slice(0))});return}if(Array.isArray(r)){e._zoomTarget=r.slice(0);return}r=y(r.values,r),c(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function vy(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function hL(e){const t=e._zoomPromise;c(t)&&(vy(e),e._completeZoom(!1))}xn.prototype._postRender=function(){Sje(this),vje(this)};function Sje(e){const t=e._zoomTarget;if(!c(t)||e.scene.mode===oe.MORPHING)return;const n=e.scene,i=n.camera,o=y(e._zoomOptions,{});let r;function s(h){c(o.offset)||(o.offset=new F_(0,-.5,h.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,r):(i.viewBoundingSphere(h,o.offset),i.lookAtTransform(L.IDENTITY),e._completeZoom(!0)),vy(e)}if(t instanceof af){if(c(t.boundingSphere)){s(t.boundingSphere);return}const h=t.frameChanged.addEventListener(function(f){s(f.boundingSphere),h()});return}if(t instanceof hi||t instanceof Bc){s(t.boundingSphere);return}if(t instanceof he){r={destination:n.mapProjection.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyTo(r):(i.setView(r),e._completeZoom(!0)),vy(e);return}const a=t,l=[];for(let h=0,f=a.length;h<f;h++){const _=e._dataSourceDisplay.getBoundingSphere(a[h],!1,gh);if(_===rt.PENDING)return;_!==rt.FAILED&&l.push(se.clone(gh))}if(l.length===0){hL(e);return}e.trackedEntity=void 0;const u=se.fromBoundingSpheres(l);e._zoomIsFlight?(vy(e),i.flyToBoundingSphere(u,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(L.IDENTITY),vy(e),e._completeZoom(!0))}function vje(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime,i=K.getValueOrUndefined(t.position,n);if(!c(i))return;const o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,gh);if(r===rt.PENDING)return;const s=o.mode;(s===oe.COLUMBUS_VIEW||s===oe.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===oe.COLUMBUS_VIEW||s===oe.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);const a=r!==rt.FAILED?gh:void 0;e._entityView=new S0(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}const Jz="/assets/Point3.3340c5c1.png";const Ije={id:"EnvironmentMap"},Dje={__name:"Map",props:{nowValue:{type:Object,default:()=>({})}},setup(e){const t=e;console.log("production",'"production"'),window.CESIUM_BASE_URL="/CesiumUnminified";var n=null,i=null,o=null;const r=Ps({}),s=Ps(!1),a=Ps("");let l=Ps("");function u(_){const g=_.entities.values;for(let m=0;m<g.length;m++){const b=g[m];b.billboard&&(_.entities.remove(b),--m)}}function h(_){if(_){let m=new og({url:"http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=5956e6519f2bb0ae8e57bc834298c9f1",layer:"tdtImgBasicLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0,maximumLevel:18});var g=new Qt(m);n.imageryLayers.add(g)}else console.log("\u5173\u95EDWMTS\u670D\u52A1(\u515C\u5E95)")}function f(){Zf.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZGZlNDYwYy1hYzNkLTQzMGMtYTZhNy1iZjVjNzgxZWE4NzIiLCJpZCI6MjE2NzUyLCJpYXQiOjE3MTYyOTI5MzN9.btze81tzNNWYuzl63jtY46tbes_XynccAz3DDW7Xdf4",n=new xn("EnvironmentMap",{baseLayerPicker:!1,animation:!1,timeline:!1,homeButton:!1,navigationHelpButton:!1,geocoder:!1,infoBox:!1,sceneMode:oe.SCENE2D,selectionIndicator:!1,sceneModePicker:!1,fullscreenButton:!1}),i=new da(n.scene.canvas),n.camera.setView({destination:d.fromDegrees(119,36,1e5)}),n.screenSpaceEventHandler.setInputAction(b=>{const T=n.scene.pick(b.position);if(console.log(T,"pickedObject"),c(T)&&T.id){const x=T.id;console.log(x,"entity"),console.log(T.id._id),a.value=T.id._id;const C=x.position.getValue(ie.now());if(console.log(x,C),C){const w=n.scene.cartesianToCanvasCoordinates(C);console.log(w),s.value=!0,m(w)}}},pn.LEFT_CLICK),n.scene.postRender.addEventListener(()=>{if(s.value){const T=n.entities.values.find(x=>x._id===a.value).position.getValue(ie.now());if(T){const x=n.scene.cartesianToCanvasCoordinates(T);m(x)}}});function m(b){b&&(r.value={position:"absolute",left:`${b.x-110}px`,top:`${b.y-150}px`})}}return zq(()=>t.nowValue,async(_,g)=>{console.log(_,g,"\u6211\u662F\u5730\u56FE\u7EC4\u4EF6\uFF0C\u76D1\u542Cprops");const m=await Xq({msNmae:_});if(m.code==200){if(console.log(m.data[0],Jz),l.value=m.data[0],u(n),o=n.entities.add({id:`${Number(m.data[0].msLongitude).toFixed(0)+Number(m.data[0].msLatitude).toFixed(0)}`,position:d.fromDegrees(Number(m.data[0].msLongitude),Number(m.data[0].msLatitude),10),billboard:{show:!0,image:Jz,scale:.2,color:z.WHITE}}),console.log(o,"_PointValue"),o){const b=o;console.log(b,"entity"),console.log(o._id),a.value=o._id;const T=b.position.getValue(ie.now());if(console.log(b,T),T){const x=n.scene.cartesianToCanvasCoordinates(T);console.log(x),s.value=!0}}n.camera.flyTo({destination:d.fromDegrees(Number(m.data[0].msLongitude),Number(m.data[0].msLatitude),1100),duration:4})}},{deep:!0}),Uq(()=>{f(),h(!0)}),kq(()=>{console.log("\u9500\u6BC1\u5B9E\u4F8B\u548C\u4E8B\u4EF6"),n.destroy(),i.destroy()}),(_,g)=>{const m=ea("CircleClose"),b=ea("el-icon");return _x(),gx("div",Ije,[s.value?(_x(),gx("div",{key:0,style:Vq(r.value),class:"popup"},[Xn(b,{class:"Icon",size:"18px",onClick:g[0]||(g[0]=T=>s.value=!1)},{default:ic(()=>[Xn(m)]),_:1}),is("p",null,jf(gr(l).msName),1),is("p",null," \u7ECF\u5EA6\uFF1A"+jf(gr(l).msLongitude),1),is("p",null," \u7EAC\u5EA6\uFF1A"+jf(gr(l).msLatitude),1)],4)):tU("",!0)])}}},Pje=eU(Dje,[["__scopeId","data-v-bdad52a8"]]);const Oje={class:"EnvironmentBox"},Lje={class:"LeftTree"},Rje={class:"LeftTree_P"},Nje={style:{color:"cornflowerblue"}},Mje={class:"LeftTree_P"},Fje={style:{display:"flex","justify-content":"flex-start"}},Bje={key:0,style:{"margin-left":"10px",color:"#ccc"}},zje={class:"TopForm"},Uje={class:"BottomTable"},kje={class:"PageBox"},Vje={__name:"Environment",setup(e){var t=localStorage.getItem("deptName")||"\u9752\u5C9B\u897F\u6D77\u5CB8\u65B0\u533A";let n=Ps(0),i=Ps(""),o=Ps([]);const r={children:"children",label:"label"};let s=Ps(!1),a=Ps({time:["",""]});const l=Ps(),h=Hq({time:[{validator:(M,U,B)=>{console.log("1",M,"2",U,"3",B),U[0]===""||U[1]===""?B(new Error("\u8BF7\u9009\u62E9\u65F6\u95F4\u6BB5")):B()},trigger:"blur"}]});let f=Ps([]),_=Ps(""),g=Ps(1),m=Ps(10),b=Ps(0);const T=M=>{console.log(M),M.devId&&(_.value=M.devId,i.value=M.label,g.value=1)};function x(){s.value=!s.value}const C=async M=>{!M||await M.validate((U,B)=>{if(U){console.log("submit!"),console.log(a.value);let S={};a.value.time&&(S.startTime=em(a.value.time[0]).format("YYYY-MM-DD"),S.endTime=em(a.value.time[1]).format("YYYY-MM-DD")),S.whetherToDownload="false",S.devId=_.value,console.log(S,"obj"),Tb(S).then(D=>{console.log(D,"res"),f.value=D.rows,b.value=D.total,D.code==200&&(g.value=1,Wq({message:`${D.msg}:\u5DF2\u4E3A\u60A8\u67E5\u8BE2\u5230${S.startTime}\u81F3${S.endTime}\u7684\u6240\u6709\u6570\u636E\uFF0C\u5171${D.total} \u6761\u6570\u636E`,type:"success",duration:5e3}))})}else console.log("error submit!",B)})};function w(){a.value.time=["",""],g.value=1,m.value=10}function v(){let M={};a.value.time[0]!==""&&(M.startTime=em(a.value.time[0]).format("YYYY-MM-DD"),M.endTime=em(a.value.time[1]).format("YYYY-MM-DD")),M.whetherToDownload="true",M.devId=_.value,M.pageNum=g.value,M.pageSize=m.value,console.log(M,"obj"),Tb(M).then(U=>{U.rows.length>0&&U.rows[U.rows.length-1].excelPath&&(console.log(U.rows[U.rows.length-1].excelPath,"res"),Yq(U.rows[U.rows.length-1].excelPath))})}function P(M){console.log(`\u6BCF\u9875 ${M} \u6761`),m.value=M,g.value=1}function N(M){console.log(`\u5F53\u524D\u9875: ${M}`),g.value=M}function k(M){let U=[];return M.forEach((B,S)=>{B.children&&(U=U.concat(B.children))}),U.length}return Gq(()=>{console.log("\u8BB0\u5F55",_.value),a.value.time[0]==""&&_.value?(console.log(typeof a.value.time[0]),Tb({devId:_.value,pageNum:g.value,pageSize:m.value}).then(M=>{f.value=M.rows,b.value=M.total})):_.value&&Tb({devId:_.value,pageNum:g.value,pageSize:m.value,startTime:em(a.value.time[0]).format("YYYY-MM-DD"),endTime:em(a.value.time[1]).format("YYYY-MM-DD")}).then(M=>{f.value=M.rows,b.value=M.total})}),jq(async()=>{const M=await $q({divisions:t});console.log(M),M.code==200&&(o.value=M.data,_.value=M.data[0].children[0].devId,console.log(_.value),i.value=M.data[0].children[0].label,n.value=k(M.data))}),(M,U)=>{const B=ea("el-tree"),S=ea("DArrowLeft"),D=ea("el-icon"),p=ea("DArrowRight"),I=ea("el-date-picker"),O=ea("el-form-item"),F=ea("el-button"),V=ea("Download"),G=ea("el-form"),j=ea("el-table-column"),W=ea("el-table"),X=ea("el-pagination");return _x(),gx("div",Oje,[is("div",Lje,[is("p",Rje,[dg(" \u603B\u8BBE\u5907\u6570\uFF1A"),is("span",Nje,"\u2003"+jf(gr(n)),1)]),is("p",Mje,[dg(" \u5F53\u524D\u9009\u62E9\uFF1A"),is("span",null,"\u2003"+jf(gr(i)),1)]),Xn(B,{"node-key":"devId",style:{width:"100%"},data:gr(o),props:r,accordion:"",onNodeClick:T},{default:ic(({node:q,data:ee})=>[is("div",Fje,[is("span",null,jf(q.label),1),ee.children?(_x(),gx("span",Bje,"("+jf(ee.children.length)+")",1)):tU("",!0)])]),_:1},8,["data"])]),is("div",{class:yL(gr(s)?"CenterBox":"CenterBox_Auto")},[is("div",{class:"Tool",onClick:x},[mL(Xn(D,{color:"#aaa"},{default:ic(()=>[Xn(S)]),_:1},512),[[_L,!gr(s)]]),mL(Xn(D,{color:"#aaa"},{default:ic(()=>[Xn(p)]),_:1},512),[[_L,gr(s)]])]),is("div",zje,[Xn(G,{ref_key:"ruleFormRef",ref:l,rules:h,model:gr(a),"label-width":"auto",style:{"max-width":"100%"},inline:!0,"label-position":"left"},{default:ic(()=>[Xn(O,{label:"\u65E5\u671F\uFF1A",prop:"time"},{default:ic(()=>[Xn(I,{modelValue:gr(a).time,"onUpdate:modelValue":U[0]||(U[0]=q=>gr(a).time=q),type:"daterange","range-separator":"\u81F3","start-placeholder":"\u5F00\u59CB\u65F6\u95F4","end-placeholder":"\u7ED3\u675F\u65F6\u95F4",size:M.size},null,8,["modelValue","size"])]),_:1}),Xn(O,null,{default:ic(()=>[Xn(F,{type:"primary",onClick:U[1]||(U[1]=q=>C(l.value))},{default:ic(()=>[dg("\u67E5\u8BE2")]),_:1}),Xn(F,{onClick:w},{default:ic(()=>[dg("\u91CD\u7F6E")]),_:1}),Xn(F,{onClick:U[2]||(U[2]=q=>v(l.value))},{default:ic(()=>[Xn(D,null,{default:ic(()=>[Xn(V)]),_:1}),dg(" \u4E0B\u8F7D ")]),_:1})]),_:1})]),_:1},8,["rules","model"])]),is("div",Uje,[Xn(W,{data:gr(f),border:"",style:{width:"100%"},height:"700"},{default:ic(()=>[Xn(j,{prop:"datetime",label:"\u65F6\u95F4",width:"180",fixed:"left"}),Xn(j,{prop:"soilEc",label:"\u571F\u58E4EC(S/cm)",width:"115"}),Xn(j,{prop:"soilTemperature",label:"\u571F\u58E4\u6E29\u5EA6(\u2103)",width:"115"}),Xn(j,{prop:"soilPh",label:"\u571F\u58E4PH\u503C(ph)",width:"115"}),Xn(j,{prop:"soilHumidity",label:"\u571F\u58E4\u6E7F\u5EA6(%rh)",width:"120"}),Xn(j,{prop:"co2Concentration",label:"\u4E8C\u6C27\u5316\u78B3\u6D53\u5EA6(ppm)",width:"150"}),Xn(j,{prop:"airHumidity",label:"\u7A7A\u6C14\u6E7F\u5EA6(%rh)",width:"120"}),Xn(j,{prop:"airTemperature",label:"\u7A7A\u6C14\u6E29\u5EA6(\u2103)",width:"120"}),Xn(j,{prop:"lightIllum",label:"\u5149\u7167\u5F3A\u5EA6(lx)",width:"115"}),Xn(j,{prop:"devId",label:"\u8BBE\u5907ID",width:"150"}),Xn(j,{prop:"lat",label:"\u7EAC\u5EA6",fixed:"right"}),Xn(j,{prop:"lng",label:"\u7ECF\u5EA6",fixed:"right"})]),_:1},8,["data"])]),is("div",kje,[Xn(X,{size:"small","current-page":gr(g),"onUpdate:current-page":U[3]||(U[3]=q=>gL(g)?g.value=q:g=q),"page-size":gr(m),"onUpdate:page-size":U[4]||(U[4]=q=>gL(m)?m.value=q:m=q),"page-sizes":[10,25,50],background:"true",layout:"total, sizes, prev, pager, next, jumper",total:gr(b),onSizeChange:P,onCurrentChange:N},null,8,["current-page","page-size","total"])])],2),is("div",{class:yL(gr(s)?"RightBox":"RightBox_None")},[Xn(Pje,{nowValue:gr(i)},null,8,["nowValue"])],2)])}}},Wje=eU(Vje,[["__scopeId","data-v-4acdc40a"]]);export{Wje as default};