buildModuleUrl-57a32107.js 46 KB

1234567891011121314151617181920212223242526
  1. define(["exports","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Cartesian2-47311507","./Math-119be1a3","./Matrix4-cde86d0e","./WebGLConstants-4ae0db90","./RuntimeError-4a5c8994"],(function(e,t,r,n,a,i,s,o,u){"use strict";function c(e){this._ellipsoid=n.defaultValue(e,a.Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(c.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),c.prototype.project=function(e,r){var a=this._semimajorAxis,i=e.longitude*a,s=e.latitude*a,o=e.height;return n.defined(r)?(r.x=i,r.y=s,r.z=o,r):new t.Cartesian3(i,s,o)},c.prototype.unproject=function(e,r){var a=this._oneOverSemimajorAxis,i=e.x*a,s=e.y*a,o=e.z;return n.defined(r)?(r.longitude=i,r.latitude=s,r.height=o,r):new t.Cartographic(i,s,o)};var d=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});function f(e,t){this.start=n.defaultValue(e,0),this.stop=n.defaultValue(t,0)}function l(e,r){this.center=t.Cartesian3.clone(n.defaultValue(e,t.Cartesian3.ZERO)),this.radius=n.defaultValue(r,0)}var p=new t.Cartesian3,h=new t.Cartesian3,m=new t.Cartesian3,y=new t.Cartesian3,v=new t.Cartesian3,C=new t.Cartesian3,g=new t.Cartesian3,q=new t.Cartesian3,b=new t.Cartesian3,w=new t.Cartesian3,R=new t.Cartesian3,E=new t.Cartesian3,A=4/3*i.CesiumMath.PI;l.fromPoints=function(e,r){if(n.defined(r)||(r=new l),!n.defined(e)||0===e.length)return r.center=t.Cartesian3.clone(t.Cartesian3.ZERO,r.center),r.radius=0,r;var a,i=t.Cartesian3.clone(e[0],g),s=t.Cartesian3.clone(i,p),o=t.Cartesian3.clone(i,h),u=t.Cartesian3.clone(i,m),c=t.Cartesian3.clone(i,y),d=t.Cartesian3.clone(i,v),f=t.Cartesian3.clone(i,C),A=e.length;for(a=1;a<A;a++){t.Cartesian3.clone(e[a],i);var _=i.x,O=i.y,x=i.z;_<s.x&&t.Cartesian3.clone(i,s),_>c.x&&t.Cartesian3.clone(i,c),O<o.y&&t.Cartesian3.clone(i,o),O>d.y&&t.Cartesian3.clone(i,d),x<u.z&&t.Cartesian3.clone(i,u),x>f.z&&t.Cartesian3.clone(i,f)}var S=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(c,s,q)),I=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(d,o,q)),T=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(f,u,q)),P=s,L=c,k=S;I>k&&(k=I,P=o,L=d),T>k&&(k=T,P=u,L=f);var U=b;U.x=.5*(P.x+L.x),U.y=.5*(P.y+L.y),U.z=.5*(P.z+L.z);var B=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(L,U,q)),z=Math.sqrt(B),D=w;D.x=s.x,D.y=o.y,D.z=u.z;var N=R;N.x=c.x,N.y=d.y,N.z=f.z;var V=t.Cartesian3.midpoint(D,N,E),j=0;for(a=0;a<A;a++){t.Cartesian3.clone(e[a],i);var M=t.Cartesian3.magnitude(t.Cartesian3.subtract(i,V,q));M>j&&(j=M);var K=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(i,U,q));if(K>B){var F=Math.sqrt(K);B=(z=.5*(z+F))*z;var H=F-z;U.x=(z*U.x+H*i.x)/F,U.y=(z*U.y+H*i.y)/F,U.z=(z*U.z+H*i.z)/F}}return z<j?(t.Cartesian3.clone(U,r.center),r.radius=z):(t.Cartesian3.clone(V,r.center),r.radius=j),r};var _=new c,O=new t.Cartesian3,x=new t.Cartesian3,S=new t.Cartographic,I=new t.Cartographic;l.fromRectangle2D=function(e,t,r){return l.fromRectangleWithHeights2D(e,t,0,0,r)},l.fromRectangleWithHeights2D=function(e,r,i,s,o){if(n.defined(o)||(o=new l),!n.defined(e))return o.center=t.Cartesian3.clone(t.Cartesian3.ZERO,o.center),o.radius=0,o;r=n.defaultValue(r,_),a.Rectangle.southwest(e,S),S.height=i,a.Rectangle.northeast(e,I),I.height=s;var u=r.project(S,O),c=r.project(I,x),d=c.x-u.x,f=c.y-u.y,p=c.z-u.z;o.radius=.5*Math.sqrt(d*d+f*f+p*p);var h=o.center;return h.x=u.x+.5*d,h.y=u.y+.5*f,h.z=u.z+.5*p,o};var T=[];l.fromRectangle3D=function(e,r,i,s){if(r=n.defaultValue(r,a.Ellipsoid.WGS84),i=n.defaultValue(i,0),n.defined(s)||(s=new l),!n.defined(e))return s.center=t.Cartesian3.clone(t.Cartesian3.ZERO,s.center),s.radius=0,s;var o=a.Rectangle.subsample(e,r,i,T);return l.fromPoints(o,s)},l.fromVertices=function(e,r,a,i){if(n.defined(i)||(i=new l),!n.defined(e)||0===e.length)return i.center=t.Cartesian3.clone(t.Cartesian3.ZERO,i.center),i.radius=0,i;r=n.defaultValue(r,t.Cartesian3.ZERO),a=n.defaultValue(a,3);var s=g;s.x=e[0]+r.x,s.y=e[1]+r.y,s.z=e[2]+r.z;var o,u=t.Cartesian3.clone(s,p),c=t.Cartesian3.clone(s,h),d=t.Cartesian3.clone(s,m),f=t.Cartesian3.clone(s,y),A=t.Cartesian3.clone(s,v),_=t.Cartesian3.clone(s,C),O=e.length;for(o=0;o<O;o+=a){var x=e[o]+r.x,S=e[o+1]+r.y,I=e[o+2]+r.z;s.x=x,s.y=S,s.z=I,x<u.x&&t.Cartesian3.clone(s,u),x>f.x&&t.Cartesian3.clone(s,f),S<c.y&&t.Cartesian3.clone(s,c),S>A.y&&t.Cartesian3.clone(s,A),I<d.z&&t.Cartesian3.clone(s,d),I>_.z&&t.Cartesian3.clone(s,_)}var T=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(f,u,q)),P=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(A,c,q)),L=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(_,d,q)),k=u,U=f,B=T;P>B&&(B=P,k=c,U=A),L>B&&(B=L,k=d,U=_);var z=b;z.x=.5*(k.x+U.x),z.y=.5*(k.y+U.y),z.z=.5*(k.z+U.z);var D=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(U,z,q)),N=Math.sqrt(D),V=w;V.x=u.x,V.y=c.y,V.z=d.z;var j=R;j.x=f.x,j.y=A.y,j.z=_.z;var M=t.Cartesian3.midpoint(V,j,E),K=0;for(o=0;o<O;o+=a){s.x=e[o]+r.x,s.y=e[o+1]+r.y,s.z=e[o+2]+r.z;var F=t.Cartesian3.magnitude(t.Cartesian3.subtract(s,M,q));F>K&&(K=F);var H=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(s,z,q));if(H>D){var G=Math.sqrt(H);D=(N=.5*(N+G))*N;var W=G-N;z.x=(N*z.x+W*s.x)/G,z.y=(N*z.y+W*s.y)/G,z.z=(N*z.z+W*s.z)/G}}return N<K?(t.Cartesian3.clone(z,i.center),i.radius=N):(t.Cartesian3.clone(M,i.center),i.radius=K),i},l.fromEncodedCartesianVertices=function(e,r,a){if(n.defined(a)||(a=new l),!n.defined(e)||!n.defined(r)||e.length!==r.length||0===e.length)return a.center=t.Cartesian3.clone(t.Cartesian3.ZERO,a.center),a.radius=0,a;var i=g;i.x=e[0]+r[0],i.y=e[1]+r[1],i.z=e[2]+r[2];var s,o=t.Cartesian3.clone(i,p),u=t.Cartesian3.clone(i,h),c=t.Cartesian3.clone(i,m),d=t.Cartesian3.clone(i,y),f=t.Cartesian3.clone(i,v),A=t.Cartesian3.clone(i,C),_=e.length;for(s=0;s<_;s+=3){var O=e[s]+r[s],x=e[s+1]+r[s+1],S=e[s+2]+r[s+2];i.x=O,i.y=x,i.z=S,O<o.x&&t.Cartesian3.clone(i,o),O>d.x&&t.Cartesian3.clone(i,d),x<u.y&&t.Cartesian3.clone(i,u),x>f.y&&t.Cartesian3.clone(i,f),S<c.z&&t.Cartesian3.clone(i,c),S>A.z&&t.Cartesian3.clone(i,A)}var I=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(d,o,q)),T=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(f,u,q)),P=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(A,c,q)),L=o,k=d,U=I;T>U&&(U=T,L=u,k=f),P>U&&(U=P,L=c,k=A);var B=b;B.x=.5*(L.x+k.x),B.y=.5*(L.y+k.y),B.z=.5*(L.z+k.z);var z=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(k,B,q)),D=Math.sqrt(z),N=w;N.x=o.x,N.y=u.y,N.z=c.z;var V=R;V.x=d.x,V.y=f.y,V.z=A.z;var j=t.Cartesian3.midpoint(N,V,E),M=0;for(s=0;s<_;s+=3){i.x=e[s]+r[s],i.y=e[s+1]+r[s+1],i.z=e[s+2]+r[s+2];var K=t.Cartesian3.magnitude(t.Cartesian3.subtract(i,j,q));K>M&&(M=K);var F=t.Cartesian3.magnitudeSquared(t.Cartesian3.subtract(i,B,q));if(F>z){var H=Math.sqrt(F);z=(D=.5*(D+H))*D;var G=H-D;B.x=(D*B.x+G*i.x)/H,B.y=(D*B.y+G*i.y)/H,B.z=(D*B.z+G*i.z)/H}}return D<M?(t.Cartesian3.clone(B,a.center),a.radius=D):(t.Cartesian3.clone(j,a.center),a.radius=M),a},l.fromCornerPoints=function(e,r,a){n.defined(a)||(a=new l);var i=t.Cartesian3.midpoint(e,r,a.center);return a.radius=t.Cartesian3.distance(i,r),a},l.fromEllipsoid=function(e,r){return n.defined(r)||(r=new l),t.Cartesian3.clone(t.Cartesian3.ZERO,r.center),r.radius=e.maximumRadius,r};var P=new t.Cartesian3;l.fromBoundingSpheres=function(e,r){if(n.defined(r)||(r=new l),!n.defined(e)||0===e.length)return r.center=t.Cartesian3.clone(t.Cartesian3.ZERO,r.center),r.radius=0,r;var a=e.length;if(1===a)return l.clone(e[0],r);if(2===a)return l.union(e[0],e[1],r);var i,s=[];for(i=0;i<a;i++)s.push(e[i].center);var o=(r=l.fromPoints(s,r)).center,u=r.radius;for(i=0;i<a;i++){var c=e[i];u=Math.max(u,t.Cartesian3.distance(o,c.center,P)+c.radius)}return r.radius=u,r};var L=new t.Cartesian3,k=new t.Cartesian3,U=new t.Cartesian3;l.fromOrientedBoundingBox=function(e,r){n.defined(r)||(r=new l);var a=e.halfAxes,i=s.Matrix3.getColumn(a,0,L),o=s.Matrix3.getColumn(a,1,k),u=s.Matrix3.getColumn(a,2,U);return t.Cartesian3.add(i,o,i),t.Cartesian3.add(i,u,i),r.center=t.Cartesian3.clone(e.center,r.center),r.radius=t.Cartesian3.magnitude(i),r},l.clone=function(e,r){if(n.defined(e))return n.defined(r)?(r.center=t.Cartesian3.clone(e.center,r.center),r.radius=e.radius,r):new l(e.center,e.radius)},l.packedLength=4,l.pack=function(e,t,r){r=n.defaultValue(r,0);var a=e.center;return t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r]=e.radius,t},l.unpack=function(e,t,r){t=n.defaultValue(t,0),n.defined(r)||(r=new l);var a=r.center;return a.x=e[t++],a.y=e[t++],a.z=e[t++],r.radius=e[t],r};var B=new t.Cartesian3,z=new t.Cartesian3;l.union=function(e,r,a){n.defined(a)||(a=new l);var i=e.center,s=e.radius,o=r.center,u=r.radius,c=t.Cartesian3.subtract(o,i,B),d=t.Cartesian3.magnitude(c);if(s>=d+u)return e.clone(a),a;if(u>=d+s)return r.clone(a),a;var f=.5*(s+d+u),p=t.Cartesian3.multiplyByScalar(c,(-s+f)/d,z);return t.Cartesian3.add(p,i,p),t.Cartesian3.clone(p,a.center),a.radius=f,a};var D=new t.Cartesian3;l.expand=function(e,r,n){n=l.clone(e,n);var a=t.Cartesian3.magnitude(t.Cartesian3.subtract(r,n.center,D));return a>n.radius&&(n.radius=a),n},l.intersectPlane=function(e,r){var n=e.center,a=e.radius,i=r.normal,s=t.Cartesian3.dot(i,n)+r.distance;return s<-a?d.OUTSIDE:s<a?d.INTERSECTING:d.INSIDE},l.transform=function(e,t,r){return n.defined(r)||(r=new l),r.center=s.Matrix4.multiplyByPoint(t,e.center,r.center),r.radius=s.Matrix4.getMaximumScale(t)*e.radius,r};var N=new t.Cartesian3;l.distanceSquaredTo=function(e,r){var n=t.Cartesian3.subtract(e.center,r,N);return t.Cartesian3.magnitudeSquared(n)-e.radius*e.radius},l.transformWithoutScale=function(e,t,r){return n.defined(r)||(r=new l),r.center=s.Matrix4.multiplyByPoint(t,e.center,r.center),r.radius=e.radius,r};var V=new t.Cartesian3;l.computePlaneDistances=function(e,r,a,i){n.defined(i)||(i=new f);var s=t.Cartesian3.subtract(e.center,r,V),o=t.Cartesian3.dot(a,s);return i.start=o-e.radius,i.stop=o+e.radius,i};for(var j=new t.Cartesian3,M=new t.Cartesian3,K=new t.Cartesian3,F=new t.Cartesian3,H=new t.Cartesian3,G=new t.Cartographic,W=new Array(8),Y=0;Y<8;++Y)W[Y]=new t.Cartesian3;var J=new c;l.projectTo2D=function(e,r,a){var i,s=(r=n.defaultValue(r,J)).ellipsoid,o=e.center,u=e.radius;i=t.Cartesian3.equals(o,t.Cartesian3.ZERO)?t.Cartesian3.clone(t.Cartesian3.UNIT_X,j):s.geodeticSurfaceNormal(o,j);var c=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,i,M);t.Cartesian3.normalize(c,c);var d=t.Cartesian3.cross(i,c,K);t.Cartesian3.normalize(d,d),t.Cartesian3.multiplyByScalar(i,u,i),t.Cartesian3.multiplyByScalar(d,u,d),t.Cartesian3.multiplyByScalar(c,u,c);var f=t.Cartesian3.negate(d,H),p=t.Cartesian3.negate(c,F),h=W,m=h[0];t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,c,m),m=h[1],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,p,m),m=h[2],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,p,m),m=h[3],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,c,m),t.Cartesian3.negate(i,i),m=h[4],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,c,m),m=h[5],t.Cartesian3.add(i,d,m),t.Cartesian3.add(m,p,m),m=h[6],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,p,m),m=h[7],t.Cartesian3.add(i,f,m),t.Cartesian3.add(m,c,m);for(var y=h.length,v=0;v<y;++v){var C=h[v];t.Cartesian3.add(o,C,C);var g=s.cartesianToCartographic(C,G);r.project(g,C)}var q=(o=(a=l.fromPoints(h,a)).center).x,b=o.y,w=o.z;return o.x=w,o.y=q,o.z=b,a},l.isOccluded=function(e,t){return!t.isBoundingSphereVisible(e)},l.equals=function(e,r){return e===r||n.defined(e)&&n.defined(r)&&t.Cartesian3.equals(e.center,r.center)&&e.radius===r.radius},l.prototype.intersectPlane=function(e){return l.intersectPlane(this,e)},l.prototype.distanceSquaredTo=function(e){return l.distanceSquaredTo(this,e)},l.prototype.computePlaneDistances=function(e,t,r){return l.computePlaneDistances(this,e,t,r)},l.prototype.isOccluded=function(e){return l.isOccluded(this,e)},l.prototype.equals=function(e){return l.equals(this,e)},l.prototype.clone=function(e){return l.clone(this,e)},l.prototype.volume=function(){var e=this.radius;return A*e*e*e};var X={POINTS:o.WebGLConstants.POINTS,LINES:o.WebGLConstants.LINES,LINE_LOOP:o.WebGLConstants.LINE_LOOP,LINE_STRIP:o.WebGLConstants.LINE_STRIP,TRIANGLES:o.WebGLConstants.TRIANGLES,TRIANGLE_STRIP:o.WebGLConstants.TRIANGLE_STRIP,TRIANGLE_FAN:o.WebGLConstants.TRIANGLE_FAN,validate:function(e){return e===X.POINTS||e===X.LINES||e===X.LINE_LOOP||e===X.LINE_STRIP||e===X.TRIANGLES||e===X.TRIANGLE_STRIP||e===X.TRIANGLE_FAN}},Q=Object.freeze(X);
  2. /**
  3. * @license
  4. *
  5. * Grauw URI utilities
  6. *
  7. * See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js
  8. *
  9. * @author Laurens Holst (http://www.grauw.nl/)
  10. *
  11. * Copyright 2012 Laurens Holst
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the "License");
  14. * you may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * http://www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *
  25. */
  26. function Z(e){if(e instanceof Z)this.scheme=e.scheme,this.authority=e.authority,this.path=e.path,this.query=e.query,this.fragment=e.fragment;else if(e){var t=$.exec(e);this.scheme=t[1],this.authority=t[2],this.path=t[3],this.query=t[4],this.fragment=t[5]}}Z.prototype.scheme=null,Z.prototype.authority=null,Z.prototype.path="",Z.prototype.query=null,Z.prototype.fragment=null;var $=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");Z.prototype.getScheme=function(){return this.scheme},Z.prototype.getAuthority=function(){return this.authority},Z.prototype.getPath=function(){return this.path},Z.prototype.getQuery=function(){return this.query},Z.prototype.getFragment=function(){return this.fragment},Z.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},Z.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},Z.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},Z.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(re,ae).replace(ee,ne)),this.path&&(this.path=this.path.replace(ee,ne)),this.query&&(this.query=this.query.replace(ee,ne)),this.fragment&&(this.fragment=this.fragment.replace(ee,ne))};var ee=/%[0-9a-z]{2}/gi,te=/[a-zA-Z0-9\-\._~]/,re=/(.*@)?([^@:]*)(:.*)?/;function ne(e){var t=unescape(e);return te.test(t)?t:e.toUpperCase()}function ae(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}function ie(e,t){if(null===e||"object"!=typeof e)return e;t=n.defaultValue(t,!1);var r=new e.constructor;for(var a in e)if(e.hasOwnProperty(a)){var i=e[a];t&&(i=ie(i,t)),r[a]=i}return r}function se(e,t,r){r=n.defaultValue(r,!1);var a,i,s,o={},u=n.defined(e),c=n.defined(t);if(u)for(a in e)e.hasOwnProperty(a)&&(i=e[a],c&&r&&"object"==typeof i&&t.hasOwnProperty(a)?(s=t[a],o[a]="object"==typeof s?se(i,s,r):i):o[a]=i);if(c)for(a in t)t.hasOwnProperty(a)&&!o.hasOwnProperty(a)&&(s=t[a],o[a]=s);return o}function oe(e,t){var r;return"undefined"!=typeof document&&(r=document),oe._implementation(e,t,r)}Z.prototype.resolve=function(e){var t=new Z;return this.scheme?(t.scheme=this.scheme,t.authority=this.authority,t.path=this.path,t.query=this.query):(t.scheme=e.scheme,this.authority?(t.authority=this.authority,t.path=this.path,t.query=this.query):(t.authority=e.authority,""==this.path?(t.path=e.path,t.query=this.query||e.query):("/"==this.path.charAt(0)?(t.path=this.path,t.removeDotSegments()):(e.authority&&""==e.path?t.path="/"+this.path:t.path=e.path.substring(0,e.path.lastIndexOf("/")+1)+this.path,t.removeDotSegments()),t.query=this.query))),t.fragment=this.fragment,t},Z.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]&&t.shift();t.length;)".."==(e=t.shift())?r.pop():"."!=e&&r.push(e);"."!=e&&".."!=e||r.push(""),n&&r.unshift(""),this.path=r.join("/")},Z.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},oe._implementation=function(e,t,r){if(!n.defined(t)){if(void 0===r)return e;t=n.defaultValue(r.baseURI,r.location.href)}var a=new Z(t);return new Z(e).resolve(a).toString()};var ue,ce=/^blob:/i;function de(e){return ce.test(e)}var fe=/^data:/i;function le(e){return fe.test(e)}var pe=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),he=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3,PACK:4,BLOCK:5,BLOCKPACK:6});function me(e){e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT);var t=n.defaultValue(e.throttleByServer,!1),r=n.defaultValue(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=n.defaultValue(e.priority,0),this.throttle=r,this.throttleByServer=t,this.type=n.defaultValue(e.type,he.OTHER),this.serverKey=void 0,this.state=pe.UNISSUED,this.deferred=void 0,this.cancelled=!1}function ye(e,t,r){this.statusCode=e,this.response=t,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n<r.length;++n){var a=r[n],i=a.indexOf(": ");if(i>0){var s=a.substring(0,i),o=a.substring(i+2);t[s]=o}}return t}(this.responseHeaders))}function ve(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}function Ce(e,t){return t-e}function ge(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function qe(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}me.prototype.cancel=function(){this.cancelled=!0},me.prototype.clone=function(e){return n.defined(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new me(this)},ye.prototype.toString=function(){var e="Request has failed.";return n.defined(this.statusCode)&&(e+=" Status Code: "+this.statusCode),e},Object.defineProperties(ve.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),ve.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);var r=this;return function(){r.removeEventListener(e,t)}},ve.prototype.removeEventListener=function(e,t){for(var r=this._listeners,n=this._scopes,a=-1,i=0;i<r.length;i++)if(r[i]===e&&n[i]===t){a=i;break}return-1!==a&&(this._insideRaiseEvent?(this._toRemove.push(a),r[a]=void 0,n[a]=void 0):(r.splice(a,1),n.splice(a,1)),!0)},ve.prototype.raiseEvent=function(){var e;this._insideRaiseEvent=!0;var t=this._listeners,r=this._scopes,a=t.length;for(e=0;e<a;e++){var i=t[e];n.defined(i)&&t[e].apply(r[e],arguments)}var s=this._toRemove;if((a=s.length)>0){for(s.sort(Ce),e=0;e<a;e++){var o=s[e];t.splice(o,1),r.splice(o,1)}s.length=0}this._insideRaiseEvent=!1},Object.defineProperties(ge.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){this._maximumLength=e,this._length>e&&e>0&&(this._length=e,this._array.length=e)}},comparator:{get:function(){return this._comparator}}}),ge.prototype.reserve=function(e){e=n.defaultValue(e,this._length),this._array.length=e},ge.prototype.heapify=function(e){e=n.defaultValue(e,0);for(var t=this._length,r=this._comparator,a=this._array,i=-1,s=!0;s;){var o=2*(e+1),u=o-1;i=u<t&&r(a[u],a[e])<0?u:e,o<t&&r(a[o],a[i])<0&&(i=o),i!==e?(qe(a,i,e),e=i):s=!1}},ge.prototype.resort=function(){for(var e=this._length,t=Math.ceil(e/2);t>=0;--t)this.heapify(t)},ge.prototype.insert=function(e){var t,r=this._array,a=this._comparator,i=this._maximumLength,s=this._length++;for(s<r.length?r[s]=e:r.push(e);0!==s;){var o=Math.floor((s-1)/2);if(!(a(r[s],r[o])<0))break;qe(r,s,o),s=o}return n.defined(i)&&this._length>i&&(t=r[i],r.pop(),this._length=i),t},ge.prototype.pop=function(e){if(e=n.defaultValue(e,0),0!==this._length){var t=this._array,r=t[e];return qe(t,e,--this._length),t[this._length]=void 0,this.heapify(e),r}};var be="undefined"!=typeof performance&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};function we(e,t){return e.priority-t.priority}var Re={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0,totalRequestTime:0},Ee=20,Ae=new ge({comparator:we});Ae.maximumLength=Ee,Ae.reserve(Ee);var _e=[],Oe={},xe="undefined"!=typeof document?new Z(document.location.href):new Z,Se=new ve;function Ie(){}function Te(e){n.defined(e.priorityFunction)&&(e.priority=e.priorityFunction())}function Pe(e){var t=n.defaultValue(Ie.requestsByServer[e],Ie.maximumRequestsPerServer);return Oe[e]<t}function Le(e){return n.defined(e.packKey)||(e.packKey=e.serverKey+"_"+e.providerName),e.packKey}function ke(e){return n.defined(e.blockKey)||(e.blockKey=e.serverKey+"_"+e.providerName+"_"+e.quadKey+e.url.substring(e.url.indexOf("dataVersion"))),e.blockKey}function Ue(e){var t=Le(e);return n.defined(Ie.packRequestGroup[t])||(Ie.packRequestGroup[t]=[]),n.defined(Ie.packRequestQuadKey[t])||(Ie.packRequestQuadKey[t]=""),n.defined(Ie.packRequestPromise[t])||(Ie.packRequestPromise[t]=n.when.defer()),n.defined(Ie.quadKeyIndex[t])||(Ie.quadKeyIndex[t]=0),e.quadKeyIndex=Ie.quadKeyIndex[t]++,e.deferred=Ie.packRequestPromise[t],e.state=pe.ISSUED,Ie.packRequestGroup[t].push(e),e.deferred.promise}function Be(e){for(var t=0,r=e.length;t<r;t++){e[t].state=pe.CANCELLED}}function ze(e){for(var t=[],r={},n=0,a=e.length;n<a;n++){var i=e[n];if(!i.cancelled){var s=i.quadKey;r[s]||(r[s]=!0,t.push(s))}}return t}function De(){var e=Ie.packRequestGroup;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];if(r.length<1)continue;var a=r[0].clone(),i=-1!==a.url.indexOf("rest/maps");a.serverKey=r[0].serverKey,a.state=r[0].state;var s=a.url,o=ze(r);if(o.length<1)continue;Ie.packRequestQuadKey[t]=i?o.join(","):o.join(";");var u=Ie.packRequestQuadKey[t];if(a.throttleByServer&&!Pe(a.serverKey)){Be(r),Ie.packRequestPromise[t].reject();continue}a.deferred=Ie.packRequestPromise[t];var c=new Z(s);c.query=i?n.defined(c.query)?c.query+"&tiles="+u:"tiles="+u:n.defined(c.query)?c.query+"&extratiles="+u:"extratiles="+u,a.url=c.toString(),je(a,a.url)}Ie.packRequestGroup={},Ie.packRequestPromise={},Ie.packRequestQuadKey={},Ie.quadKeyIndex={}}function Ne(){var e=Ie.blockRequest;for(var t in e){if(e.hasOwnProperty(t))je(e[t])}Ie.blockRequest={}}function Ve(e){if(e.state===pe.UNISSUED)if(e.state=pe.ISSUED,e.type===he.PACK||e.type===he.BLOCKPACK){var t=Le(e);n.defined(Ie.packRequestPromise[t])||(Ie.packRequestPromise[t]=n.when.defer()),e.deferred=Ie.packRequestPromise[t]}else e.deferred=n.when.defer();return e.deferred.promise}function je(e,t){var r=Ve(e);return e.state=pe.ACTIVE,_e.push(e),++Re.numberOfActiveRequests,++Re.numberOfActiveRequestsEver,++Oe[e.serverKey],e.startTime=be(),e.requestFunction(t).then(function(e){return function(t){if(e.state!==pe.CANCELLED&&(--Re.numberOfActiveRequests,--Oe[e.serverKey],Se.raiseEvent(),e.state=pe.RECEIVED,e.deferred.resolve(t),e.endTime=be(),(Ie.statisticRequestTime>0||e.type!==he.OTHER)&&(Re.totalRequestTime+=e.endTime-e.startTime),e.type===he.BLOCK||e.type===he.BLOCKPACK)){var r=ke(e);n.defined(Ie.blockDefer[r])&&(Ie.blockDefer[r]=void 0,delete Ie.blockDefer[r])}}}(e)).otherwise(function(e){return function(t){e.state!==pe.CANCELLED&&(++Re.numberOfFailedRequests,--Re.numberOfActiveRequests,--Oe[e.serverKey],Se.raiseEvent(t),e.state=pe.FAILED,e.deferred.reject(t))}}(e)),r}function Me(e){var t=e.state===pe.ACTIVE;e.state=pe.CANCELLED,++Re.numberOfCancelledRequests,e.deferred.reject(),t&&(--Re.numberOfActiveRequests,--Oe[e.serverKey],++Re.numberOfCancelledActiveRequests),n.defined(e.cancelFunction)&&e.cancelFunction()}Ie.TIMEOUT=5e3,Ie.CANCLE_COUNT=3,Ie.statisticRequestTime=-1,Ie.maximumRequests=50,Ie.maximumRequestsPerServer=6,Ie.perPacketCount=20,Ie.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18},Ie.throttleRequests=!0,Ie.debugShowStatistics=!1,Ie.requestCompletedEvent=Se,Object.defineProperties(Ie,{activeRequestLength:{get:function(){return _e.length}},statistics:{get:function(){return Re}},priorityHeapLength:{get:function(){return Ee},set:function(e){if(e<Ee)for(;Ae.length>e;){Me(Ae.pop())}Ee=e,Ae.maximumLength=e,Ae.reserve(e)}}}),Ie.packRequestGroup={},Ie.packRequestPromise={},Ie.packRequestQuadKey={},Ie.quadKeyIndex={},Ie.packRequestHeap={},Ie.blockDefer={},Ie.blockRequest={},Ie.update=function(){var e,t,r=0,n=_e.length;for(e=0;e<n;++e)(t=_e[e]).cancelled&&Me(t),t.state===pe.ACTIVE?r>0&&(_e[e-r]=t):++r;_e.length-=r;var a=Ae.internalArray,i=Ae.length;for(e=0;e<i;++e)Te(a[e]);Ae.resort(),function(){for(var e in Ie.packRequestHeap)if(Ie.packRequestHeap.hasOwnProperty(e)){for(var t=Ie.packRequestHeap[e],r=t.internalArray,n=t.length,a=0;a<n;++a)Te(r[a]);t.resort()}}(),Ne(),function(){for(var e in Ie.packRequestHeap)if(Ie.packRequestHeap.hasOwnProperty(e))for(var t=Ie.packRequestHeap[e];t.length>0;){var r=t.pop();r.cancelled?Me(r):Ue(r)}De()}();for(var s=Math.max(Ie.maximumRequests-_e.length,0),o=0;o<s&&Ae.length>0;)(t=Ae.pop()).cancelled?Me(t):!t.throttleByServer||Pe(t.serverKey)?(je(t),++o):Me(t);!function(){if(!Ie.debugShowStatistics)return;0===Re.numberOfActiveRequests&&Re.lastNumberOfActiveRequests>0&&(Re.numberOfAttemptedRequests>0&&(console.log("Number of attempted requests: "+Re.numberOfAttemptedRequests),Re.numberOfAttemptedRequests=0),Re.numberOfCancelledRequests>0&&(console.log("Number of cancelled requests: "+Re.numberOfCancelledRequests),Re.numberOfCancelledRequests=0),Re.numberOfCancelledActiveRequests>0&&(console.log("Number of cancelled active requests: "+Re.numberOfCancelledActiveRequests),Re.numberOfCancelledActiveRequests=0),Re.numberOfFailedRequests>0&&(console.log("Number of failed requests: "+Re.numberOfFailedRequests),Re.numberOfFailedRequests=0));Re.lastNumberOfActiveRequests=Re.numberOfActiveRequests}()},Ie.getServerKey=function(e){var t=new Z(e).resolve(xe);t.normalize();var r=t.authority;/:/.test(r)||(r=r+":"+("https"===t.scheme?"443":"80"));var a=Oe[r];return n.defined(a)||(Oe[r]=0),r},Ie.request=function(e){if(le(e.url)||de(e.url))return Se.raiseEvent(),e.state=pe.RECEIVED,e.requestFunction();if(++Re.numberOfAttemptedRequests,n.defined(e.serverKey)||(e.serverKey=Ie.getServerKey(e.url)),e.type===he.BLOCK)return function(e){var t=ke(e),r=Ie.blockDefer[t];return n.defined(r)||(r=Ie.blockDefer[t]=n.when.defer(),Ie.blockRequest[t]=e),e.deferred=r,e.state=pe.ISSUED,e.deferred.promise}(e);if(!e.throttleByServer||Pe(e.serverKey)){if(!Ie.throttleRequests||!e.throttle)return je(e);if(!(_e.length>=Ie.maximumRequests)){var t;if(Te(e),e.type===he.PACK||e.type===he.BLOCKPACK){var r=function(e){var t=Le(e),r=Ie.packRequestHeap[t];return n.defined(r)||((r=Ie.packRequestHeap[t]=new ge({comparator:we})).maximumLength=Ie.perPacketCount,r.reserve(Ee)),r}(e),a=!0;if(e.type===he.BLOCKPACK)for(var i=0;i<r.length;i++)if(r._array[i].quadKey===e.quadKey){e.blockRequest=r._array[i],a=!1;break}a&&(t=r.insert(e))}else t=Ae.insert(e);if(n.defined(t)){if(t===e)return;Me(t)}return Ve(e)}}},Ie.clearForSpecs=function(){for(;Ae.length>0;){Me(Ae.pop())}for(var e=_e.length,t=0;t<e;++t)Me(_e[t]);_e.length=0,Oe={},Re.numberOfAttemptedRequests=0,Re.numberOfActiveRequests=0,Re.numberOfCancelledRequests=0,Re.numberOfCancelledActiveRequests=0,Re.numberOfFailedRequests=0,Re.numberOfActiveRequestsEver=0,Re.lastNumberOfActiveRequests=0,Re.totalRequestTime=0},Ie.numberOfActiveRequestsByServer=function(e){return Oe[e]},Ie.requestHeap=Ae;var Ke={},Fe={};Ke.add=function(e,t){var r=e.toLowerCase()+":"+t;n.defined(Fe[r])||(Fe[r]=!0)},Ke.remove=function(e,t){var r=e.toLowerCase()+":"+t;n.defined(Fe[r])&&delete Fe[r]},Ke.contains=function(e){var t=function(e){var t=new Z(e);t.normalize();var r=t.getAuthority();if(n.defined(r)){if(-1!==r.indexOf("@")){var a=r.split("@");r=a[1]}if(-1===r.indexOf(":")){var i=t.getScheme();if(n.defined(i)||(i=(i=window.location.protocol).substring(0,i.length-1)),"http"===i)r+=":80";else{if("https"!==i)return;r+=":443"}}return r}}(e);return!(!n.defined(t)||!n.defined(Fe[t]))},Ke.clear=function(){Fe={}};var He={};function Ge(e,t){n.defined(He[e])||(He[e]=!0,console.warn(n.defaultValue(t,e)))}Ge.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",Ge.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",Ge.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",Ge.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";var We,Ye=function(){try{var e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob","blob"===e.responseType}catch(e){return!1}}();function Je(e,t,r,a){var i,s=e.query;if(!n.defined(s)||0===s.length)return{};if(-1===s.indexOf("=")){var o={};o[s]=void 0,i=o}else i=function(e){var t={};if(""===e)return t;for(var r=e.replace(/\+/g,"%20").split(/[&;]/),a=0,i=r.length;a<i;++a){var s=r[a].split("=");if(s.length>2){var o=r[a].indexOf("=");s=[r[a].substring(0,o),r[a].substring(o+1,r[a].length)]}var u=decodeURIComponent(s[0]),c=s[1];c=n.defined(c)?decodeURIComponent(c):"";var d=t[u];"string"==typeof d?t[u]=[d,c]:Array.isArray(d)?d.push(c):t[u]=c}return t}(s);t._queryParameters=r?$e(i,t._queryParameters,a):i,e.query=void 0}function Xe(e,t){var r=t._queryParameters,a=Object.keys(r);1!==a.length||n.defined(r[a[0]])?e.query=function(e,t){var r="";for(var n in e)if(e.hasOwnProperty(n)){var a=e[n],i=encodeURIComponent(n)+"=";if(Array.isArray(a))for(var s=0,o=a.length;s<o;++s)r+=!0===t?i+encodeURI(a[s])+"&":i+encodeURIComponent(a[s])+"&";else r+=!0===t?i+encodeURI(a)+"&":i+encodeURIComponent(a)+"&"}return r.slice(0,-1)}(r):e.query=a[0]}function Qe(e,t){return n.defined(e)?n.defined(e.clone)?e.clone():ie(e):t}function Ze(e){if(e.state===pe.ISSUED||e.state===pe.ACTIVE)throw new u.RuntimeError("The Resource is already being fetched.");e.state=pe.UNISSUED,e.deferred=void 0}function $e(e,t,r){if(!r)return se(e,t);var a=ie(e,!0);for(var i in t)if(t.hasOwnProperty(i)){var s=a[i],o=t[i];n.defined(s)?(Array.isArray(s)||(s=a[i]=[s]),a[i]=s.concat(o)):a[i]=Array.isArray(o)?o.slice():o}return a}function et(e){"string"==typeof(e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT))&&(e={url:e}),this._url=void 0,this._templateValues=Qe(e.templateValues,{}),this._queryParameters=Qe(e.queryParameters,{}),this.headers=Qe(e.headers,{}),this.request=n.defaultValue(e.request,new me),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=n.defaultValue(e.retryAttempts,0),this._retryCount=0;var t=new Z(e.url);Je(t,this,!0,!0),t.fragment=void 0,this._url=t.toString()}function tt(e){var t=e.resource,r=e.flipY,a=e.preferImageBitmap,i=t.request;i.url=t.url,i.requestFunction=function(){var e=!1;t.isDataUri||t.isBlobUri||(e=t.isCrossOriginUrl);var s=n.when.defer();return et._Implementations.createImage(i,e,s,r,a),s.promise};var s=Ie.request(i);if(n.defined(s))return s.otherwise((function(e){return i.state!==pe.FAILED?n.when.reject(e):t.retryOnError(e).then((function(s){return s?(i.state=pe.UNISSUED,i.deferred=void 0,tt({resource:t,flipY:r,preferImageBitmap:a})):n.when.reject(e)}))}))}function rt(e,t,r){var a={};a[t]=r,e.setQueryParameters(a);var i=e.request;i.url=e.url,i.requestFunction=function(){var t=n.when.defer();return window[r]=function(e){t.resolve(e);try{delete window[r]}catch(e){window[r]=void 0}},et._Implementations.loadAndExecuteScript(e.url,r,t),t.promise};var s=Ie.request(i);if(n.defined(s))return s.otherwise((function(a){return i.state!==pe.FAILED?n.when.reject(a):e.retryOnError(a).then((function(s){return s?(i.state=pe.UNISSUED,i.deferred=void 0,rt(e,t,r)):n.when.reject(a)}))}))}et.createIfNeeded=function(e){return e instanceof et?e.getDerivedResource({request:e.request}):"string"!=typeof e?e:new et({url:e})},et.supportsImageBitmapOptions=function(){if(n.defined(We))return We;if("function"!=typeof createImageBitmap)return We=n.when.resolve(!1);return We=et.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4////fwAJ+wP9CNHoHgAAAABJRU5ErkJggg=="}).then((function(e){return createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none"})})).then((function(e){return!0})).otherwise((function(){return!1}))},Object.defineProperties(et,{isBlobSupported:{get:function(){return Ye}}}),Object.defineProperties(et.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){var t=new Z(e);Je(t,this,!1),t.fragment=void 0,this._url=t.toString()}},extension:{get:function(){return function(e){var t=new Z(e);t.normalize();var r=t.path,n=r.lastIndexOf("/");return-1!==n&&(r=r.substr(n+1)),n=r.lastIndexOf("."),-1===n?"":r.substr(n+1)}(this._url)}},isDataUri:{get:function(){return le(this._url)}},isBlobUri:{get:function(){return de(this._url)}},isCrossOriginUrl:{get:function(){return function(e){n.defined(ue)||(ue=document.createElement("a")),ue.href=window.location.href;var t=ue.host,r=ue.protocol;return ue.href=e,ue.href=ue.href,r!==ue.protocol||t!==ue.host}(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}}),et.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;var r=new Z(this._url);e&&Xe(r,this);var a=r.toString().replace(/%7B/g,"{").replace(/%7D/g,"}"),i=this._templateValues;return a=a.replace(/{(.*?)}/g,(function(e,t){var r=i[t];return n.defined(r)?encodeURIComponent(r):e})),t&&n.defined(this.proxy)&&(a=this.proxy.getURL(a)),a},et.prototype.setQueryParameters=function(e,t){this._queryParameters=t?$e(this._queryParameters,e,!1):$e(e,this._queryParameters,!1)},et.prototype.appendQueryParameters=function(e){this._queryParameters=$e(e,this._queryParameters,!0)},et.prototype.setTemplateValues=function(e,t){this._templateValues=t?se(this._templateValues,e):se(e,this._templateValues)},et.prototype.getDerivedResource=function(e){var t=this.clone();if(t._retryCount=0,n.defined(e.url)){var r=new Z(e.url);Je(r,t,!0,n.defaultValue(e.preserveQueryParameters,!1)),r.fragment=void 0,t._url=r.resolve(new Z(oe(this._url))).toString()}return n.defined(e.queryParameters)&&(t._queryParameters=se(e.queryParameters,t._queryParameters)),n.defined(e.templateValues)&&(t._templateValues=se(e.templateValues,t.templateValues)),n.defined(e.headers)&&(t.headers=se(e.headers,t.headers)),n.defined(e.proxy)&&(t.proxy=e.proxy),n.defined(e.request)&&(t.request=e.request),n.defined(e.retryCallback)&&(t.retryCallback=e.retryCallback),n.defined(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},et.prototype.retryOnError=function(e){var t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return n.when(!1);var r=this;return n.when(t(this,e)).then((function(e){return++r._retryCount,e}))},et.prototype.clone=function(e){return n.defined(e)||(e=new et({url:this._url})),e._url=this._url,e._queryParameters=ie(this._queryParameters),e._templateValues=ie(this._templateValues),e.headers=ie(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e},et.prototype.getBaseUri=function(e){return function(e,t){var r="",a=e.lastIndexOf("/");return-1!==a&&(r=e.substring(0,a+1)),t?(e=new Z(e),n.defined(e.query)&&(r+="?"+e.query),n.defined(e.fragment)&&(r+="#"+e.fragment),r):r}(this.getUrlComponent(e),e)},et.prototype.appendForwardSlash=function(){var e;this._url=(0!==(e=this._url).length&&"/"===e[e.length-1]||(e+="/"),e)},et.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},et.fetchArrayBuffer=function(e){return new et(e).fetchArrayBuffer()},et.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},et.fetchBlob=function(e){return new et(e).fetchBlob()},et.prototype.fetchImage=function(e){e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT);var t=n.defaultValue(e.preferImageBitmap,!1),r=n.defaultValue(e.preferBlob,!1),a=n.defaultValue(e.flipY,!1);if(Ze(this.request),!Ye||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!r)return tt({resource:this,flipY:a,preferImageBitmap:t});var i,s,o,u=this.fetchBlob();return n.defined(u)?et.supportsImageBitmapOptions().then((function(e){return i=e&&t,u})).then((function(e){if(n.defined(e)){if(o=e,i)return et.createImageBitmapFromBlob(e,{flipY:a,premultiplyAlpha:!1});var t=window.URL.createObjectURL(e);return tt({resource:s=new et({url:t}),flipY:a,preferImageBitmap:!1})}})).then((function(e){if(n.defined(e))return e.blob=o,i||window.URL.revokeObjectURL(s.url),e})).otherwise((function(e){return n.defined(s)&&window.URL.revokeObjectURL(s.url),e.blob=o,n.when.reject(e)})):void 0},et.fetchImage=function(e){return new et(e).fetchImage({flipY:e.flipY,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},et.prototype.fetchText=function(){return this.fetch({responseType:"text"})},et.fetchText=function(e){return new et(e).fetchText()},et.prototype.fetchJson=function(){var e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(n.defined(e))return e.then((function(e){if(n.defined(e))return JSON.parse(e)}))},et.fetchJson=function(e){return new et(e).fetchJson()},et.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},et.fetchXML=function(e){return new et(e).fetchXML()},et.prototype.fetchJsonp=function(e){var t;e=n.defaultValue(e,"callback"),Ze(this.request);do{t="loadJsonp"+Math.random().toString().substring(2,8)}while(n.defined(window[t]));return rt(this,e,t)},et.fetchJsonp=function(e){return new et(e).fetchJsonp(e.callbackParameterName)},et.prototype._makeRequest=function(e){var t=this;Ze(t.request);var r=t.request;r.url=t.url,r.requestFunction=function(a){var i=e.responseType,s=se(e.headers,t.headers),o=e.overrideMimeType,u=e.method,c=e.data,d=n.when.defer(),f=n.defined(a)?a:t.url,l=et._Implementations.loadWithXhr(f,i,u,c,s,d,o);return n.defined(l)&&n.defined(l.abort)&&(r.cancelFunction=function(){l.abort()}),d.promise};var a=Ie.request(r);if(n.defined(a))return a.then((function(e){return e})).otherwise((function(a){return r.state!==pe.FAILED?n.when.reject(a):t.retryOnError(a).then((function(i){return i?(r.state=pe.UNISSUED,r.deferred=void 0,t.fetch(e)):n.when.reject(a)}))}))};var nt=/^data:(.*?)(;base64)?,(.*)$/;function at(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function it(e,t){for(var r=at(e,t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return n}function st(e,t){switch(t){case"text":return e.toString("utf8");case"json":return JSON.parse(e.toString("utf8"));default:return new Uint8Array(e).buffer}}et.prototype.fetch=function(e){return(e=Qe(e,{})).method="GET",this._makeRequest(e)},et.fetch=function(e){return new et(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et.prototype.delete=function(e){return(e=Qe(e,{})).method="DELETE",this._makeRequest(e)},et.delete=function(e){return new et(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},et.prototype.head=function(e){return(e=Qe(e,{})).method="HEAD",this._makeRequest(e)},et.head=function(e){return new et(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et.prototype.options=function(e){return(e=Qe(e,{})).method="OPTIONS",this._makeRequest(e)},et.options=function(e){return new et(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et.prototype.post=function(e,t){return r.Check.defined("data",e),(t=Qe(t,{})).method="POST",t.data=e,this._makeRequest(t)},et.post=function(e){return new et(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et.prototype.put=function(e,t){return r.Check.defined("data",e),(t=Qe(t,{})).method="PUT",t.data=e,this._makeRequest(t)},et.put=function(e){return new et(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et.prototype.patch=function(e,t){return r.Check.defined("data",e),(t=Qe(t,{})).method="PATCH",t.data=e,this._makeRequest(t)},et.patch=function(e){return new et(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},et._Implementations={},et._Implementations.createImage=function(e,t,r,a,i){var s=e.url;et.supportsImageBitmapOptions().then((function(o){if(o&&i){var c=n.when.defer(),d=et._Implementations.loadWithXhr(s,"blob","GET",void 0,void 0,c,void 0,void 0,void 0);return n.defined(d)&&n.defined(d.abort)&&(e.cancelFunction=function(){d.abort()}),c.promise.then((function(e){if(n.defined(e))return et.createImageBitmapFromBlob(e,{flipY:a,premultiplyAlpha:!1});r.reject(new u.RuntimeError("Successfully retrieved "+s+" but it contained no content."))})).then(r.resolve)}!function(e,t,r){var n=new Image;n.onload=function(){r.resolve(n)},n.onerror=function(e){r.reject(e)},t&&(Ke.contains(e)?n.crossOrigin="use-credentials":n.crossOrigin=""),n.src=e}(s,t,r)})).otherwise(r.reject)},et.createImageBitmapFromBlob=function(e,t){return r.Check.defined("options",t),r.Check.typeOf.bool("options.flipY",t.flipY),r.Check.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none"})};var ot="undefined"==typeof XMLHttpRequest;et._Implementations.loadWithXhr=function(e,t,r,a,i,s,o){var c=nt.exec(e);if(null===c){if(!ot){var d=new XMLHttpRequest;if(Ke.contains(e)&&(d.withCredentials=!0),e=e.replace(/{/g,"%7B").replace(/}/g,"%7D"),d.open(r,e,!0),n.defined(o)&&n.defined(d.overrideMimeType)&&d.overrideMimeType(o),n.defined(i))for(var f in i)i.hasOwnProperty(f)&&d.setRequestHeader(f,i[f]);n.defined(t)&&(d.responseType=t);var l=!1;return"string"==typeof e&&(l=0===e.indexOf("file://")||"undefined"!=typeof window&&"file://"===window.location.origin),d.onload=function(){if(!(d.status<200||d.status>=300)||l&&0===d.status){var e=d.response,a=d.responseType;if("HEAD"===r||"OPTIONS"===r){var i=d.getAllResponseHeaders().trim().split(/[\r\n]+/),o={};return i.forEach((function(e){var t=e.split(": "),r=t.shift();o[r]=t.join(": ")})),void s.resolve(o)}if(204===d.status)s.resolve();else if(!n.defined(e)||n.defined(t)&&a!==t)if("json"===t&&"string"==typeof e)try{s.resolve(JSON.parse(e))}catch(e){s.reject(e)}else(""===a||"document"===a)&&n.defined(d.responseXML)&&d.responseXML.hasChildNodes()?s.resolve(d.responseXML):""!==a&&"text"!==a||!n.defined(d.responseText)?s.reject(new u.RuntimeError("Invalid XMLHttpRequest response type.")):s.resolve(d.responseText);else s.resolve(e)}else s.reject(new ye(d.status,d.response,d.getAllResponseHeaders()))},d.onerror=function(e){s.reject(new ye)},d.send(a),d}!function(e,t,r,n,a,i,s){var o=require("url").parse(e),c="https:"===o.protocol?require("https"):require("http"),d=require("zlib"),f={protocol:o.protocol,hostname:o.hostname,port:o.port,path:o.path,query:o.query,method:r,headers:a};c.request(f).on("response",(function(e){if(e.statusCode<200||e.statusCode>=300)i.reject(new ye(e.statusCode,e,e.headers));else{var r=[];e.on("data",(function(e){r.push(e)})),e.on("end",(function(){var n=Buffer.concat(r);"gzip"===e.headers["content-encoding"]?d.gunzip(n,(function(e,r){e?i.reject(new u.RuntimeError("Error decompressing response.")):i.resolve(st(r,t))})):i.resolve(st(n,t))}))}})).on("error",(function(e){i.reject(new ye)})).end()}(e,t,r,0,i,s)}else s.resolve(function(e,t){t=n.defaultValue(t,"");var r=e[1],a=!!e[2],i=e[3];switch(t){case"":case"text":return at(a,i);case"arraybuffer":return it(a,i);case"blob":var s=it(a,i);return new Blob([s],{type:r});case"document":return(new DOMParser).parseFromString(at(a,i),r);case"json":return JSON.parse(at(a,i))}}(c,t))},et._Implementations.loadAndExecuteScript=function(e,t,r){return function(e){var t=n.when.defer(),r=document.createElement("script");r.async=!0,r.src=e;var a=document.getElementsByTagName("head")[0];return r.onload=function(){r.onload=void 0,a.removeChild(r),t.resolve()},r.onerror=function(e){t.reject(e)},a.appendChild(r),t.promise}(e).otherwise(r.reject)},et._DefaultImplementations={},et._DefaultImplementations.createImage=et._Implementations.createImage,et._DefaultImplementations.loadWithXhr=et._Implementations.loadWithXhr,et._DefaultImplementations.loadAndExecuteScript=et._Implementations.loadAndExecuteScript,et.DEFAULT=Object.freeze(new et({url:"undefined"==typeof document?"":document.location.href.split("?")[0]}));var ut,ct,dt,ft=/((?:.*\/)|^)Cesium\.js$/;function lt(e){return"undefined"==typeof document?e:(n.defined(ut)||(ut=document.createElement("a")),ut.href=e,ut.href=ut.href,ut.href)}function pt(){return n.defined(ct)||(e="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:"object"==typeof define&&n.defined(define.amd)&&!define.amd.toUrlUndefined&&n.defined(require.toUrl)?oe("..",yt("Core/buildModuleUrl.js")):function(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;t<r;++t){var n=e[t].getAttribute("src"),a=ft.exec(n);if(null!==a)return a[1]}}(),(ct=new et({url:lt(e)})).appendForwardSlash()),ct;var e}function ht(e){return lt(require.toUrl("../"+e))}function mt(e){return pt().getDerivedResource({url:e}).url}function yt(e){return n.defined(dt)||(dt="object"==typeof define&&n.defined(define.amd)&&!define.amd.toUrlUndefined&&n.defined(require.toUrl)?ht:mt),dt(e)}yt._cesiumScriptRegex=ft,yt._buildModuleUrlFromBaseUrl=mt,yt._clearBaseResource=function(){ct=void 0},yt.setBaseUrl=function(e){ct=et.DEFAULT.getDerivedResource({url:e})},yt.getCesiumBaseUrl=pt,e.BoundingSphere=l,e.GeographicProjection=c,e.Intersect=d,e.Interval=f,e.PrimitiveType=Q,e.Resource=et,e.buildModuleUrl=yt,e.oneTimeWarning=Ge}));